mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-08-22 05:06:39 -04:00
x86: Make the i8042 driver checkpatch clean
Signed-off-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
parent
36b2409a3d
commit
dd4a5b2246
@ -42,7 +42,7 @@ extern void gt_cpcidvi_out8(u32 offset, u8 data);
|
||||
#ifdef CONFIG_CONSOLE_CURSOR
|
||||
extern void console_cursor(int state);
|
||||
static int blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
|
||||
static int cursor_state = 0;
|
||||
static int cursor_state;
|
||||
#endif
|
||||
|
||||
/* locals */
|
||||
@ -50,7 +50,7 @@ static int cursor_state = 0;
|
||||
static int kbd_input = -1; /* no input yet */
|
||||
static int kbd_mapping = KBD_US; /* default US keyboard */
|
||||
static int kbd_flags = NORMAL; /* after reset */
|
||||
static int kbd_state = 0; /* unshift code */
|
||||
static int kbd_state; /* unshift code */
|
||||
|
||||
static void kbd_conv_char(unsigned char scan_code);
|
||||
static void kbd_led_set(void);
|
||||
@ -64,8 +64,8 @@ static void kbd_alt (unsigned char scan_code);
|
||||
static int kbd_input_empty(void);
|
||||
static int kbd_reset(void);
|
||||
|
||||
static unsigned char kbd_fct_map [144] =
|
||||
{ /* kbd_fct_map table for scan code */
|
||||
static unsigned char kbd_fct_map[144] = {
|
||||
/* kbd_fct_map table for scan code */
|
||||
0, AS, AS, AS, AS, AS, AS, AS, /* scan 0- 7 */
|
||||
AS, AS, AS, AS, AS, AS, AS, AS, /* scan 8- F */
|
||||
AS, AS, AS, AS, AS, AS, AS, AS, /* scan 10-17 */
|
||||
@ -86,8 +86,7 @@ static unsigned char kbd_fct_map [144] =
|
||||
AS, EX, EX, AS, EX, AS, EX, EX /* enhanced */
|
||||
};
|
||||
|
||||
static unsigned char kbd_key_map [2][5][144] =
|
||||
{
|
||||
static unsigned char kbd_key_map[2][5][144] = {
|
||||
{ /* US keyboard */
|
||||
{ /* unshift code */
|
||||
0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 0- 7 */
|
||||
@ -294,8 +293,7 @@ static unsigned char kbd_key_map [2][5][144] =
|
||||
}
|
||||
};
|
||||
|
||||
static unsigned char ext_key_map [] =
|
||||
{
|
||||
static unsigned char ext_key_map[] = {
|
||||
0x1c, /* keypad enter */
|
||||
0x1d, /* right control */
|
||||
0x35, /* keypad slash */
|
||||
@ -325,24 +323,22 @@ int i8042_kbd_init (void)
|
||||
char *penv;
|
||||
|
||||
#ifdef CONFIG_USE_CPCIDVI
|
||||
if ((penv = getenv ("console")) != NULL) {
|
||||
if (strncmp (penv, "serial", 7) == 0) {
|
||||
penv = getenv("console");
|
||||
if (penv != NULL) {
|
||||
if (strncmp(penv, "serial", 7) == 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Init keyboard device (default US layout) */
|
||||
keymap = KBD_US;
|
||||
if ((penv = getenv ("keymap")) != NULL)
|
||||
{
|
||||
penv = getenv("keymap");
|
||||
if (penv != NULL) {
|
||||
if (strncmp(penv, "de", 3) == 0)
|
||||
keymap = KBD_GER;
|
||||
}
|
||||
|
||||
for (try = 0; try < KBD_RESET_TRIES; try++)
|
||||
{
|
||||
if (kbd_reset() == 0)
|
||||
{
|
||||
for (try = 0; try < KBD_RESET_TRIES; try++) {
|
||||
if (kbd_reset() == 0) {
|
||||
kbd_mapping = keymap;
|
||||
kbd_flags = NORMAL;
|
||||
kbd_state = 0;
|
||||
@ -364,8 +360,7 @@ int i8042_tstc (void)
|
||||
unsigned char scan_code = 0;
|
||||
|
||||
#ifdef CONFIG_CONSOLE_CURSOR
|
||||
if (--blinkCount == 0)
|
||||
{
|
||||
if (--blinkCount == 0) {
|
||||
cursor_state ^= 1;
|
||||
console_cursor(cursor_state);
|
||||
blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
|
||||
@ -373,10 +368,9 @@ int i8042_tstc (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((in8 (I8042_STATUS_REG) & 0x01) == 0)
|
||||
if ((in8(I8042_STATUS_REG) & 0x01) == 0) {
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
scan_code = in8(I8042_DATA_REG);
|
||||
if (scan_code == 0xfa)
|
||||
return 0;
|
||||
@ -400,13 +394,10 @@ int i8042_getc (void)
|
||||
int ret_chr;
|
||||
unsigned char scan_code;
|
||||
|
||||
while (kbd_input == -1)
|
||||
{
|
||||
while ((in8 (I8042_STATUS_REG) & 0x01) == 0)
|
||||
{
|
||||
while (kbd_input == -1) {
|
||||
while ((in8(I8042_STATUS_REG) & 0x01) == 0) {
|
||||
#ifdef CONFIG_CONSOLE_CURSOR
|
||||
if (--blinkCount==0)
|
||||
{
|
||||
if (--blinkCount == 0) {
|
||||
cursor_state ^= 1;
|
||||
console_cursor(cursor_state);
|
||||
blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
|
||||
@ -414,9 +405,7 @@ int i8042_getc (void)
|
||||
udelay(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
scan_code = in8(I8042_DATA_REG);
|
||||
|
||||
if (scan_code != 0xfa)
|
||||
kbd_conv_char (scan_code);
|
||||
}
|
||||
@ -430,8 +419,7 @@ int i8042_getc (void)
|
||||
|
||||
static void kbd_conv_char(unsigned char scan_code)
|
||||
{
|
||||
if (scan_code == 0xe0)
|
||||
{
|
||||
if (scan_code == 0xe0) {
|
||||
kbd_flags |= EXT;
|
||||
return;
|
||||
}
|
||||
@ -442,10 +430,8 @@ static void kbd_conv_char (unsigned char scan_code)
|
||||
else
|
||||
kbd_flags &= ~BRK;
|
||||
|
||||
if ((scan_code == 0xe1) || (kbd_flags & E1))
|
||||
{
|
||||
if (scan_code == 0xe1)
|
||||
{
|
||||
if ((scan_code == 0xe1) || (kbd_flags & E1)) {
|
||||
if (scan_code == 0xe1) {
|
||||
kbd_flags ^= BRK; /* reset the break flag */
|
||||
kbd_flags ^= E1; /* bitwise EXOR with E1 flag */
|
||||
}
|
||||
@ -454,15 +440,12 @@ static void kbd_conv_char (unsigned char scan_code)
|
||||
|
||||
scan_code &= 0x7f;
|
||||
|
||||
if (kbd_flags & EXT)
|
||||
{
|
||||
if (kbd_flags & EXT) {
|
||||
int i;
|
||||
|
||||
kbd_flags ^= EXT;
|
||||
for (i=0; ext_key_map[i]; i++)
|
||||
{
|
||||
if (ext_key_map[i] == scan_code)
|
||||
{
|
||||
for (i = 0; ext_key_map[i]; i++) {
|
||||
if (ext_key_map[i] == scan_code) {
|
||||
scan_code = 0x80 + i;
|
||||
break;
|
||||
}
|
||||
@ -472,21 +455,27 @@ static void kbd_conv_char (unsigned char scan_code)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (kbd_fct_map [scan_code])
|
||||
{
|
||||
case AS: kbd_normal (scan_code);
|
||||
switch (kbd_fct_map[scan_code]) {
|
||||
case AS:
|
||||
kbd_normal(scan_code);
|
||||
break;
|
||||
case SH: kbd_shift (scan_code);
|
||||
case SH:
|
||||
kbd_shift(scan_code);
|
||||
break;
|
||||
case CN: kbd_ctrl (scan_code);
|
||||
case CN:
|
||||
kbd_ctrl(scan_code);
|
||||
break;
|
||||
case NM: kbd_num (scan_code);
|
||||
case NM:
|
||||
kbd_num(scan_code);
|
||||
break;
|
||||
case CP: kbd_caps (scan_code);
|
||||
case CP:
|
||||
kbd_caps(scan_code);
|
||||
break;
|
||||
case ST: kbd_scroll (scan_code);
|
||||
case ST:
|
||||
kbd_scroll(scan_code);
|
||||
break;
|
||||
case AK: kbd_alt (scan_code);
|
||||
case AK:
|
||||
kbd_alt(scan_code);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@ -499,17 +488,14 @@ static void kbd_normal (unsigned char scan_code)
|
||||
{
|
||||
unsigned char chr;
|
||||
|
||||
if ((kbd_flags & BRK) == NORMAL)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL) {
|
||||
chr = kbd_key_map[kbd_mapping][kbd_state][scan_code];
|
||||
if ((chr == 0xff) || (chr == 0x00))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* if caps lock convert upper to lower */
|
||||
if (((kbd_flags & CAPS) == CAPS) && (chr >= 'a' && chr <= 'z'))
|
||||
{
|
||||
if (((kbd_flags & CAPS) == CAPS) &&
|
||||
(chr >= 'a' && chr <= 'z')) {
|
||||
chr -= 'a' - 'A';
|
||||
}
|
||||
kbd_input = chr;
|
||||
@ -521,13 +507,10 @@ static void kbd_normal (unsigned char scan_code)
|
||||
|
||||
static void kbd_shift(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK) {
|
||||
kbd_state = AS;
|
||||
kbd_flags &= (~SHIFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
kbd_state = SH;
|
||||
kbd_flags |= SHIFT;
|
||||
}
|
||||
@ -538,13 +521,10 @@ static void kbd_shift (unsigned char scan_code)
|
||||
|
||||
static void kbd_ctrl(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK) {
|
||||
kbd_state = AS;
|
||||
kbd_flags &= (~CTRL);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
kbd_state = CN;
|
||||
kbd_flags |= CTRL;
|
||||
}
|
||||
@ -555,8 +535,7 @@ static void kbd_ctrl (unsigned char scan_code)
|
||||
|
||||
static void kbd_caps(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL) {
|
||||
kbd_flags ^= CAPS;
|
||||
kbd_led_set(); /* update keyboard LED */
|
||||
}
|
||||
@ -567,8 +546,7 @@ static void kbd_caps (unsigned char scan_code)
|
||||
|
||||
static void kbd_num(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL) {
|
||||
kbd_flags ^= NUM;
|
||||
kbd_state = (kbd_flags & NUM) ? AS : NM;
|
||||
kbd_led_set(); /* update keyboard LED */
|
||||
@ -580,8 +558,7 @@ static void kbd_num (unsigned char scan_code)
|
||||
|
||||
static void kbd_scroll(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL)
|
||||
{
|
||||
if ((kbd_flags & BRK) == NORMAL) {
|
||||
kbd_flags ^= STP;
|
||||
kbd_led_set(); /* update keyboard LED */
|
||||
if (kbd_flags & STP)
|
||||
@ -595,13 +572,10 @@ static void kbd_scroll (unsigned char scan_code)
|
||||
|
||||
static void kbd_alt(unsigned char scan_code)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK)
|
||||
{
|
||||
if ((kbd_flags & BRK) == BRK) {
|
||||
kbd_state = AS;
|
||||
kbd_flags &= (~ALT);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
kbd_state = AK;
|
||||
kbd_flags &= ALT;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user