diff options
author | Simon Glass <sjg@chromium.org> | 2012-04-10 10:37:29 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2012-04-11 16:28:53 -0700 |
commit | 220a5a496d09e36b2281b484d651fd3c379ecf81 (patch) | |
tree | ebc3403b2d430b7b46d73fd5b45cb17ecdf20ec2 /include | |
parent | 84ee7cd80364cb9333c6dc912f41194fb3215ae9 (diff) | |
download | chrome-ec-220a5a496d09e36b2281b484d651fd3c379ecf81.tar.gz |
Update keyboard scanning for stm32 to use messages
Provide the required plumbing for the stm32 keyboard scan code so that
the message layer will pick up keyboard scans.
The design is as follows:
- When a change in keyboard state is detected, the keyboard matrix
scanning code will call the board-specific board_keyboard_scan_ready()
function to interrupt the AP.
- The AP will initiate a CMDC_KEY_STATE transaction over SPI or I2C
- The SPI or I2C driver will call message_process_cmd() to process the
command
- This in turn will call keyboard_get_scan() to get the latest scan data
For SPI:
- The AP will initiate an 20-byte (or longer) SPI transaction
- The EC will see the command, and provide the keyboard state in response,
with the response being part of the same transaction
For I2C:
- The AP will initiate a 1-byte write to set the EC mode.
- The AP will then initiate an 18-byte read, and the EC will send the
message including keyboard state
BUG=chromium-os:28925
TEST=build on daisy and discovery; run on daisy
Change-Id: I905ef9d567e43d85fb851052f67586eff58e1167
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/keyboard_scan.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h index 31341333c5..6ba01f9d0e 100644 --- a/include/keyboard_scan.h +++ b/include/keyboard_scan.h @@ -16,4 +16,19 @@ int keyboard_scan_init(void); /* Returns non-zero if recovery key was pressed at boot. */ int keyboard_scan_recovery_pressed(void); +/** + * Get the scan data from the keyboard. + * + * This returns the results of the last keyboard scan, by pointing the + * supplied buffer to it, and returning the number of bytes available. + * + * The supplied buffer can be used directly if required, but in that case + * the number of bytes available is limited to 'max_bytes'. + * + * @param buffp Pointer to buffer to contain data + * @param max_bytes Maximum number of bytes available in *buffp + * @return number of bytes available, or -1 for error + */ +int keyboard_get_scan(uint8_t **buffp, int max_bytes); + #endif /* __CROS_KEYBOARD_SCAN_H */ |