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

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

?? pxa_camera-hzh.c

?? 基于intel xscale下的linux系統(tǒng)camera驅(qū)動程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*     pxa_camera - main file for camera driver	Copyright (C) 2003, Intel Corporation.    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.    Code Status:    2004/10/19: Yan Yin <yan.yin@intel.com>        - Ported to 2.6 kernel		- Made camera driver a loadable module*/ #include <linux/config.h>#include <linux/module.h>#include <linux/version.h>#include <linux/init.h>#include <linux/fs.h>#include <linux/vmalloc.h>#include <linux/delay.h>#include <linux/slab.h>#include <linux/proc_fs.h>#include <linux/ctype.h>#include <linux/pagemap.h>#include <linux/interrupt.h>#include <linux/videodev.h>#include <linux/pci.h>#include <linux/pm.h>#include <linux/poll.h>#include <linux/wait.h>#include <linux/cpufreq.h>#include <linux/types.h>#include <asm/mach-types.h>#include <asm/io.h>#include <asm/semaphore.h>#include <asm/hardware.h>#include <asm/dma.h>#include <asm/irq.h>#include <asm/arch/irqs.h>#include <asm/arch/pxa-regs.h>#include "camera.h"#include "ci.h"#ifdef CONFIG_MACH_MAINSTONE#define   ADCM2650#else#define   OV9640#endif#ifdef ADCM2650#include "adcm2650.h"#include "adcm2650_hw.h"#endif#ifdef OV9640#include "ov9640.h"#include "ov9640_hw.h"#endif#define CIBR0_PHY	(0x50000000 + 0x28)#define CIBR1_PHY	(0x50000000 + 0x30)#define CIBR2_PHY	(0x50000000 + 0x38)#ifdef ADCM2650#define MAX_WIDTH	480#define MAX_HEIGHT	640#define MIN_WIDTH	72#define MIN_HEIGHT	72#endif#ifdef OV9640#define MAX_WIDTH	640#define MAX_HEIGHT	480#define MIN_WIDTH	88#define MIN_HEIGHT	72#endif#define WIDTH_DEFT	176#define HEIGHT_DEFT	144#define FRAMERATE_DEFT	0x0#define BUF_SIZE_DEFT	0xE1000#define SINGLE_DESC_TRANS_MAX  	8000#define MAX_DESC_NUM	0x400#define MAX_BLOCK_NUM	20/* * Buffer Size Calculate Formula * Buffer_Size = Page_Align (Max(window_size(VGA), window_size(CIF)*3) * Max(BPP)) * Buffer_Size = Page_Align (Max ((640 * 480), (352 * 288 *3)) * 3) = 0xE1000 */static camera_context_t  *g_camera_context = NULL;struct device *g_camera_device;#ifdef ADCM2650static camera_function_t  adcm2650_func;#endif#ifdef OV9640static camera_function_t  ov9640_func;#endifwait_queue_head_t  camera_wait_q;	/* /dev/videoX registration number */static int 	minor = 0;int		ci_dma_y;int		ci_dma_cb;int		ci_dma_cr;volatile int 	task_waiting = 0;static int 	still_image_mode = 0;static int	still_image_rdy	= 0;static int 	first_video_frame = 0;void pxa_ci_dma_irq_y(int channel, void *data, struct pt_regs *regs);void pxa_ci_dma_irq_cb(int channel, void *data, struct pt_regs *regs);void pxa_ci_dma_irq_cr(int channel, void *data, struct pt_regs *regs);static unsigned long ci_regs_base = 0;   /* for CI registers IOMEM mapping */#define CI_REG(x)             (* (volatile u32*)(x) )#define CI_REG_SIZE             0x40 /* 0x5000_0000 --- 0x5000_0038 * 64K */#define CI_REGS_PHYS            0x50000000  /* Start phyical address of CI registers *//*********************************************************************** * * Declarations * ***********************************************************************/// map of camera image format (camera.h) ==> capture interface format (ci.h)static const CI_IMAGE_FORMAT FORMAT_MAPPINGS[] = {        CI_RAW8,                   //RAW        CI_RAW9,        CI_RAW10,        CI_RGB444,                 //RGB        CI_RGB555,        CI_RGB565,        CI_RGB666_PACKED,          //RGB Packed         CI_RGB666,        CI_RGB888_PACKED,        CI_RGB888,        CI_RGBT555_0,              //RGB+Transparent bit 0        CI_RGBT888_0,        CI_RGBT555_1,              //RGB+Transparent bit 1          CI_RGBT888_1,            CI_INVALID_FORMAT,        CI_YCBCR422,               //YCBCR        CI_YCBCR422_PLANAR,        //YCBCR Planaried        CI_INVALID_FORMAT,        CI_INVALID_FORMAT};static int update_dma_chain( p_camera_context_t camera_context );static void start_dma_transfer( p_camera_context_t camera_context, unsigned block_id );static void stop_dma_transfer( p_camera_context_t camera_context );static int start_capture( p_camera_context_t camera_context, unsigned int block_id, unsigned int frames );void pxa_dma_repeat(camera_context_t  *cam_ctx);void pxa_dma_continue(camera_context_t *cam_ctx);/*********************************************************************** * * Private functions * ***********************************************************************//*Generate dma descriptorsPre-condition: these variables must be set properly                block_number, fifox_transfer_size                 dma_descriptors_virtual, dma_descriptors_physical, dma_descirptors_sizePost-condition: these variables will be set                fifox_descriptors_virtual, fifox_descriptors_physical                              fifox_num_descriptors */int update_dma_chain( p_camera_context_t camera_context ){	pxa_dma_desc *cur_des_virtual, *cur_des_physical, *last_des_virtual = NULL;	int des_transfer_size, remain_size;	unsigned int i,j;	int target_physical;	int target_virtual;	// clear descriptor pointers	camera_context->fifo0_descriptors_virtual = camera_context->fifo0_descriptors_physical = 0;	camera_context->fifo1_descriptors_virtual = camera_context->fifo1_descriptors_physical = 0;	camera_context->fifo2_descriptors_virtual = camera_context->fifo2_descriptors_physical = 0;	// calculate how many descriptors are needed per frame	camera_context->fifo0_num_descriptors = ( camera_context->fifo0_transfer_size + SINGLE_DESC_TRANS_MAX -1 )		 / SINGLE_DESC_TRANS_MAX;	camera_context->fifo1_num_descriptors = ( camera_context->fifo1_transfer_size + SINGLE_DESC_TRANS_MAX -1 )		 / SINGLE_DESC_TRANS_MAX;	camera_context->fifo2_num_descriptors = ( camera_context->fifo2_transfer_size + SINGLE_DESC_TRANS_MAX -1 )		 / SINGLE_DESC_TRANS_MAX;	// check if enough memory to generate descriptors	if ( (camera_context->fifo0_num_descriptors + camera_context->fifo1_num_descriptors +  			camera_context->fifo2_num_descriptors) * camera_context->block_number 			> camera_context->dma_descriptors_size)		return -1;	// generate fifo0 dma chains	camera_context->fifo0_descriptors_virtual = (unsigned)camera_context->dma_descriptors_virtual;	camera_context->fifo0_descriptors_physical = (unsigned)camera_context->dma_descriptors_physical;	cur_des_virtual = (pxa_dma_desc *)camera_context->fifo0_descriptors_virtual;	cur_des_physical = (pxa_dma_desc *)camera_context->fifo0_descriptors_physical;	for(i=0; i<camera_context->block_number; i++) {		// in each iteration, generate one dma chain for one frame		remain_size = camera_context->fifo0_transfer_size;		// assume the blocks are stored consecutively		target_physical = (unsigned)camera_context->buffer_physical + camera_context->block_size * i;		target_virtual = (unsigned)camera_context->buffer_virtual + camera_context->block_size * i;				for(j=0; j<camera_context->fifo0_num_descriptors; j++) {			 // set descriptor		        if (remain_size > SINGLE_DESC_TRANS_MAX)         			des_transfer_size = SINGLE_DESC_TRANS_MAX;        		else		       		des_transfer_size = remain_size;		        cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);        		cur_des_virtual->dsadr = CIBR0_PHY;       // FIFO0 physical address        		cur_des_virtual->dtadr = target_physical;        		cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;		        // advance pointers        		remain_size -= des_transfer_size;        		cur_des_virtual++;		        cur_des_physical++;        		target_physical += des_transfer_size;		        target_virtual += des_transfer_size;		}        		// stop the dma transfer on one frame captured		last_des_virtual = cur_des_virtual - 1;		//last_des_virtual->ddadr |= 0x1;	}	last_des_virtual->ddadr = ((unsigned)camera_context->fifo0_descriptors_physical);    	// generate fifo1 dma chains	if (camera_context->fifo1_transfer_size) {		// record fifo1 descriptors' start address		camera_context->fifo1_descriptors_virtual = (unsigned)cur_des_virtual;		camera_context->fifo1_descriptors_physical = (unsigned)cur_des_physical;		for(i=0; i<camera_context->block_number; i++) {			// in each iteration, generate one dma chain for one frame			remain_size = camera_context->fifo1_transfer_size;        		// assume the blocks are stored consecutively        		target_physical = (unsigned)camera_context->buffer_physical + camera_context->block_size * i         	                    + camera_context->fifo0_transfer_size;        		target_virtual = (unsigned)camera_context->buffer_virtual + camera_context->block_size * i         	                    + camera_context->fifo0_transfer_size;            		for(j=0; j<camera_context->fifo1_num_descriptors; j++) {        		        // set descriptor        			if (remain_size > SINGLE_DESC_TRANS_MAX)         		            des_transfer_size = SINGLE_DESC_TRANS_MAX;        		        else        		            des_transfer_size = remain_size;        		        cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);        		        cur_des_virtual->dsadr = CIBR1_PHY;      // FIFO1 physical address        		        cur_des_virtual->dtadr = target_physical;        		        cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;            		        // advance pointers        		        remain_size -= des_transfer_size;        		        cur_des_virtual++;        		        cur_des_physical++;        		        target_physical += des_transfer_size;        		        target_virtual += des_transfer_size;        			}        		// stop the dma transfer on one frame captured        		last_des_virtual = cur_des_virtual - 1;			//last_des_virtual->ddadr |= 0x1;        	}		last_des_virtual->ddadr = ((unsigned)camera_context->fifo1_descriptors_physical);	}    	// generate fifo2 dma chains	if (camera_context->fifo2_transfer_size) {		// record fifo1 descriptors' start address		camera_context->fifo2_descriptors_virtual = (unsigned)cur_des_virtual;		camera_context->fifo2_descriptors_physical = (unsigned)cur_des_physical;		for(i=0; i<camera_context->block_number; i++) {			// in each iteration, generate one dma chain for one frame			remain_size = camera_context->fifo2_transfer_size;			// assume the blocks are stored consecutively			target_physical = (unsigned)camera_context->buffer_physical + camera_context->block_size * i                             + camera_context->fifo0_transfer_size + camera_context->fifo1_transfer_size;    		        for(j=0; j<camera_context->fifo2_num_descriptors; j++) {                		// set descriptor                		if (remain_size > SINGLE_DESC_TRANS_MAX)                 			des_transfer_size = SINGLE_DESC_TRANS_MAX;                		else                			des_transfer_size = remain_size;                		cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);                		cur_des_virtual->dsadr = CIBR2_PHY;      // FIFO2 physical address                		cur_des_virtual->dtadr = target_physical;                		cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;                    		// advance pointers                		remain_size -= des_transfer_size;                		cur_des_virtual++;                		cur_des_physical++;                		target_physical += des_transfer_size;		        }		        // stop the dma transfer on one frame captured        		last_des_virtual = cur_des_virtual - 1;			//last_des_virtual->ddadr |= 0x1;        	}		last_des_virtual->ddadr = ((unsigned)camera_context->fifo2_descriptors_physical);	}	return 0;   }void start_dma_transfer( p_camera_context_t camera_context, unsigned block_id ){	pxa_dma_desc *des_virtual, *des_physical;    	if (block_id >= camera_context->block_number)        	return;        	// start channel 0	des_virtual = (pxa_dma_desc *)camera_context->fifo0_descriptors_virtual 		+ block_id * camera_context->fifo0_num_descriptors;	des_physical = (pxa_dma_desc *)camera_context->fifo0_descriptors_physical 		+ block_id * camera_context->fifo0_num_descriptors;        DDADR(camera_context->dma_channels[0]) = (int) des_physical;        DCSR(camera_context->dma_channels[0]) |= DCSR_RUN;	// start channel 1	if ( camera_context->fifo1_descriptors_virtual ) {		des_virtual = (pxa_dma_desc *)camera_context->fifo1_descriptors_virtual + 			block_id * camera_context->fifo1_num_descriptors;		des_physical = (pxa_dma_desc *)camera_context->fifo1_descriptors_physical + 			block_id * camera_context->fifo1_num_descriptors;                DDADR(camera_context->dma_channels[1]) = (int) des_physical;                DCSR(camera_context->dma_channels[1]) |= DCSR_RUN;	}	// start channel 2	if ( camera_context->fifo2_descriptors_virtual ) {		des_virtual = (pxa_dma_desc *)camera_context->fifo2_descriptors_virtual + 			block_id * camera_context->fifo2_num_descriptors;		des_physical = (pxa_dma_desc *)camera_context->fifo2_descriptors_physical + 			block_id * camera_context->fifo2_num_descriptors;                DDADR(camera_context->dma_channels[2]) = (int) des_physical;                DCSR(camera_context->dma_channels[2]) |= DCSR_RUN;	}}void stop_dma_transfer( p_camera_context_t camera_context ){	        int ch0, ch1, ch2;        ch0 = camera_context->dma_channels[0];        ch1 = camera_context->dma_channels[1];        ch2 = camera_context->dma_channels[2];        DCSR(ch0) &= ~DCSR_RUN;        DCSR(ch1) &= ~DCSR_RUN;        DCSR(ch2) &= ~DCSR_RUN;	return;}int start_capture( p_camera_context_t camera_context, unsigned int block_id, unsigned int frames ){	int   status;	// clear ci fifo	ci_reset_fifo();	ci_clear_int_status(0xFFFFFFFF);	// start dma	start_dma_transfer(camera_context, block_id);		// start capture	status = camera_context->camera_functions->start_capture(camera_context, frames);	return status;}/*********************************************************************** * * Init/Deinit APIs * ***********************************************************************/int camera_init( p_camera_context_t camera_context ){	int   ret = 0;	int i;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色一区在线观看| 日韩精品一区二区三区在线播放| 99久久精品免费| 色综合色狠狠综合色| 日韩欧美aaaaaa| 亚洲国产乱码最新视频 | 欧美一区二区三区电影| 国产农村妇女毛片精品久久麻豆 | 亚洲一区二区三区视频在线| 日韩高清不卡在线| 国产白丝精品91爽爽久久| 337p亚洲精品色噜噜| 亚洲精品成人精品456| 国产精品一卡二卡| 欧美成人精品1314www| 亚洲国产日韩在线一区模特| 成人的网站免费观看| 欧美精品一区二区三区蜜臀| 日韩精品成人一区二区三区| 日本乱码高清不卡字幕| 国产精品免费丝袜| 国产成人亚洲综合a∨猫咪| 制服丝袜激情欧洲亚洲| 亚洲最大色网站| 91在线免费看| 久久久久久久久岛国免费| 秋霞电影一区二区| 6080yy午夜一二三区久久| 一区二区三区欧美日| 高清视频一区二区| 中文字幕不卡在线播放| 国产不卡一区视频| 国产精品毛片久久久久久久 | 日韩专区欧美专区| 欧美军同video69gay| 亚洲福利一二三区| 欧美肥胖老妇做爰| 日产欧产美韩系列久久99| 91精品国产综合久久国产大片| 亚洲h在线观看| 欧美一区二区三区免费观看视频| 午夜电影网一区| 日韩免费福利电影在线观看| 九九精品一区二区| 26uuu色噜噜精品一区二区| 国产乱码精品一区二区三 | 久久99久久久久久久久久久| 日韩欧美一区在线观看| 日日摸夜夜添夜夜添精品视频 | 国内久久婷婷综合| 久久精品亚洲精品国产欧美kt∨| 国产白丝精品91爽爽久久| 日韩一区中文字幕| 一本久久精品一区二区| 亚洲永久精品国产| 欧美精品在线观看一区二区| 亚洲成a人片在线观看中文| 欧美放荡的少妇| 久久成人免费网站| 精品久久久久久久久久久久包黑料 | 国产色婷婷亚洲99精品小说| 成人av在线影院| 亚洲第四色夜色| 精品日韩一区二区三区免费视频| 国产精品一区二区久久精品爱涩| 亚洲精品五月天| 日韩欧美国产1| 色哟哟日韩精品| 精品一区二区三区久久| 亚洲品质自拍视频| 日韩欧美久久久| a级高清视频欧美日韩| 日韩国产一区二| 国产精品电影一区二区| 日韩一级二级三级精品视频| 成人免费av网站| 蜜桃视频在线观看一区| 国产精品美女久久久久久久| 91精品国产91综合久久蜜臀| 成人h精品动漫一区二区三区| 五月激情综合色| 1000精品久久久久久久久| 欧美成人性福生活免费看| 在线影视一区二区三区| 国产精品一区在线观看乱码| 亚洲综合成人网| 国产精品久久久久久福利一牛影视| 欧美日韩亚洲综合在线| 成人黄色综合网站| 激情欧美一区二区| 日韩精品国产精品| 亚洲成人精品影院| 亚洲蜜臀av乱码久久精品| 久久综合国产精品| 日韩午夜在线播放| 7777精品久久久大香线蕉 | 日韩视频免费观看高清完整版 | 亚洲一区免费视频| 亚洲欧洲av一区二区三区久久| 精品久久久三级丝袜| 欧美一区二区在线不卡| 欧美亚洲免费在线一区| av一区二区三区| 国产成人免费在线视频| 国产一区二区视频在线| 久久99精品视频| 美女久久久精品| 免费成人在线网站| 裸体在线国模精品偷拍| 奇米色777欧美一区二区| 丝袜a∨在线一区二区三区不卡| 亚洲欧美激情在线| 一区二区三区国产精品| 一区二区三区精品视频在线| 自拍偷拍亚洲激情| 亚洲日穴在线视频| 一区二区三区在线播放| 一区二区三区欧美| 丝袜a∨在线一区二区三区不卡| 亚洲国产精品一区二区www在线| 亚洲综合999| 日韩黄色免费电影| 精品写真视频在线观看| 国产福利一区二区三区视频 | 国产精品黄色在线观看| 国产精品夫妻自拍| 亚洲国产一区在线观看| 天天综合日日夜夜精品| 蜜桃久久久久久久| 国产一区二区伦理片| 成人黄色在线网站| 在线观看日韩高清av| 777亚洲妇女| 久久色中文字幕| 亚洲天堂网中文字| 午夜精品视频一区| 韩国av一区二区三区在线观看| 国产盗摄女厕一区二区三区| 97精品久久久午夜一区二区三区| 91成人网在线| 久久综合久色欧美综合狠狠| 中文字幕av资源一区| 亚洲尤物在线视频观看| 久久国产福利国产秒拍| 成人一二三区视频| 欧美日韩国产影片| 久久精品一区二区三区不卡| 亚洲色图欧美在线| 日本女优在线视频一区二区| 国产乱妇无码大片在线观看| 91麻豆文化传媒在线观看| 欧美一区二区三区四区在线观看| 国产午夜精品一区二区三区视频| 亚洲欧美一区二区三区孕妇| 人人狠狠综合久久亚洲| 东方aⅴ免费观看久久av| 精品婷婷伊人一区三区三| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲天堂精品视频| 裸体在线国模精品偷拍| 91麻豆免费观看| 久久久精品tv| 视频在线观看91| 92国产精品观看| 久久久www免费人成精品| 亚洲第一福利一区| 9l国产精品久久久久麻豆| 日韩精品一区在线| 尤物视频一区二区| 成人激情综合网站| 久久综合九色综合97_久久久| 午夜私人影院久久久久| 99精品在线免费| 国产欧美日韩久久| 精品系列免费在线观看| 欧美精品成人一区二区三区四区| 亚洲欧洲一区二区三区| 国产精品亚洲专一区二区三区| 欧美日韩国产首页| 一区二区三区在线免费播放| 成人av在线观| 日本一区二区三区在线观看| 久久黄色级2电影| 欧美一级在线观看| 调教+趴+乳夹+国产+精品| 欧美综合一区二区三区| 椎名由奈av一区二区三区| 国产福利91精品一区二区三区| 日韩午夜激情av| 美日韩一区二区| 欧美一三区三区四区免费在线看| 亚洲va欧美va人人爽| 欧美午夜寂寞影院| 一区二区三区中文免费| 在线看日本不卡| 亚洲精品中文字幕乱码三区| 色久综合一二码| 一片黄亚洲嫩模| 欧美精品丝袜久久久中文字幕| 亚洲福利一区二区|