Browse Source

Add the SMI712 8Bits 332 and index two modes support in the cfb_console.c

master
root 16 years ago
parent
commit
5c1a73654d
  1. 10
      Targets/Bonito2fdev/conf/Bonito.2fdev.cs5536
  2. 2
      Targets/Bonito2fdev/conf/ld.script
  3. 60
      fb/cfb_console.c
  4. 25
      sys/dev/pci/smi712.c
  5. 11
      sys/dev/pci/smi712.h

10
Targets/Bonito2fdev/conf/Bonito.2fdev.cs5536

@ -82,8 +82,12 @@ option NOPCINAMES # Save some space for x86emu
select mod_framebuffer
select mod_smi712 # X86 emulation for VGA
option SMI712
option X1024x768
option CONFIG_VIDEO_16BPP
#option X1024x768
option X800x600
#option X640x480
#option CONFIG_VIDEO_16BPP
option CONFIG_VIDEO_8BPP
#option CONFIG_VIDEO_8BPP_INDEX
#
# Functional options.
@ -175,7 +179,7 @@ option PCI_IDSEL_CS5536=14
option COM3_BASE_ADDR=0xbff003f8
#option WDC_NORESET
select cs5536
option CONFIG_VIDEO_SM501_16BPP
#option CONFIG_VIDEO_SM501_16BPP
option DEVBD2F_CS5536
select gzip
option INPUT_FROM_BOTH

2
Targets/Bonito2fdev/conf/ld.script

