|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22:
23: static SInt8 cmdLengthTable[256] = {
24: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 0x00 - 0x0F
25: // 0x10 - 0x1F
26: 1, // 0x10 Subsystem Power/Clock Control
27: 1, // 0x11 Subsystem Power/Clock Control (yet more)
28: -1,-1,-1,-1,-1,-1, // 0x12 - 0x17
29: 0, // 0x18 Read Power/Clock Status
30: 0, // 0x19 Read Power/Clock Status (yet more)
31: -1,-1,-1,-1,-1, // 0x1A
32: 0, // 0x1F RESERVED FOR MSC/PG&E EMULATION
33: // 0x20 - 0x2F
34: -1, // 0x20 Set New Apple Desktop Bus Command
35: 0, // 0x21 ADB Autopoll Abort
36: 2, // 0x22 ADB Set Keyboard Addresses
37: 1, // 0x23 ADB Set Hang Threshold
38: 1, // 0x24 ADB Enable/Disable Programmers Key
39: -1,-1,-1, // 0x25
40: 0, // 0x28 ADB Transaction Read
41: -1,-1,-1,-1,-1,-1,-1, // 0x29
42: // 0x30 - 0x3F
43: 4, // 0x30 Set Realtime Clock.
44: 20, // 0x31 Write Parameter RAM
45: -1, // 0x32 Write Extended Parameter RAM.
46: 3, // 0x33 Write NVRAM
47: -1,-1,-1,-1, // 0x34
48: 0, // 0x38 Read Realtime Clock.
49: 0, // 0x39 Read Parameter RAM
50: 2, // 0x3A Read Extended Parameter RAM.
51: 2, // 0x3B Read NVRAM
52: -1,-1,-1,-1, // 0x3C
53: // 0x40 - 0x4F
54: 1, // 0x40 Set Screen Contrast
55: 1, // 0x41 Set Screen Brightness
56: -1,-1,-1,-1,-1,-1, // 0x42
57: 0, // 0x48 Read Screen Contrast
58: 0, // 0x49 Read Screen Brightness
59: -1,-1, // 0x4A
60: 1, // 0x4C PCMCIA card eject
61: -1,-1,-1, // 0x4D
62: // 0x50 - 0x5F
63: 1, // 0x50 Set Internal Modem Control Bits
64: 0, // 0x51 Clear FIFOs
65: 2, // 0x52 Set FIFO Interrupt Marks
66: 2, // 0x53 Set FIFO Sizes
67: -1, // 0x54 Write Data to Modem
68: 1, // 0x55 Set Data Mode
69: 3, // 0x56 Set Flow Control Mode
70: 1, // 0x57 Set DAA control lines
71: 0, // 0x58 Read Internal Modem Status
72: 1, // 0x59 Get DAA Identification
73: 0, // 0x5A Get FIFO Counts
74: 0, // 0x5B Get Maximum FIFO Sizes
75: 0, // 0x5C Read Data From Modem
76: -1, // 0x5D General Purpose modem command (modem dependent)
77: -1,-1, // 0x5E
78: // 0x60 - 0x6F
79: 2, // 0x60 Set low power warning and cutoff levels
80: -1, // 0x61
81: 2, // 0x62 Set low power first dialog and 10 second warning levels
82: 0, // 0x63 Get low power first dialog and 10 second warning levels
83: -1,-1,-1,-1, // 0x64
84: 0, // 0x68 Read Charger State, Battery Voltage, Temperature
85: 0, // 0x69 Read Instantaneous Charger, Battery, Temperature
86: 0, // 0x6A Read low power warning and cutoff levels
87: 0, // 0x6B Read Extended Battery Status
88: 0, // 0x6C Read Battery ID
89: 0, // 0x6D Battery Parameters
90: -1,-1, // 0x6E
91: // 0x70 - 0x7F
92: 1, // 0x70 Set One-Second Interrupt
93: 1, // 0x71 Modem Interrupt Control
94: 1, // 0x72 Set Modem Interrupt
95: -1,-1,-1,-1,-1, // 0x73
96: 0, // 0x78 Read Interrupt Flag Register.
97: 0, // 0x79 Read Modem Interrupt Data
98: -1,-1,-1,-1, // 0x7A
99: 4, // 0x7E Enter Shutdown Mode
100: 4, // 0x7F Enter Sleep Mode
101: // 0x80 - 0x8F
102: 4, // 0x80 Set Wakeup Timer
103: -1, // 0x81
104: 0, // 0x82 Disable Wakeup Timer
105: -1,-1,-1,-1,-1, // 0x83
106: 0, // 0x88 Read Wakeup Timer
107: -1,-1,-1,-1,-1,-1,-1,// 0x89
108: // 0x90 - 0x9F
109: 1, // 0x90 Set Sound Control Bits
110: 2, // 0x91 Set DFAC Control Register
111: -1,-1,-1,-1,-1,-1, // 0x92
112: 0, // 0x98 Read Sound Control Status
113: 0, // 0x99 Read DFAC Control Register
114: -1,-1,-1,-1,-1,-1, // 0x9A
115: // 0xA0 - 0xAF
116: 2, // 0xA0 Write Modem Register
117: 2, // 0xA1 Clear Modem Register Bits
118: 2, // 0xA2 Set Modem Register Bits
119: 4, // 0xA3 Write DSP RAM
120: -1, // 0xA4 Set Filter Coefficients
121: 0, // 0xA5 Reset Modem
122: -1,-1, // 0xA6
123: 1, // 0xA8 Read Modem Register
124: 1, // 0xA9 Send Break
125: 3, // 0xAA Dial Digit
126: 2, // 0xAB Read DSP RAM
127: -1,-1,-1,-1, // 0xAC
128: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 0xB0 - 0xBF
129: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, // 0xC0 - 0xCF
130: // 0xD0 - 0xDF
131: 0, // 0xD0 Reset CPU
132: -1,-1,-1,-1,-1,-1,-1, // 0xD1
133: 1, // 0xD8 Read A/D Status
134: 1, // 0xD9 Read User Input
135: -1,-1, // 0xDA
136: 0, // 0xDC read external switches
137: 0, // 0xDD -
138: -1,-1, // 0xDE
139: // 0xE0 - 0xEF
140: -1, // 0xE0 Write to internal PMGR memory
141: 4, // 0xE1 Download Flash EEPROM Code
142: 0, // 0xE2 Get Flash EEPROM Status
143: -1,-1,-1,-1,-1, // 0xE3
144: 3, // 0xE8 Read PMGR internal memory
145: -1, // 0xE9 -
146: 0, // 0xEA Read PMGR firmware version number
147: -1, // 0xEB -
148: 0, // 0xEC Execute self test
149: -1, // 0xED PMGR diagnostics (selector-based)
150: -1, // 0xEE -
151: 0, // 0xEF PMGR soft reset
152: // 0xF0 - 0xFF
153: -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
154: };
155:
156:
157:
158: // This table is used to determine how to handle the reply:
159:
160: //=0:no reply should be expected.
161: //=1: only a reply byte will be sent (this is a special case for a couple of commands)
162: //<0:a reply is expected and the PMGR will send a count byte.
163: //>1:a reply is expected and the PMGR will not send a count byte,
164: //but the count will be (value-1).
165: //
166: //Unused commands in the range $x8 to $xF will be marked as expecting a reply (with count)
167: //so that commands may be added without having to change the ROM.
168:
169: static SInt8 rspLengthTable[256] = {
170: // 0x00 - 0x0F
171: 0,0,0,0,0,0,0,0, // 0x00 -
172: -1,-1,-1,-1,-1,-1,-1,-1, // 0x08 -
173: // 0x10 - 0x1F
174: 0, // 0x10 Subsystem Power/Clock Control
175: 0, // 0x11 Subsystem Power/Clock Control (yet more)
176: 0,0,0,0,0,0, // 0x12 -
177: 1+1, // 0x18 Read Power/Clock Status
178: 1+1, // 0x19 Read Power/Clock Status (yet more)
179: -1,-1,-1,-1,-1, // 0x1A -
180: 0, // 0x1F RESERVED FOR MSC/PG&E EMULATION
181: // 0x20 - 0x2F
182: 0, // 0x20 Set New Apple Desktop Bus Command
183: 0, // 0x21 ADB Autopoll Abort
184: 0, // 0x22 ADB Set Keyboard Addresses
185: 0, // 0x23 ADB Set Hang Threshold
186: 0, // 0x24 ADB Enable/Disable Programmers Key
187: 0,0,0, // 0x25 -
188: -1, // 0x28 ADB Transaction Read
189: -1,-1,-1,-1,-1,-1,-1, // 0x29 -
190: // 0x30 - 0x3F
191: 0, // 0x30 Set Realtime Clock.
192: 0, // 0x31 Write Parameter RAM
193: 0, // 0x32 Write Extended Parameter RAM.
194: 0, // 0x33 Write NVRAM
195: 0,0,0,0, // 0x34 -
196: 4+1, // 0x38 Read Realtime Clock.
197: 20+1, // 0x39 Read Parameter RAM
198: -1, // 0x3A Read Extended Parameter RAM.
199: 1+1, // 0x3B Read NVRAM
200: -1,-1,-1,-1, // 0x3C -
201: // 0x40 - 0x4F
202: 0, // 0x40 Set Screen Contrast
203: 0, // 0x41 Set Screen Brightness
204: 0,0,0,0,0,0, // 0x42 -
205: 1+1, // 0x48 Read Screen Contrast
206: 1+1, // 0x49 Read Screen Brightness
207: -1,-1, // 0x4A -
208: 0, // 0x4C PCMCIA card eject
209: -1,-1,-1, // 0x4D -
210: // 0x50 - 0x5F
211: 0, // 0x50 Set Internal Modem Control Bits
212: 0, // 0x51 Clear FIFOs
213: 0, // 0x52 Set FIFO Interrupt Marks
214: 0, // 0x53 Set FIFO Sizes
215: 0, // 0x54 Write Data to Modem
216: 0, // 0x55 Set Data Mode
217: 0, // 0x56 Set Flow Control Mode
218: 0, // 0x57 Set DAA control lines
219: 1+1, // 0x58 Read Internal Modem Status
220: 0, // 0x59 Get DAA Identification
221: 2+1, // 0x5A Get FIFO Counts
222: 2+1, // 0x5B Get Maximum FIFO Sizes
223: -1, // 0x5C Read Data From Modem
224: -1, // 0x5D General Purpose modem command (modem dependent)
225: -1,-1, // 0x5E -
226: // 0x60 - 0x6F
227: 0, // 0x60 Set low power warning and cutoff levels
228: 0, // 0x61 -
229: 0, // 0x62 Set low power first dialog and 10 second warning levels
230: 2+1, // 0x63 Get low power first dialog and 10 second warning levels
231: 0,0,0,0, // 0x64 -
232: 3+1, // 0x68 Read Charger State, Battery Voltage, Temperature
233: 3+1, // 0x69 Read Instantaneous Charger, Battery, Temperature
234: 2+1, // 0x6A Read low power warning and cutoff levels
235: 8+1, // 0x6B Read Extended Battery Status
236: -1, // 0x6C Read Battery ID
237: -1, // 0x6D Battery Parameters (10+1 for AJ, 22+1 for Malcolm)
238: -1,-1, // 0x6E -
239: // 0x70 - 0x7F
240: 0, // 0x70 Set One-Second Interrupt
241: 0, // 0x71 Modem Interrupt Control
242: 0, // 0x72 Set Modem Interrupt
243: 0,0,0,0,0, // 0x73 -
244: -1, // 0x78 Read Interrupt Flag Register.
245: -1, // 0x79 Read Modem Interrupt Data
246: -1,-1,-1,-1, // 0x7A -
247: 0+1, // 0x7E Enter Shutdown Mode
248: 0+1, // 0x7F Enter Sleep Mode
249: // 0x80 - 0x8F
250: 0, // 0x80 Set Wakeup Timer
251: 0, // 0x81 -
252: 0, // 0x82 Disable Wakeup Timer
253: 0,0,0,0,0, // 0x83 -
254: 5+1, // 0x88 Read Wakeup Timer
255: -1,-1,-1,-1,-1,-1,-1, // 0x89 -
256: // 0x90 - 0x9F
257: 0, // 0x90 Set Sound Control Bits
258: 0, // 0x91 Set DFAC Control Register
259: 0,0,0,0,0,0, // 0x92 -
260: 1+1, // 0x98 Read Sound Control Status
261: 1+1, // 0x99 Read DFAC Control Register
262: 1,-1,-1,-1,-1,-1, // 0x9A -
263: // 0xA0 - 0xAF
264: 0, // 0xA0 Write Modem Register
265: 0, // 0xA1 Clear Modem Register Bits
266: 0, // 0xA2 Set Modem Register Bits
267: 0, // 0xA3 Write DSP RAM
268: 0, // 0xA4 Set Filter Coefficients
269: 0, // 0xA5 Reset Modem
270: 0,0, // 0xA6 -
271: 1+1, // 0xA8 Read Modem Register
272: 0, // 0xA9 Send Break
273: 0, // 0xAA Dial Digit
274: 0, // 0xAB Read DSP RAM
275: -1,-1,-1,-1, // 0xAC -
276: // 0xB0 - 0xBF
277: 0,0,0,0,0,0,0,0, // 0xB0 -
278: -1,-1,-1,-1,-1,-1,-1,-1, // 0xB8 -
279: // 0xC0 - 0xCF
280: 0,0,0,0,0,0,0,0, // 0xC0 -
281: -1,-1,-1,-1,-1,-1,-1,-1, // 0xC8 -
282: // 0xD0 - 0xDF
283: 0,0,0,0,0,0,0,0, // 0xD0 Reset CPU
284: 1+1, // 0xD8 Read A/D Status
285: 1+1, // 0xD9 Read User Input
286: -1,-1, // 0xDA -
287: 1+1, // 0xDC read external switches
288: -1,-1,-1, // 0xDD -
289: // 0xE0 - 0xEF
290: 0, // 0xE0 Write to internal PMGR memory
291: 0, // 0xE1 Download Flash EEPROM Code
292: 0+1, // 0xE2 Get Flash EEPROM Status
293: 0,0,0,0,0, // 0xE3 -
294: -1, // 0xE8 Read PMGR internal memory
295: -1, // 0xE9 -
296: 1+1, // 0xEA Read PMGR firmware version number
297: -1, // 0xEB -
298: -1, // 0xEC Execute self test
299: -1, // 0xED PMGR diagnostics (selector-based)
300: -1, // 0xEE -
301: 0, // 0xEF PMGR soft reset
302: // 0xF0 - 0xFF
303: 0,0,0,0,0,0,0,0, // 0xF0 -
304: -1,-1,-1,-1,-1,-1,-1,-1 // 0xF8 -
305: };
306:
307:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.