Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / wmi / wmi_internal.h
1 /*
2  * @File: 
3  * 
4  * @Abstract: internal data and structure definitions for WMI service
5  * 
6  * @Notes: 
7  * 
8  * 
9  * Copyright (c) 2007 Atheros Communications Inc.
10  * All rights reserved.
11  *
12  */
13
14 #ifndef WMI_INTERNAL_H_
15 #define WMI_INTERNAL_H_
16
17 #define WMI_CMD_ALIGNMENT_SIZE  128
18
19 #ifdef WMI_DEBUG
20
21 /* WMI debug log definitions */
22
23 #define WMI_DBG0_LOG(debugid) \
24     DBGLOG_ARG0_RECORD(DBGLOG_HEADER_UPPER_HALF(debugid, \
25                        DBGLOG_MODULEID_WMI, 0))
26
27 #define WMI_DBG1_LOG(debugid, arg1) \
28     DBGLOG_ARG1_RECORD(DBGLOG_HEADER_UPPER_HALF(debugid, \
29                        DBGLOG_MODULEID_WMI, 1), arg1)
30
31 #define WMI_DBG2_LOG(debugid, arg1, arg2) \
32     DBGLOG_ARG2_RECORD(DBGLOG_HEADER_UPPER_HALF(debugid, \
33                        DBGLOG_MODULEID_WMI, 2), arg1, arg2)
34
35 #else
36 #define WMI_DBG0_LOG(debugid)
37 #define WMI_DBG1_LOG(debugid, arg1)
38 #define WMI_DBG2_LOG(debugid, arg1, arg2)
39 #endif /* WMI_DEBUG */
40
41 #define EVT_PKT_IN_USE        (1 << 0)
42 #define EVT_PKT_IS_FREE(e)    !((e)->Flags & EVT_PKT_IN_USE)  
43 #define EVT_MARK_FREE(e)      (e)->Flags &= ~EVT_PKT_IN_USE;
44 #define EVT_MARK_INUSE(e)     (e)->Flags |= EVT_PKT_IN_USE
45 #define IS_EVT_CLASS_BUFFERED(ec)   ((ec) != WMI_EVT_CLASS_DIRECT_BUFFER)
46
47 typedef struct _WMI_POOL_STATE {
48         int     MaxAllocation;      /* maximum allocations allowed for this pool */
49         int     CurrentAllocation;  /* current allocations outstanding */
50 } WMI_POOL_STATE; 
51
52 typedef struct _WMI_SVC_CONTEXT {
53         htc_handle_t         HtcHandle;
54         pool_handle_t        PoolHandle;    
55         int                  PendingEvents;                      /* no. of pending events */
56         HTC_SERVICE          WMIControlService;                  /* registered control service */
57         HTC_ENDPOINT_ID      ControlEp;                          /* endpoint assigned to us */
58         WMI_DISPATCH_TABLE  *pDispatchHead;                      /* dispatch list head ptr  */
59         WMI_DISPATCH_TABLE  *pDispatchTail;                      /* dispatch list tail ptr */   
60
61         // Left a door for extension the structure
62         void *pReserved;
63 } WMI_SVC_CONTEXT;
64
65 #endif /*WMI_INTERNAL_H_*/