• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * \param  pRxDmaBufAddr - Pointer for providing the Rx DMA buffer address to the upper layers to use it directly
65  * \param  pRxDmaBufLen  - The Rx DMA buffer length in bytes
66  * \param  pTxDmaBufAddr - Pointer for providing the Tx DMA buffer address to the upper layers to use it directly
67  * \param  pTxDmaBufLen  - The Tx DMA buffer length in bytes
68  * \return 0 = OK, otherwise = error
69  *
70  * \par Description
71  * Called by BusDrv to initialize the SDIO driver and HW.
72  *
73  * \sa
74  */
75 int        sdioAdapt_ConnectBus    (void *        fCbFunc,
76                                     void *        hCbArg,
77                                     unsigned int  uBlkSizeShift,
78                                     unsigned int  uSdioThreadPriority,
79                                     unsigned char **pRxDmaBufAddr,
80                                     unsigned int  *pRxDmaBufLen,
81                                     unsigned char **pTxDmaBufAddr,
82                                     unsigned int  *pTxDmaBufLen);
83 
84 /** \brief	sdioAdapt_DisconnectBus: Disconnect SDIO driver
85  *
86  * \param  void
87  * \return 0 = OK, otherwise = error
88  *
89  * \par Description
90  * Called by BusDrv. Disconnect the SDIO driver.
91  *
92  * \sa
93  */
94 int        sdioAdapt_DisconnectBus (void);
95 /** \brief	sdioAdapt_Transact: Process transaction
96  *
97  * \param  uFuncId    - SDIO function ID (1- BT, 2 - WLAN)
98  * \param  uHwAddr    - HW address where to write the data
99  * \param  pHostAddr  - The data buffer to write from or read into
100  * \param  uLength    - The data length in bytes
101  * \param  bDirection - TRUE = Read,  FALSE = Write
102  * \param  bBlkMode   - If TRUE - use block mode
103  * \param  bMore      - If TRUE, more transactions are expected so don't turn off any HW
104  * \return COMPLETE if Txn completed in this context, PENDING if not, ERROR if failed
105  *
106  * \par Description
107  * Called by the BusDrv module to issue an SDIO transaction.
108  * Call write or read SDIO-driver function according to the direction.
109  * Use Sync or Async method according to the transaction length
110  *
111  * \note   It's assumed that this function is called only when idle (i.e. previous Txn is done).
112  *
113  * \sa
114  */
115 ETxnStatus sdioAdapt_Transact      (unsigned int  uFuncId,
116                                     unsigned int  uHwAddr,
117                                     void *        pHostAddr,
118                                     unsigned int  uLength,
119                                     unsigned int  bDirection,
120                                     unsigned int  bBlkMode,
121                                     unsigned int  bFixedAddr,
122                                     unsigned int  bMore);
123 /** \brief	sdioAdapt_TransactBytes: Process bytes transaction
124  *
125  * \param  uFuncId    - SDIO function ID (1- BT, 2 - WLAN)
126  * \param  uHwAddr    - HW address where to write the data
127  * \param  pHostAddr  - The data buffer to write from or read into
128  * \param  uLength    - The data length in bytes
129  * \param  bDirection - TRUE = Read,  FALSE = Write
130  * \param  bMore      - If TRUE, more transactions are expected so don't turn off any HW
131  * \return COMPLETE if Txn succeeded, ERROR if failed
132  *
133  * \par Description
134  * Called by the BusDrv module to issue a bytes stream SDIO transaction.
135  * Call write or read SDIO-driver Sync function according to the direction.
136  *
137  * \note   It's assumed that this function is called only when idle (i.e. previous Txn is done).
138  *
139  * \sa
140  */
141 ETxnStatus sdioAdapt_TransactBytes (unsigned int  uFuncId,
142                                     unsigned int  uHwAddr,
143                                     void *        pHostAddr,
144                                     unsigned int  uLength,
145                                     unsigned int  bDirection,
146                                     unsigned int  bMore);
147 
148 
149 
150 #endif /*__SDIO_ADAPT_API_H__*/
151