Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvec.h

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #ifndef INCLUDED_nvec_H
34 #define INCLUDED_nvec_H
35
36
37 #if defined(__cplusplus)
38 extern "C"
39 {
40 #endif
41
42
43 /**
44 * @file nvec.h
45 * @brief <b> Nv Embedded Controller (EC) Interface.</b>
46 *
47 * @b Description: This file declares the interface for communicating with
48 * an Embedded Controller (EC).
49 *
50 * Usage:
51 *
52 * The EC Interface (ECI) handles communication of packets the AP and EC.
53 *
54 * Multiple AP clients are allowed to communicate with the EC concurrently.
55 * Each client opens its own channel by invoking NvEcOpen(), where the
56 * InstanceId parameter specifies which EC to communicate with. Typically,
57 * only a single EC instance will be present.
58 *
59 * Three types of packets are supported --
60 *
61 * * Request Packets -- sent from AP to EC
62 * * Response Packets -- sent from EC to AP
63 * * Event Packets -- sent from EC to AP
64 *
65 * There is a one-to-one correspondence between Request Packets and Response
66 * Packets. For every Request Packet sent from the AP to the EC, there will be
67 * one and only one corresponding Response Packet sent from the EC back to the
68 * AP.
69 *
70 * Event Packets, on the other hand, are unsolicited and can be sent by the
71 * EC at any time.
72 *
73 * See below for detailed information about the format and content of the
74 * packet types.
75 *
76 * Since Requests and Responses are always paired, the ECI treats the process of
77 * sending a Request and waiting for the corresponding Response as a single
78 * operation. The NvEcSendRequest() routine carries out this operation.
79 * Normally the routine will block until after the Request is sent and the
80 * Response received; however, certain error conditions can cause the routine to
81 * return early, e.g., request transmit errors, response timeout errors, etc.
82 *
83 * Event packets are treated differently than Requests and Responses since they
84 * can occur asynchronously with respect to other AP activities. In a sense,
85 * Events are similar to interrupts. Several types of events are supported,
86 * e.g., keyboard events, ps/2 device events, gpio events, etc. The client
87 * wishing to receive Event Packets must first register for the desired event
88 * types by invoking the NvEcRegisterForEvents() routine. The client also
89 * provides a semaphore when registering. The ECI will signal the semaphore
90 * when an event of the specified type arrives.
91 *
92 * Next, the client blocks on the semaphore, waiting for an event to arrive.
93 * When an event arrives, the ECI will signal the semaphore and hold the Event
94 * Packet until it is retrieved by the client. Since the ECI will have signaled
95 * the semaphore, the client will become unblocked and can retrieve the pending
96 * Event Packet using the NvEcGetEvent() routine. If the client fails to
97 * retrieve the event, any event buffering capability within the ECI will
98 * eventually become exhausted and the ECI will be forced to stall the
99 * communications channel between the AP and EC, thereby impacting all of the
100 * the ECI clients in the system. Finally, the client can call
101 * NvEcUnregisterForEvents() to unregister when it no longer wishes to receive
102 * events. Note that events are discarded if no client is registered to receive
103 * them.
104 *
105 * Generally, packets will be truncated to fit within the bounds of client-
106 * supplied buffers and no error will be reported; however, if the client buffer
107 * is too small to hold even a minimum-size packet (i.e., a packet with no
108 * payload) then an error will be reported and the buffer contents will be
109 * undefined.
110 *
111 */
112
113 #include "nvcommon.h"
114 #include "nvos.h"
115
116 /**
117 * A type-safe handle for EC
118 */
119
120 typedef struct NvEcRec *NvEcHandle;
121
122 /**
123 * A type-safe handle for EC Event Registration
124 */
125
126 typedef struct NvEcEventRegistrationRec *NvEcEventRegistrationHandle;
127
128 /**
129 * Packet definitions
130 *
131 * Defines format of request, response, and event packets sent between the AP
132 * and the EC.
133 *
134 * Note that the first element of any packet is the packet type, so given any
135 * unknown packet it is possible to determine its type (request, response, or
136 * event). From there, the remainder of the packet can be decoded using the
137 * structure definition -- NvEcRequest, NvEcResponse, or NvEcEvent.
138 *
139 * For example, a keyboard request would have a packet type of Request/Response
140 * and a request/response type of Keyboard. The response to a keyboard request
141 * would have a packet type of Response and a request/response type of Keyboard.
142 * Finally, a keyboard event would have a packet type of Event and an event type
143 * of Keyboard.
144 *
145 * Request operations are specified as a combination of a request type and a
146 * request sub-type. Since every request has a corresponding response, requests
147 * and responses have a common set of types and sub-types.
148 *
149 * There is a separate set of types for event packets, and events do not have a
150 * sub-type.
151 *
152 * Note that these are the packet formats as presented to clients of the NvEc
153 * API. Actual format of data communicated between AP and EC may differ at the
154 * transport level.
155 */
156 #define NVEC_MAX_PAYLOAD_BYTES (30)
157
158 /**
159 * Packet types
160 */
161
162 typedef enum
163 {
164 NvEcPacketType_Request,
165 NvEcPacketType_Response,
166 NvEcPacketType_Event,
167 NvEcPacketType_Num,
168 NvEcPacketType_Force32 = 0x7FFFFFFF
169 } NvEcPacketType;
170
171 /**
172 * Request/response types
173 *
174 * Each request has a corresponding response, so they share a common set of type s.
175 */
176
177 typedef enum
178 {
179 NvEcRequestResponseType_System = 1,
180 NvEcRequestResponseType_Battery,
181 NvEcRequestResponseType_Gpio,
182 NvEcRequestResponseType_Sleep,
183 NvEcRequestResponseType_Keyboard,
184 NvEcRequestResponseType_AuxDevice,
185 NvEcRequestResponseType_Control,
186 NvEcRequestResponseType_OEM0 = 0xd,
187 NvEcRequestResponseType_OEM1,
188 NvEcRequestResponseType_Num,
189 NvEcRequestResponseType_Force32 = 0x7FFFFFFF
190 } NvEcRequestResponseType;
191
192 /**
193 * Request/response sub-types
194 *
195 * Each request has a corresponding response, so they share a common set of
196 * sub-types.
197 */
198
199 typedef enum
200 {
201 NvEcRequestResponseSubtype_None,
202 NvEcRequestResponseSubtype_Num,
203 NvEcRequestResponseSubtype_Force32 = 0x7FFFFFFF
204 } NvEcRequestResponseSubtype;
205
206 /**
207 * Event types
208 */
209
210 typedef enum
211 {
212 NvEcEventType_Keyboard,
213 NvEcEventType_AuxDevice0,
214 NvEcEventType_AuxDevice1,
215 NvEcEventType_AuxDevice2,
216 NvEcEventType_AuxDevice3,
217 NvEcEventType_System,
218 NvEcEventType_GpioScalar,
219 NvEcEventType_GpioVector,
220 NvEcEventType_Battery,
221 NvEcEventType_OEM0 = 0xd,
222 NvEcEventType_OEM1,
223 NvEcEventType_Num,
224 NvEcEventType_Force32 = 0x7FFFFFFF
225 } NvEcEventType;
226
227 /**
228 * Supported status codes
229 */
230
231 typedef enum
232 {
233 NvEcStatus_Success,
234 NvEcStatus_TimeOut,
235 NvEcStatus_Parity,
236 NvEcStatus_Unavailable,
237 NvEcStatus_InvalidCommand,
238 NvEcStatus_InvalidSize,
239 NvEcStatus_InvalidParameter,
240 NvEcStatus_UnsupportedConfiguration,
241 NvEcStatus_ChecksumFailure,
242 NvEcStatus_WriteFailure,
243 NvEcStatus_ReadFailure,
244 NvEcStatus_Overflow,
245 NvEcStatus_Underflow,
246 NvEcStatus_InvalidState,
247 NvEcStatus_OEM0 = 0xd0,
248 NvEcStatus_OEM1,
249 NvEcStatus_OEM2,
250 NvEcStatus_OEM3,
251 NvEcStatus_OEM4,
252 NvEcStatus_OEM5,
253 NvEcStatus_OEM6,
254 NvEcStatus_OEM7,
255 NvEcStatus_OEM8,
256 NvEcStatus_OEM9,
257 NvEcStatus_OEM10,
258 NvEcStatus_OEM11,
259 NvEcStatus_OEM12,
260 NvEcStatus_OEM13,
261 NvEcStatus_OEM14,
262 NvEcStatus_OEM15,
263 NvEcStatus_OEM16,
264 NvEcStatus_OEM17,
265 NvEcStatus_OEM18,
266 NvEcStatus_OEM19,
267 NvEcStatus_OEM20,
268 NvEcStatus_OEM21,
269 NvEcStatus_OEM22,
270 NvEcStatus_OEM23,
271 NvEcStatus_OEM24,
272 NvEcStatus_OEM25,
273 NvEcStatus_OEM26,
274 NvEcStatus_OEM27,
275 NvEcStatus_OEM28,
276 NvEcStatus_OEM29,
277 NvEcStatus_OEM30,
278 NvEcStatus_OEM31,
279 NvEcStatus_UnspecifiedError = 0xff,
280 NvEcStatus_Num,
281 NvEcStatus_Force32 = 0x7FFFFFFF
282 } NvEcStatus;
283
284 /**
285 * EC Request Packet
286 */
287
288 typedef struct NvEcRequestRec
289 {
290 NvEcPacketType PacketType;
291 NvEcRequestResponseType RequestType;
292 NvEcRequestResponseSubtype RequestSubtype;
293 NvU32 RequestorTag;
294 NvU32 NumPayloadBytes;
295 NvU8 Payload[30];
296 } NvEcRequest;
297
298 #define NVEC_MIN_REQUEST_SIZE (offsetof(struct NvEcRequestRec, Payload[0]))
299
300 /**
301 * EC Response Packet
302 */
303
304 typedef struct NvEcResponseRec
305 {
306 NvEcPacketType PacketType;
307 NvEcRequestResponseType ResponseType;
308 NvEcRequestResponseSubtype ResponseSubtype;
309 NvU32 RequestorTag;
310 NvEcStatus Status;
311 NvU32 NumPayloadBytes;
312 NvU8 Payload[30];
313 } NvEcResponse;
314
315 #define NVEC_MIN_RESPONSE_SIZE (offsetof(struct NvEcResponseRec, Payload[0]))
316
317 /**
318 * EC Event Packet
319 */
320
321 typedef struct NvEcEventRec
322 {
323 NvEcPacketType PacketType;
324 NvEcEventType EventType;
325 NvEcStatus Status;
326 NvU32 NumPayloadBytes;
327 NvU8 Payload[30];
328 } NvEcEvent;
329
330 #define NVEC_MIN_EVENT_SIZE (offsetof(struct NvEcEventRec, Payload[0]))
331
332 /**
333 * EC power states
334 */
335
336 typedef enum
337 {
338 NvEcPowerState_PowerDown,
339 NvEcPowerState_Suspend,
340 NvEcPowerState_Restart,
341 NvEcPowerState_Num,
342 NvEcPowerState_Force32 = 0x7FFFFFFF
343 } NvEcPowerState;
344
345 /**
346 * Initialize and open a channel to the Embedded Controller (EC). This routine
347 * allocates the handle for the EC channel and returns it to the caller.
348 *
349 * @param phEc pointer to location where EC channel handles is to be stored
350 * @param InstanceId instance of EC to which a channel is to be opened
351 *
352 * @retval NvSuccess Channel has been successfully opened.
353 * @retval NvError_InsufficientMemory Routine was unable to allocate memory.
354 * @retval NvError_AlreadyAllocated Maximum number of channels have already
355 * been opened
356 * @retval NvError_NotSupported InstanceId is invalid
357 */
358
359 NvError NvEcOpen(
360 NvEcHandle * phEc,
361 NvU32 InstanceId );
362
363 /**
364 * Closes and de-initializes a channel to the Embedded Controller (EC). Also,
365 * frees memory allocated for the handle.
366 *
367 * @param hEc handle for EC channel
368 *
369 * @retval none
370 */
371
372 void NvEcClose(
373 NvEcHandle hEc );
374
375 /**
376 * Send a request to the EC. Then wait for the EC's response and return it to
377 * the caller. This routine blocks until the EC's response is received. The
378 * response is only valid if NvSuccess is returned.
379 *
380 * The request or response can fail due to time-out errors or transmission
381 * errors.
382 *
383 * If the EC sends a larger response packet than will fit in the provided
384 * buffer, the response will be truncated to fit within the available buffer and
385 * no error will be returned.
386 *
387 * @param hEc handle for EC channel
388 * @param pRequest pointer to buffer containing EC request
389 * @param pResponse pointer to buffer where EC response is to be stored
390 * @param RequestSize length of EC request buffer, in bytes
391 * @param ResponseSize length of EC response buffer, in bytes
392 *
393 * @retval NvSuccess Request was successfully sent to EC and a corresponding
394 * response was successfully received from the EC
395 * @retval NvError_TimeOut EC failed to respond within required time interval
396 * @retval NvError_InvalidSize Request or Response buffer is too small to hold
397 * minimum-size packet
398 * @retval NvError_BadSize Request or response size is incorrect
399 * @retval NvError_I2cWriteFailed Transmission error while sending request
400 * @retval NvError_I2cReadFailed Transmission error while receiving request
401 */
402
403 NvError NvEcSendRequest(
404 NvEcHandle hEc,
405 NvEcRequest * pRequest,
406 NvEcResponse * pResponse,
407 NvU32 RequestSize,
408 NvU32 ResponseSize );
409
410 /**
411 * Register the caller to receive certain types of events from the EC.
412 *
413 * The caller provides a list of the types of events to be received.
414 * Registering for an event type guarantees that all event packets of the
415 * specified type are delivered to the caller. If the caller fails to retrieve
416 * the event packet (via NvEcGetEvent), then EC communications will generally be
417 * stalled until such time as a buffer is provided. Thus, an ill-behaved client
418 * can impact systemwide performance.
419 *
420 * To avoid stalling EC communications, the caller can also provide a hint as to
421 * the amount of buffering that may be needed to account for any expected
422 * "burstiness" in the arrival of events. This allows stalling to be delayed
423 * until all buffers have been exhaused. Both the number of buffers and the
424 * size of each buffer is specified. Event Packets larger than the specified
425 * buffer size will be truncated to fit and no error will be reported.
426 *
427 * Finally, the caller provides a semaphore, which is to be signaled when an
428 * event (of the specified type) arrives. The caller can then wait on the
429 * semaphore, so as to block until an event occurs. The semaphone must be
430 * initialized to zero before being passed to this routine.
431 *
432 * @param hEc handle for EC channel
433 * @param phEcEventRegistration pointer to location where EC Event Registration
434 * handle is to be stored
435 * @param hSema handle for semaphore used to notify caller that an event has
436 * arrived. Semaphore must be initialized to zero.
437 * @param NumEventTypes number of entries in pEventTypes array
438 * @param pEventTypes pointer to an array of EC event types to be reported to
439 * the caller
440 * @param NumEventPackets number of event packets to buffer (hint)
441 * @param EventPacketSize size of each event packet buffer (hint), in bytes
442 *
443 * @retval NvSuccess Registration for events was successful
444 * @retval NvError_InsufficientMemory Routine was unable to allocate memory.
445 * @retval NvError_BadParameter Invalid event type specified
446 * @retval NvError_AlreadyAllocated Client has already registered for the
447 * specified event type
448 * @retval NvError_InvalidSize Buffer is too small to hold minimum-size Event
449 * Packet
450 */
451
452 NvError NvEcRegisterForEvents(
453 NvEcHandle hEc,
454 NvEcEventRegistrationHandle * phEcEventRegistration,
455 NvOsSemaphoreHandle hSema,
456 NvU32 NumEventTypes,
457 NvEcEventType * pEventTypes,
458 NvU32 NumEventPackets,
459 NvU32 EventPacketSize );
460
461 /**
462 * Retrieve pending Event Packet by copying contents into user-supplied buffer.
463 *
464 * If the user-supplied buffer is too small to hold the full payload of the
465 * Event Packet, then the payload will be truncated and no error will be
466 * returned.
467 *
468 * @param hEcEventRegistration EC Event Registration handle
469 * @param pEvent pointer to buffer where EC event is to be stored
470 * @param EventSize length of EC event buffer, in bytes
471 *
472 * @retval NvSuccess Event Packet retrieved successfully
473 * @retval NvError_InvalidSize Buffer is too small to hold minimum-size Event
474 * Packet
475 * @retval NvError_BadParameter Invalid handle
476 * @retval NvError_InvalidAddress Null buffer pointer
477 * @retval NvError_InvalidState No Event Packets available
478 */
479
480 NvError NvEcGetEvent(
481 NvEcEventRegistrationHandle hEcEventRegistration,
482 NvEcEvent * pEvent,
483 NvU32 EventSize );
484
485 /**
486 * Unregister the caller so that events previously registered for will no longer
487 * be received.
488 *
489 * @param hEcEventRegistration EC Event Registration handle
490 *
491 * @retval NvSuccess Caller successfully unregistered from specified events
492 * @retval NvError_BadParameter Invalid handle
493 */
494
495 NvError NvEcUnregisterForEvents(
496 NvEcEventRegistrationHandle hEcEventRegistration );
497
498 /**
499 * Configure driver and EC for new power state (suspend, powerdown, or restart)
500 *
501 * @param PowerState desired new power state
502 *
503 * @retval NvSuccess .
504 */
505
506 NvError NvEcPowerSuspend(
507 NvEcPowerState PowerState );
508
509 /**
510 * Power Resume.
511 *
512 * @param none
513 *
514 * @retval NvSuccess .
515 */
516
517 NvError NvEcPowerResume(
518 void );
519
520 /*******************************************************************************
521 *
522 * Request/Response details
523 *
524 */
525
526 /**
527 * Variable-length strings
528 *
529 * Variable-length strings in Response Packets may not be null-terminated.
530 * Maximum length for variable-length strings is defined below.
531 */
532
533 #define NVEC_MAX_RESPONSE_STRING_SIZE 30
534
535 /**
536 * Byte ordering
537 *
538 * Multi-byte integers in the payload section of Request, Response, and Event
539 * Packets are treated as byte arrays. The bytes are stored in little-endian
540 * order (least significant byte first, most significant byte last).
541 */
542
543 /*******************************************************************************
544 *
545 * System Request/Response details
546 *
547 */
548
549 /**
550 * System subtypes
551 */
552
553 typedef enum
554 {
555 NvEcSystemSubtype_GetStatus,
556 NvEcSystemSubtype_ConfigureEventReporting,
557 NvEcSystemSubtype_AcknowledgeSystemStatus,
558 NvEcSystemSubtype_ConfigureWake = 0xfd,
559
560 NvEcSystemSubtype_Num,
561 NvEcSystemSubtype_Max = 0x7fffffff
562 } NvEcSystemSubtype;
563
564 /**
565 * System payload data structures
566 */
567
568 typedef struct NvEcSystemGetStateResponsePayloadRec
569 {
570 NvU8 State[2]; // see NVEC_SYSTEM_STATE* #define's
571 NvU8 OemState[2];
572 } NvEcSystemGetStateResponsePayload;
573
574 #define NVEC_SYSTEM_STATE0_0_EC_RESET_RANGE 4:4
575 #define NVEC_SYSTEM_STATE0_0_AP_POWERDOWN_NOW_RANGE 3:3
576 #define NVEC_SYSTEM_STATE0_0_AP_SUSPEND_NOW_RANGE 2:2
577 #define NVEC_SYSTEM_STATE0_0_AP_RESTART_NOW_RANGE 1:1
578
579 #define NVEC_SYSTEM_STATE1_0_AC_RANGE 0:0
580 #define NVEC_SYSTEM_STATE1_0_AC_NOT_PRESENT 0x0
581 #define NVEC_SYSTEM_STATE1_0_AC_PRESENT 0x1
582
583 typedef struct NvEcSystemConfigureEventReportingRequestPayloadRec
584 {
585 NvU8 ReportEnable; // see NVEC_SYSTEM_REPORT_ENABLE* #define's
586 NvU8 SystemStateMask[2]; // see NVEC_SYSTEM_STATE* #define's
587 NvU8 OemStateMask[2];
588 } NvEcSystemConfigureEventReportingRequestPayload;
589
590 #define NVEC_SYSTEM_REPORT_ENABLE_0_ACTION_RANGE 7:0
591 #define NVEC_SYSTEM_REPORT_ENABLE_0_ACTION_DISABLE 0x0
592 #define NVEC_SYSTEM_REPORT_ENABLE_0_ACTION_ENABLE 0x1
593
594 typedef struct NvEcSystemAcknowledgeSystemStatusRequestPayloadRec
595 {
596 NvU8 SystemStateMask[2]; // see NVEC_SYSTEM_STATE* #define's
597 NvU8 OemStateMask[2];
598 } NvEcSystemAcknowledgeSystemStatusRequestPayload;
599
600 typedef struct NvEcSystemConfigureWakeRequestPayloadRec
601 {
602 NvU8 WakeEnable; // see NVEC_SYSTEM_WAKE_ENABLE* #define's
603 NvU8 SystemStateMask[2]; // see NVEC_SYSTEM_STATE* #define's
604 NvU8 OemStateMask[2];
605 } NvEcSystemConfigureWakeRequestPayload;
606
607 #define NVEC_SYSTEM_WAKE_ENABLE_0_ACTION_RANGE 7:0
608 #define NVEC_SYSTEM_WAKE_ENABLE_0_ACTION_DISABLE 0x0
609 #define NVEC_SYSTEM_WAKE_ENABLE_0_ACTION_ENABLE 0x1
610
611
612 /*******************************************************************************
613 *
614 * Battery Request/Response details
615 *
616 */
617
618 /**
619 * Battery subtypes
620 */
621
622 typedef enum
623 {
624 NvEcBatterySubtype_GetSlotStatus,
625 NvEcBatterySubtype_GetVoltage,
626 NvEcBatterySubtype_GetTimeRemaining,
627 NvEcBatterySubtype_GetCurrent,
628 NvEcBatterySubtype_GetAverageCurrent,
629 NvEcBatterySubtype_GetAveragingTimeInterval,
630 NvEcBatterySubtype_GetCapacityRemaining,
631 NvEcBatterySubtype_GetLastFullChargeCapacity,
632 NvEcBatterySubtype_GetDesignCapacity,
633 NvEcBatterySubtype_GetCriticalCapacity,
634 NvEcBatterySubtype_GetTemperature,
635 NvEcBatterySubtype_GetManufacturer,
636 NvEcBatterySubtype_GetModel,
637 NvEcBatterySubtype_GetType,
638 NvEcBatterySubtype_GetRemainingCapacityAlarm,
639 NvEcBatterySubtype_SetRemainingCapacityAlarm,
640 NvEcBatterySubtype_SetConfiguration,
641 NvEcBatterySubtype_GetConfiguration,
642 NvEcBatterySubtype_ConfigureEventReporting,
643 NvEcBatterySubtype_ConfigureWake = 0x1d,
644
645 NvEcBatterySubtype_Num,
646 NvEcBatterySubtype_Max = 0x7fffffff
647 } NvEcBatterySubtype;
648
649 #define NVEC_SUBTYPE_0_BATTERY_SLOT_RANGE 7:4
650 #define NVEC_SUBTYPE_0_BATTERY_INFO_RANGE 3:0
651
652 /**
653 * Battery payload data structures
654 */
655
656 typedef struct NvEcBatteryGetSlotStatusResponsePayloadRec
657 {
658 NvU8 SlotStatus; // see NVEC_BATTERY_SLOT_STATUS* #define's
659 NvU8 CapacityGauge;
660 } NvEcBatteryGetSlotStatusResponsePayload;
661
662 #define NVEC_BATTERY_SLOT_STATUS_0_CRITICAL_CAPACITY_ALARM_RANGE 3:3
663 #define NVEC_BATTERY_SLOT_STATUS_0_CRITICAL_CAPACITY_ALARM_UNSET 0x0
664 #define NVEC_BATTERY_SLOT_STATUS_0_CRITICAL_CAPACITY_ALARM_SET 0x1
665
666 #define NVEC_BATTERY_SLOT_STATUS_0_CHARGING_STATE_RANGE 2:1
667 #define NVEC_BATTERY_SLOT_STATUS_0_CHARGING_STATE_IDLE 0x0
668 #define NVEC_BATTERY_SLOT_STATUS_0_CHARGING_STATE_CHARGING 0x1
669 #define NVEC_BATTERY_SLOT_STATUS_0_CHARGING_STATE_DISCHARGING 0x2
670
671 #define NVEC_BATTERY_SLOT_STATUS_0_PRESENT_STATE_RANGE 0:0
672 #define NVEC_BATTERY_SLOT_STATUS_0_PRESENT_STATE_NOT_PRESENT 0x0
673 #define NVEC_BATTERY_SLOT_STATUS_0_PRESENT_STATE_PRESENT 0x1
674
675 typedef struct NvEcBatteryGetVoltageResponsePayloadRec
676 {
677 NvU8 PresentVoltage[2]; // 16-bit unsigned value, in mV
678 } NvEcBatteryGetVoltageResponsePayload;
679
680 typedef struct NvEcBatteryGetTimeRemainingResponsePayloadRec
681 {
682 NvU8 TimeRemaining[2]; // 16-bit unsigned value, in minutes
683 } NvEcBatteryGetTimeRemainingResponsePayload;
684
685 typedef struct NvEcBatteryGetCurrentResponsePayloadRec
686 {
687 NvU8 PresentCurrent[2]; // 16-bit signed value, in mA
688 } NvEcBatteryGetCurrentResponsePayload;
689
690 typedef struct NvEcBatteryGetAverageCurrentResponsePayloadRec
691 {
692 NvU8 AverageCurrent[2]; // 16-bit signed value, in mA
693 } NvEcBatteryGetAverageCurrentResponsePayload;
694
695 typedef struct NvEcBatteryGetAveragingTimeIntervalResponsePayloadRec
696 {
697 NvU8 TimeInterval[2]; // 16-bit unsigned value, in msec
698 } NvEcBatteryGetAveragingTimeIntervalResponsePayload;
699
700 typedef struct NvEcBatteryGetCapacityRemainingResponsePayloadRec
701 {
702 NvU8 CapacityRemaining[2]; // 16-bit unsigned value, in mAh or 10mWh
703 } NvEcBatteryGetCapacityRemainingResponsePayload;
704
705 typedef struct NvEcBatteryGetLastFullChargeCapacityResponsePayloadRec
706 {
707 NvU8 LastFullChargeCapacity[2]; // 16-bit unsigned value, in mAh or 10mW h
708 } NvEcBatteryGetLastFullChargeCapacityResponsePayload;
709
710 typedef struct NvEcBatteryGetDesignCapacityResponsePayloadRec
711 {
712 NvU8 DesignCapacity[2]; // 16-bit unsigned value, in mAh or 10mWh
713 } NvEcBatteryGetDesignCapacityResponsePayload;
714
715 typedef struct NvEcBatteryGetCriticalCapacityResponsePayloadRec
716 {
717 NvU8 CriticalCapacity[2]; // 16-bit unsigned value, in mAh or 10mWh
718 } NvEcBatteryGetCriticalCapacityResponsePayload;
719
720 typedef struct NvEcBatteryGetTemperatureResponsePayloadRec
721 {
722 NvU8 Temperature[2]; // 16-bit unsigned value, in 0.1 degrees Kelvin
723 } NvEcBatteryGetTemperatureResponsePayload;
724
725 typedef struct NvEcBatteryGetManufacturerResponsePayloadRec
726 {
727 char Manufacturer[NVEC_MAX_RESPONSE_STRING_SIZE];
728 } NvEcBatteryGetManufacturerResponsePayload;
729
730 typedef struct NvEcBatteryGetModelResponsePayloadRec
731 {
732 char Model[NVEC_MAX_RESPONSE_STRING_SIZE];
733 } NvEcBatteryGetModelResponsePayload;
734
735 typedef struct NvEcBatteryGetTypeResponsePayloadRec
736 {
737 char Type[NVEC_MAX_RESPONSE_STRING_SIZE];
738 } NvEcBatteryGetTypeResponsePayload;
739
740 typedef struct NvEcBatterySetRemainingCapacityAlarmRequestPayloadRec
741 {
742 NvU8 CapacityThreshold[2]; // 16-bit unsigned value, in mAh or 10mWh
743 } NvEcBatterySetRemainingCapacityAlarmRequestPayload;
744
745 typedef struct NvEcBatteryGetRemainingCapacityAlarmResponsePayloadRec
746 {
747 NvU8 CapacityThreshold[2]; // 16-bit unsigned value, in mAh or 10mWh
748 } NvEcBatteryGetRemainingCapacityAlarmResponsePayload;
749
750 typedef struct NvEcBatterySetConfigurationRequestPayloadRec
751 {
752 NvU8 Configuration; // see NVEC_BATTERY_CONFIGURATION* #define's
753 } NvEcBatterySetConfigurationRequestPayload;
754
755 #define NVEC_BATTERY_CONFIGURATION_0_CAPACITY_UNITS_RANGE 0:0
756 #define NVEC_BATTERY_CONFIGURATION_0_CAPACITY_UNITS_MAH 0x0
757 #define NVEC_BATTERY_CONFIGURATION_0_CAPACITY_UNITS_10MWH 0x1
758
759 typedef struct NvEcBatteryGetConfigurationResponsePayloadRec
760 {
761 NvU8 Configuration; // see NVEC_BATTERY_CONFIGURATION* #define's
762 } NvEcBatteryGetConfigurationResponsePayload;
763
764 typedef struct NvEcBatteryConfigureEventReportingRequestPayloadRec
765 {
766 NvU8 ReportEnable; // see NVEC_BATTERY_REPORT_ENABLE* #define's
767 NvU8 EventTypes; // see NVEC_BATTERY_EVENT_TYPE* #define's
768 } NvEcBatteryConfigureEventReportingRequestPayload;
769
770 #define NVEC_BATTERY_REPORT_ENABLE_0_ACTION_RANGE 7:0
771 #define NVEC_BATTERY_REPORT_ENABLE_0_ACTION_DISABLE 0x0
772 #define NVEC_BATTERY_REPORT_ENABLE_0_ACTION_ENABLE 0x1
773
774 #define NVEC_BATTERY_EVENT_TYPE_0_REMAINING_CAPACITY_ALARM_RANGE 2:2
775 #define NVEC_BATTERY_EVENT_TYPE_0_REMAINING_CAPACITY_ALARM_ENABLE 0x0
776 #define NVEC_BATTERY_EVENT_TYPE_0_REMAINING_CAPACITY_ALARM_DISABLE 0x1
777
778 #define NVEC_BATTERY_EVENT_TYPE_0_CHARGING_STATE_RANGE 1:1
779 #define NVEC_BATTERY_EVENT_TYPE_0_CHARGING_STATE_ENABLE 0x0
780 #define NVEC_BATTERY_EVENT_TYPE_0_CHARGING_STATE_DISABLE 0x1
781
782 #define NVEC_BATTERY_EVENT_TYPE_0_PRESENT_STATE_RANGE 0:0
783 #define NVEC_BATTERY_EVENT_TYPE_0_PRESENT_STATE_ENABLE 0x0
784 #define NVEC_BATTERY_EVENT_TYPE_0_PRESENT_STATE_DISABLE 0x1
785
786 typedef struct NvEcBatteryConfigureWakeRequestPayloadRec
787 {
788 NvU8 WakeEnable; // see NVEC_BATTERY_WAKE_ENABLE* #define's
789 NvU8 EventTypes; // see NVEC_BATTERY_EVENT_TYPE* #define's
790 } NvEcBatteryConfigureWakeRequestPayload;
791
792 #define NVEC_BATTERY_WAKE_ENABLE_ACTION_RANGE 7:0
793 #define NVEC_BATTERY_WAKE_ENABLE_ACTION_DISABLE 0x0
794 #define NVEC_BATTERY_WAKE_ENABLE_ACTION_ENABLE 0x1
795
796 /*******************************************************************************
797 *
798 * Gpio Request/Response details
799 *
800 */
801
802 /**
803 * Gpio subtypes
804 */
805
806 typedef enum
807 {
808 NvEcGpioSubtype_ConfigurePin,
809 NvEcGpioSubtype_SetPinScalar,
810 NvEcGpioSubtype_GetPinScalar,
811 NvEcGpioSubtype_ConfigureEventReportingScalar,
812 NvEcGpioSubtype_AcknowledgeEventReportScalar,
813
814 NvEcGpioSubtype_GetEventReportScalar = 0x6,
815
816 NvEcGpioSubtype_ConfigureWakeScalar = 0x1d,
817
818 NvEcGpioSubtype_SetPinVector = 0x21,
819 NvEcGpioSubtype_GetPinVector,
820 NvEcGpioSubtype_ConfigureEventReportingVector,
821 NvEcGpioSubtype_AcknowledgeEventReportVector,
822
823 NvEcGpioSubtype_GetEventReportVector = 0x26,
824
825 NvEcGpioSubtype_ConfigureWakeVector = 0x3d,
826
827 NvEcGpioSubtype_Num,
828 NvEcGpioSubtype_Max = 0x7fffffff
829 } NvEcGpioSubtype;
830
831 /**
832 * Gpio payload data structures
833 */
834
835 typedef struct NvEcGpioConfigurePinRequestPayloadRec
836 {
837 NvU8 Configuration[2]; // see NVEC_GPIO_CONFIGURATION* #define's
838 NvU8 LogicalPinNumber;
839 } NvEcGpioConfigurePinRequestPayload;
840
841 #define NVEC_GPIO_CONFIGURATION0_0_MODE_RANGE 7:5
842 #define NVEC_GPIO_CONFIGURATION0_0_MODE_INPUT 0x0
843 #define NVEC_GPIO_CONFIGURATION0_0_MODE_OUTPUT 0x1
844 #define NVEC_GPIO_CONFIGURATION0_0_MODE_TRISTATE 0x2
845 #define NVEC_GPIO_CONFIGURATION0_0_MODE_UNUSED 0x3
846
847 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_RANGE 4:2
848 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_NONE 0x0
849 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_RISING_EDGE 0x1
850 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_FALLING_EDGE 0x2
851 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_ANY_EDGE 0x3
852 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_LO_LEVEL 0x4
853 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_HI_LEVEL 0x5
854 #define NVEC_GPIO_CONFIGURATION0_0_EVENT_TRIGGER_TYPE_LEVEL_CHANGE 0x6
855
856 #define NVEC_GPIO_CONFIGURATION0_0_PULL_RANGE 1:0
857 #define NVEC_GPIO_CONFIGURATION0_0_PULL_NONE 0x0
858 #define NVEC_GPIO_CONFIGURATION0_0_PULL_DOWN 0x1
859 #define NVEC_GPIO_CONFIGURATION0_0_PULL_UP 0x2
860
861 #define NVEC_GPIO_CONFIGURATION0_0_OUTPUT_DRIVE_TYPE_RANGE 7:6
862 #define NVEC_GPIO_CONFIGURATION0_0_OUTPUT_DRIVE_TYPE_PUSH_PULL 0x0
863 #define NVEC_GPIO_CONFIGURATION0_0_OUTPUT_DRIVE_TYPE_OPEN_DRAIN 0x1
864
865 #define NVEC_GPIO_CONFIGURATION0_0_SCHMITT_TRIGGER_RANGE 5:5
866 #define NVEC_GPIO_CONFIGURATION0_0_SCHMITT_TRIGGER_DISABLE 0x0
867 #define NVEC_GPIO_CONFIGURATION0_0_SCHMITT_TRIGGER_ENABLE 0x1
868
869 /**
870 * GPIO scalar payload data structures
871 */
872
873 typedef struct NvEcGpioSetPinScalarRequestPayloadRec
874 {
875 NvU8 DriveLevel; // see NVEC_GPIO_DRIVE_LEVEL* #define's
876 NvU8 LogicalPinNumber;
877 } NvEcGpioSetPinScalarRequestPayload;
878
879 #define NVEC_GPIO_DRIVE_LEVEL_0_DRIVE_LEVEL_RANGE 0:0
880 #define NVEC_GPIO_DRIVE_LEVEL_0_DRIVE_LEVEL_LOGICAL_LO 0x0
881 #define NVEC_GPIO_DRIVE_LEVEL_0_DRIVE_LEVEL_LOGICAL_HI 0x1
882
883 typedef struct NvEcGpioGetPinScalarRequestPayloadRec
884 {
885 NvU8 LogicalPinNumber;
886 } NvEcGpioGetPinScalarRequestPayload;
887
888 typedef struct NvEcGpioGetPinScalarResponsePayloadRec
889 {
890 NvU8 DriveLevel; // see NVEC_GPIO_DRIVE_LEVEL* #define's
891 } NvEcGpioGetPinScalarResponsePayload;
892
893 typedef struct NvEcGpioConfigureEventReportingScalarRequestPayloadRec
894 {
895 NvU8 ReportEnable; // 0x0 to disable, 0x1 to enable
896 NvU8 LogicalPinNumber;
897 } NvEcGpioConfigureEventReportingScalarRequestPayload;
898
899 typedef struct NvEcGpioAcknowledgeEventReportScalarRequestPayloadRec
900 {
901 NvU8 LogicalPinNumber;
902 } NvEcGpioAcknowledgeEventReportScalarRequestPayload;
903
904 typedef struct NvEcGpioGetEventReportScalarRequestPayloadRec
905 {
906 NvU8 LogicalPinNumber;
907 } NvEcGpioGetEventReportScalarRequestPayload;
908
909 typedef struct NvEcGpioGetEventReportScalarResponsePayloadRec
910 {
911 NvU8 TriggerStatus; // see NVEC_GPIO_TRIGGER_STATUS* #define's
912 } NvEcGpioGetEventReportScalarResponsePayload;
913
914 #define NVEC_GPIO_TRIGGER_STATUS_0_TRIGGER_STATUS_RANGE 0:0
915 #define NVEC_GPIO_TRIGGER_STATUS_0_TRIGGER_STATUS_NO_EVENT_DETECTED 0x0
916 #define NVEC_GPIO_TRIGGER_STATUS_0_TRIGGER_STATUS_EVENT_DETECTED 0x1
917
918 typedef struct NvEcGpioConfigureWakeScalarRequestPayloadRec
919 {
920 NvU8 WakeEnable; // 0x0 to disable, 0x1 to enable
921 NvU8 LogicalPinNumber;
922 } NvEcGpioConfigureWakeScalarRequestPayload;
923
924 /**
925 * GPIO vector payload data structures
926 */
927
928 #define NVEC_GPIO_MAX_BIT_VECTOR_BYTES 24
929
930 typedef struct NvEcGpioSetPinVectorRequestPayloadRec
931 {
932 NvU8 DriveLevel; // see NVEC_GPIO_DRIVE_LEVEL* #define's
933 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
934 } NvEcGpioSetPinVectorRequestPayload;
935
936 typedef struct NvEcGpioGetPinVectorRequestPayloadRec
937 {
938 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
939 } NvEcGpioGetPinVectorRequestPayload;
940
941 typedef struct NvEcGpioGetPinVectorResponsePayloadRec
942 {
943 NvU8 DriveLevelBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
944 } NvEcGpioGetPinVectorResponsePayload;
945
946 typedef struct NvEcGpioConfigureEventReportingVectorRequestPayloadRec
947 {
948 NvU8 ReportEnable; // see NVEC_GPIO_REPORT_ENABLE* #define's
949 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
950 } NvEcGpioConfigureEventReportingVectorRequestPayload;
951
952 #define NVEC_GPIO_REPORT_ENABLE_0_ACTION_RANGE 7:0
953 #define NVEC_GPIO_REPORT_ENABLE_0_ACTION_DISABLE 0x0
954 #define NVEC_GPIO_REPORT_ENABLE_0_ACTION_ENABLE 0x1
955
956 typedef struct NvEcGpioAcknowledgeEventReportVectorRequestPayloadRec
957 {
958 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
959 } NvEcGpioAcknowledgeEventReportVectorRequestPayload;
960
961 typedef struct NvEcGpioGetEventReportVectorRequestPayloadRec
962 {
963 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
964 } NvEcGpioGetEventReportVectorRequestPayload;
965
966 typedef struct NvEcGpioGetEventReportVectorResponsePayloadRec
967 {
968 NvU8 TriggerStatusBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
969 } NvEcGpioGetEventReportVectorResponsePayload;
970
971 typedef struct NvEcGpioConfigureWakeVectorRequestPayloadRec
972 {
973 NvU8 WakeEnable; // see NVEC_GPIO_WAKE_ENABLE* #define's
974 NvU8 PinSelectionBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
975 } NvEcGpioConfigureWakeVectorRequestPayload;
976
977 #define NVEC_GPIO_WAKE_ENABLE_0_ACTION_RANGE 7:0
978 #define NVEC_GPIO_WAKE_ENABLE_0_ACTION_DISABLE 0x0
979 #define NVEC_GPIO_WAKE_ENABLE_0_ACTION_ENABLE 0x1
980
981 /*******************************************************************************
982 *
983 * Sleep Request/Response details
984 *
985 */
986
987 /**
988 * Sleep subtypes
989 */
990
991 typedef enum
992 {
993 NvEcSleepSubtype_GlobalConfigureEventReporting,
994
995 NvEcSleepSubtype_ApPowerDown = 0x1,
996 NvEcSleepSubtype_ApSuspend = 0x2,
997 NvEcSleepSubtype_ApRestart = 0x3,
998
999 NvEcSleepSubtype_Num,
1000 NvEcSleepSubtype_Max = 0x7fffffff
1001 } NvEcSleepSubtype;
1002
1003 /**
1004 * Sleep payload data structures
1005 */
1006
1007 typedef struct NvEcSleepGlobalConfigureEventReportingRequestPayloadRec
1008 {
1009 NvU8 GlobalReportEnable; // see NVEC_SLEEP_GLOBAL_REPORT_ENABLE* #define 's
1010 } NvEcSleepGlobalConfigureEventReportingRequestPayload;
1011
1012 #define NVEC_SLEEP_GLOBAL_REPORT_ENABLE_0_ACTION_RANGE 7:0
1013 #define NVEC_SLEEP_GLOBAL_REPORT_ENABLE_0_ACTION_DISABLE 0x0
1014 #define NVEC_SLEEP_GLOBAL_REPORT_ENABLE_0_ACTION_ENABLE 0x1
1015
1016 /*******************************************************************************
1017 *
1018 * Keyboard Request/Response details
1019 *
1020 */
1021
1022 /**
1023 * Keyboard subtypes
1024 */
1025
1026 typedef enum
1027 {
1028 NvEcKeyboardSubtype_ConfigureWake = 0x3,
1029 NvEcKeyboardSubtype_ConfigureWakeKeyReport,
1030
1031 NvEcKeyboardSubtype_Reset = 0xff,
1032 NvEcKeyboardSubtype_Enable = 0xf4,
1033 NvEcKeyboardSubtype_Disable = 0xf5,
1034 NvEcKeyboardSubtype_SetScanCodeSet = 0xf1,
1035 NvEcKeyboardSubtype_GetScanCodeSet = 0xf0,
1036 NvEcKeyboardSubtype_SetLeds = 0xed,
1037
1038 NvEcKeyboardSubtype_Num,
1039 NvEcKeyboardSubtype_Max = 0x7fffffff
1040 } NvEcKeyboardSubtype;
1041
1042 /**
1043 * Keyboard payload data structures
1044 */
1045
1046 typedef struct NvEcKeyboardConfigureWakeRequestPayloadRec
1047 {
1048 NvU8 WakeEnable; // see NVEC_KEYBOARD_WAKE_ENABLE* #define's
1049 NvU8 EventTypes; // see NVEC_KEYBOARD_EVENT_TYPE* #define's
1050 } NvEcKeyboardConfigureWakeRequestPayload;
1051
1052 #define NVEC_KEYBOARD_WAKE_ENABLE_0_ACTION_RANGE 7:0
1053 #define NVEC_KEYBOARD_WAKE_ENABLE_0_ACTION_DISABLE 0x0
1054 #define NVEC_KEYBOARD_WAKE_ENABLE_0_ACTION_ENABLE 0x1
1055
1056 #define NVEC_KEYBOARD_EVENT_TYPE_0_SPECIAL_KEY_PRESS_RANGE 1:1
1057 #define NVEC_KEYBOARD_EVENT_TYPE_0_SPECIAL_KEY_PRESS_DISABLE 0x0
1058 #define NVEC_KEYBOARD_EVENT_TYPE_0_SPECIAL_KEY_PRESS_ENABLE 0x1
1059
1060 #define NVEC_KEYBOARD_EVENT_TYPE_0_ANY_KEY_PRESS_RANGE 0:0
1061 #define NVEC_KEYBOARD_EVENT_TYPE_0_ANY_KEY_PRESS_DISABLE 0x0
1062 #define NVEC_KEYBOARD_EVENT_TYPE_0_ANY_KEY_PRESS_ENABLE 0x1
1063
1064 typedef struct NvEcKeyboardConfigureWakeKeyReportingRequestPayloadRec
1065 {
1066 NvU8 ReportWakeKey; // see NVEC_KEYBOARD_REPORT_WAKE_KEY* #define's
1067 } NvEcKeyboardConfigureWakeKeyReportingRequestPayload;
1068
1069 #define NVEC_KEYBOARD_REPORT_WAKE_KEY_0_ACTION_RANGE 7:0
1070 #define NVEC_KEYBOARD_REPORT_WAKE_KEY_0_ACTION_DISABLE 0x0
1071 #define NVEC_KEYBOARD_REPORT_WAKE_KEY_0_ACTION_ENABLE 0x1
1072
1073 typedef struct NvEcKeyboardSetScanCodeSetRequestPayloadRec
1074 {
1075 NvU8 ScanSet;
1076 } NvEcKeyboardSetScanCodeSetRequestPayload;
1077
1078 typedef struct NvEcKeyboardGetScanCodeSetResponsePayloadRec
1079 {
1080 NvU8 ScanSet;
1081 } NvEcKeyboardGetScanCodeSetResponsePayload;
1082
1083 typedef struct NvEcKeyboardSetLedsRequestPayloadRec
1084 {
1085 NvU8 LedFlag; // see NVEC_KEYBOARD_SET_LEDS* #define's
1086 } NvEcKeyboardSetLedsRequestPayload;
1087
1088 #define NVEC_KEYBOARD_SET_LEDS_0_SCROLL_LOCK_LED_RANGE 2:2
1089 #define NVEC_KEYBOARD_SET_LEDS_0_SCROLL_LOCK_LED_ON 0x1
1090 #define NVEC_KEYBOARD_SET_LEDS_0_SCROLL_LOCK_LED_OFF 0x0
1091
1092 #define NVEC_KEYBOARD_SET_LEDS_0_NUM_LOCK_LED_RANGE 1:1
1093 #define NVEC_KEYBOARD_SET_LEDS_0_NUM_LOCK_LED_ON 0x1
1094 #define NVEC_KEYBOARD_SET_LEDS_0_NUM_LOCK_LED_OFF 0x0
1095
1096 #define NVEC_KEYBOARD_SET_LEDS_0_CAPS_LOCK_LED_RANGE 0:0
1097 #define NVEC_KEYBOARD_SET_LEDS_0_CAPS_LOCK_LED_ON 0x1
1098 #define NVEC_KEYBOARD_SET_LEDS_0_CAPS_LOCK_LED_OFF 0x0
1099
1100
1101 /*******************************************************************************
1102 *
1103 * AuxDevice Request/Response details
1104 *
1105 */
1106
1107 /**
1108 * AuxDevice subtypes
1109 *
1110 * Note that for AuxDevice's the subtype setting contains two bit-fields which
1111 * encode the following information --
1112 * * port id on which operation is to be performed
1113 * * operation subtype to perform
1114 */
1115
1116 typedef enum
1117 {
1118 NvEcAuxDeviceSubtype_Reset,
1119 NvEcAuxDeviceSubtype_SendCommand,
1120 NvEcAuxDeviceSubtype_ReceiveBytes,
1121 NvEcAuxDeviceSubtype_AutoReceiveBytes,
1122 NvEcAuxDeviceSubtype_CancelAutoReceive,
1123 NvEcAuxDeviceSubtype_SetCompression,
1124
1125 NvEcAuxDeviceSubtype_ConfigureWake = 0x3d,
1126
1127 NvEcAuxDeviceSubtype_Num,
1128 NvEcAuxDeviceSubtype_Max = 0x7fffffff
1129 } NvEcAuxDeviceSubtype;
1130
1131 #define NVEC_SUBTYPE_0_AUX_PORT_ID_RANGE 7:6
1132
1133 #define NVEC_SUBTYPE_0_AUX_PORT_ID_0 0x0
1134 #define NVEC_SUBTYPE_0_AUX_PORT_ID_1 0x1
1135 #define NVEC_SUBTYPE_0_AUX_PORT_ID_2 0x2
1136 #define NVEC_SUBTYPE_0_AUX_PORT_ID_3 0x3
1137
1138 #define NVEC_SUBTYPE_0_AUX_PORT_SUBTYPE_RANGE 5:0
1139
1140 /**
1141 * AuxDevice payload data structures
1142 */
1143
1144 typedef struct NvEcAuxDeviceSendCommandRequestPayloadRec
1145 {
1146 NvU8 Operation;
1147 NvU8 NumBytesToReceive;
1148 } NvEcAuxDeviceSendCommandRequestPayload;
1149
1150 typedef struct NvEcAuxDeviceReceiveBytesRequestPayloadRec
1151 {
1152 NvU8 NumBytesToReceive;
1153 } NvEcAuxDeviceReceiveBytesRequestPayload;
1154
1155 typedef struct NvEcAuxDeviceAutoReceiveBytesRequestPayloadRec
1156 {
1157 NvU8 NumBytesToReceive;
1158 } NvEcAuxDeviceAutoReceiveBytesRequestPayload;
1159
1160 typedef struct NvEcAuxDeviceSetCompressionRequestPayloadRec
1161 {
1162 NvU8 CompressionEnable; // see NVEC_AUX_DEVICE_SET_COMPRESSION* #define' s
1163 } NvEcAuxDeviceSetCompressionRequestPayload;
1164
1165 #define NVEC_AUX_DEVICE_COMPRESSION_ENABLE_0_ACTION_RANGE 0:0
1166 #define NVEC_AUX_DEVICE_COMPRESSION_ENABLE_0_ACTION_DISABLE 0x0
1167 #define NVEC_AUX_DEVICE_COMPRESSION_ENABLE_0_ACTION_ENABLE 0x1
1168
1169 typedef struct NvEcAuxDeviceConfigureWakeRequestPayloadRec
1170 {
1171 NvU8 WakeEnable; // see NVEC_AUX_DEVICE_WAKE_ENABLE* #define's
1172 NvU8 EventTypes; // see NVEC_AUX_DEVICE_EVENT_TYPE* #define's
1173 } NvEcAuxDeviceConfigureWakeRequestPayload;
1174
1175 #define NVEC_AUX_DEVICE_WAKE_ENABLE_0_ACTION_RANGE 7:0
1176 #define NVEC_AUX_DEVICE_WAKE_ENABLE_0_ACTION_DISABLE 0x0
1177 #define NVEC_AUX_DEVICE_WAKE_ENABLE_0_ACTION_ENABLE 0x1
1178
1179 #define NVEC_AUX_DEVICE_EVENT_TYPE_0_ANY_EVENT_RANGE 0:0
1180 #define NVEC_AUX_DEVICE_EVENT_TYPE_0_ANY_EVENT_DISABLE 0x0
1181 #define NVEC_AUX_DEVICE_EVENT_TYPE_0_ANY_EVENT_ENABLE 0x1
1182
1183
1184 /*******************************************************************************
1185 *
1186 * Control Request/Response details
1187 *
1188 */
1189
1190 /**
1191 * Control subtypes
1192 */
1193
1194 typedef enum
1195 {
1196 NvEcControlSubtype_Reset,
1197 NvEcControlSubtype_SelfTest,
1198 NvEcControlSubtype_NoOperation,
1199
1200 NvEcControlSubtype_GetSpecVersion = 0x10,
1201 NvEcControlSubtype_GetCapabilities,
1202 NvEcControlSubtype_GetConfiguration,
1203 NvEcControlSubtype_GetProductName = 0x14,
1204 NvEcControlSubtype_GetFirmwareVersion,
1205
1206 NvEcControlSubtype_InitializeGenericConfiguration = 0x20,
1207 NvEcControlSubtype_SendGenericConfigurationBytes,
1208 NvEcControlSubtype_FinalizeGenericConfiguration,
1209
1210 NvEcControlSubtype_InitializeFirmwareUpdate = 0x30,
1211 NvEcControlSubtype_SendFirmwareBytes,
1212 NvEcControlSubtype_FinalizeFirmwareUpdate,
1213 NvEcControlSubtype_PollFirmwareUpdate,
1214
1215 NvEcControlSubtype_GetFirmwareSize = 0x40,
1216 NvEcControlSubtype_ReadFirmwareBytes,
1217
1218 NvEcControlSubtype_Num,
1219 NvEcControlSubtype_Max = 0x7fffffff
1220 } NvEcControlSubtype;
1221
1222 /**
1223 * Control payload data structures
1224 */
1225
1226 typedef struct NvEcControlGetSpecVersionResponsePayloadRec
1227 {
1228 NvU8 Version;
1229 } NvEcControlGetSpecVersionResponsePayload;
1230
1231 // extract 4-bit major version number from 8-bit version number
1232 #define NVEC_SPEC_VERSION_MAJOR(x) (((x)>>4) & 0xf)
1233
1234 // extract 4-bit minor version number from 8-bit version number
1235 #define NVEC_SPEC_VERSION_MINOR(x) ((x) & 0xf)
1236
1237 // assemble 8-bit version number from 4-bit major version number
1238 // and 4-bit minor version number
1239 #define NVEC_SPEC_VERSION(major, minor) ((((major)&0xf) << 4) | ((minor)&0xf))
1240
1241 #define NVEC_SPEC_VERSION_1_0 NVEC_SPEC_VERSION(1,0)
1242
1243 typedef struct NvEcControlGetCapabilitiesResponsePayloadRec
1244 {
1245 NvU8 Capabilities[2]; // see NVEC_CONTROL_CAPABILITIES* #define's
1246 NvU8 OEMCapabilities[2];
1247 } NvEcControlGetCapabilitiesResponsePayload;
1248
1249 #define NVEC_CONTROL_CAPABILITIES0_0_FIXED_SIZE_EVENT_PACKET_RANGE 4:4
1250 #define NVEC_CONTROL_CAPABILITIES0_0_FIXED_SIZE_EVENT_PACKET_NOT_SUPPORTED 0x0
1251 #define NVEC_CONTROL_CAPABILITIES0_0_FIXED_SIZE_EVENT_PACKET_SUPPORTED 0x1
1252
1253 #define NVEC_CONTROL_CAPABILITIES0_0_NON_EC_WAKE_RANGE 3:3
1254 #define NVEC_CONTROL_CAPABILITIES0_0_NON_EC_WAKE_NOT_SUPPORTED 0x0
1255 #define NVEC_CONTROL_CAPABILITIES0_0_NON_EC_WAKE_SUPPORTED 0x1
1256
1257 #define NVEC_CONTROL_CAPABILITIES0_0_GENERIC_CONFIGURATION_RANGE 0:0
1258 #define NVEC_CONTROL_CAPABILITIES0_0_GENERIC_CONFIGURATION_NOT_SUPPORTED 0x0
1259 #define NVEC_CONTROL_CAPABILITIES0_0_GENERIC_CONFIGURATION_SUPPORTED 0x1
1260
1261 typedef struct NvEcControlGetConfigurationResponsePayloadRec
1262 {
1263 NvU8 Configuration[2]; // see NVEC_CONTROL_CONFIGURATION* #define's
1264 NvU8 OEMConfiguration[2];
1265 } NvEcControlGetConfigurationResponsePayload;
1266
1267 #define NVEC_CONTROL_CONFIGURATION0_0_NUM_AUX_DEVICE_PORTS_RANGE 5:4
1268 #define NVEC_CONTROL_CONFIGURATION0_0_NUM_BATTERY_SLOTS_RANGE 3:0
1269
1270 typedef struct NvEcControlGetProductNameResponsePayloadRec
1271 {
1272 char ProductName[NVEC_MAX_RESPONSE_STRING_SIZE];
1273 } NvEcControlGetProductNameResponsePayload;
1274
1275 typedef struct NvEcControlGetFirmwareVersionResponsePayloadRec
1276 {
1277 NvU8 VersionMinor[2];
1278 NvU8 VersionMajor[2];
1279 } NvEcControlGetFirmwareVersionResponsePayload;
1280
1281 typedef struct NvEcControlInitializeGenericConfigurationRequestPayloadRec
1282 {
1283 NvU8 ConfigurationId[4];
1284 } NvEcControlInitializeGenericConfigurationRequestPayload;
1285
1286 typedef struct NvEcControlSendGenericConfigurationBytesResponsePayloadRec
1287 {
1288 NvU8 NumBytes[4];
1289 } NvEcControlSendGenericConfigurationBytesResponsePayload;
1290
1291 typedef struct NvEcControlSendFirmwareBytesResponsePayloadRec
1292 {
1293 NvU8 NumBytes[4];
1294 } NvEcControlSendFirmwareBytesResponsePayload;
1295
1296 typedef struct NvEcControlPollFirmwareUpdateResponsePayloadRec
1297 {
1298 NvU8 Flag; // see NVEC_CONTROL_POLL_FIRMWARE_UPDATE* #define's
1299 } NvEcControlPollFirmwareUpdateResponsePayload;
1300
1301 #define NVEC_CONTROL_POLL_FIRMWARE_UPDATE_0_FLAG_RANGE 7:0
1302 #define NVEC_CONTROL_POLL_FIRMWARE_UPDATE_0_FLAG_BUSY 0x0
1303 #define NVEC_CONTROL_POLL_FIRMWARE_UPDATE_0_FLAG_READY 0x1
1304
1305 typedef struct NvEcControlGetFirmwareSizeResponsePayloadRec
1306 {
1307 NvU8 NumBytes[4];
1308 } NvEcControlGetFirmwareSizeResponsePayload;
1309
1310
1311 /*******************************************************************************
1312 *
1313 * Keyboard Event details
1314 *
1315 */
1316
1317 // there are no predefined structures for payload content; only the higher-level
1318 // keyboard driver will know how to interpret the payload data
1319
1320 /*******************************************************************************
1321 *
1322 * Auxiliary Device Event details
1323 *
1324 */
1325
1326 // there are no predefined structures for payload content; only the higher-level
1327 // auxiliary device driver will know how to interpret the payload data
1328
1329 /*******************************************************************************
1330 *
1331 * System Event details
1332 *
1333 */
1334
1335 typedef struct NvEcSystemEventPayloadRec
1336 {
1337 NvU8 State[2]; // see NVEC_SYSTEM_STATE* #define's
1338 NvU8 OEMState[2];
1339 } NvEcSystemEventPayload;
1340
1341 /*******************************************************************************
1342 *
1343 * GPIO Scalar Event details
1344 *
1345 */
1346
1347 typedef struct NvEcGpioScalarEventPayloadRec
1348 {
1349 NvU8 LogicalPinNumber;
1350 } NvEcGpioScalarEventPayload;
1351
1352 /*******************************************************************************
1353 *
1354 * GPIO Vector Event details
1355 *
1356 */
1357
1358 typedef struct NvEcGpioVectorEventPayloadRec
1359 {
1360 NvU8 TriggerStatusBitVector[NVEC_GPIO_MAX_BIT_VECTOR_BYTES];
1361 } NvEcGpioVectorEventPayload;
1362
1363 /*******************************************************************************
1364 *
1365 * Battery Event details
1366 *
1367 */
1368
1369 typedef struct NvEcBatteryEventPayloadRec
1370 {
1371 NvU8 SlotNumber;
1372 NvU8 SlotStatus; // see NVEC_BATTERY_SLOT_STATUS* #define's
1373 } NvEcBatteryEventPayload;
1374
1375
1376 /*******************************************************************************
1377 *
1378 * Generic Configuration Package Header
1379 *
1380 */
1381
1382 typedef struct NvEcGenericConfigurationPackageHeaderRec
1383 {
1384 NvU8 MagicNumber[4]; // see NVEC_GENERIC_CONFIGURATION_MAGIC* #define's
1385 NvU8 SpecVersion;
1386 NvU8 Reserved0;
1387 char ProductName[NVEC_MAX_RESPONSE_STRING_SIZE];
1388 NvU8 FirmwareVersionMinor[2];
1389 NvU8 FirmwareVersionMajor[2];
1390 NvU8 ConfigurationID[4];
1391 NvU8 BodyLength[4];
1392 NvU8 Checksum[4]; // CRC-32 from IEEE 802.3
1393 } NvEcGenericConfigurationPackageHeader;
1394
1395 #define NVEC_GENERIC_CONFIGURATION_MAGIC_HEADER_NUMBER_BYTE_0 'c'
1396 #define NVEC_GENERIC_CONFIGURATION_MAGIC_HEADER_NUMBER_BYTE_1 'n'
1397 #define NVEC_GENERIC_CONFIGURATION_MAGIC_HEADER_NUMBER_BYTE_2 'f'
1398 #define NVEC_GENERIC_CONFIGURATION_MAGIC_HEADER_NUMBER_BYTE_3 'g'
1399
1400 /*******************************************************************************
1401 *
1402 * Firmware Update Package Header
1403 *
1404 */
1405
1406 typedef struct NvEcFirmwareUpdatePackageHeaderRec
1407 {
1408 NvU8 MagicNumber[4]; // see NVEC_FIRMWARE_UPDATE_MAGIC* #define's
1409 NvU8 SpecVersion;
1410 NvU8 Reserved0;
1411 char ProductName[NVEC_MAX_RESPONSE_STRING_SIZE];
1412 NvU8 FirmwareVersionMinor[2];
1413 NvU8 FirmwareVersionMajor[2];
1414 NvU8 BodyLength[4];
1415 NvU8 Checksum[4]; // CRC-32 from IEEE 802.3
1416 } NvEcFirmwareUpdatePackageHeader;
1417
1418 #define NVEC_FIRMWARE_UPDATE_HEADER_MAGIC_NUMBER_BYTE_0 'u'
1419 #define NVEC_FIRMWARE_UPDATE_HEADER_MAGIC_NUMBER_BYTE_1 'p'
1420 #define NVEC_FIRMWARE_UPDATE_HEADER_MAGIC_NUMBER_BYTE_2 'd'
1421 #define NVEC_FIRMWARE_UPDATE_HEADER_MAGIC_NUMBER_BYTE_3 't'
1422
1423
1424 #if defined(__cplusplus)
1425 }
1426 #endif
1427
1428 #endif
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvddk_usbphy.h ('k') | arch/arm/mach-tegra/nv/include/nvec_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698