summaryrefslogtreecommitdiff
path: root/include/keyboard.h
blob: 8e218796a03b9636939ffcb8710d8f57b5901d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * The functions implemented by keyboard component of EC core.
 */

#ifndef __CROS_EC_KEYBOARD_H
#define __CROS_EC_KEYBOARD_H

#include "common.h"

#define MAX_SCAN_CODE_LEN 4

/* Called by keyboard scan code once any key state change (after de-bounce),
 *
 * This function will look up matrix table and convert scancode host.
 */
void keyboard_state_changed(int row, int col, int is_pressed);


/* Handle the port 0x60 writes from host.
 *
 * This functions returns the number of bytes stored in *output buffer.
 */
int handle_keyboard_data(uint8_t data, uint8_t *output);

/* Handle the port 0x64 writes from host.
 *
 * This functions returns the number of bytes stored in *output buffer.
 * BUT theose bytes will appear at port 0x60.
 */
int handle_keyboard_command(uint8_t command, uint8_t *output);

/* Clear the keyboard buffer to host. */
void keyboard_clear_underlying_buffer(void);

/* Send make/break code of power button to host. */
void keyboard_set_power_button(int pressed);

/* Log the keyboard-related information */
void kblog_put(char type, uint8_t byte);

#endif  /* __CROS_EC_KEYBOARD_H */