1/* 2 * txXfer_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/**************************************************************************** 36 * 37 * MODULE: txXfer_api.h 38 * 39 * PURPOSE: Tx Xfer module API. 40 * 41 ****************************************************************************/ 42 43#ifndef _TX_XFER_API_H 44#define _TX_XFER_API_H 45 46 47#include "TWDriver.h" 48 49 50/* 51 * Public Function Definitions: 52 * ============================ 53 */ 54 55 56/** 57 * \fn txXfer_Create 58 * \brief Create module 59 * 60 * Create module 61 * 62 * \note 63 * \param hOs - The OS API handle 64 * \return The created module handle 65 * \sa 66 */ 67TI_HANDLE txXfer_Create (TI_HANDLE hOs); 68 69 70/** 71 * \fn txXfer_Destroy 72 * \brief Destroy module 73 * 74 * Destroy module 75 * 76 * \note 77 * \param hTxXfer - Module handle 78 * \return TI_OK 79 * \sa 80 */ 81TI_STATUS txXfer_Destroy (TI_HANDLE hTxXfer); 82 83 84/** 85 * \fn txXfer_Init 86 * \brief Initialize module variables 87 * 88 * Initialize module variables including saving other modules handles 89 * 90 * \note 91 * \param hTxXfer - Module handle 92 * \param hXXX - Other modules handles 93 * \return TI_OK 94 * \sa 95 */ 96TI_STATUS txXfer_Init (TI_HANDLE hTxXfer, TI_HANDLE hReport, TI_HANDLE hTwIf); 97 98 99/** 100 * \fn txXfer_Restart 101 * \brief Restart some module variables 102 * 103 * Restart some module variables upon init, stop or recovery 104 * 105 * \note 106 * \param hTxXfer - Module handle 107 * \return TI_OK 108 * \sa 109 */ 110TI_STATUS txXfer_Restart (TI_HANDLE hTxXfer); 111 112 113/** 114 * \fn txXfer_SetDefaults 115 * \brief Configure module default settings 116 * 117 * Configure module default settings from ini file 118 * 119 * \note 120 * \param hTxXfer - Module handle 121 * \param pInitParams - The default paremeters structure 122 * \return void 123 * \sa 124 */ 125void txXfer_SetDefaults (TI_HANDLE hTxXfer, TTwdInitParams *pInitParams); 126 127 128/** 129 * \fn txXfer_SetBusParams 130 * \brief Configure bus related parameters 131 * 132 * Configure bus driver DMA-able buffer length to be used as a limit to the aggragation length. 133 * 134 * \note 135 * \param hTxXfer - Module handle 136 * \param uDmaBufLen - The bus driver DMA-able buffer length 137 * \return void 138 * \sa 139 */ 140void txXfer_SetBusParams (TI_HANDLE hTxXfer, TI_UINT32 uDmaBufLen); 141 142 143/** 144 * \fn txXfer_RegisterCb 145 * \brief Register callback functions 146 * 147 * Called by Tx upper layers to register their CB for packet transfer completion. 148 * Registered only if needed (currently used only by WHA layer). 149 * 150 * \note 151 * \param hTxXfer - Module handle 152 * \param CallBackID - Type of CB being registered (currently only transfer completion) 153 * \param CBFunc - The CB function 154 * \param CBObj - The parameter to provide when calling the CB 155 * \return void 156 * \sa 157 */ 158void txXfer_RegisterCb (TI_HANDLE hTxXfer, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj); 159 160 161/** 162 * \fn txXfer_SendPacket 163 * \brief Send a Tx packet to the FW 164 * 165 * Called by the Tx upper layers to send a new Tx packet to the FW (after FW resources were allocated). 166 * Aggregate the packet if possible, and if needed call txXfer_SendAggregatedPkts to forward 167 * the aggregation to the FW. 168 * 169 * \note 170 * \param hTxXfer - Module handle 171 * \param pPktCtrlBlk - The new packet to send 172 * \return COMPLETE if completed in this context, PENDING if not, ERROR if failed 173 * \sa 174 */ 175ETxnStatus txXfer_SendPacket (TI_HANDLE hTxXfer, TTxCtrlBlk *pPktCtrlBlk); 176 177 178/** 179 * \fn txXfer_EndOfBurst 180 * \brief Indicates that current packets burst stopped 181 * 182 * Called by the Tx upper layers to indicate that the current packets burst stopped. 183 * Sends the current aggregation of packets to the FW. 184 * 185 * \note 186 * \param hTxXfer - module handle 187 * \return void 188 * \sa 189 */ 190void txXfer_EndOfBurst (TI_HANDLE hTxXfer); 191 192 193 194#ifdef TI_DBG 195void txXfer_ClearStats (TI_HANDLE hTxXfer); 196void txXfer_PrintStats (TI_HANDLE hTxXfer); 197#endif 198 199 200 201#endif /* _TX_XFER_API_H */ 202