@ -8,7 +8,7 @@ ENTRY(_start)
SECTIONS
{
. = 0xffffffff80010000;
. = 0xffffffff88000000;
.text :
{
_ftext = . ;

60
fb/cfb_console.c

@ -306,17 +306,21 @@ void console_cursor (int state);
/* Macros */
#ifdef VIDEO_FB_LITTLE_ENDIAN
#define BYTESWAP32(x) (x)
#define SWAP16(x) ((((x) & 0x00ff) << 8) | ( (x) >> 8))
#define SWAP32(x) ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
(((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) )
#define SHORTSWAP32(x) ((((x) & 0x000000ff) << 8) | (((x) & 0x0000ff00) >> 8)|\
(((x) & 0x00ff0000) << 8) | (((x) & 0xff000000) >> 8) )
#else
#define BYTESWAP32(x) ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
(((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) )
#define SWAP16(x) (x)
#define SWAP32(x) (x)
#define SHORTSWAP32(x) (x)
#endif
#if defined(DEBUG) || defined(DEBUG_CFB_CONSOLE)
#define PRINTD(x) printf(x)
#else
@ -446,8 +450,8 @@ void video_drawchars_xor (int xx, int yy, unsigned char *s, int count)
dest += VIDEO_LINE_LEN) {
unsigned char bits = *cdat++;
((unsigned int *) dest)[0] ^= (video_font_draw_table8[bits >> 4] & eorx) ^ bgx;
((unsigned int *) dest)[1] ^= (video_font_draw_table8[bits & 15] & eorx) ^ bgx;
((unsigned int *) dest)[0] ^= BYTESWAP32((video_font_draw_table8[bits >> 4] & eorx) ^ bgx);
((unsigned int *) dest)[1] ^= BYTESWAP32((video_font_draw_table8[bits & 15] & eorx) ^ bgx);
}
dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
s++;
@ -610,8 +614,8 @@ void video_drawchars (int xx, int yy, unsigned char *s, int count)
dest += VIDEO_LINE_LEN) {
unsigned char bits = *cdat++;
((unsigned int *) dest)[0] = (video_font_draw_table8[bits >> 4] & eorx) ^ bgx;
((unsigned int *) dest)[1] = (video_font_draw_table8[bits & 15] & eorx) ^ bgx;
((unsigned int *) dest)[0] = BYTESWAP32((video_font_draw_table8[bits >> 4] & eorx) ^ bgx);
((unsigned int *) dest)[1] = BYTESWAP32((video_font_draw_table8[bits & 15] & eorx) ^ bgx);
}
dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
s++;
@ -1060,7 +1064,7 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
case 8:
padded_line -= width;
if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
#if 0
#if 1
/* Copy colormap */
for (xcount = 0; xcount < colors; ++xcount) {
cte = bmp->color_table[xcount];
@ -1262,7 +1266,7 @@ void logo_plot (void *screen, int width, int x, int y)
#endif
if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
#if 0
#if 1
for (i = 0; i < VIDEO_LOGO_COLORS; i++) {
video_set_lut (i + VIDEO_LOGO_LUT_OFFSET,
logo_red[i], logo_green[i], logo_blue[i]);
@ -1506,6 +1510,40 @@ void set_cursor_fb(unsigned char x,unsigned char y)
console_row=y;
}
#ifdef SMI712
#define udelay delay
#define SMI_LUT_MASK (pGD->isaBase + 0x03c6) /* lut mask reg */
#define SMI_LUT_START (pGD->isaBase + 0x03c8) /* lut start index */
#define SMI_LUT_RGB (pGD->isaBase + 0x03c9) /* lut colors auto incr.*/
#define SMI_INDX_ATTR (pGD->isaBase + 0x03c0) /* attributes index reg */
/*******************************************************************************
*
* Set a RGB color in the LUT (8 bit index)
*/
void video_set_lut (
unsigned int index, /* color number */
unsigned char r, /* red */
unsigned char g, /* green */
unsigned char b /* blue */
)
{
pGD = &GD;
out8 (SMI_LUT_MASK, 0xff);
out8 (SMI_LUT_START, (char)index);
out8 (SMI_LUT_RGB, r>>2); /* red */
udelay (10);
out8 (SMI_LUT_RGB, g>>2); /* green */
udelay (10);
out8 (SMI_LUT_RGB, b>>2); /* blue */
udelay (10);
}
#endif
/*****************************************************************************/
int fb_init (unsigned long fbbase,unsigned long iobase)
@ -1553,9 +1591,11 @@ int fb_init (unsigned long fbbase,unsigned long iobase)
#elif defined(CONFIG_VIDEO_4BPP)
pGD->gdfIndex = GDF__4BIT;
pGD->gdfBytesPP= 1;
#elif defined(CONFIG_VIDEO_8BPP_INDEX)
pGD->gdfBytesPP= 1;
pGD->gdfIndex = GDF__8BIT_INDEX;
#elif defined(CONFIG_VIDEO_8BPP)
pGD->gdfBytesPP= 1;
// pGD->gdfIndex = GDF__8BIT_INDEX;
pGD->gdfIndex = GDF__8BIT_332RGB;
#elif defined(CONFIG_VIDEO_16BPP)
pGD->gdfBytesPP= 2;
@ -1575,6 +1615,10 @@ int fb_init (unsigned long fbbase,unsigned long iobase)
printf("cfb_console init,fb=%x\n",pGD->frameAdrs);
#ifdef SMI712
pGD->isaBase=pGD->frameAdrs + 0x00700000 ;
#endif
video_fb_address = (void *) VIDEO_FB_ADRS;
#ifdef CONFIG_VIDEO_HW_CURSOR
video_init_hw_cursor (VIDEO_FONT_WIDTH, VIDEO_FONT_HEIGHT);
@ -1582,7 +1626,7 @@ int fb_init (unsigned long fbbase,unsigned long iobase)
/* Init drawing pats */
switch (VIDEO_DATA_FORMAT) {
#if 0
#if 1
case GDF__8BIT_INDEX:
video_set_lut (0x01, CONSOLE_FG_COL, CONSOLE_FG_COL, CONSOLE_FG_COL);
video_set_lut (0x00, CONSOLE_BG_COL, CONSOLE_BG_COL, CONSOLE_BG_COL);

25
sys/dev/pci/smi712.c

@ -92,8 +92,10 @@ static void smi_set_timing(struct par_info *hw)
/* set data width */
m_nScreenStride = (hw->width * hw->bits_per_pixel) / 64;
#ifdef CONFIG_VIDEO_8BPP
writel(hw->m_pVPR+0x0,0);
#ifdef CONFIG_VIDEO_8BPP_INDEX
writel(hw->m_pVPR+0x0,0x00000000);
#elif defined(CONFIG_VIDEO_8BPP)
writel(hw->m_pVPR+0x0,0x00050000);
#elif defined(CONFIG_VIDEO_16BPP)
writel(hw->m_pVPR+0x0,0x00020000);
#elif defined(CONFIG_VIDEO_24BPP)
@ -185,7 +187,26 @@ int smi712_init(char * fbaddress,char * ioaddress)
hw.width = FB_XSIZE;
hw.height = FB_YSIZE;
#endif
#if defined(CONFIG_VIDEO_1BPP)
hw.bits_per_pixel = 1;
#elif defined(CONFIG_VIDEO_2BPP)
hw.bits_per_pixel = 2;
#elif defined(CONFIG_VIDEO_4BPP)
hw.bits_per_pixel = 4;
#elif defined(CONFIG_VIDEO_8BPP_INDEX)
hw.bits_per_pixel = 8;
#elif defined(CONFIG_VIDEO_8BPP)
hw.bits_per_pixel = 8;
#elif defined(CONFIG_VIDEO_16BPP)
hw.bits_per_pixel = 16;
#elif defined(CONFIG_VIDEO_24BPP)
hw.bits_per_pixel = 24;
#elif defined(CONFIG_VIDEO_32BPP)
hw.bits_per_pixel = 32;
#else
hw.bits_per_pixel = 16;
#endif
hw.hz = 60;
if (!SMIRegs)

11
sys/dev/pci/smi712.h

@ -64,7 +64,7 @@ static struct par_info hw; /* used to record hardware information
#define SIZE_VPR (0x6C + 1)
#define SIZE_DPR (0x44 + 1)
#define numVGAModes 6
#define numVGAModes 9
#define numChipIDs 3
#define NR_PALETTE 256
@ -159,7 +159,7 @@ struct ModeInit
struct ModeInit VGAMode[numVGAModes] =
{
/* {
{
// mode#0: 640 x 480 8Bpp 60Hz
640, 480, 8, 60,
// Init_MISC
@ -219,7 +219,7 @@ struct ModeInit VGAMode[numVGAModes] =
0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
},
},
*/
{
/* mode#1: 640 x 480 16Bpp 60Hz */
640, 480, 16, 60,
@ -340,7 +340,6 @@ struct ModeInit VGAMode[numVGAModes] =
0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
},
},
/*
{// mode#3: 800 x 600 8Bpp 60Hz
800,600,8,60,
0x2B, // Init_MISC
@ -400,7 +399,7 @@ struct ModeInit VGAMode[numVGAModes] =
},
},
*/
{/* mode#4: 800 x 600 16Bpp 60Hz */
800, 600, 16, 60,
/* Init_MISC */
@ -518,7 +517,6 @@ struct ModeInit VGAMode[numVGAModes] =
0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
},
},
/*
{// mode#6: 1024 x 768 8Bpp 60Hz
1024,768,8,60,
// Init_MISC
@ -578,7 +576,6 @@ struct ModeInit VGAMode[numVGAModes] =
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
},
},
*/
{ /* mode#7: 1024 x 768 16Bpp 60Hz */
1024,768,16,60,
/* Init_MISC */

Loading…
Cancel
Save