Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 1 | /* |
| 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 Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 8 | * published by the Free Software Foundation; version 2 of the License. |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 9 | * |
| 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 Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef _EC_H |
| 17 | #define _EC_H |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 18 | |
Anton Kochkov | 7e59f769 | 2010-06-29 21:13:20 +0000 | [diff] [blame] | 19 | #define EC_DATA 0x62 |
| 20 | #define EC_SC 0x66 |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 21 | |
| 22 | /* EC_SC input */ |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 23 | #define EC_SMI_EVT (1 << 6) // 1: SMI event pending |
| 24 | #define EC_SCI_EVT (1 << 5) // 1: SCI event pending |
| 25 | #define EC_BURST (1 << 4) // controller is in burst mode |
| 26 | #define EC_CMD (1 << 3) // 1: byte in data register is command |
| 27 | // 0: byte in data register is data |
| 28 | #define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec) |
| 29 | #define EC_OBF (1 << 0) // 1: output buffer full (data ready for host) |
| 30 | |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 31 | /* EC_SC output */ |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 32 | #define RD_EC 0x80 // Read Embedded Controller |
| 33 | #define WR_EC 0x81 // Write Embedded Controller |
| 34 | #define BE_EC 0x82 // Burst Enable Embedded Controller |
| 35 | #define BD_EC 0x83 // Burst Disable Embedded Controller |
| 36 | #define QR_EC 0x84 // Query Embedded Controller |
Anton Kochkov | 7e59f769 | 2010-06-29 21:13:20 +0000 | [diff] [blame] | 37 | #define RX_EC 0xf0 // Read Extended operation |
| 38 | #define WX_EC 0xf1 // Write Extended operation |
Stefan Reinauer | b5ab323 | 2009-04-22 07:23:00 +0000 | [diff] [blame] | 39 | |
| 40 | int send_ec_command(uint8_t command); |
| 41 | int send_ec_data(uint8_t data); |
| 42 | int send_ec_data_nowait(uint8_t data); |
| 43 | uint8_t recv_ec_data(void); |
| 44 | uint8_t ec_read(uint8_t addr); |
Anton Kochkov | 7e59f769 | 2010-06-29 21:13:20 +0000 | [diff] [blame] | 45 | int ec_write(uint8_t addr, uint8_t data); |
| 46 | uint8_t ec_ext_read(uint16_t addr); |
| 47 | int ec_ext_write(uint16_t addr, uint8_t data); |
Stefan Reinauer | 984e0f3 | 2010-01-16 17:50:55 +0000 | [diff] [blame] | 48 | uint8_t ec_idx_read(uint16_t addr); |
Alexander Couzens | 0edf419 | 2015-02-06 22:27:33 +0100 | [diff] [blame] | 49 | uint8_t ec_query(void); |
Uwe Hermann | 257ae3f | 2009-04-22 12:28:14 +0000 | [diff] [blame] | 50 | #endif |