本文整理汇总了C++中read_fifo函数的典型用法代码示例。如果您正苦于以下问题:C++ read_fifo函数的具体用法?C++ read_fifo怎么用?C++ read_fifo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_fifo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hscx_empty_fifo
static void
hscx_empty_fifo(struct HscxState *hsp, int count)
{
u_char *ptr;
struct IsdnCardState *sp = hsp->sp;
long flags;
if ((sp->debug & L1_DEB_HSCX) && !(sp->debug & L1_DEB_HSCX_FIFO))
debugl1(sp, "hscx_empty_fifo");
if (hsp->rcvidx + count > HSCX_BUFMAX) {
if (sp->debug & L1_DEB_WARN)
debugl1(sp, "hscx_empty_fifo: incoming packet too large");
writehscxCMDR(sp->hscx[hsp->hscx], 0x80);
hsp->rcvidx = 0;
return;
}
ptr = hsp->rcvbuf + hsp->rcvidx;
hsp->rcvidx += count;
save_flags(flags);
cli();
read_fifo(sp->hscx[hsp->hscx], ptr, count);
writehscxCMDR(sp->hscx[hsp->hscx], 0x80);
restore_flags(flags);
if (sp->debug & L1_DEB_HSCX_FIFO) {
char tmp[128];
char *t = tmp;
t += sprintf(t, "hscx_empty_fifo %c cnt %d",
hsp->hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(sp, tmp);
}
}
示例2: s3c_out_epn
static void s3c_out_epn(struct s3c_udc *dev, u32 ep_idx)
{
struct s3c_ep *ep = &dev->ep[ep_idx];
struct s3c_request *req;
if (unlikely(!(ep->desc))) {
/* Throw packet away.. */
printk("%s: No descriptor?!?\n", __FUNCTION__);
return;
}
if (list_empty(&ep->queue))
req = 0;
else
req = list_entry(ep->queue.next,
struct s3c_request, queue);
if (unlikely(!req)) {
DEBUG_OUT_EP("%s: NULL REQ on OUT EP-%d\n", __FUNCTION__, ep_idx);
return;
} else {
read_fifo(ep, req);
}
}
示例3: EXTI0_IRQHandler
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(DIO0_IRQ) != RESET)
{
EXTI_ClearITPendingBit(DIO0_IRQ);
hal_DIOx_ITConfig(all,DISABLE);
if(g_fsk.states == RF_STATE_TX_RUNNING)
{
SX1276FskSetOpMode( RF_OPMODE_STANDBY );
g_fsk.states = RF_STATE_TX_DONE;
process_post(&hal_RF_process, PROCESS_EVENT_MSG, (void *)(&g_fsk.states));
}
if(g_fsk.states == RF_STATE_RX_SYNC)
{
SX1276FskSetOpMode( RF_OPMODE_STANDBY );
read_fifo(true);
etimer_stop(&timer_rf);
g_fsk.states = RF_STATE_RX_DONE;
process_post(&hal_RF_process, PROCESS_EVENT_MSG, (void *)(&g_fsk.states));
}
}
}
示例4: musb_peri_rx_ep
static void musb_peri_rx_ep(unsigned int ep)
{
u16 peri_rxcount = readw(&musbr->ep[ep].epN.rxcount);
if (peri_rxcount) {
struct usb_endpoint_instance *endpoint;
u32 length;
u8 *data;
endpoint = GET_ENDPOINT(udc_device, ep);
if (endpoint && endpoint->rcv_urb) {
struct urb *urb = endpoint->rcv_urb;
unsigned int remaining_space = urb->buffer_length -
urb->actual_length;
if (remaining_space) {
int urb_bad = 0; /* urb is good */
if (peri_rxcount > remaining_space)
length = remaining_space;
else
length = peri_rxcount;
data = (u8 *) urb->buffer_data;
data += urb->actual_length;
/* The common musb fifo reader */
read_fifo(ep, length, data);
musb_peri_rx_ack(ep);
/*
* urb's actual_length is updated in
* usbd_rcv_complete
*/
usbd_rcv_complete(endpoint, length, urb_bad);
} else {
if (debug_level > 0)
serial_printf("ERROR : %s %d no space "
"in rcv buffer\n",
__PRETTY_FUNCTION__, ep);
}
} else {
if (debug_level > 0)
serial_printf("ERROR : %s %d problem with "
"endpoint\n",
__PRETTY_FUNCTION__, ep);
}
} else {
if (debug_level > 0)
serial_printf("ERROR : %s %d with nothing to do\n",
__PRETTY_FUNCTION__, ep);
}
}
示例5: main
int main(int argc, char *argv[])
{
args list;
int fd;
pid_t pid;
int size = 0;
int i = 1;
int nodes_num = 0;
char sz[25];
char pipe_path[30];
if(process_c_args(argc, argv, &list))
{
return -1;
}
size = strtol(list.file_name, NULL, 10);
snprintf(sz, 25, "%d", size);
if(mkfifo ("/tmp/1_p",0666) == -1)
{
perror("Error creating named pipe");
}
pid = fork();
if(pid == 0) //child
{
//SM node arguments: lower bound, upper bound, sorting attribute, file name, node number, current depth, max depth
execl("smnode", "smnode", "0", sz, list.attrib, list.file_name, "1", "0", list.depth, (char *)0);
fflush(stdout);
perror("Can't execute smnode\n");
} else if (pid < 0) //fork failed
{
perror("Fork error!\n");
} else //parent
{
fd = open("/tmp/1_p", O_RDONLY);
read_fifo(fd,size);
close(fd);
}
printf("\n\n ======================= Sorting Statistics ======================= \n\n");
read_stat();
printf("\n\n ================================================================== \n\n");
//remove the pipes when finished
nodes_num = (int)(pow(2,atoi(list.depth)+1)) - 1;
for(i = 1; i <= nodes_num; i++)
{
snprintf(pipe_path, 30, "/tmp/%d_p", i);
unlink(pipe_path);
}
return 0;
}
示例6: get_next_pulse
std::vector<uint32_t>& get_next_pulse(uint32_t n_pts) {
adc_data.resize(n_pts);
if (n_pts == 0)
return adc_data;
wait_for(1);
uint32_t data = read_fifo();
// Wait for the beginning of a pulse
while ((data & (1 << 15)) != (1 << 15)) {
wait_for(1);
data = read_fifo();
}
adc_data[0] = data;
wait_for(n_pts -1);
for (unsigned int i=1; i < n_pts; i++)
adc_data[i] = read_fifo();
return adc_data;
}
示例7: main
int main(int argc, char **argv)
{
pid_t pid;
int i = 1;
int top, floor;
make_fifo();
if (argc < 2)
{
fprintf(stderr, "usage: %s 44 100...\n", argv[0]);
exit(1);
}
for(; argv[i] != '\0'; i++)
{
pid = fork();
if (pid < 0)
{
exit(1);
}
else if (pid == 0)
{
if(i == 1)
{
floor = 2;
}
else floor = atoi(argv[i-1]) + 1;
top = atoi(argv[i]);
printf("child %i: bottom=%i, top=%i\n", getpid(), floor, top);
sieve(floor, top);
exit(0x47);
}
else
{
int status = 0;
read_fifo();
wait(&status);
if(status == 18176)
printf("child %i exited cleanly\n", pid);
else
printf("unknown exit %i (0x%x)\n", status, status);
}
}
return 0;
}
示例8: ReadHSCXfifo
static void
ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{
switch (cs->subtyp) {
case R647:
case R685:
read_fifo(cs->hw.gazel.hscxfifo[hscx], data, size);
break;
case R753:
case R742:
read_fifo_ipac(cs->hw.gazel.ipac, hscx * 0x40, data, size);
break;
}
}
示例9: ReadISACfifo
static void
ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
switch (cs->subtyp) {
case R647:
case R685:
read_fifo(cs->hw.gazel.isacfifo, data, size);
break;
case R753:
case R742:
read_fifo_ipac(cs->hw.gazel.ipac, 0x80, data, size);
break;
}
}
示例10: mididrv_in
/* gets a byte from MIDI-In, returns !=0 if byte received, byte in *b. */
int mididrv_in(BYTE *b)
{
if (!handle_in) {
log_error(mididrv_log, "Attempt to read from closed MIDI-In port!");
return -1;
}
if (read_fifo(b)) {
#ifdef DEBUG
log_message(mididrv_log, "in got %02x", *b);
#endif
return 1;
}
return 0;
}
示例11: lis331_read
static ssize_t
lis331_read(struct file *filp, char *buffer, size_t buflen)
{
/* if the buffer is large enough, and data are available, return success */
if (buflen >= 12) {
if (read_fifo((uint16_t *)buffer))
return 12;
/* no data */
return 0;
}
/* buffer too small */
errno = ENOSPC;
return ERROR;
}
示例12: lh7a40x_out_epn
static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
{
struct lh7a40x_ep *ep = &dev->ep[ep_idx];
struct lh7a40x_request *req;
DEBUG("%s: %d\n", __func__, ep_idx);
usb_set_index(ep_idx);
if (ep->desc) {
u32 csr;
csr = usb_read(ep->csr1);
while ((csr =
usb_read(ep->
csr1)) & (USB_OUT_CSR1_OUT_PKT_RDY |
USB_OUT_CSR1_SENT_STALL)) {
DEBUG("%s: %x\n", __func__, csr);
if (csr & USB_OUT_CSR1_SENT_STALL) {
DEBUG("%s: stall sent, flush fifo\n",
__func__);
/* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1); */
flush(ep);
} else if (csr & USB_OUT_CSR1_OUT_PKT_RDY) {
if (list_empty(&ep->queue))
req = 0;
else
req =
list_entry(ep->queue.next,
struct lh7a40x_request,
queue);
if (!req) {
printk(KERN_WARNING
"%s: NULL REQ %d\n",
__func__, ep_idx);
flush(ep);
break;
} else {
read_fifo(ep, req);
}
}
}
} else {
示例13: EXTI1_IRQHandler
void EXTI1_IRQHandler(void)
{
if(EXTI_GetITStatus(DIO1_IRQ) != RESET)
{
EXTI_ClearITPendingBit(DIO1_IRQ);
if(g_fsk.states == RF_STATE_TX_RUNNING)
{
fill_fifo();
}
if(g_fsk.states == RF_STATE_RX_SYNC)
{
read_fifo(false);
}
}
}
示例14: handle_ep
static int handle_ep(struct imx_ep_struct *imx_ep)
{
struct imx_request *req;
int completed = 0;
do {
if (!list_empty(&imx_ep->queue))
req = list_entry(imx_ep->queue.next,
struct imx_request, queue);
else {
D_REQ(imx_ep->imx_usb->dev, "<%s> no request on %s\n",
__func__, imx_ep->ep.name);
return 0;
}
if (EP_DIR(imx_ep)) /* */
completed = write_fifo(imx_ep, req);
else /* */
completed = read_fifo(imx_ep, req);
dump_ep_stat(__func__, imx_ep);
} while (completed);
示例15: elfin_out_epn
static void elfin_out_epn(struct elfin_udc *dev, u32 ep_idx)
{
struct elfin_ep *ep = &dev->ep[ep_idx];
struct elfin_request *req;
DPRINTK("%s: %d\n", __FUNCTION__, ep_idx);
if (ep->desc) {
u32 csr;
csr = usb_read(ep->csr1, ep_index(ep));
while ((csr = usb_read(ep->csr1, ep_index(ep)))
& (S3C2410_UDC_OCSR1_PKTRDY | S3C2410_UDC_OCSR1_SENTSTL)) {
DPRINTK("%s: %x\n", __FUNCTION__, csr);
if (csr & S3C2410_UDC_OCSR1_SENTSTL) {
DPRINTK("%s: stall sent, flush fifo\n",
__FUNCTION__);
/* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1, ep_index(ep)); */
} else if (csr & S3C2410_UDC_OCSR1_PKTRDY) {
if (list_empty(&ep->queue))
req = 0;
else
req = list_entry(ep->queue.next,
struct elfin_request, queue);
if (!req) {
//printk("%s: NULL REQ %d\n",
// __FUNCTION__, ep_idx);
break;
} else {
read_fifo(ep, req);
}
}
}
} else {