treewide: replace GPLv2 long form headers with SPDX header
[coreboot.git] / util / ectool / ec.h
blob004bd7d9bc96c7a40fbda4dcbcc42130413daf58
1 /* This file is part of the ectool project. */
2 /* SPDX-License-Identifier: GPL-2.0-only */
4 #ifndef _EC_H
5 #define _EC_H
7 /* EC_SC input */
8 #define EC_SMI_EVT (1 << 6) // 1: SMI event pending
9 #define EC_SCI_EVT (1 << 5) // 1: SCI event pending
10 #define EC_BURST (1 << 4) // controller is in burst mode
11 #define EC_CMD (1 << 3) // 1: byte in data register is command
12 // 0: byte in data register is data
13 #define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec)
14 #define EC_OBF (1 << 0) // 1: output buffer full (data ready for host)
16 /* EC_SC output */
17 #define RD_EC 0x80 // Read Embedded Controller
18 #define WR_EC 0x81 // Write Embedded Controller
19 #define BE_EC 0x82 // Burst Enable Embedded Controller
20 #define BD_EC 0x83 // Burst Disable Embedded Controller
21 #define QR_EC 0x84 // Query Embedded Controller
22 #define RX_EC 0xf0 // Read Extended operation
23 #define WX_EC 0xf1 // Write Extended operation
25 int send_ec_command(uint8_t command);
26 int send_ec_data(uint8_t data);
27 int send_ec_data_nowait(uint8_t data);
28 uint8_t recv_ec_data(void);
29 uint8_t ec_read(uint8_t addr);
30 int ec_write(uint8_t addr, uint8_t data);
31 uint8_t ec_ext_read(uint16_t addr);
32 int ec_ext_write(uint16_t addr, uint8_t data);
33 uint8_t ec_idx_read(uint16_t addr);
34 uint8_t ec_query(void);
35 int get_ec_ports(void);
36 #endif