4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
35 /** \file FwEvent_api.h
42 #ifndef _FW_EVENT_API_H
43 #define _FW_EVENT_API_H
45 /* Public Function Definitions */
48 * \brief Create the FwEvent module object
50 * \param hOs - OS module object handle
51 * \return Handle to the created object
54 * Calling this function creates a FwEvent object
58 TI_HANDLE fwEvent_Create (TI_HANDLE hOs);
62 * \brief Destroys the FwEvent object
64 * \param hFwEvent - The object to free
68 * Calling this function destroys a FwEvent object
72 TI_STATUS fwEvent_Destroy (TI_HANDLE hFwEvent);
76 * \brief Requests the context engine to schedule the driver task
78 * \param hFwEvent - FwEvent Driver handle
82 * Called by the FW-Interrupt ISR.
83 * Requests the context engine to schedule the driver task
84 * for handling the FW-Events (FwEvent callback).
88 void fwEvent_InterruptRequest (TI_HANDLE hFwEvent);
92 * \brief Config the FwEvent module object
94 * \param hFwEvent - FwEvent Driver handle
95 * \param hTWD - Handle to TWD module
99 * From hTWD we extract : hOs, hReport, hTwIf, hContext,
100 * hHealthMonitor, hEventMbox, hCmdMbox, hRxXfer,
101 * hTxHwQueue, hTxResult
102 * In this function we also register the FwEvent to the context engine
106 TI_STATUS fwEvent_Init (TI_HANDLE hFwEvent, TI_HANDLE hTWD);
110 * \brief Called by any handler that completed after pending
112 * \param hFwEvent - FwEvent Driver handle
116 * Decrement pending handlers counter and if 0 call the SM to complete its process.
120 void fwEvent_HandlerCompleted (TI_HANDLE hFwEvent);
124 * \brief Stop & reset FwEvent (called by the driver stop process)
126 * \param hFwEvent - FwEvent Driver handle
133 TI_STATUS fwEvent_Stop (TI_HANDLE hFwEvent);
137 * \brief Translate host to FW time (Usec)
139 * \param hFwEvent - FwEvent Driver handle
140 * \param uHostTime - The host time in MS to translate
142 * \return FW Time in Usec
148 TI_UINT32 fwEvent_TranslateToFwTime (TI_HANDLE hFwEvent, TI_UINT32 uHostTime);
152 * \brief Disable the FwEvent client of the context thread handler
154 * \param hFwEvent - FwEvent Driver handle
161 void fwEvent_DisableInterrupts (TI_HANDLE hFwEvent);
165 * \brief Enable the FwEvent client of the context thread handler
167 * \param hFwEvent - FwEvent Driver handle
174 void fwEvent_EnableInterrupts (TI_HANDLE hFwEvent);
178 * \brief Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle
180 * \param hFwEvent - FwEvent Driver handle
184 * Called when driver Start or recovery process is completed.
185 * Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle
186 * (in case we missed an Rx interrupt in a recovery process).
190 void fwEvent_EnableExternalEvents(TI_HANDLE hFwEvent);
194 * \brief Unmask only cmd-cmplt and events interrupts (needed for init phase)
196 * \param hFwEvent - FwEvent Driver handle
200 * Unmask only cmd-cmplt and events interrupts (needed for init phase).
205 void fwEvent_SetInitMask (TI_HANDLE hFwEvent);
211 void fwEvent_PrintStat (TI_HANDLE hFwEvent);
217 #endif /* _FW_EVENT_API_H */