亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cim.c

?? 君正早期ucos系統(tǒng)(只有早期的才不沒有打包成庫),MPLAYER,文件系統(tǒng),圖片解碼,瀏覽,電子書,錄音,想學(xué)ucos,識貨的人就下吧 russblock fmradio explore set
?? C
字號:
/* * ucosii/jz4730/drv/cim.c * * Camera Interface Module (CIM) driver for JzSOC * This driver is independent of the camera sensor * * Copyright (C) 2005  JunZheng semiconductor * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include "includes.h" //ucosii#include "jz4740.h"#include "camera.h" // Select one of the sensors#undef dprintf#define dprintf(x...)int printf(char *format, ...);/* If use cachable descriptor, enable this *///#define USE_CACHE 1/* * CIM configuration. */typedef struct{	u32 cfg;	u32 ctrl;	u32 mclk;} cim_config_t;struct cim_config {	int mclk;/* Master clock output to the sensor */	int vsp; /* VSYNC Polarity:0-rising edge is active,1-falling edge is active */	int hsp; /* HSYNC Polarity:0-rising edge is active,1-falling edge is active */	int pcp; /* PCLK Polarity:0-rising edge sampling,1-falling edge sampling */	int dsm; /* Data Sampling Mode:0-CCIR656 Progressive Mode, 1-CCIR656 Interlace Mode,2-Gated Clock Mode,3-Non-Gated Clock Mode */	int pack; /* Data Packing Mode: suppose received data sequence were 0x11 0x22 0x33 0x44, then packing mode will rearrange the sequence in the RXFIFO:		     0: 0x11 0x22 0x33 0x44		     1: 0x22 0x33 0x44 0x11		     2: 0x33 0x44 0x11 0x22		     3: 0x44 0x11 0x22 0x33		     4: 0x44 0x33 0x22 0x11		     5: 0x33 0x22 0x11 0x44		     6: 0x22 0x11 0x44 0x33		     7: 0x11 0x44 0x33 0x22		  */	int inv_dat;    /* Inverse Input Data Enable */	int frc;        /* Frame Rate Control:0-15 */	int trig;   /* RXFIFO Trigger 0:4 | 1:8 | 2:12 | 3:16 | 4:20 | 5:24 | 6:28 | 7:32 */};/* Actual image size, must less than max values */static int img_width, img_height, img_bpp;/* * CIM DMA descriptor */struct cim_desc {	u32 nextdesc;   /* Physical address of next desc */	u32 framebuf;   /* Physical address of frame buffer */	u32 frameid;    /* Frame ID */ 	u32 dmacmd;     /* DMA command */};/* * CIM device structure */struct cim_device {	unsigned char *framebuf;	unsigned int frame_size;        OS_EVENT *WaitSem;        OS_EVENT *JpegWaitSem;	struct cim_desc *frame_desc __attribute__ ((aligned (16)));};// globalstatic struct cim_device *cim_dev;static struct cim_desc cim_frame_desc[CIM_BUF_NUM] __attribute__ ((aligned (16)));static struct cim_desc cim_jpeg_desc __attribute__ ((aligned (16)));static struct cim_desc cim_test_jpeg_desc __attribute__ ((aligned (16)));#ifndef USE_CACHEstatic struct cim_desc *cim_uncached_frame_desc;#endif/* Buffer ID for buffer mutex handling */static int cim_id_init = 1;static int init_post = 0;static int cim_tran_buf_id;	/*cim dma current transfer buffer ID*/static int data_ready_buf_id;	/*data ready for yuv convert buffer ID*/static int last_data_buf_id;	/*last buf of yuv convert, if equal to data_ready_buf_id, wait eof intr*/static int data_buf_reading_flag, jpeg_reading_flag;static int img_width, img_height, img_bpp;static unsigned char *frm_buf;	/*current trans buffer pointer*/static unsigned char *jpeg_buf; /* buf for jpeg data *///#define CameraSize (4096 + (IMG_WIDTH * IMG_HEIGHT * IMG_BPP / 8 + 4095) / 4096 *4096 * CIM_BUF_NUM)#define CameraSize (4096 + (img_width * img_height * img_bpp / 8 + 4095) / 4096 *4096 * CIM_BUF_NUM)typedef void (* ALLOCMEMFUNC)( void *, int);static ALLOCMEMFUNC allocmemfunc=NULL, allocjpgmemfunc = NULL;void   SetAllocMemfunc(ALLOCMEMFUNC func){     allocmemfunc=func;}void   SetAllocJpgMemfunc(ALLOCMEMFUNC func){    allocjpgmemfunc = func;}/*========================================== * Sensor Configure CIM depend on Sensor *==========================================*/static struct cim_config cim_cfg = {#if CAMERATYPE == 1  /*OV2640*/	24000000, 1, 0, 0, 2, 4, 0, 0, 1,#endif#if CAMERATYPE == 2  /*OV3640*///	24000000, 1, 0, 0, 2, 4, 0, 0, 1,	24000000, 1, 0, 0, 2, 4, 0, 0, 0,#endif};/*============================= * CIM init routines *=============================*/static void camera_gpio_init(void) {	__gpio_as_cim();	__gpio_as_i2c();}/*=================================================== * Config CIM Modules depends on Sensor arguments *===================================================*/static void cim_config(cim_config_t *c){	REG_CIM_CFG = c->cfg;	REG_CIM_CTRL = c->ctrl;	/* Set the master clock output */	__cim_set_master_clk(__cpm_get_hclk(), c->mclk);	// Enable sof, eof and stop interrupts//	__cim_enable_sof_intr();	__cim_enable_eof_intr();//	__cim_enable_stop_intr();	__cim_enable_rxfifo_overflow_intr();}/* * Split YUV to three buf */void split_yuv422(unsigned char * yuv_buf,unsigned char * y_buf,unsigned char * u_buf,unsigned char * v_buf){	int i = 0, j;	for (j = 0;j < cim_dev->frame_size; i+=4, j+=4){		 y_buf[i/2]   = yuv_buf[j+0];		 y_buf[i/2+1] = yuv_buf[j+2];		 u_buf[i/4]   = yuv_buf[j+1];		 v_buf[i/4]   = yuv_buf[j+3];	}	__dcache_writeback_all(); }static unsigned char * cim_start_dma(void){	frm_buf = (u8 *)VIRT(cim_frame_desc[data_ready_buf_id].framebuf);	return frm_buf;}void framebuf_handled(void) {	data_buf_reading_flag = 0;	//last_data_buf_id = data_ready_buf_id;}/*=================================================== *Start cim and dma to transfer data from sensor *===================================================*/void cim_start(void){	if (cim_id_init == 1) {		cim_tran_buf_id = 0;		last_data_buf_id = data_ready_buf_id = 0;		data_buf_reading_flag = 0;		cim_id_init = 0;	}	__cim_disable();	__cim_set_da(PHYS((unsigned int)(&cim_frame_desc[cim_tran_buf_id])));//	__cim_set_da(PHYS(cim_dev->frame_desc));	__cim_clear_state();	// clear state register	__cim_reset_rxfifo();	// resetting rxfifo	__cim_unreset_rxfifo();	__cim_enable_dma();	// enable dma	__cim_enable();}void cim_stop(void){	__cim_disable();	__cim_clear_state();}/*============================================ * Framebuffer allocation and destroy *============================================*/static void cim_fb_destroy(void){	if (cim_dev->framebuf) {	  cim_dev->framebuf = NULL;	}}/*======================================= *Alloc JPEG buf y-buf, u-buf, v-buf *=======================================*/static unsigned char * get_jpeg_buf(void) {//	static unsigned char jpeg_heap[JPEG_BUF_SIZE + 0x10];	static unsigned char *jpeg_heap;        if(allocjpgmemfunc)            allocjpgmemfunc(&jpeg_heap, JPEG_BUF_SIZE + 0x10);	printf("_____________jpeg_heap____________ = 0x%08x\n", (unsigned int)jpeg_heap);	return jpeg_heap;}/*======================= * Set cim desc list *=======================*/static struct cim_desc *get_desc_list(u8 *cim_heap){	int i, num, page_nums = 0;	unsigned char *p_buf;	struct cim_desc *desc_list_head __attribute__ ((aligned (16)));	struct cim_desc *desc_list_tail __attribute__ ((aligned (16)));	struct cim_desc *p_desc __attribute__ ((aligned (16)));	int frm_id = 0;#ifndef USE_CACHE	struct cim_desc *cim_uncached_jpeg_desc, *cim_uncached_test_jpeg_desc;	cim_uncached_frame_desc = (struct cim_desc *)CIM_UNCACHED(cim_frame_desc);	cim_uncached_jpeg_desc =  (struct cim_desc *)CIM_UNCACHED(&cim_jpeg_desc);	cim_uncached_test_jpeg_desc =  (struct cim_desc *)CIM_UNCACHED(&cim_test_jpeg_desc);#endif	desc_list_head = desc_list_tail = NULL;	/* Prepare CIM_BUF_NUM-1 link descriptors for getting sensor data */	for (i = 0; i < CIM_BUF_NUM; i++) {#ifdef USE_CACHE		p_desc = &cim_frame_desc[i];#else /* uncached */		p_desc = &cim_uncached_frame_desc[i];#endif		p_buf = (u8 *)((u32)cim_dev->framebuf + cim_dev->frame_size  * i);		if (desc_list_head == NULL)			desc_list_head = p_desc;		else			desc_list_tail->nextdesc = PHYS(p_desc);			desc_list_tail = p_desc;		desc_list_tail->framebuf = PHYS(p_buf);		desc_list_tail->frameid = frm_id;		desc_list_tail->dmacmd = (cim_dev->frame_size >> 2) | CIM_CMD_EOFINT;		frm_id++;	}	desc_list_tail->nextdesc = PHYS(desc_list_head);#ifdef USE_CACHE /* cachable */	dma_cache_wback_inv(cim_frame_desc, sizeof(struct cim_desc) * CIM_BUF_NUM);	cim_test_jpeg_desc->framebuf = PHYS(jpeg_buf);	cim_test_jpeg_desc->nextdesc = PHYS(NULL);	cim_test_jpeg_desc->frameid = 0xf;	cim_test_jpeg_desc->dmacmd = (4 >> 2) | CIM_CMD_EOFINT | CIM_CMD_STOP;	dma_cache_wback_inv(&cim_test_jpeg_desc, sizeof(struct cim_desc));	cim_jpeg_desc.framebuf = PHYS(jpeg_buf);	cim_jpeg_desc.nextdesc = PHYS(NULL);	cim_jpeg_desc.frameid = 0xf;	cim_jpeg_desc.dmacmd = (JPEG_BUF_SIZE >> 2) | CIM_CMD_EOFINT | CIM_CMD_STOP;	dma_cache_wback_inv(&cim_jpeg_desc, sizeof(struct cim_desc));#else /* uncached */	cim_uncached_test_jpeg_desc->framebuf = PHYS(jpeg_buf);	cim_uncached_test_jpeg_desc->nextdesc = PHYS(NULL);	cim_uncached_test_jpeg_desc->frameid = 0xf;	cim_uncached_test_jpeg_desc->dmacmd = (4 >> 2) | CIM_CMD_EOFINT | CIM_CMD_STOP;	cim_uncached_jpeg_desc->framebuf = PHYS(jpeg_buf);	cim_uncached_jpeg_desc->nextdesc = PHYS(NULL);	cim_uncached_jpeg_desc->frameid = 0xf;	cim_uncached_jpeg_desc->dmacmd = (JPEG_BUF_SIZE >> 2) | CIM_CMD_EOFINT | CIM_CMD_STOP;#endif#if 0	for (i = 0; i < CIM_BUF_NUM; i++) {		printf("cim_frame_desc[%d] addr      \t= 0x%08x\n", i, (unsigned int)(&cim_frame_desc[i]));		printf("cim_frame_desc[%d].framebuf \t= 0x%08x\n",i, (unsigned int)cim_frame_desc[i].framebuf);		printf("cim_frame_desc[%d].frameid \t= 0x%08x\n",i, (unsigned int)cim_frame_desc[i].frameid);		printf("cim_frame_desc[%d].dmacmd \t= 0x%08x\n",i, (unsigned int)cim_frame_desc[i].dmacmd);		printf("cim_frame_desc[%d].nextdesc \t= 0x%08x\n",i, (unsigned int)cim_frame_desc[i].nextdesc);	}#endif	return desc_list_head;}/*================================================ * Alloc framebuf for get camera data through DMA *================================================*/static int cim_fb_alloc(void){//	static u8 cim_heap[4096 + (IMG_WIDTH * IMG_HEIGHT * IMG_BPP / 8 + 4095) / 4096 *4096 * CIM_BUF_NUM]  __attribute__ ((aligned(4096)));	static u8  *cim_heap;        if(allocmemfunc)            allocmemfunc(&cim_heap, CameraSize);	cim_dev->frame_size = img_width * img_height * (img_bpp/8);//	cim_dev->framebuf = (u8 *)(((u32)cim_heap & ~0xfff) + 0x1000);	cim_dev->framebuf = (u8 *)((u32)cim_heap & ~0x3);	if ( !(cim_dev->framebuf) ) {		return -1;	}	jpeg_buf = get_jpeg_buf();	cim_dev->frame_desc = get_desc_list(cim_heap);	return 0;}/*========================= * File operations *=========================*/unsigned char * cim_read(void){  return cim_start_dma();}/* * Snapshot functions  */unsigned char * cim_snapshot(int mode){	int i;        u8 err;	cim_stop();	jpeg_reading_flag = 1;	output_jpeg(0);	for(i = 0; i < 2; i++) {		__cim_disable();		__cim_set_da(PHYS((unsigned int)(&cim_test_jpeg_desc)));		__cim_clear_state();	// clear state register		__cim_reset_rxfifo();	// resetting rxfifo		__cim_unreset_rxfifo();		__cim_enable_dma();	// enable dma		__cim_enable();		OSSemPend(cim_dev->JpegWaitSem, 0, &err);	}	for(i = 0; i < 1; i++) {		__cim_disable();		__cim_set_da(PHYS((unsigned int)(&cim_jpeg_desc)));		__cim_clear_state();	// clear state register		__cim_reset_rxfifo();	// resetting rxfifo		__cim_unreset_rxfifo();		__cim_enable_dma();	// enable dma		__cim_enable();        //printf(" 5 ======================== cim_snapshot \n");		OSSemPend(cim_dev->JpegWaitSem, 0, &err);	}        //printf(" 6 ======================== cim_snapshot \n");	__cim_disable();        //printf(" 7 ======================== cim_snapshot \n");	return jpeg_buf;}void cim_snapshot_finish(void) {	jpeg_reading_flag = 0;	output_yuv();	cim_start();}void cim_close(void){        cim_stop();  //  	free_irq(IRQ_CIM);	cim_fb_destroy();}/*========================= * Interrupt handler *=========================*/static void cim_irq_handler(int irq, void *dev_id){	u32 state = REG_CIM_STATE, curr_frmid = REG_CIM_FID;	if (state & CIM_STATE_DMA_EOF) {		if (jpeg_reading_flag != 1) {				data_ready_buf_id = cim_tran_buf_id;				cim_tran_buf_id = curr_frmid;		}		else {			printf("JPEG EOF interrupt\n");			OSSemPost(cim_dev->JpegWaitSem);		}	}	if (state & CIM_STATE_RXF_OF) {		printf("OverFlow interrupt...\n");		printf("REG_CIM_STATE = 0x%08x\n", state);		__cim_disable();		__cim_reset_rxfifo();	// resetting rxfifo		__cim_unreset_rxfifo();		__cim_enable_dma();	// enable dma		__cim_enable();	}	/* clear status flags*/	REG_CIM_STATE = 0;}/*=========================================================== * Get image parameters from app, Call it before cim_init() *===========================================================*//*============================ * Module init *============================*///int cim_init(void)int cim_init(img_param_t *img){        static struct cim_device *dev;	int ret;	cim_config_t c;	static struct cim_device dev0;	camera_gpio_init();	/* set image parameter*/	img_width  = img->in_width;	img_height = img->in_height;	img_bpp    = img->in_bpp;	/* config cim */	c.mclk = cim_cfg.mclk;	c.cfg = (cim_cfg.vsp << 14) | (cim_cfg.hsp << 13) | (cim_cfg.pcp << 12) | (cim_cfg.dsm << 0) | (cim_cfg.pack << 4) | (cim_cfg.inv_dat << 15);	c.ctrl = (cim_cfg.frc << 16) | (cim_cfg.trig << 4);	cim_config(&c);	/* cim image parameter isn't set newly */	/* allocate device */        dev = &dev0;	/* record device */	cim_dev = dev;	/* allocate a frame buffer */	if (cim_fb_alloc() < 0) {		return -1;	}	dev->WaitSem = OSSemCreate(0);	dev->JpegWaitSem = OSSemCreate(0);	if ((ret = request_irq(IRQ_CIM, cim_irq_handler, dev)) == -1) {		cim_fb_destroy();		printf("CIM could not get IRQ");		return ret;	}	printf("JzSOC Camera Interface(CIM) driver init OK\n");	return 0;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久爽爽爽麻豆色哟哟| 欧美性xxxxxxxx| 国产人伦精品一区二区| 国产乱人伦精品一区二区在线观看 | 亚洲欧美视频一区| 91猫先生在线| 日一区二区三区| 精品免费国产二区三区| 国产河南妇女毛片精品久久久| 国产精品久久精品日日| 色琪琪一区二区三区亚洲区| 日韩中文欧美在线| 久久日韩精品一区二区五区| 国产成人99久久亚洲综合精品| 国产精品免费网站在线观看| 在线亚洲一区观看| 久久爱www久久做| 国产精品素人一区二区| 欧美亚洲综合一区| 国产真实乱子伦精品视频| 亚洲国产电影在线观看| 91国偷自产一区二区使用方法| 天天综合色天天综合色h| 久久久久久久网| 欧美在线免费观看视频| 精品在线播放午夜| 最新国产成人在线观看| 欧美精品自拍偷拍| 成人一道本在线| 午夜久久久影院| 中国av一区二区三区| 欧美高清视频在线高清观看mv色露露十八| 久久成人免费网站| 一区二区三区不卡视频| 国产午夜精品久久久久久免费视 | 色悠久久久久综合欧美99| 日韩综合一区二区| 中文字幕日韩欧美一区二区三区| 欧美一区在线视频| 91成人免费电影| 国产成人h网站| 免费看欧美美女黄的网站| 亚洲日本在线观看| 精品国产免费久久| 3d成人动漫网站| 一本一道综合狠狠老| 国产xxx精品视频大全| 免费日韩伦理电影| 亚洲午夜日本在线观看| 国产精品嫩草影院av蜜臀| 精品剧情在线观看| 欧美色图一区二区三区| 99久久综合99久久综合网站| 激情丁香综合五月| 日本中文字幕一区二区有限公司| 亚洲激情自拍偷拍| 亚洲三级在线播放| 国产日韩欧美麻豆| 精品国产91亚洲一区二区三区婷婷| 欧美精品第一页| 欧美视频在线一区| 一本一道久久a久久精品| 成人的网站免费观看| 国产黄色成人av| 国产一区二区福利| 国产一区二区三区不卡在线观看 | 捆绑紧缚一区二区三区视频| 日本亚洲天堂网| 五月天网站亚洲| 亚洲一区二区三区精品在线| 伊人一区二区三区| 一区二区三区 在线观看视频 | 国产精品青草久久| 国产女同性恋一区二区| 国产亚洲综合av| 国产日韩综合av| 中文字幕欧美一| 综合av第一页| 亚洲综合色丁香婷婷六月图片| 一区二区三区**美女毛片| 亚洲综合免费观看高清完整版在线| 亚洲精品视频自拍| 亚洲1区2区3区视频| 亚洲成av人片在线| 蜜臀av性久久久久av蜜臀妖精| 免费看黄色91| 国产精品影视网| 91一区二区三区在线播放| 91在线视频播放| 欧美日韩一二三区| 制服丝袜亚洲播放| 久久美女艺术照精彩视频福利播放| 久久精品免视看| 亚洲黄色在线视频| 亚洲不卡av一区二区三区| 麻豆专区一区二区三区四区五区| 国产剧情在线观看一区二区| 福利电影一区二区| 欧美性受xxxx| 精品国产一区二区三区不卡| 国产精品第一页第二页第三页| 亚洲综合激情网| 麻豆一区二区在线| 成人avav影音| 在线成人高清不卡| 久久精品免费在线观看| 亚洲日穴在线视频| 美国毛片一区二区三区| 不卡的av网站| 欧美日产国产精品| 国产午夜亚洲精品午夜鲁丝片| 中文字幕日韩精品一区| 日产欧产美韩系列久久99| 国产成人高清在线| 在线播放中文一区| 日本一区二区免费在线| 视频一区在线视频| 国产成人亚洲综合a∨婷婷图片| 色综合久久中文字幕综合网| 欧美成人一区二区三区在线观看| 国产精品美女久久久久av爽李琼| 亚洲午夜精品一区二区三区他趣| 狠狠色丁香久久婷婷综| 在线观看av一区二区| 久久久www成人免费毛片麻豆| 亚洲一区二区三区不卡国产欧美| 国产毛片精品视频| 欧美无砖砖区免费| 国产精品亲子伦对白| 欧美a级一区二区| 色婷婷精品大视频在线蜜桃视频| 精品国产99国产精品| 午夜精品久久久久久久| 成人18精品视频| 欧美精品一区二区不卡| 日韩国产高清影视| 91麻豆自制传媒国产之光| 26uuu欧美| 奇米777欧美一区二区| 欧美三级中文字幕在线观看| 欧美国产在线观看| 国产一区二区三区在线观看免费视频| 欧美视频第二页| 亚洲综合视频网| 91美女片黄在线| 亚洲天堂免费看| 菠萝蜜视频在线观看一区| 久久这里只有精品6| 免费成人在线观看视频| 欧美日韩二区三区| 亚洲精品videosex极品| 99re热这里只有精品视频| 久久伊人蜜桃av一区二区| 麻豆精品国产91久久久久久| 欧美人狂配大交3d怪物一区| 一区二区三区国产豹纹内裤在线| 9i看片成人免费高清| 中文字幕av一区二区三区| 国产毛片精品一区| 国产亚洲短视频| 国产福利精品导航| 欧美激情一区二区三区不卡 | 国产美女娇喘av呻吟久久| 日韩精品一区二区在线观看| 日本不卡免费在线视频| 欧美日韩国产美| 天天综合天天综合色| 91精品国产一区二区三区蜜臀 | 亚洲天堂中文字幕| 91在线精品秘密一区二区| 18欧美亚洲精品| 91色在线porny| 亚洲午夜国产一区99re久久| 欧美精品在线视频| 蜜桃久久久久久久| 久久亚洲精品国产精品紫薇| 国产盗摄一区二区| 国产精品久久久久久久岛一牛影视 | 一区二区三区在线高清| 欧美日韩一级大片网址| 蜜臀av性久久久久av蜜臀妖精| 精品国产人成亚洲区| 成人午夜激情在线| 亚洲欧美日韩国产综合| 欧美日韩一卡二卡三卡| 精品一区二区三区视频| 欧美激情在线看| 色婷婷国产精品| 秋霞电影网一区二区| 国产亚洲婷婷免费| 99精品视频在线观看| 亚欧色一区w666天堂| 精品剧情v国产在线观看在线| 国产mv日韩mv欧美| 亚洲午夜在线视频| 久久精品视频一区二区三区| 色悠悠亚洲一区二区| 理论片日本一区| 亚洲男人天堂av网| 日韩精品一区二区三区四区视频|