blob: fd062356d037d664d42f3550d4d37030645f58de [file] [log] [blame]
Stefan Reinauerb5ab3232009-04-22 07:23:00 +00001/*
2 * This file is part of the ectool project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
Uwe Hermann257ae3f2009-04-22 12:28:14 +00008 * published by the Free Software Foundation; version 2 of the License.
Stefan Reinauerb5ab3232009-04-22 07:23:00 +00009 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000014 */
15
16#ifndef _EC_H
17#define _EC_H
Uwe Hermann257ae3f2009-04-22 12:28:14 +000018
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000019/* EC_SC input */
Uwe Hermann257ae3f2009-04-22 12:28:14 +000020#define EC_SMI_EVT (1 << 6) // 1: SMI event pending
21#define EC_SCI_EVT (1 << 5) // 1: SCI event pending
22#define EC_BURST (1 << 4) // controller is in burst mode
23#define EC_CMD (1 << 3) // 1: byte in data register is command
24 // 0: byte in data register is data
25#define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec)
26#define EC_OBF (1 << 0) // 1: output buffer full (data ready for host)
27
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000028/* EC_SC output */
Uwe Hermann257ae3f2009-04-22 12:28:14 +000029#define RD_EC 0x80 // Read Embedded Controller
30#define WR_EC 0x81 // Write Embedded Controller
31#define BE_EC 0x82 // Burst Enable Embedded Controller
32#define BD_EC 0x83 // Burst Disable Embedded Controller
33#define QR_EC 0x84 // Query Embedded Controller
Anton Kochkov7e59f762010-06-29 21:13:20 +000034#define RX_EC 0xf0 // Read Extended operation
35#define WX_EC 0xf1 // Write Extended operation
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000036
37int send_ec_command(uint8_t command);
38int send_ec_data(uint8_t data);
39int send_ec_data_nowait(uint8_t data);
40uint8_t recv_ec_data(void);
41uint8_t ec_read(uint8_t addr);
Anton Kochkov7e59f762010-06-29 21:13:20 +000042int ec_write(uint8_t addr, uint8_t data);
43uint8_t ec_ext_read(uint16_t addr);
44int ec_ext_write(uint16_t addr, uint8_t data);
Stefan Reinauer984e0f32010-01-16 17:50:55 +000045uint8_t ec_idx_read(uint16_t addr);
Alexander Couzens0edf4192015-02-06 22:27:33 +010046uint8_t ec_query(void);
Iru Cai2e8f4cc2018-01-25 21:44:09 +080047int get_ec_ports(void);
Uwe Hermann257ae3f2009-04-22 12:28:14 +000048#endif