This commit is contained in:
Vladimir Serbinenko committed 2016-02-23 11:26:35 +01:00
1 parent 74cef4ab78
commit 06c92907c1
3 files changed
+14 -12

No files matched your search

+9 -8
View File
@@ -26,13 +26,13 @@
#include <grub/term.h> #include <grub/term.h>
#include <grub/time.h> #include <grub/time.h>
#include <grub/fdtbus.h> #include <grub/fdtbus.h>
#include <grub/cros_ec.h> #include <grub/arm/cros_ec.h>
struct grub_ps2_state ps2_state; struct grub_ps2_state ps2_state;
struct cros_ec_keyscan old_scan; struct grub_cros_ec_keyscan old_scan;
static grub_uint8_t map_code[CROS_EC_KEYSCAN_COLS][CROS_EC_KEYSCAN_ROWS]; static grub_uint8_t map_code[GRUB_CROS_EC_KEYSCAN_COLS][GRUB_CROS_EC_KEYSCAN_ROWS];
static grub_uint8_t e0_translate[16] = static grub_uint8_t e0_translate[16] =
{ {
@@ -47,13 +47,13 @@ static grub_uint8_t e0_translate[16] =
static int static int
grub_cros_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) grub_cros_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
{ {
struct cros_ec_keyscan scan; struct grub_cros_ec_keyscan scan;
int i, j; int i, j;
if (cros_ec_scan_keyboard(&scan) < 0) if (grub_cros_ec_scan_keyboard(&scan) < 0)
return GRUB_TERM_NO_KEY; return GRUB_TERM_NO_KEY;
for (i = 0; i < CROS_EC_KEYSCAN_COLS; i++) for (i = 0; i < GRUB_CROS_EC_KEYSCAN_COLS; i++)
if (scan.data[i] ^ old_scan.data[i]) if (scan.data[i] ^ old_scan.data[i])
for (j = 0; j < CROS_EC_KEYSCAN_ROWS; j++) for (j = 0; j < GRUB_CROS_EC_KEYSCAN_ROWS; j++)
if ((scan.data[i] ^ old_scan.data[i]) & (1 << j)) if ((scan.data[i] ^ old_scan.data[i]) & (1 << j))
{ {
grub_uint8_t code = map_code[i][j]; grub_uint8_t code = map_code[i][j];
@@ -93,7 +93,8 @@ cros_attach(const struct grub_fdtbus_dev *dev __attribute__ ((unused)))
if (keymap) if (keymap)
{ {
for (i = 0; i + 3 < keymap_size; i += 4) for (i = 0; i + 3 < keymap_size; i += 4)
if (keymap[i+1] < CROS_EC_KEYSCAN_COLS && keymap[i] < CROS_EC_KEYSCAN_ROWS && keymap[i+2] == 0 && keymap[i+3] < 0x80) if (keymap[i+1] < GRUB_CROS_EC_KEYSCAN_COLS && keymap[i] < GRUB_CROS_EC_KEYSCAN_ROWS
&& keymap[i+2] == 0 && keymap[i+3] < 0x80)
map_code[keymap[i+1]][keymap[i]] = keymap[i+3]; map_code[keymap[i+1]][keymap[i]] = keymap[i+3];
} }
+4 -3
View File
@@ -21,7 +21,7 @@
#include <grub/mm.h> #include <grub/mm.h>
#include <grub/time.h> #include <grub/time.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/cros_ec.h> #include <grub/arm/cros_ec.h>
static grub_uint64_t static grub_uint64_t
grub_get_time_us (void) grub_get_time_us (void)
@@ -93,7 +93,7 @@ spi_stop (void)
#define mdelay grub_millisleep #define mdelay grub_millisleep
#define memcpy grub_memcpy #define memcpy grub_memcpy
static const uint64_t FramingTimeoutMs = 300 * 1000; static const uint64_t FramingTimeoutUs = 300 * 1000;
static const uint8_t EcFramingByte = 0xec; static const uint8_t EcFramingByte = 0xec;
@@ -249,7 +249,8 @@ static int ec_command(int cmd, int cmd_version,
} }
// If the caller wants the response, copy it out for them. // If the caller wants the response, copy it out for them.
din_len = MIN(din_len, length); if (length < din_len)
din_len = length;
if (din) { if (din) {
memcpy(din, (uint8_t *)busbuf + CROS_EC_SPI_IN_HDR_SIZE, memcpy(din, (uint8_t *)busbuf + CROS_EC_SPI_IN_HDR_SIZE,
din_len); din_len);
+1 -1
View File
@@ -7,7 +7,7 @@
#define GRUB_CROS_EC_KEYSCAN_ROWS 8 #define GRUB_CROS_EC_KEYSCAN_ROWS 8
struct grub_cros_ec_keyscan { struct grub_cros_ec_keyscan {
grub_uint8_t data[CROS_EC_KEYSCAN_COLS]; grub_uint8_t data[GRUB_CROS_EC_KEYSCAN_COLS];
}; };
int int