1/*
2 * public_event_mbox.h
3 *
4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 *  * Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *  * Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in
15 *    the documentation and/or other materials provided with the
16 *    distribution.
17 *  * Neither the name Texas Instruments nor the names of its
18 *    contributors may be used to endorse or promote products derived
19 *    from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/**********************************************************************************************************************
35
36  FILENAME:       public_event_mbox.h
37
38  DESCRIPTION:    Public header for the Event Mailbox FW<->Driver interface
39
40
41
42***********************************************************************************************************************/
43#ifndef PUBLIC_EVENT_MBOX_H
44#define PUBLIC_EVENT_MBOX_H
45
46/******************************************************************************
47
48	EVENT MBOX
49
50    The event mechanism is based on a pair of event buffers (buffers "A" and "B") in fixed locations
51    in the device's memory. The host processes one buffer (buffer "A") while the other buffer
52    (buffer "B") continues to collect events. When the host is finished, it begins processing the
53    other buffer ("B") while the first buffer ("A") collects, and so on.
54    If the host is not processing events, an interrupt is issued to the host signaling that a
55    buffer is ready. The interrupt that the host receives indicates the appropriate event structure
56    buffer. Once the host finishes processing events from one buffer,
57    it signals with an acknowledge interrupt (bit 0 in the INT_TRIG register) that the event buffer
58    is free. This interrupt triggers the device to send the next event structure if there are any
59    collected events in it.
60
61    Note: Only one instance (the last) of each type of event is collected.
62
63******************************************************************************/
64
65
66#include "public_types.h"
67#include "public_commands.h"
68#include "public_infoele.h"
69
70
71
72/*************************************************************************
73
74  Events Enumeration
75
76**************************************************************************/
77typedef enum
78{
79    RSSI_SNR_TRIGGER_0_EVENT_ID              = BIT_0,
80    RSSI_SNR_TRIGGER_1_EVENT_ID              = BIT_1,
81    RSSI_SNR_TRIGGER_2_EVENT_ID              = BIT_2,
82    RSSI_SNR_TRIGGER_3_EVENT_ID              = BIT_3,
83    RSSI_SNR_TRIGGER_4_EVENT_ID              = BIT_4,
84    RSSI_SNR_TRIGGER_5_EVENT_ID              = BIT_5,
85    RSSI_SNR_TRIGGER_6_EVENT_ID              = BIT_6,
86    RSSI_SNR_TRIGGER_7_EVENT_ID              = BIT_7,
87
88    MEASUREMENT_START_EVENT_ID               = BIT_8,
89    MEASUREMENT_COMPLETE_EVENT_ID            = BIT_9,
90    SCAN_COMPLETE_EVENT_ID                   = BIT_10,
91    SCHEDULED_SCAN_COMPLETE_EVENT_ID         = BIT_11,
92    AP_DISCOVERY_COMPLETE_EVENT_ID           = BIT_12,
93    PS_REPORT_EVENT_ID                       = BIT_13,
94    PSPOLL_DELIVERY_FAILURE_EVENT_ID 	     = BIT_14,
95    DISCONNECT_EVENT_COMPLETE_ID             = BIT_15,
96    JOIN_EVENT_COMPLETE_ID                   = BIT_16,
97    CHANNEL_SWITCH_COMPLETE_EVENT_ID         = BIT_17,
98    BSS_LOSE_EVENT_ID                        = BIT_18,
99    REGAINED_BSS_EVENT_ID                    = BIT_19,
100    ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID    = BIT_20,
101    RESERVED_21                              = BIT_21,
102    SOFT_GEMINI_SENSE_EVENT_ID               = BIT_22,
103    SOFT_GEMINI_PREDICTION_EVENT_ID          = BIT_23,
104    SOFT_GEMINI_AVALANCHE_EVENT_ID           = BIT_24,
105    PLT_RX_CALIBRATION_COMPLETE_EVENT_ID     = BIT_25,
106    DBG_EVENT_ID                             = BIT_26,
107    HEALTH_CHECK_REPLY_EVENT_ID              = BIT_27,
108
109    PERIODIC_SCAN_COMPLETE_EVENT_ID          = BIT_28,
110    PERIODIC_SCAN_REPORT_EVENT_ID            = BIT_29,
111
112    BA_SESSION_TEAR_DOWN_EVENT_ID	         = BIT_30,
113
114    EVENT_MBOX_ALL_EVENT_ID                  = MAX_POSITIVE32
115} EventMBoxId_e;
116
117/*************************************************************************
118
119  Specific Event Parameters
120
121**************************************************************************/
122typedef enum
123{
124    SCHEDULED_SCAN_COMPLETED_OK = 0,
125    SCHEDULED_SCAN_TSF_ERROR    = 1
126} ScheduledScanReportStatus_enum;
127
128
129typedef enum
130{
131    CHANNEL_SWITCH_COMPLETE_OK,
132    CHANNEL_SWITCH_TSF_ERROR
133} ChannelSwitchReportStatus_enum;
134
135
136typedef enum
137{
138    ENTER_POWER_SAVE_FAIL    =  0,
139    ENTER_POWER_SAVE_SUCCESS =  1,
140    EXIT_POWER_SAVE_FAIL     =  2,
141    EXIT_POWER_SAVE_SUCCESS  =  3,
142    POWER_SAVE_STATUS_NUMBER
143} EventsPowerSave_enum;
144
145typedef enum
146{
147    TEST1_DBG_EVENT_ID = 0,
148    TEST2_DBG_EVENT_ID = 0x11,
149    LAST_DBG_EVENT_ID= 0xff
150}dbgEventId_enum;
151
152#ifdef HOST_COMPILE
153typedef uint8 ScheduledScanReportStatus_e;
154typedef uint8 ChannelSwitchReportStatus_e;
155typedef uint8 EventsPowerSave_e;
156typedef uint8 dbgEventId_e;
157#else
158typedef ScheduledScanReportStatus_enum ScheduledScanReportStatus_e;
159typedef ChannelSwitchReportStatus_enum ChannelSwitchReportStatus_e;
160typedef EventsPowerSave_enum EventsPowerSave_e;
161typedef dbgEventId_enum dbgEventId_e;
162#endif
163
164
165#define MAX_EVENT_REPORT_PARAMS 5
166typedef struct
167{
168    dbgEventId_e dbgEventId;  /*uint8*/
169    uint8       numberOfRelevantParams;
170    uint16      reservedPad16;
171    uint32      eventReportP1;
172    uint32      eventReportP2;
173    uint32      eventReportP3;
174}dbgEventRep_t;
175
176typedef struct
177{
178	uint8		numberOfScanResults;   /* How many results were parsed */
179	uint8       scanTag;               /* Tag of scan */
180    uint8       padding[2];            /* for alignment to 32 bits boundry*/
181    uint32      scheduledScanStatus;   /* [0-7] scan completed status, [8-23] Attended Channels map, [24-31] reserved. */
182} scanCompleteResults_t;
183
184/*************************************************************************
185
186  The Event Mailbox structure in memory
187
188**************************************************************************/
189typedef struct EventMailBox_t
190{
191    /* Events Bit Mask */
192    uint32 eventsVector;
193    uint32 eventsMask;
194    uint32 reserved1;
195    uint32 reserved2;
196
197    /* Events Data */
198
199
200    dbgEventRep_t      dbgEventRep;         /* refer to dbgEventRep_t*/
201                                            /* [DBG_EVENT_ID]*/
202
203    scanCompleteResults_t scanCompleteResults; /* Scan complete results (counter and scan tag) */
204
205    uint16 scheduledScanAttendedChannels;   /* Channels scanned by the Scheduled Scan. */
206                                            /* [SCHEDULED_SCAN_COMPLETE_EVENT_ID]*/
207
208    uint8  softGeminiSenseInfo;             /* Contains the type of the BT Coexistence sense event.*/
209                                            /* [SOFT_GEMINI_SENSE_EVENT_ID]*/
210
211    uint8  softGeminiProtectiveInfo;        /* Contains information from the BT activity prediction */
212                                            /* machine [SOFT_GEMINI_PREDICTION_EVENT_ID]*/
213
214    int8   RSSISNRTriggerMetric[NUM_OF_RSSI_SNR_TRIGGERS];   /* RSSI and SNR Multiple Triggers Array */
215                                            /* machine [RSSI_SNR_TRIGGER_0-8_EVENT_ID]*/
216
217    uint8  channelSwitchStatus;             /* Status of channel switch. Refer to*/
218                                            /* ChannelSwitchReportStatus_enum.*/
219                                            /* [CHANNEL_SWITCH_COMPLETE_EVENT_ID]*/
220
221    uint8  scheduledScanStatus;             /* Status of scheduled scan. Refer to */
222                                            /* ScheduledScanReportStatus_enum.*/
223                                            /* [SCHEDULED_SCAN_COMPLETE_EVENT_ID]*/
224
225    uint8  psStatus;                        /* refer to EventsPowerSave_enum.*/
226                                            /* [PS_REPORT_EVENT_ID].*/
227
228
229
230    uint8  padding[29];                     /* for alignment to 32 bits boundry*/
231
232
233} EventMailBox_t;
234
235#endif /* PUBLIC_EVENT_MBOX_H*/
236
237
238