blob: b06816de45f267b09fae3a9847458a3fc82b7830 [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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Uwe Hermann257ae3f2009-04-22 12:28:14 +000017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000018 */
19
20#ifndef _EC_H
21#define _EC_H
Uwe Hermann257ae3f2009-04-22 12:28:14 +000022
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000023#include <stdint.h>
Uwe Hermann257ae3f2009-04-22 12:28:14 +000024
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000025#define EC_DATA 0x62
26#define EC_SC 0x66
27
28/* EC_SC input */
Uwe Hermann257ae3f2009-04-22 12:28:14 +000029#define EC_SMI_EVT (1 << 6) // 1: SMI event pending
30#define EC_SCI_EVT (1 << 5) // 1: SCI event pending
31#define EC_BURST (1 << 4) // controller is in burst mode
32#define EC_CMD (1 << 3) // 1: byte in data register is command
33 // 0: byte in data register is data
34#define EC_IBF (1 << 1) // 1: input buffer full (data ready for ec)
35#define EC_OBF (1 << 0) // 1: output buffer full (data ready for host)
36
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000037/* EC_SC output */
Uwe Hermann257ae3f2009-04-22 12:28:14 +000038#define RD_EC 0x80 // Read Embedded Controller
39#define WR_EC 0x81 // Write Embedded Controller
40#define BE_EC 0x82 // Burst Enable Embedded Controller
41#define BD_EC 0x83 // Burst Disable Embedded Controller
42#define QR_EC 0x84 // Query Embedded Controller
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000043
44int send_ec_command(uint8_t command);
45int send_ec_data(uint8_t data);
46int send_ec_data_nowait(uint8_t data);
47uint8_t recv_ec_data(void);
48uint8_t ec_read(uint8_t addr);
Stefan Reinauerb5ab3232009-04-22 07:23:00 +000049
Uwe Hermann257ae3f2009-04-22 12:28:14 +000050#endif