⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncplus_mjpeg.h

📁 MJPEG Driver 3.0.1
💻 H
字号:
/* * ncplus_mjpeg.h * * Copyright(C) 2002, 2003 Asicbank Ltd., Chipsbarin Ltd. * * 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; with out 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, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * modified, May 2nd, 2002, Thursday * 	donald @ ASIC BANK * modified, Feb 21th, 2003, Saturday *      Dojip Kim <greendrm@chipsbrain.com> */#ifndef __ASM_HARDWARE_NCPLUS_MJPEG_H#define __ASM_HARDWARE_NCPLUS_MJPEG_H#ifdef __KERNEL__#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later *//* version dependencies have been confined to a separate file */#include "sysdep.h"#endif/* * Macros to help debugging */#undef PDEBUG             /* undef it, just in case */#ifdef MJPEG_DEBUG#  ifdef __KERNEL__     /* This one if debugging is on, and kernel space */#    define PDEBUG(fmt, args...) printk( KERN_DEBUG "mjpeg: " fmt, ## args)#  else     /* This one for user space */#    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)#  endif#else#  define PDEBUG(fmt, args...) /* not debugging: nothing */#endif#undef PDEBUGG#define PDEBUGG(fmt, args...) /* nothing: it's a placeholder */#ifdef __KERNEL__#ifndef MJPEG_MAJOR#define MJPEG_MAJOR 254#endif#define IRQ_MJPEG		14		// mjpeg interrupt number#define MJPEG_START		0xd0000000	// mjpeg physical address#define MJPEG_BASE		0xfc000000	// FIXME mjpeg virtual address//#define COMPRESSED_SIZE		0x80000		// FIXME 512k bytes (SDRAM)#define COMPRESSED_SIZE		0x30000		// FIXME 192k bytes (SDRAM)//#define COMPRESSED_START	(0xc1e00000)	// point to 31 M position (SDRAM)#define COMPRESSED_START	(0xc1d00000)	// point to 30 M position (SDRAM)#define COMPRESSED_BASE1	(0xfb000000)	// FIXME virtual address of COMPRESSED_BASE1#define COMPRESSED_END1		(COMPRESSED_BASE1+COMPRESSED_SIZE)#define COMPRESSED_BASE2	(COMPRESSED_END1)#define COMPRESSED_END2		(COMPRESSED_BASE2+COMPRESSED_SIZE)#define __mjpeg_raw_readl(p)          (*(volatile unsigned long *)(p))#define __mjpeg_raw_writel(v,p)       (*(volatile unsigned long *)(p) = (v))#define mjpeg_readb(off)         __mjpeg_raw_readb(MJPEG_BASE + (off))#define mjpeg_readw(off)         __mjpeg_raw_readw(MJPEG_BASE + (off))#define mjpeg_readl(off)         __mjpeg_raw_readl(MJPEG_BASE + (off))#define mjpeg_writeb(val,off)    __mjpeg_raw_writeb(val, MJPEG_BASE + (off))#define mjpeg_writew(val,off)    __mjpeg_raw_writew(val, MJPEG_BASE + (off))#define mjpeg_writel(val,off)    __mjpeg_raw_writel(val, MJPEG_BASE + (off))#endif // __KERNEL__/* * ioctl definitions *//* use 'k' as magic number */#define MJPEG_IOC_MAGIC  'k'#define MJPEG_IOCRESET    _IO(MJPEG_IOC_MAGIC, 0)#define MJPEG_IOCSTART    _IO(MJPEG_IOC_MAGIC, 1)#define MJPEG_IOCSTOP     _IO(MJPEG_IOC_MAGIC, 2)/* *  * S means "Set" through a ptr, *  * T means "Tell" directly with the argument value *  * G means "Get": reply by setting through a pointer *  * Q means "Query": response is on the return value *  * X means "eXchange": G and S atomically *  * H means "sHift": T and Q atomically *  */#define MJPEG_IOCQFRAMEAVAIL	_IO(MJPEG_IOC_MAGIC, 3)#define MJPEG_IOCQFRAMESIZE	_IO(MJPEG_IOC_MAGIC, 4)#define MJPEG_IOCTALPHA		_IO(MJPEG_IOC_MAGIC, 5)#define MJPEG_IOCTRESOL		_IO(MJPEG_IOC_MAGIC, 6)#define MJPEG_IOCGREAD		_IO(MJPEG_IOC_MAGIC, 7)#define MJPEG_IOCQALPHA		_IO(MJPEG_IOC_MAGIC, 8)	#define MJPEG_IOCQRESOL		_IO(MJPEG_IOC_MAGIC, 9)#define MJPEG_IOCTROTATE	_IO(MJPEG_IOC_MAGIC, 10)#define MJPEG_IOCQROTATE	_IO(MJPEG_IOC_MAGIC, 11)/***#define MJPEG_IOCSALPHA   _IOW(MJPEG_IOC_MAGIC,  3, s_nAlphaCoeff)#define MJPEG_IOCSRESTART _IOW(MJPEG_IOC_MAGIC,  4, s_nRestartInterval)#define MJPEG_IOCTALPHA   _IO(MJPEG_IOC_MAGIC,   5)#define MJPEG_IOCTRESTART _IO(MJPEG_IOC_MAGIC,   6)#define MJPEG_IOCGALPHA   _IOR(MJPEG_IOC_MAGIC,  7, s_nAlphaCoeff)#define MJPEG_IOCGRESTART _IOR(MJPEG_IOC_MAGIC,  8, s_nRestartInterval)#define MJPEG_IOCQALPHA   _IO(MJPEG_IOC_MAGIC,   9)#define MJPEG_IOCQRESTART _IO(MJPEG_IOC_MAGIC,   10)#define MJPEG_IOCXALPHA   _IOWR(MJPEG_IOC_MAGIC, 11, s_nAlphaCoeff)#define MJPEG_IOCXRESTART _IOWR(MJPEG_IOC_MAGIC, 12, s_nRestartInterval)#define MJPEG_IOCHALPHA   _IO(MJPEG_IOC_MAGIC,   13)#define MJPEG_IOCHRESTART _IO(MJPEG_IOC_MAGIC,   14)***//* ... more to come */#define MJPEG_IOCHARDRESET _IO(MJPEG_IOC_MAGIC,  15) /* debugging tool */#define MJPEG_IOC_MAXNR 15typedef struct {	char * copy2user;	int thread_no;} strt_mjpeg_copy;#ifdef __KERNEL__#define THREAD0 0x1#define THREAD1 0x2#define THREAD2 0x4#define THREAD3 0x8#define THREAD4 0x10/*  * constant values */#define QUANTS_COUNT		64		// number of quantization coefficients (y, uv)static const unsigned char yquant[QUANTS_COUNT] = {	0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e,	0x0d, 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28,	0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,	0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,	0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,	0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,	0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,	0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63 };static const unsigned char uvquant[QUANTS_COUNT] = {	0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,	0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,	0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63 };/* * register position offset */#define	Y_QUANT_COEFF		0x00000000	// Y plane quantization coefficient start position#define	UV_QUANT_COEFF 		0x00000100	// UV plane quantization coefficient start position#define	YSTART_ADD		0x00000200	// Y start address#define	USTART_ADD		0x00000204	// U start address#define	VSTART_ADD		0x00000208	// V start address#define	IMAGE_MCUWIDE		0x0000020c	// image width MCU block number#define	IMAGE_MCUHIGH		0x00000210	// image height MCU block number#define	ALPHA_COEFF		0x00000214	// quantization alpha coefficient  #define	RSTINTERVAL		0x00000218	// marker restart interval #define	JPEG_COMMAND		0x0000021c	// jpeg encoder command#define	JPEG_STATUS		0x00000220	// status register #define	COMPRESS_START		0x00000224	// compressed data start address#define PREPRO_HLENGTH		0x00000230	// image width register#define PREPRO_VLENGTH		0x00000234	// image height register#define PREPRO_FORMAT		0x00000238	// image dcp mode format & scaling #define SDRAM_MODE_COM		0x00000240	// sdram mode setting register#define MCU_FIFO_STATUS		0x00000244	// fifo level, read/write pointer#define DMA_MODE_COMMAND	0x00000250	// dma mode register setting #define DMA_START_ADD		0x00000254	// dma start address #define DMA_COUNT_NUM		0x00000258	// dma count number of read data #define DMA_DESTINATION 	0x0000025c	// dma destination address #define	MODULE_FUNC_STS 	0x00000260	// system function status#define	MODULE_FUNC_SET 	0x00000264	// system function setting program/* * register values *//* * COMMAND_REG values */#define NEXT_FRAME_PROGED		0x1#define CVIDEO_MODE_420			0x2#define CVIDEO_MODE_422			0x0/* * STATUS_REG values */#define IRQ_ACT_CLR			0x1#define WAIT_FOR_DATA			0x2#define READY_FOR_PROG			0x4#define	COMPRESS_START_VAL 		COMPRESSED_BASE1	// compressed data start address/* * PREPROCESS_FORMAT values */#define PVIDEO_MODE_420			0x1#define PVIDEO_MODE_422			0x0#define CAM_SOURCE_DCP			0x0#define CAM_SOURCE_EXT1			0x2#define CAM_SOURCE_EXT2			0x4#define CAM_SOURCE_EXT3			0x6#define STANDARD_CCIR601		0x0#define STANDARD_OTHERS			0x20#define NTSC_MODE			0x00#define PAL_MODE			0x40#define IMG_HOR_START_PNT		80		// horizontal offset point for scaling#define IMG_VER_START_PNT		11		// vertical offset point for scaling#define SDRAM_MODE_COM_VAL  		0x07ffff35	// sdram mode setting register/* * DMA_MODE_COMMAND values */#define FIFO_ENABLE			0x1#define DMA_ENABLE			0x2#define FIFO_STAT_EMPTY			0x0#define FIFO_STAT_HALF			0x4#define FIFO_STAT_FULL			0x8#define FIFO_STAT_READING		0xc#define FIFO_SET_HALF			0x10		// request condition for DMA or IRQ#define FIFO_SET_FULL			0x00		// request condition for DMA or IRQ#define DMA_MODE_COMMAND_VAL 		0x00000000	// dma mode register setting #define DMA_START_ADD_VAL  		0x00000270	// dma start address//#define DMA_COUNT_NUM_VAL  		0x00000030	// dma count number of read data (48 burst)#define DMA_COUNT_NUM_VAL  		0x00000020	// dma count number of read data (32 burst)#define DMA_DESTINATION_VAL  		COMPRESSED_BASE1	// dma destination address/* * MODULE_FUNC_STATUS values */#define ENCODER_STATUS#define MJPEG_IRQ_STATUS		0x8		// interrupt requested#define DMA_STATUS			0x10		// DMA requested#define ENCODER_STAT_IDLE		0x00		// encoder idle mode#define NEW_FRAME_START			0x20		// encoding of new frame just started#define ENCODER_STAT_ACTIVE		0x40		// encoder active mode#define FRAME_ENC_FINISHED		0x60		// encoding of a frame just finished#define	MODULE_FUNC_SET_NORMAL 		0x00000000	// normal mode, 0x00000000#define	MODULE_FUNC_SET_STOP 		0x00000003	// lock mode, 0x00000003#define	MODULE_FUNC_SET_RESET 		0x00000008	// reset mode, 0x00000008/* * 160x120, 422, case 142 */#define	YSTART_ADD_VAL_142   		0x00000000	// Y start address for 160x120 422 case#define	USTART_ADD_VAL_142   		0x000012c0	// U start address for 160x120 422 case#define	VSTART_ADD_VAL_142 		0x00001c20	// V start address for 160x120 422 case#define	IMAGE_MCUWIDE_VAL_142 		0x0000000a	// image width MCU block number (10)#define	IMAGE_MCUHIGH_VAL_142 		0x0000000f	// image height MCU block number (15)#define	ALPHA_COEFF_VAL_142 		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_142 		0x000003e8	// marker restart interval (1000)#define PREPRO_HLENGTH_VAL_142  	0x000000a0	// image width register (160) for 160x120 #define PREPRO_VLENGTH_VAL_142  	0x00000078	// image height register (120) for 160x120#define PREPRO_FORMAT_VAL_142		0x00002820	// image dcp mode format & scaling (75808)/* * 160x120, 420, case 140 */#define	YSTART_ADD_VAL_140   		0x00000000	// Y start address for 160x120 420 case#define	USTART_ADD_VAL_140   		0x000012c0	// U start address for 160x120 420 case#define	VSTART_ADD_VAL_140 		0x00001770	// V start address for 160x120 420 case#define	IMAGE_MCUWIDE_VAL_140 		0x0000000a	// image width MCU block number (10)#define	IMAGE_MCUHIGH_VAL_140 		0x00000008	// image height MCU block number (8)#define	ALPHA_COEFF_VAL_140 		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_140 		0x000003e8	// marker restart interval (1000)#define PREPRO_HLENGTH_VAL_140  	0x000000a0	// image width register (160) for 160x120 #define PREPRO_VLENGTH_VAL_140  	0x00000078	// image height register (120) for 160x120#define PREPRO_FORMAT_VAL_140		0x00002821	// image dcp mode format & scaling (75809)/* * 320x240, 422, case 342 */#define	YSTART_ADD_VAL_342   		0x00000000	// Y start address for 320x240 422 case#define	USTART_ADD_VAL_342   		0x00004b00	// U start address for 320x240 422 case#define	VSTART_ADD_VAL_342 		0x00007080	// V start address for 320x240 422 case#define	IMAGE_MCUWIDE_VAL_342 		0x00000014	// image width MCU block number (20)#define	IMAGE_MCUHIGH_VAL_342 		0x0000001e	// image height MCU block number (30)#define	ALPHA_COEFF_VAL_342 		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_342 		0x000007d0	// marker restart interval (2000)#define PREPRO_HLENGTH_VAL_342  	0x00000140	// image width register (320) for 320x240 #define PREPRO_VLENGTH_VAL_342  	0x000000f0	// image height register (240) for 320x240#define PREPRO_FORMAT_VAL_342  		0x00002820	// image dcp mode format & scaling (75808)/* * 320x240, 420, case 340 */#define	YSTART_ADD_VAL_340		0x00000000	// Y start address for 320x240 420 case#define	USTART_ADD_VAL_340		0x00004b00	// U start address for 320x240 420 case#define	VSTART_ADD_VAL_340		0x00005dc0	// V start address for 320x240 420 case#define	IMAGE_MCUWIDE_VAL_340		0x00000014	// image width MCU block number (20)#define	IMAGE_MCUHIGH_VAL_340		0x0000000f	// image height MCU block number (15)#define	ALPHA_COEFF_VAL_340		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_340		0x000007d0	// marker restart interval (2000)#define PREPRO_HLENGTH_VAL_340		0x00000140	// image width register (320) for 320x240 #define PREPRO_VLENGTH_VAL_340		0x000000f0	// image height register (240) for 320x240#define PREPRO_FORMAT_VAL_340		0x00002821	// image dcp mode format & scaling (75809)/* * 640x480, 422, case 642 */#define	YSTART_ADD_VAL_642   		0x00000000	// Y start address for 640x480 422 case#define	USTART_ADD_VAL_642   		0x00012c00	// U start address for 640x480 422 case#define	VSTART_ADD_VAL_642 		0x0001c200	// V start address for 640x480 422 case#define	IMAGE_MCUWIDE_VAL_642 		0x00000028	// image width MCU block number (40)#define	IMAGE_MCUHIGH_VAL_642 		0x0000003c	// image height MCU block number (60)#define	ALPHA_COEFF_VAL_642 		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_642 		0x000007d0	// marker restart interval (2000)#define PREPRO_HLENGTH_VAL_642  	0x00000280	// image width register (640) for 640x480 #define PREPRO_VLENGTH_VAL_642  	0x000001e0	// image height register (480) for 640x480#define PREPRO_FORMAT_VAL_642  		0x00002820	// image dcp mode format & scaling (75808)/* * 640x480, 420, case 640 */#define	YSTART_ADD_VAL_640   		0x00000000	// Y start address for 640x480 420 case#define	USTART_ADD_VAL_640   		0x00012c00	// U start address for 640x480 420 case#define	VSTART_ADD_VAL_640 		0x00017700	// V start address for 640x480 420 case#define	IMAGE_MCUWIDE_VAL_640 		0x00000028	// image width MCU block number (40)#define	IMAGE_MCUHIGH_VAL_640 		0x0000001e	// image height MCU block number (30)#define	ALPHA_COEFF_VAL_640 		0x00000040	// quantization alpha coefficient (50%) #define	RSTINTERVAL_VAL_640 		0x000007d0	// marker restart interval (2000)#define PREPRO_HLENGTH_VAL_640  	0x00000280	// image width register (640) for 640x480 #define PREPRO_VLENGTH_VAL_640  	0x000001e0	// image height register (480) for 640x480#define PREPRO_FORMAT_VAL_640  		0x00002821	// image dcp mode format & scaling (75809)#endif // __KERNEL__#endif /* __ASM_HARDWARE_NCPLUS_MJPEG_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -