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

📄 sa1100fb.c

📁 linux下的VIDEO接口驱动程序
💻 C
📖 第 1 页 / 共 5 页
字号:
	hsync_len:	3,		vsync_len:	1,	left_margin:	41,		upper_margin:	0,	right_margin:	101,		lower_margin:	0,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,	lccr0:		LCCR0_Color | LCCR0_Dual | LCCR0_Pas,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2) | 8,#error FIXME	/*	 * FIXME: please get rid of the '| 8' in preference to an	 * LCCR3_PixClkDiv() version. --rmk	 */};#endif#ifdef LART_GREY_LCDstatic struct sa1100fb_mach_info lart_grey_info __initdata = {	pixclock:	150000,		bpp:		4,	xres:		320,		yres:		240,	hsync_len:	1,		vsync_len:	1,	left_margin:	4,		upper_margin:	0,	right_margin:	2,		lower_margin:	0,	cmap_greyscale:	1,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,	lccr0:		LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_COLOR_LCDstatic struct sa1100fb_mach_info lart_color_info __initdata = {	pixclock:	150000,		bpp:		16,	xres:		320,		yres:		240,	hsync_len:	2,		vsync_len:	3,	left_margin:	69,		upper_margin:	14,	right_margin:	8,		lower_margin:	4,	sync:		0,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_VIDEO_OUTstatic struct sa1100fb_mach_info lart_video_info __initdata = {	pixclock:	39721,		bpp:		16,	xres:		640,		yres:		480,	hsync_len:	95,		vsync_len:	2,	left_margin:	40,		upper_margin:	32,	right_margin:	24,		lower_margin:	11,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),};#endif#ifdef LART_KIT01_LCDstatic struct sa1100fb_mach_info lart_kit01_info __initdata ={	pixclock:	63291,		bpp:		16,	xres:		640,		yres:		480,	hsync_len:	64,		vsync_len:	3,	left_margin:	122,	upper_margin:	45,	right_margin:	10,		lower_margin:	10,	sync:		0,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnH | LCCR3_PixFlEdg};#endif#ifdef CONFIG_SA1100_FRODOstatic struct sa1100fb_mach_info frodo_kit01_info __initdata ={	/* best would be 41731 (25.8mhz), but we can only do 14.743mhz at 191.7mhz clock speed */	pixclock:		73030,		bpp:		16,	xres:			640,		yres:		480,	hsync_len:		32,		vsync_len:		19,	left_margin:	120,	upper_margin:	33,	right_margin:	17,		lower_margin:	12,	sync:			0,	lccr0:			LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:			LCCR3_OutEnH | LCCR3_PixFlEdg};#endif#ifdef CONFIG_SA1100_SHANNONstatic struct sa1100fb_mach_info shannon_info __initdata = {	pixclock:	152500,		bpp:		8,	xres:		640,		yres:		480,	hsync_len:	4,		vsync_len:	3,	left_margin:	2,		upper_margin:	0,	right_margin:	1,		lower_margin:	0,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 	lccr0:		LCCR0_Color | LCCR0_Dual | LCCR0_Pas,	lccr3:		LCCR3_ACBsDiv(512),};#endif#ifdef CONFIG_SA1100_OMNIMETERstatic struct sa1100fb_mach_info omnimeter_info __initdata = {	pixclock:	0,		bpp:		4,	xres:		480,		yres:		320,	hsync_len:	1,		vsync_len:	1,	left_margin:	10,		upper_margin:	0,	right_margin:	10,		lower_margin:	0,	cmap_greyscale:	1,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,	lccr0:		LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_8PixMono,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(255) |			LCCR3_PixClkDiv(44),#error FIXME: fix pixclock, ACBsDiv	/*	 * FIXME: I think ACBsDiv is wrong above - should it be 512 (disabled)?	 *   - rmk	 */};#endif#ifdef CONFIG_SA1100_PANGOLINstatic struct sa1100fb_mach_info pangolin_info __initdata = {	pixclock:	341521,		bpp:		16,	xres:		800,		yres:		600,	hsync_len:	64,		vsync_len:	7,	left_margin:	160,		upper_margin:	7,	right_margin:	24,		lower_margin:	1,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsCntOff,};#endif#ifdef CONFIG_SA1100_SIMPUTERstatic struct sa1100fb_mach_info simputer_info __initdata = {	pixclock:	70000,		bpp:		4,	xres:		320,		yres:		240,	hsync_len:	9,		vsync_len:	2,	left_margin:	9,		upper_margin:	0,	right_margin:	2,		lower_margin:	0,	cmap_greyscale:	1,	sync:		FB_SYNC_HOR_HIGH_ACT |  FB_SYNC_VERT_HIGH_ACT ,	lccr0:		LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(202),};#endif#ifdef CONFIG_SA1100_STORK#if STORK_TFT			/* ie the NEC TFT *//* * pixclock is ps per clock. say 72Hz, 800x600 clocks => (1/72)/(800*600) * = 28935 and a bit * NB likely to be increased to ease bus timings wrt pcmcia interface */static struct sa1100fb_mach_info stork_tft_info __initdata = {	pixclock:	28935,		bpp:		16,	xres:		640,		yres:		480,	hsync_len:	64,		vsync_len:	2,	left_margin:	48,		upper_margin:	12,	right_margin:	48,		lower_margin:	31,	sync:		0,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg,};static struct sa1100fb_rgb stork_tft_rgb_16 = {	red:	{ offset: 11, length: 5, },	green:	{ offset: 5,  length: 6, },	blue:	{ offset: 0,  length: 5, },	transp:	{ offset: 0,  length: 0, },};#else	/* Kyocera DSTN */static struct sa1100fb_mach_info stork_dstn_info __initdata = {	pixclock:	0,		bpp:		16,	xres:		640,		yres:		480,	hsync_len:	2,		vsync_len:	2,	left_margin:	2,		upper_margin:	0,	right_margin:	2,		lower_margin:	0,	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT ,	lccr0:		LCCR0_Color | LCCR0_Dual | LCCR0_Pas,#error Fixme	lccr3:		0xff00 |			0x18		/* ought to be 0x14 but DMA isn't up to that as yet */};static struct sa1100fb_rgb stork_dstn_rgb_16 = {	red:	{ offset: 8,  length: 4, },	green:	{ offset: 4,  length: 4, },	blue:	{ offset: 0,  length: 4, },	transp:	{ offset: 0,  length: 0, },};#endif#endif#ifdef CONFIG_SA1100_XP860static struct sa1100fb_mach_info xp860_info __initdata = {	pixclock:	0,		bpp:		8,	xres:		1024,		yres:		768,	hsync_len:	3,		vsync_len:	3,	left_margin:	3,		upper_margin:	2,	right_margin:	2,		lower_margin:	1,	sync:		0,	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_PixClkDiv(6),};#endifstatic struct sa1100fb_mach_info * __initsa1100fb_get_machine_info(struct sa1100fb_info *fbi){	struct sa1100fb_mach_info *inf = NULL;	/*	 *            R        G       B       T	 * default  {11,5}, { 5,6}, { 0,5}, { 0,0}	 * h3600    {12,4}, { 7,4}, { 1,4}, { 0,0}	 * freebird { 8,4}, { 4,4}, { 0,4}, {12,4}	 */#ifdef CONFIG_SA1100_ASSABET	if (machine_is_assabet()) {#ifndef ASSABET_PAL_VIDEO		inf = &lq039q2ds54_info;#else		inf = &pal_info;#endif	}#endif#ifdef CONFIG_SA1100_H3XXX	if (machine_is_h3600()) {		inf = &h3600_info;		fbi->rgb[RGB_16] = &h3600_rgb_16;	}	if (machine_is_h3100()) {		inf = &h3100_info;	}	if (machine_is_h3800()) {		inf = &h3800_info;	}#endif#ifdef CONFIG_SA1100_BRUTUS	if (machine_is_brutus()) {		inf = &brutus_info;	}#endif#ifdef CONFIG_SA1100_CERF	if (machine_is_cerf()) {		inf = &cerf_info;	}#endif#ifdef CONFIG_SA1100_FREEBIRD	if (machine_is_freebird()) {		inf = &freebird_info;		fbi->rgb[RGB_16] = &freebird_rgb16;	}#endif#ifdef CONFIG_SA1100_GRAPHICSCLIENT	if (machine_is_graphicsclient()) {		inf = &graphicsclient_info;	}#endif#ifdef CONFIG_SA1100_GRAPHICSMASTER	if (machine_is_graphicsmaster()) {		inf = &graphicsmaster_info;	}#endif#ifdef CONFIG_SA1100_ADSBITSY	if (machine_is_adsbitsy()) {		inf = &adsbitsy_info;	}#endif#ifdef CONFIG_SA1100_ADSBITSYPLUS	if (machine_is_adsbitsyplus()) {		inf = &adsbitsyplus_info;		}	}#endif#ifdef CONFIG_SA1100_HUW_WEBPANEL	if (machine_is_huw_webpanel()) {		inf = &huw_webpanel_info;	}#endif#ifdef CONFIG_SA1100_LART	if (machine_is_lart()) {#ifdef LART_GREY_LCD		inf = &lart_grey_info;#endif#ifdef LART_COLOR_LCD		inf = &lart_color_info;#endif#ifdef LART_VIDEO_OUT		inf = &lart_video_info;#endif#ifdef LART_KIT01_LCD		inf = &lart_kit01_info;#endif	}#endif#ifdef CONFIG_SA1100_FRODO	if (machine_is_frodo()) {		inf = &frodo_kit01_info;	}#endif#ifdef CONFIG_SA1100_SHANNON	if (machine_is_shannon()) {		inf = &shannon_info;	}#endif#ifdef CONFIG_SA1100_SIMPUTER	if (machine_is_simputer()) {		inf = &simputer_info;	}#endif#ifdef CONFIG_SA1100_OMNIMETER	if (machine_is_omnimeter()) {		inf = &omnimeter_info;	}#endif#ifdef CONFIG_SA1100_PANGOLIN	if (machine_is_pangolin()) {		inf = &pangolin_info;	}#endif#ifdef CONFIG_SA1100_XP860	if (machine_is_xp860()) {		inf = &xp860_info;	}#endif#ifdef CONFIG_SA1100_STORK	if (machine_is_stork()) {#if STORK_TFT		inf = &stork_tft_info;		fbi->rgb[RGB_16] = &stork_tft_rgb_16;#else		inf = &stork_dstn_info;		fbi->rgb[RGB_16] = &stork_dstn_rgb_16;#endif	}#endif	return inf;}static int sa1100fb_activate_var(struct fb_var_screeninfo *var, struct sa1100fb_info *);static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state);static inline void sa1100fb_schedule_task(struct sa1100fb_info *fbi, u_int state){	unsigned long flags;	local_irq_save(flags);	/*	 * We need to handle two requests being made at the same time.	 * There are two important cases:	 *  1. When we are changing VT (C_REENABLE) while unblanking (C_ENABLE)	 *     We must perform the unblanking, which will do our REENABLE for us.	 *  2. When we are blanking, but immediately unblank before we have	 *     blanked.  We do the "REENABLE" thing here as well, just to be sure.	 */	if (fbi->task_state == C_ENABLE && state == C_REENABLE)		state = (u_int) -1;	if (fbi->task_state == C_DISABLE && state == C_ENABLE)		state = C_REENABLE;	if (state != (u_int)-1) {		fbi->task_state = state;		schedule_task(&fbi->task);	}	local_irq_restore(flags);}/* * Get the VAR structure pointer for the specified console */static inline struct fb_var_screeninfo *get_con_var(struct fb_info *info, int con){	struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;	return (con == fbi->currcon || con == -1) ? &fbi->fb.var : &fb_display[con].var;}/* * Get the DISPLAY structure pointer for the specified console */static inline struct display *get_con_display(struct fb_info *info, int con){	struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;	return (con < 0) ? fbi->fb.disp : &fb_display[con];}/* * Get the CMAP pointer for the specified console */static inline struct fb_cmap *get_con_cmap(struct fb_info *info, int con){	struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;	return (con == fbi->currcon || con == -1) ? &fbi->fb.cmap : &fb_display[con].cmap;}static inline u_intchan_to_field(u_int chan, struct fb_bitfield *bf){	chan &= 0xffff;	chan >>= 16 - bf->length;	return chan << bf->offset;}/* * Convert bits-per-pixel to a hardware palette PBS value. */static inline u_intpalette_pbs(struct fb_var_screeninfo *var){	int ret = 0;	switch (var->bits_per_pixel) {#ifdef FBCON_HAS_CFB4	case 4:  ret = 0 << 12;	break;#endif#ifdef FBCON_HAS_CFB8	case 8:  ret = 1 << 12; break;#endif#ifdef FBCON_HAS_CFB16	case 16: ret = 2 << 12; break;#endif	}	return ret;}static intsa1100fb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,		       u_int trans, struct fb_info *info){	struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;	u_int val, ret = 1;	if (regno < fbi->palette_size) {		val = ((red >> 4) & 0xf00);		val |= ((green >> 8) & 0x0f0);		val |= ((blue >> 12) & 0x00f);		if (regno == 0)			val |= palette_pbs(&fbi->fb.var);		fbi->palette_cpu[regno] = val;		ret = 0;	}	return ret;}

⌨️ 快捷键说明

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