kernels/linux-2.4.0/drivers/video/sis/sis_main.c
/*
 *    Set a single color register. The values supplied are already
 *    rounded down to the hardware's capabilities (according to the
 *    entries in the var structure). Return != 0 for invalid regno.
 */
Set a single color register. The values supplied are already
rounded down to the hardware's capabilities (according to the
entries in the var structure). Return != 0 for invalid regno.
Set a single color register . The values supplied are already rounded down to the hardware ' s capabilities ( according to the entries in the var structure ) . Return ! = 0 for invalid regno .
static int sis_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
			 unsigned transp, struct fb_info *fb_info)
{
	if (regno >= video_cmap_len)
		return 1;
	palette[regno].red = red;
	palette[regno].green = green;
	palette[regno].blue = blue;
	switch (ivideo.video_bpp) {
#ifdef FBCON_HAS_CFB8
	case 8:
		vgawb(DAC_ADR, regno);
		vgawb(DAC_DATA, red >> 10);
		vgawb(DAC_DATA, green >> 10);
		vgawb(DAC_DATA, blue >> 10);
		if(uDispType & MASK_DISPTYPE_DISP2)
		{
			vgawb(DAC2_ADR,  regno);
			vgawb(DAC2_DATA, red   >> 8);
			vgawb(DAC2_DATA, green >> 8);
			vgawb(DAC2_DATA, blue  >> 8);
		}
		break;
#endif
#ifdef FBCON_HAS_CFB16
	case 15:
	case 16:
		fbcon_cmap.cfb16[regno] =
		    ((red & 0xf800)) |
		    ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
		break;
#endif
#ifdef FBCON_HAS_CFB24
	case 24:
		red >>= 8;
		green >>= 8;
		blue >>= 8;
		fbcon_cmap.cfb24[regno] =
		    (red << 16) | (green << 8) | (blue);
		break;
#endif
#ifdef FBCON_HAS_CFB32
	case 32:
		red >>= 8;
		green >>= 8;
		blue >>= 8;
		fbcon_cmap.cfb32[regno] =
		    (red << 16) | (green << 8) | (blue);
		break;
#endif
	}
	return 0;
}
static int sis_setcolreg ( unsigned regno , unsigned red , unsigned green , unsigned blue , unsigned transp , struct fb_info * fb_info ) { if ( regno >= video_cmap_len ) return 1 ; palette [ regno ] . red = red ; palette [ regno ] . green = green ; palette [ regno ] . blue = blue ; switch ( ivideo . video_bpp ) { #ifdef FBCON_HAS_CFB8 case 8 : vgawb ( DAC_ADR , regno ) ; vgawb ( DAC_DATA , red >> 10 ) ; vgawb ( DAC_DATA , green >> 10 ) ; vgawb ( DAC_DATA , blue >> 10 ) ; if ( uDispType & MASK_DISPTYPE_DISP2 ) { vgawb ( DAC2_ADR , regno ) ; vgawb ( DAC2_DATA , red >> 8 ) ; vgawb ( DAC2_DATA , green >> 8 ) ; vgawb ( DAC2_DATA , blue >> 8 ) ; } break ; #endif #ifdef FBCON_HAS_CFB16 case 15 : case 16 : fbcon_cmap . cfb16 [ regno ] = ( ( red & 0xf800 ) ) | ( ( green & 0xfc00 ) >> 5 ) | ( ( blue & 0xf800 ) >> 11 ) ; break ; #endif #ifdef FBCON_HAS_CFB24 case 24 : red >>= 8 ; green >>= 8 ; blue >>= 8 ; fbcon_cmap . cfb24 [ regno ] = ( red << 16 ) | ( green << 8 ) | ( blue ) ; break ; #endif #ifdef FBCON_HAS_CFB32 case 32 : red >>= 8 ; green >>= 8 ; blue >>= 8 ; fbcon_cmap . cfb32 [ regno ] = ( red << 16 ) | ( green << 8 ) | ( blue ) ; break ; #endif } return 0 ; }
Set a single color register.
Set a single color register .
/* VB connected */