1/* 2 * SdioAdapter.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/** \file SdioAdapter.h 35 * \brief SDIO adapter module API definition 36 * 37 * \see SdioAdapter.c 38 */ 39 40#ifndef __SDIO_ADAPT_API_H__ 41#define __SDIO_ADAPT_API_H__ 42 43 44#include "TxnDefs.h" 45 46 47/************************************************************************ 48 * Defines 49 ************************************************************************/ 50 51/************************************************************************ 52 * Types 53 ************************************************************************/ 54 55/************************************************************************ 56 * Functions 57 ************************************************************************/ 58/** \brief sdioAdapt_ConnectBus: Init SDIO driver and HW 59 * 60 * \param fCbFunc - The bus driver's callback upon async transaction completion 61 * \param hCbArg - The CB function handle 62 * \param uBlkSizeShift - In block-mode: BlkSize = (1 << uBlkSizeShift) 63 * \param uSdioThreadPriority - The SDIO interrupt handler thread priority 64 * \return 0 = OK, otherwise = error 65 * 66 * \par Description 67 * Called by BusDrv to initialize the SDIO driver and HW. 68 * 69 * \sa 70 */ 71int sdioAdapt_ConnectBus (void * fCbFunc, 72 void * hCbArg, 73 unsigned int uBlkSizeShift, 74 unsigned int uSdioThreadPriority, 75 unsigned char **pTxDmaSrcAddr); 76 77/** \brief sdioAdapt_DisconnectBus: Disconnect SDIO driver 78 * 79 * \param void 80 * \return 0 = OK, otherwise = error 81 * 82 * \par Description 83 * Called by BusDrv. Disconnect the SDIO driver. 84 * 85 * \sa 86 */ 87int sdioAdapt_DisconnectBus (void); 88/** \brief sdioAdapt_Transact: Process transaction 89 * 90 * \param uFuncId - SDIO function ID (1- BT, 2 - WLAN) 91 * \param uHwAddr - HW address where to write the data 92 * \param pHostAddr - The data buffer to write from or read into 93 * \param uLength - The data length in bytes 94 * \param bDirection - TRUE = Read, FALSE = Write 95 * \param bBlkMode - If TRUE - use block mode 96 * \param bMore - If TRUE, more transactions are expected so don't turn off any HW 97 * \return COMPLETE if Txn completed in this context, PENDING if not, ERROR if failed 98 * 99 * \par Description 100 * Called by the BusDrv module to issue an SDIO transaction. 101 * Call write or read SDIO-driver function according to the direction. 102 * Use Sync or Async method according to the transaction length 103 * 104 * \note It's assumed that this function is called only when idle (i.e. previous Txn is done). 105 * 106 * \sa 107 */ 108ETxnStatus sdioAdapt_Transact (unsigned int uFuncId, 109 unsigned int uHwAddr, 110 void * pHostAddr, 111 unsigned int uLength, 112 unsigned int bDirection, 113 unsigned int bBlkMode, 114 unsigned int bFixedAddr, 115 unsigned int bMore); 116/** \brief sdioAdapt_TransactBytes: Process bytes transaction 117 * 118 * \param uFuncId - SDIO function ID (1- BT, 2 - WLAN) 119 * \param uHwAddr - HW address where to write the data 120 * \param pHostAddr - The data buffer to write from or read into 121 * \param uLength - The data length in bytes 122 * \param bDirection - TRUE = Read, FALSE = Write 123 * \param bMore - If TRUE, more transactions are expected so don't turn off any HW 124 * \return COMPLETE if Txn succeeded, ERROR if failed 125 * 126 * \par Description 127 * Called by the BusDrv module to issue a bytes stream SDIO transaction. 128 * Call write or read SDIO-driver Sync function according to the direction. 129 * 130 * \note It's assumed that this function is called only when idle (i.e. previous Txn is done). 131 * 132 * \sa 133 */ 134ETxnStatus sdioAdapt_TransactBytes (unsigned int uFuncId, 135 unsigned int uHwAddr, 136 void * pHostAddr, 137 unsigned int uLength, 138 unsigned int bDirection, 139 unsigned int bMore); 140 141 142 143#endif /*__SDIO_ADAPT_API_H__*/ 144