• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ read_fifo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中read_fifo函数的典型用法代码示例。如果您正苦于以下问题:C++ read_fifo函数的具体用法?C++ read_fifo怎么用?C++ read_fifo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了read_fifo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:34,代码来源:teles3.c


示例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);
	}

}
开发者ID:AustinBleax,项目名称:Bali_SK4G,代码行数:26,代码来源:s3c_udc_otg_xfer_slave.c


示例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));
      }
    } 
}
开发者ID:bearxiong99,项目名称:lamp_project_master,代码行数:26,代码来源:sx1276-Fsk.c


示例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);
	}
}
开发者ID:MeiDahua,项目名称:uboot-tuna,代码行数:56,代码来源:musb_udc.c


示例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;
}
开发者ID:ykoziy,项目名称:ParallelSorter,代码行数:55,代码来源:mysortapp.c


示例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;
    }
开发者ID:Koheron,项目名称:zynq-sdk,代码行数:22,代码来源:pulse.hpp


示例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;
}
开发者ID:sshah93,项目名称:Concurrent-Programming,代码行数:51,代码来源:primary.c


示例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;
	}
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:14,代码来源:gazel.c


示例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;
	}
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:14,代码来源:gazel.c


示例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;
}
开发者ID:r-type,项目名称:vice-libretro,代码行数:16,代码来源:mididrv.c


示例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;
}
开发者ID:aliniger,项目名称:px4_nxbuilder_orca,代码行数:16,代码来源:drv_lis331.c


示例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 {
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:47,代码来源:lh7a40x_udc.c


示例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);
        }
    }
}
开发者ID:bearxiong99,项目名称:lamp_project_master,代码行数:17,代码来源:sx1276-Fsk.c


示例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);
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:23,代码来源:imx_udc.c


