1/* 2 * FwEvent_api.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/** \file FwEvent_api.h 36 * \brief FwEvent api 37 * 38 * \see FwEvent.c 39 */ 40 41 42#ifndef _FW_EVENT_API_H 43#define _FW_EVENT_API_H 44 45/* Public Function Definitions */ 46 47/* 48 * \brief Create the FwEvent module object 49 * 50 * \param hOs - OS module object handle 51 * \return Handle to the created object 52 * 53 * \par Description 54 * Calling this function creates a FwEvent object 55 * 56 * \sa fwEvent_Destroy 57 */ 58TI_HANDLE fwEvent_Create (TI_HANDLE hOs); 59 60 61/* 62 * \brief Destroys the FwEvent object 63 * 64 * \param hFwEvent - The object to free 65 * \return TI_OK 66 * 67 * \par Description 68 * Calling this function destroys a FwEvent object 69 * 70 * \sa fwEvent_Create 71 */ 72TI_STATUS fwEvent_Destroy (TI_HANDLE hFwEvent); 73 74 75/* 76 * \brief Requests the context engine to schedule the driver task 77 * 78 * \param hFwEvent - FwEvent Driver handle 79 * \return void 80 * 81 * \par Description 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). 85 * 86 * \sa 87 */ 88void fwEvent_InterruptRequest (TI_HANDLE hFwEvent); 89 90 91/* 92 * \brief Config the FwEvent module object 93 * 94 * \param hFwEvent - FwEvent Driver handle 95 * \param hTWD - Handle to TWD module 96 * \return TI_OK 97 * 98 * \par Description 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 103 * 104 * \sa 105 */ 106TI_STATUS fwEvent_Init (TI_HANDLE hFwEvent, TI_HANDLE hTWD); 107 108 109/* 110 * \brief Called by any handler that completed after pending 111 * 112 * \param hFwEvent - FwEvent Driver handle 113 * 114 * \par Description 115 * 116 * Decrement pending handlers counter and if 0 call the SM to complete its process. 117 * 118 * \sa 119 */ 120void fwEvent_HandlerCompleted (TI_HANDLE hFwEvent); 121 122 123/* 124 * \brief Stop & reset FwEvent (called by the driver stop process) 125 * 126 * \param hFwEvent - FwEvent Driver handle 127 * \return TI_OK 128 * 129 * \par Description 130 * 131 * \sa 132 */ 133TI_STATUS fwEvent_Stop (TI_HANDLE hFwEvent); 134 135 136/* 137 * \brief Translate host to FW time (Usec) 138 * 139 * \param hFwEvent - FwEvent Driver handle 140 * \param uHostTime - The host time in MS to translate 141 * 142 * \return FW Time in Usec 143 * 144 * \par Description 145 * 146 * \sa 147 */ 148TI_UINT32 fwEvent_TranslateToFwTime (TI_HANDLE hFwEvent, TI_UINT32 uHostTime); 149 150 151/* 152 * \brief Disable the FwEvent client of the context thread handler 153 * 154 * \param hFwEvent - FwEvent Driver handle 155 * \return void 156 * 157 * \par Description 158 * 159 * \sa 160 */ 161void fwEvent_DisableInterrupts (TI_HANDLE hFwEvent); 162 163 164/* 165 * \brief Enable the FwEvent client of the context thread handler 166 * 167 * \param hFwEvent - FwEvent Driver handle 168 * \return void 169 * 170 * \par Description 171 * 172 * \sa 173 */ 174void fwEvent_EnableInterrupts (TI_HANDLE hFwEvent); 175 176 177/* 178 * \brief Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle 179 * 180 * \param hFwEvent - FwEvent Driver handle 181 * \return void 182 * 183 * \par Description 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). 187 * 188 * \sa 189 */ 190void fwEvent_EnableExternalEvents(TI_HANDLE hFwEvent); 191 192 193/* 194 * \brief Unmask only cmd-cmplt and events interrupts (needed for init phase) 195 * 196 * \param hFwEvent - FwEvent Driver handle 197 * \return Event mask 198 * 199 * \par Description 200 * Unmask only cmd-cmplt and events interrupts (needed for init phase). 201 202 * 203 * \sa 204 */ 205void fwEvent_SetInitMask (TI_HANDLE hFwEvent); 206 207 208 209#ifdef TI_DBG 210 211void fwEvent_PrintStat (TI_HANDLE hFwEvent); 212 213#endif /* TI_DBG */ 214 215 216 217#endif /* _FW_EVENT_API_H */ 218 219 220 221 222 223 224 225