summaryrefslogtreecommitdiff
path: root/board/eltec/mhpc/mhpc.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /board/eltec/mhpc/mhpc.c
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
downloadu-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.zip
u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz
u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.bz2
* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'board/eltec/mhpc/mhpc.c')
-rw-r--r--board/eltec/mhpc/mhpc.c216
1 files changed, 108 insertions, 108 deletions
diff --git a/board/eltec/mhpc/mhpc.c b/board/eltec/mhpc/mhpc.c
index 81f820a..83952d8 100644
--- a/board/eltec/mhpc/mhpc.c
+++ b/board/eltec/mhpc/mhpc.c
@@ -40,17 +40,17 @@ extern char console_buffer[CFG_CBSIZE];
extern void eeprom_init (void);
extern int eeprom_read (unsigned dev_addr, unsigned offset,
- unsigned char *buffer, unsigned cnt);
+ unsigned char *buffer, unsigned cnt);
extern int eeprom_write (unsigned dev_addr, unsigned offset,
- unsigned char *buffer, unsigned cnt);
+ unsigned char *buffer, unsigned cnt);
/* globals */
void *video_hw_init(void);
void video_set_lut (unsigned int index, /* color number */
- unsigned char r, /* red */
- unsigned char g, /* green */
- unsigned char b /* blue */
- );
+ unsigned char r, /* red */
+ unsigned char g, /* green */
+ unsigned char b /* blue */
+ );
GraphicDevice gdev;
@@ -153,9 +153,9 @@ int misc_init_r(void)
revinfo mhpcRevInfo;
char nid[32];
char *mhpcSensorTypes[] = { "OMNIVISON OV7610/7620 color",
- "OMNIVISON OV7110 b&w", NULL };
+ "OMNIVISON OV7110 b&w", NULL };
char hex[23] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0,
- 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
+ 0, 0, 0, 0, 10, 11, 12, 13, 14, 15 };
int i;
/* check revision data */
@@ -166,62 +166,62 @@ int misc_init_r(void)
printf ("Enter revision number (0-9): %c ", mhpcRevInfo.revision[0]);
if (0 != readline (NULL))
{
- mhpcRevInfo.revision[0] = (char)toupper(console_buffer[0]);
+ mhpcRevInfo.revision[0] = (char)toupper(console_buffer[0]);
}
printf ("Enter revision character (A-Z): %c ", mhpcRevInfo.revision[1]);
if (1 == readline (NULL))
{
- mhpcRevInfo.revision[1] = (char)toupper(console_buffer[0]);
+ mhpcRevInfo.revision[1] = (char)toupper(console_buffer[0]);
}
printf("Enter board name (V-XXXX-XXXX): %s ", (char *)&mhpcRevInfo.board);
if (11 == readline (NULL))
{
- for (i=0; i<11; i++)
- {
- mhpcRevInfo.board[i] = (char)toupper(console_buffer[i]);
- mhpcRevInfo.board[11] = '\0';
- }
+ for (i=0; i<11; i++)
+ {
+ mhpcRevInfo.board[i] = (char)toupper(console_buffer[i]);
+ mhpcRevInfo.board[11] = '\0';
+ }
}
printf("Supported sensor types:\n");
i=0;
do
{
- printf("\n \'%d\' : %s\n", i, mhpcSensorTypes[i]);
+ printf("\n \'%d\' : %s\n", i, mhpcSensorTypes[i]);
} while ( mhpcSensorTypes[++i] != NULL );
do
{
- printf("\nEnter sensor number (0-255): %d ", (int)mhpcRevInfo.sensor );
- if (0 != readline (NULL))
- {
- mhpcRevInfo.sensor = (unsigned char)simple_strtoul(console_buffer, NULL, 10);
- }
+ printf("\nEnter sensor number (0-255): %d ", (int)mhpcRevInfo.sensor );
+ if (0 != readline (NULL))
+ {
+ mhpcRevInfo.sensor = (unsigned char)simple_strtoul(console_buffer, NULL, 10);
+ }
} while ( mhpcRevInfo.sensor >= i );
printf("Enter serial number: %s ", (char *)&mhpcRevInfo.serial );
if (6 == readline (NULL))
{
- for (i=0; i<6; i++)
- {
- mhpcRevInfo.serial[i] = console_buffer[i];
- }
- mhpcRevInfo.serial[6] = '\0';
+ for (i=0; i<6; i++)
+ {
+ mhpcRevInfo.serial[i] = console_buffer[i];
+ }
+ mhpcRevInfo.serial[6] = '\0';
}
printf("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x ",
- mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
- mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
- mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5] );
+ mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
+ mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
+ mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5] );
if (12 == readline (NULL))
{
- for (i=0; i<12; i+=2)
- {
- mhpcRevInfo.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
- hex[toupper(console_buffer[i+1])-'0']);
- }
+ for (i=0; i<12; i+=2)
+ {
+ mhpcRevInfo.etheraddr[i>>1] = (char)(16*hex[toupper(console_buffer[i])-'0'] +
+ hex[toupper(console_buffer[i+1])-'0']);
+ }
}
/* setup new revision data */
@@ -230,16 +230,16 @@ int misc_init_r(void)
/* set environment */
sprintf( nid, "%02x:%02x:%02x:%02x:%02x:%02x",
- mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
- mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
- mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
+ mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1],
+ mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3],
+ mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
setenv("ethaddr", nid);
/* print actual board identification */
printf("Ident: %s %s Ser %s Rev %c%c\n",
- mhpcRevInfo.board, (mhpcRevInfo.sensor==0?"color":"b&w"),
- (char *)&mhpcRevInfo.serial,
- mhpcRevInfo.revision[0], mhpcRevInfo.revision[1]);
+ mhpcRevInfo.board, (mhpcRevInfo.sensor==0?"color":"b&w"),
+ (char *)&mhpcRevInfo.serial,
+ mhpcRevInfo.revision[0], mhpcRevInfo.revision[1]);
return (0);
}
@@ -308,29 +308,29 @@ static void video_circle (char *center, int radius, int color, int pitch)
*(center-x+y*pitch) = color;
while(y>x)
{
- if (d<0)
- {
- d += dE;
- dE += 2;
- dSE += 2;
- x++;
- }
- else
- {
- d += dSE;
- dE += 2;
- dSE += 4;
- x++;
- y--;
- }
- *(center+x+y*pitch) = color;
- *(center+y+x*pitch) = color;
- *(center+y-x*pitch) = color;
- *(center+x-y*pitch) = color;
- *(center-x-y*pitch) = color;
- *(center-y-x*pitch) = color;
- *(center-y+x*pitch) = color;
- *(center-x+y*pitch) = color;
+ if (d<0)
+ {
+ d += dE;
+ dE += 2;
+ dSE += 2;
+ x++;
+ }
+ else
+ {
+ d += dSE;
+ dE += 2;
+ dSE += 4;
+ x++;
+ y--;
+ }
+ *(center+x+y*pitch) = color;
+ *(center+y+x*pitch) = color;
+ *(center+y-x*pitch) = color;
+ *(center+x-y*pitch) = color;
+ *(center-x-y*pitch) = color;
+ *(center-y-x*pitch) = color;
+ *(center-y+x*pitch) = color;
+ *(center-x+y*pitch) = color;
}
}
@@ -344,31 +344,31 @@ static void video_test_image(void)
/* draw raster */
for (i=0; i<LCD_VIDEO_ROWS; i+=32)
{
- memset((char*)(LCD_VIDEO_ADDR+i*LCD_VIDEO_COLS), LCD_VIDEO_FG, LCD_VIDEO_COLS);
- for (n=i+1;n<i+32;n++)
- memset((char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS), LCD_VIDEO_BG, LCD_VIDEO_COLS);
+ memset((char*)(LCD_VIDEO_ADDR+i*LCD_VIDEO_COLS), LCD_VIDEO_FG, LCD_VIDEO_COLS);
+ for (n=i+1;n<i+32;n++)
+ memset((char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS), LCD_VIDEO_BG, LCD_VIDEO_COLS);
}
for (i=0; i<LCD_VIDEO_COLS; i+=32)
{
- for (n=0; n<LCD_VIDEO_ROWS; n++)
- *(char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS+i) = LCD_VIDEO_FG;
+ for (n=0; n<LCD_VIDEO_ROWS; n++)
+ *(char*)(LCD_VIDEO_ADDR+n*LCD_VIDEO_COLS+i) = LCD_VIDEO_FG;
}
/* draw gray bar */
di = (char *)(LCD_VIDEO_ADDR + (LCD_VIDEO_COLS-256)/64*32 + 97*LCD_VIDEO_COLS);
for (n=0; n<63; n++)
{
- for (i=0; i<256; i++)
- {
- *di++ = (char)i;
- *(di+LCD_VIDEO_COLS*64) = (i&1)*255;
- }
- di += LCD_VIDEO_COLS-256;
+ for (i=0; i<256; i++)
+ {
+ *di++ = (char)i;
+ *(di+LCD_VIDEO_COLS*64) = (i&1)*255;
+ }
+ di += LCD_VIDEO_COLS-256;
}
video_circle ((char*)LCD_VIDEO_ADDR+LCD_VIDEO_COLS/2+LCD_VIDEO_ROWS/2*LCD_VIDEO_COLS,
- LCD_VIDEO_ROWS/2,LCD_VIDEO_FG, LCD_VIDEO_COLS);
+ LCD_VIDEO_ROWS/2,LCD_VIDEO_FG, LCD_VIDEO_COLS);
}
/* ------------------------------------------------------------------------- */
@@ -377,36 +377,36 @@ static void video_default_lut (unsigned int clut_type)
{
unsigned int i;
unsigned char RGB[] =
- {
- 0x00, 0x00, 0x00, /* black */
- 0x80, 0x80, 0x80, /* gray */
- 0xff, 0x00, 0x00, /* red */
- 0x00, 0xff, 0x00, /* green */
- 0x00, 0x00, 0xff, /* blue */
- 0x00, 0xff, 0xff, /* cyan */
- 0xff, 0x00, 0xff, /* magenta */
- 0xff, 0xff, 0x00, /* yellow */
- 0x80, 0x00, 0x00, /* dark red */
- 0x00, 0x80, 0x00, /* dark green */
- 0x00, 0x00, 0x80, /* dark blue */
- 0x00, 0x80, 0x80, /* dark cyan */
- 0x80, 0x00, 0x80, /* dark magenta */
- 0x80, 0x80, 0x00, /* dark yellow */
- 0xc0, 0xc0, 0xc0, /* light gray */
- 0xff, 0xff, 0xff, /* white */
- };
+ {
+ 0x00, 0x00, 0x00, /* black */
+ 0x80, 0x80, 0x80, /* gray */
+ 0xff, 0x00, 0x00, /* red */
+ 0x00, 0xff, 0x00, /* green */
+ 0x00, 0x00, 0xff, /* blue */
+ 0x00, 0xff, 0xff, /* cyan */
+ 0xff, 0x00, 0xff, /* magenta */
+ 0xff, 0xff, 0x00, /* yellow */
+ 0x80, 0x00, 0x00, /* dark red */
+ 0x00, 0x80, 0x00, /* dark green */
+ 0x00, 0x00, 0x80, /* dark blue */
+ 0x00, 0x80, 0x80, /* dark cyan */
+ 0x80, 0x00, 0x80, /* dark magenta */
+ 0x80, 0x80, 0x00, /* dark yellow */
+ 0xc0, 0xc0, 0xc0, /* light gray */
+ 0xff, 0xff, 0xff, /* white */
+ };
switch (clut_type)
{
case 1:
- for (i=0; i<240; i++)
- video_set_lut (i, i, i, i);
- for (i=0; i<16; i++)
- video_set_lut (i+240, RGB[i*3], RGB[i*3+1], RGB[i*3+2]);
- break;
+ for (i=0; i<240; i++)
+ video_set_lut (i, i, i, i);
+ for (i=0; i<16; i++)
+ video_set_lut (i+240, RGB[i*3], RGB[i*3+1], RGB[i*3+2]);
+ break;
default:
- for (i=0; i<256; i++)
- video_set_lut (i, i, i, i);
+ for (i=0; i<256; i++)
+ video_set_lut (i, i, i, i);
}
}
@@ -420,9 +420,9 @@ void *video_hw_init (void)
/* enable video only on CLUT value */
if ((penv = getenv ("clut")) != NULL)
- clut = (u_int)simple_strtoul (penv, NULL, 10);
+ clut = (u_int)simple_strtoul (penv, NULL, 10);
else
- return NULL;
+ return NULL;
/* disable graphic before write LCD regs. */
immr->im_lcd.lcd_lccr = 0x96000866;
@@ -433,7 +433,7 @@ void *video_hw_init (void)
immr->im_lcd.lcd_lcvcr = 0x900f0024;
printf ("Video: 640x480 8Bit Index Lut %s\n",
- (clut==1?"240/16 (gray/vga)":"256(gray)"));
+ (clut==1?"240/16 (gray/vga)":"256(gray)"));
video_default_lut (clut);
@@ -451,11 +451,11 @@ void *video_hw_init (void)
gdev.gdfIndex = GDF__8BIT_INDEX;
if (clut > 1)
- /* return Graphic Device for console */
- return (void *)&gdev;
+ /* return Graphic Device for console */
+ return (void *)&gdev;
else
- /* just graphic enabled - draw something beautiful */
- video_test_image();
+ /* just graphic enabled - draw something beautiful */
+ video_test_image();
return NULL; /* this disabels cfb - console */
}
@@ -463,7 +463,7 @@ void *video_hw_init (void)
/* ------------------------------------------------------------------------- */
void video_set_lut (unsigned int index,
- unsigned char r, unsigned char g, unsigned char b)
+ unsigned char r, unsigned char g, unsigned char b)
{
unsigned int lum;
unsigned short *pLut = (unsigned short *)(CFG_IMMR + 0x0e00);