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

📄 at2042_inf.c

📁 这个是Linux下的关于2042的程序
💻 C
📖 第 1 页 / 共 4 页
字号:
#define __BACK_COLOR__	1
#endif

static void set_res (unsigned short res, unsigned short frm)
{
	volatile unsigned short id_conf;
	volatile unsigned short frame_rate;
		
	if (res==RES_MODE_DI)		/*RES_MODE_DI*/
	{
#ifdef __BACK_COLOR__		/*2005-03-28 netbsd __BACK_COLOR__*/
		id_conf = RxID(0x8, 0x00, 0x18, W_FLAG);/*backgrounf color on/off*/
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0x00;
#endif

		/* Input Video Format : 0x01 */
		id_conf = RxID(GID_ENC_VIDEO, 0x00, 0x01, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 720;		// hor_size

		if (PAL_NTSC==NTSC) {
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 480;	// ver_size
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 4;		// video_input_rate 30000/10001
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		// field_mode (d1=>interlaced '0')
			printk_netbsd2 ("[Input video Format 720, 480, 4, 0]\n"); 
		}
		else {
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 576;	// ver_size
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 3;	// video_input_rate 25
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;	// field_mode (d1=>interlaced '0')
			printk_netbsd2 ("[Input video Format 720, 576, 3, 0]\n"); 		
		}
		
		/*Input  video scale mode*/
		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x22, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		// hor_scale 1
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		// ver_scale 1
		printk_netbsd2 ("[Input  video scale mode : 100, 100]\n"); 
		
		/*Encoding region information*/
		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x23, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		//hor_offset	0
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		//ver_offset	0
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (720>>4);	//hor_MB	45
		if (PAL_NTSC==NTSC)  {	/*NTSC D1*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (480>>4);	//ver_MB		30
			printk_netbsd ("[RESOLUTION : NTSC 720x480]\n"); 
		}
		else {	/*PAL D1*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (576>>4);	//ver_MB		30
			printk_netbsd ("[RESOLUTION : PAL 720x576]\n"); 			
		}		

		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x24, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;		//Input frames
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;		//recoded frames

		/*Recoding frame rate control*/
		if (frm>=30) frame_rate=30;	
		else if (frm<=1) frame_rate=1;	
		else frame_rate=frm;
		printk_netbsd2 ("[FRAME_RATE : %d/SEC]\n" , frame_rate);
		
#ifdef __ZOOM_IN__
		/* ZOOM_IN */
		id_conf = RxID(GID_DEC_VIDEO, 0, 0x10, W_FLAG);	
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0 |0);	//hor_zoom |ver_zoom
		printk_netbsd2 ("[ZOOM_IN : OFF]\n"); 
#endif		

#ifdef __PIP__	/*2005-01-07*/
		/*Rescale*/
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x10, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 4;// 2/3 Hor scale
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 4;// 2/3 Ver scale
		printk_netbsd2 ("[Display Rescale]\n"); 
		/*Deocding video offset*/		
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x11, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x0c);// Hor offset
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x08);// Ver offset
#else	/*2005-01-18*/
		/*Rescale*/
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x10, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Hor scale
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Ver scale
		printk_netbsd2 ("[Display Rescale]\n"); 
		/*Deocding video offset*/		
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x11, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x00);// Hor offset
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x00);// Ver offset
#endif		
	}
	else 		/*RES_MODE_CIF*/
	{
#ifdef __BACK_COLOR__		/*2005-03-28 netbsd __BACK_COLOR__*/
		id_conf = RxID(0x8, 0x00, 0x18, W_FLAG);/*backgrounf color on/off*/
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0x01;
#endif

		/* Input Video Format : 0x01 */
		id_conf = RxID(GID_ENC_VIDEO, 0x00, 0x01, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 720;		// hor_size
		
		if (PAL_NTSC==NTSC) {
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =480;	// ver_size
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 7;		// video_input_rate 60000/10001
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;		// field_mode (d1=>progressive '1')
			printk_netbsd2 ("[Input video Format 720, 480, 4, 0]\n"); 
		}
		else {
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =576;	// ver_size
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 6;		// video_input_rate 50
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;		// field_mode (d1=>progressive '1')
			printk_netbsd2 ("[Input video Format 720, 576, 3, 0]\n"); 		
		}

 		/*Input  video scale mode*/
		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x22, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  2;		// hor_scale 1/2
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;		// ver_scale 1/1 progressive
		//*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;	// ver_scale 1/2 interace
		printk_netbsd2 ("[Input  video scale mode 50, 100]\n"); 
		
		/*Encoding region information*/
		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x23, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  0;			//hor_offset	0
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  0;			//ver_offset	0
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  (360>>4);	//hor_MB	0x16
		
		if (PAL_NTSC==NTSC) {	/*NTSC CIF*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =   (240>>4);	//ver_MB		0x0F
			printk_netbsd ("[RESOLUTION : NTSC 360x240]\n"); 

#ifdef __BACK_COLOR__	/*2005-03-28 netbsd __BACK_COLOR__*/
			id_conf = RxID(0x8, 0x00, 0x19, W_FLAG);/*background color*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=id_conf;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=32;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=16;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=16;
			
			id_conf = RxID(0x8, 0x00, 0x1A, W_FLAG);/*foreground video window*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=id_conf;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=0;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=0;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=350;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=240/2;
			
			printk_netbsd ("[### BACKGROUND_RECONFIGURATION ###] \n");
#endif
			
		}
		else {		/*PAL CIF*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =   (288>>4);	//ver_MB		0x12
			printk_netbsd ("[RESOLUTION : PAL 360x288]\n"); 

#ifdef __BACK_COLOR__		/*2005-03-28 netbsd __BACK_COLOR__*/
			id_conf = RxID(0x8, 0x00, 0x19, W_FLAG);/*background color*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=id_conf;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=32;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=16;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=16;
			
			id_conf = RxID(0x8, 0x00, 0x1A, W_FLAG);/*foreground video window*/
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=id_conf;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=0;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=0;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=350;
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO))=288/2;
			
			printk_netbsd ("[### BACKGROUND_RECONFIGURATION ###] \n");
#endif
		}
		
		id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x24, W_FLAG);
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  2;		//Input frames
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) =  1;		//recoded frames

		/*Recoding frame rate control*/
		if (frm>=30) frame_rate=30;	
		else if (frm<=1) frame_rate=1;	
		else frame_rate=frm;
		printk_netbsd2 ("[FRAME_RATE : %d/SEC]\n" , frame_rate);

#ifdef __ZOOM_IN__	
		/* ZOOM_IN */
		id_conf = RxID(GID_DEC_VIDEO, 0, 0x10, W_FLAG);	
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (1 |2);	//hor_zoom  | ver_zoom
		printk_netbsd2 ("[ZOOM_IN : ON]\n"); 
#endif		

#ifdef __PIP__	/*2005-01-07*/
		/*Rescale*/
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x10, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Hor scale
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Ver scale
		printk_netbsd2("[Display Rescale]\n"); 
		/*Deocding video offset*/		
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x11, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x15);// Hor offset
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x0d);// Ver offset
#else	/*2005-01-18*/
		/*Rescale*/
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x10, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Hor scale
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;// 1/1 Ver scale
		printk_netbsd2 ("[Display Rescale]\n"); 
		/*Deocding video offset*/		
		id_conf = RxID(GID_DEC_VIDEO_CH, 0x00, 0x11, W_FLAG);
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x00);// Hor offset
		*((unsigned short  *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = (0x00);// Ver offset	
#endif		
	}
	
	return ;	
}



/* decoder parameters */
void video_decoder_cfg(void) 
{
	volatile unsigned short id_conf;

	id_conf = RxID(GID_DEC_AUDIO, 0, 0x01, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 9;
	
	id_conf = RxID(GID_DEC_AUDIO, 0, 0x03, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 1;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;
	
	id_conf = RxID(GID_DEC_AUDIO, 0, 0x04, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;

	id_conf = RxID(GID_DEC_AUDIO, 0, 0x05, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;
	
	id_conf = RxID(GID_DEC_AUDIO, 0, 0x06, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 64;

	id_conf = RxID(GID_DEC_AUDIO, 0, 0x07, W_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = 0;
	printk_netbsd ("[video_decoder_cfg]\n"); 

}


static void read_tx_reg (void) 
{
	volatile unsigned short id_conf;

	//id_conf = RxID(GID_ENC_AUDIO, 0, 0x01, R_FLAG);	
	id_conf = RxID(GID_ENC_VIDEO, 0x00, 0x01, R_FLAG);
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	printk_netbsd ("[kernel][read_tx_reg] 0x%x\n", id_conf); 

#if 0		/*JMP 2005-01-10	netbsd*/
	/*RATE_CNT_ID*/
	id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x04, R_FLAG);		
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;	
	printk ("[kernel][RATE_CNT_ID] 0x%x\n", id_conf);AT2042_DELAY(100000);

	/*QUALITY_ID*/
	id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x05, R_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	printk ("[kernel][QUALITY_ID] 0x%x\n", id_conf);AT2042_DELAY(100000);	
	
	/*CBR_RATE_ID*/
	id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x06, R_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	printk ("[kernel][CBR_RATE_ID] 0x%x\n", id_conf);AT2042_DELAY(100000);

	/*ENC_OPT_ID*/
	id_conf = RxID(GID_ENC_VIDEO, 0x00, 0x11, R_FLAG);	
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	printk ("[kernel][ENC_OPT_ID] 0x%x\n", id_conf);AT2042_DELAY(100000);	

	/*RESOL_ID*/
	id_conf = RxID(GID_ENC_VIDEO_CH, 0x00, 0x22, R_FLAG);
	*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = id_conf;
	printk ("[kernel][RESOL_ID] 0x%x\n", id_conf);AT2042_DELAY(100000);	
	
	for (id_conf=0;id_conf<20;id_conf++) {AT2042_DELAY(100000);}
#endif	

	return ;
}

volatile unsigned short DECODER_STOP=0;

static int at2041_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
	_SET_REG_STR_ set_reg_str={0,0,{0,0,0,0,0,0}};
	volatile unsigned short ioctl_dat=0;
	printk_netbsd2 ("[at2041_inf]at2041_ioctl : 0x%x\n", cmd);
	
	switch(cmd) {
			
		//case READ_Tx_FIFO :
		case AT2041_TX_FIFO_ADDR :
			put_user(*tx_buf[txfifo_rd_cnt], (unsigned short *) arg);
			
			/* txfifo ring buffer control */
			if (!txfifo_ring_cnt && txfifo_rd_cnt <= txfifo_wr_cnt) {
				txfifo_rd_cnt ++;
				if (txfifo_rd_cnt == MAX_BUF_NUM) {
					txfifo_ring_cnt --;
					txfifo_rd_cnt = 0;
				}
			} else if (txfifo_ring_cnt) {
				txfifo_rd_cnt ++;
			}
			break; 
			
		case SET_REG:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			do_mw32 ( (_SET_REG_STR_ ) set_reg_str);	
			if (set_reg_str.value[0]==RxID(0x02, 0x00, 0x03, W_FLAG) && (set_reg_str.value[1]&0x01))
			{
				if (!DECODER_STOP) 
				{
					printk_netbsd ("[### DECODER_STOP ###]\n");				
					DECODER_STOP=1;
				}
			}
			break;
#if 0
		//case WRITE_Rx_FIFO :
		case AT2041_RX_FIFO_ADDR :
			//get_user(ioctl_dat, (unsigned short *)arg);
			//do_mw32(AT2041_RX_FIFO_ADDR, ioctl_dat);			
			printk ("AT2041_RX_FIFO_ADDR\n");
			break;	
			
		//case WRITE_COMMAND_REG :
		case AT2041_COMMAND_REG_ADDR :
			//get_user(ioctl_dat, (unsigned short *)arg);
			//do_mw32(AT2041_COMMAND_REG_ADDR, ioctl_dat);			
			printk ("AT2041_COMMAND_REG_ADDR\n");
			break;	

		//case WRITE_CONTROL_REG :
		case AT2041_CONTROL_REG_ADDR :
			//get_user(ioctl_dat, (unsigned short *)arg);
			//do_mw32(AT2041_CONTROL_REG_ADDR, ioctl_dat);			
			printk ("AT2041_CONTROL_REG_ADDR\n");
			break;	         
		//case READ_STATUS_REG :
#endif			
		case AT2041_STATUS_REG_ADDR :
			ioctl_dat = *((unsigned short *)((unsigned int)fifo_reg + AT2041_STATUS_REG));
			printk_netbsd2 ("AT2041_STATUS_REG_ADDR : 0x%x\n", ioctl_dat);
			put_user(ioctl_dat, (unsigned short *) arg);
			break;  
			
		case AT2041_TX_FIFO_ADDR_READ :
			read_tx_reg();
#if 0			/*JMP 2005-01-10*/
			copy_to_user( (unsigned short *)arg, (AT2042_CUR *)&at2042_cur,  sizeof(AT2042_CUR));			
#endif
			break;  
			
		case AT2041_INIT :
			//at2041_ioctl_init();
			//pre_enc_config();
			break;			

		case SET_CBR:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			set_cbr(set_reg_str.value[1]);
			break;
		case SET_QUALITY:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			set_quality(set_reg_str.value[1]);
			break;
		case SET_ENC_MODE:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			set_enc_mode(set_reg_str.value[1]);
			break;
		case SET_ENC_OPT:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			set_enc_opt(set_reg_str.value[1]);
			break;
		case SET_RES:
			copy_from_user( (_SET_REG_STR_ *)&set_reg_str, (unsigned short *)arg , sizeof(_SET_REG_STR_));
			set_res(set_reg_str.value[1], set_reg_str.value[2]);
			break;
			
		case AT2041_RX_FIFO_ADDR :			
			get_user(ioctl_dat, (unsigned short *)arg);			
			*((unsigned short *)((unsigned int)fifo_reg + AT2041_RX_FIFO)) = ioctl_dat;
			break;			

⌨️ 快捷键说明

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