2 * Copyright (C) 2000 Andrew Grover
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 // TODO: Linux-specific
24 #include <linux/spinlock.h>
25 #include <asm/semaphore.h>
30 /*****************************************************************************
31 * Types & Other Defines
32 *****************************************************************************/
34 #define EC_DEFAULT_TIMEOUT 1000 /* 1 second */
35 #define EC_GPE_UNKNOWN 0xFFFFFFFF
36 #define EC_PORT_UNKNOWN 0x00000000
37 #define EC_BURST_ENABLE_ACKNOWLEDGE 0x90
43 typedef UINT8 EC_COMMAND;
45 #define EC_COMMAND_UNKNOWN ((EC_COMMAND) 0x00)
46 #define EC_COMMAND_READ ((EC_COMMAND) 0x80)
47 #define EC_COMMAND_WRITE ((EC_COMMAND) 0x81)
48 #define EC_COMMAND_QUERY ((EC_COMMAND) 0x84)
53 * The encoding of the EC status register is illustrated below.
54 * Note that a set bit (1) indicates the property is TRUE
55 * (e.g. if bit 0 is set then the output buffer is full).
60 * | | | | | | | +- Output Buffer Full (OBF)?
61 * | | | | | | +--- Input Buffer Full (IBF)?
62 * | | | | | +----- <reserved>
63 * | | | | +------- data Register is command Byte?
64 * | | | +--------- Burst Mode Enabled?
65 * | | +----------- SCI event?
66 * | +------------- SMI event?
67 * +--------------- <Reserved>
70 typedef UINT8 EC_STATUS;
72 #define EC_FLAG_OUTPUT_BUFFER ((EC_STATUS) 0x01)
73 #define EC_FLAG_INPUT_BUFFER ((EC_STATUS) 0x02)
74 #define EC_FLAG_BURST_MODE ((EC_STATUS) 0x10)
75 #define EC_FLAG_SCI ((EC_STATUS) 0x20)
81 typedef UINT8 EC_EVENT;
83 #define EC_EVENT_UNKNOWN ((EC_EVENT) 0x00)
84 #define EC_EVENT_NONE ((EC_EVENT) 0x00)
85 #define EC_EVENT_OUTPUT_BUFFER_FULL ((EC_EVENT) 0x01)
86 #define EC_EVENT_INPUT_BUFFER_EMPTY ((EC_EVENT) 0x02)
87 #define EC_EVENT_SCI ((EC_EVENT) 0x03)
100 #endif /* __EC_H__ */