示例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 {
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:37,代码来源:s3c24xx_udc.c


示例16: isac_empty_fifo

static void
isac_empty_fifo(struct IsdnCardState *sp, int count)
{
	u_char *ptr;
	long flags;

	if ((sp->debug & L1_DEB_ISAC) && !(sp->debug & L1_DEB_ISAC_FIFO))
		if (sp->debug & L1_DEB_ISAC)
			debugl1(sp, "isac_empty_fifo");

	if ((sp->rcvidx + count) >= MAX_DFRAME_LEN) {
		if (sp->debug & L1_DEB_WARN) {
			char tmp[40];
			sprintf(tmp, "isac_empty_fifo overrun %d",
				sp->rcvidx + count);
			debugl1(sp, tmp);
		}
		writereg(sp->isac, ISAC_CMDR, 0x80);
		sp->rcvidx = 0;
		return;
	}
	ptr = sp->rcvbuf + sp->rcvidx;
	sp->rcvidx += count;
	save_flags(flags);
	cli();
	read_fifo(sp->isac, ptr, count);
	writereg(sp->isac, ISAC_CMDR, 0x80);
	restore_flags(flags);
	if (sp->debug & L1_DEB_ISAC_FIFO) {
		char tmp[128];
		char *t = tmp;

		t += sprintf(t, "isac_empty_fifo cnt %d", count);
		QuickHex(t, ptr, count);
		debugl1(sp, tmp);
	}
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:37,代码来源:teles3.c


示例17: musb_peri_ep0_rx

static void musb_peri_ep0_rx(void)
{
	/*
	 * This is the completion of the data OUT / RX
	 *
	 * Host is sending data to ep0 that is not
	 * part of setup.  This comes from the cdc_recv_setup
	 * op that is device specific.
	 *
	 * Pass the data back to driver ep0_recv_setup which
	 * should give the cdc_recv_setup the chance to handle
	 * the rx
	 */
	u16 csr0;
	u16 count0;

	if (debug_level > 3) {
		if (0 != ep0_urb->actual_length) {
			serial_printf("%s finished ? %d of %d\n",
				      __PRETTY_FUNCTION__,
				      ep0_urb->actual_length,
				      ep0_urb->device_request.wLength);
		}
	}

	if (ep0_urb->device_request.wLength == ep0_urb->actual_length) {
		musb_peri_ep0_last();
		SET_EP0_STATE(IDLE);
		ep0_recv_setup(ep0_urb);
		return;
	}

	csr0 = readw(&musbr->ep[0].ep0.csr0);
	if (!(MUSB_CSR0_RXPKTRDY & csr0))
		return;

	count0 = readw(&musbr->ep[0].ep0.count0);

	if (count0) {
		struct usb_endpoint_instance *endpoint;
		u32 length;
		u8 *data;

		endpoint = ep0_endpoint;
		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 (count0 > remaining_space)
					length = remaining_space;
				else
					length = count0;

				data = (u8 *) urb->buffer_data;
				data += urb->actual_length;

				/* The common musb fifo reader */
				read_fifo(0, length, data);

				musb_peri_ep0_ack_req();

				/*
				 * 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 no space in "
						      "rcv buffer\n",
						      __PRETTY_FUNCTION__);
			}
		} else {
			if (debug_level > 0)
				serial_printf("ERROR : %s problem with "
					      "endpoint\n",
					      __PRETTY_FUNCTION__);
		}
	} else {
		if (debug_level > 0)
			serial_printf("ERROR : %s with nothing to do\n",
				      __PRETTY_FUNCTION__);
	}
}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:89,代码来源:musb_udc.c


示例18: GrabImage

int GrabImage(char* str)
{
    char VH,VL;
    uint8_t temp;
    uint8_t buf[256];
    static int k = 0;
    int i,j = 0;
    int nmemb = 1;
    printf("GrabImage.\n");

    //Open the new file
    fp = fopen(str,"w+");
    if (fp == NULL)
    {
        printf("open file failed\n");
        return 0;
    }
    //Switch to FIFO Mode
    write_reg(ARDUCHIP_TIM, MODE_MASK);
    //Flush the FIFO
    flush_fifo();
    //Start capture
    capture();
    printf("Start Capture\n");

    //Polling the capture done flag
    while(!(read_reg(ARDUCHIP_TRIG) & CAP_DONE_MASK));
    printf("Capture Done!\n");

    k = 0;
    //Write the BMP header
    for( i = 0; i < BMPIMAGEOFFSET; i++)
    {
        char ch = pgm_read_byte(&bmp_header[i]);
        buf[k++] = ch;
    }
    fwrite(buf,k,nmemb,fp);
    //Read first dummy byte
    //myCAM.read_fifo();

    k = 0;
    //Read 320x240x2 byte from FIFO
    //Save as RGB565 bmp format
    for(i = 0; i < 240; i++)
        for(j = 0; j < 320; j++)
        {
            VH = read_fifo();
            VL = read_fifo();
            buf[k++] = VL;
            buf[k++] = VH;
            //Write image data to bufer if not full
            if(k >= 256)
            {
                //Write 256 bytes image data to file from buffer
                fwrite(buf,256,nmemb,fp);
                k = 0;
            }
        }
    //Close the file
    fclose(fp);
    //Clear the capture done flag
    clear_fifo_flag();

    //Switch to LCD Mode
    write_reg(ARDUCHIP_TIM, 0);
    return 1;
}
开发者ID:chuck1,项目名称:RaspberryPi,代码行数:67,代码来源:PiCAM_OV7670_Playback.c


示例19: hscx_read_fifo

static void
hscx_read_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size)
{
	read_fifo(cs->hw.teles3.hscxfifo[hscx], data, size);
}
开发者ID:xricson,项目名称:knoppix,代码行数:5,代码来源:teles3.c


示例20: isac_read_fifo

static void
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
	read_fifo(cs->hw.teles3.isacfifo, data, size);
}
开发者ID:xricson,项目名称:knoppix,代码行数:5,代码来源:teles3.c



注:本文中的read_fifo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ read_file函数代码示例发布时间:2022-05-30
下一篇:
C++ read_extent_buffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap