| 1 |
|
| 2 |
|
| 3 |
#ifndef _EC_ACPI_H |
| 4 |
#define _EC_ACPI_H |
| 5 |
|
| 6 |
#include <types.h> |
| 7 |
|
| 8 |
#define EC_DATA 0x62 |
| 9 |
#define EC_SC 0x66 |
| 10 |
|
| 11 |
|
| 12 |
#define EC_SMI_EVT (1 << 6) // 1: SMI event pending |
| 13 |
#define EC_SCI_EVT (1 << 5) // 1: SCI event pending |
| 14 |
#define EC_BURST (1 << 4) // 1: controller is in burst mode |
| 15 |
#define EC_CMD (1 << 3) // 1: byte in data register is command |
| 16 |
|
| 17 |
#define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec) |
| 18 |
#define EC_OBF (1 << 0) // 1: output buffer full (data ready for host) |
| 19 |
|
| 20 |
#define RD_EC 0x80 // Read Embedded Controller |
| 21 |
#define WR_EC 0x81 // Write Embedded Controller |
| 22 |
#define BE_EC 0x82 // Burst Enable Embedded Controller |
| 23 |
#define BD_EC 0x83 // Burst Disable Embedded Controller |
| 24 |
#define QR_EC 0x84 // Query Embedded Controller |
| 25 |
|
| 26 |
bool ec_ready_send(int timeout_us); |
| 27 |
bool ec_ready_recv(int timeout_us); |
| 28 |
int send_ec_command(u8 command); |
| 29 |
int send_ec_command_timeout(u8 command, int timeout); |
| 30 |
int send_ec_data(u8 data); |
| 31 |
int send_ec_data_timeout(u8 data, int timeout); |
| 32 |
int recv_ec_data(void); |
| 33 |
int recv_ec_data_timeout(int timeout); |
| 34 |
void ec_clear_out_queue(void); |
| 35 |
u8 ec_status(void); |
| 36 |
u8 ec_query(void); |
| 37 |
u8 ec_read(u8 addr); |
| 38 |
int ec_write(u8 addr, u8 data); |
| 39 |
void ec_set_bit(u8 addr, u8 bit); |
| 40 |
void ec_clr_bit(u8 addr, u8 bit); |
| 41 |
void ec_set_ports(u16 cmd_reg, u16 data_reg); |
| 42 |
|
| 43 |
#endif |