0
|
1 |
/*
|
|
2 |
* CmdQueue_api.h
|
|
3 |
*
|
|
4 |
* Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
7 |
* This program and the accompanying materials are made available under the
|
|
8 |
* terms of the Eclipse Public License v1.0 or BSD License which accompanies
|
|
9 |
* this distribution. The Eclipse Public License is available at
|
|
10 |
* http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.
|
|
11 |
*
|
|
12 |
* Redistribution and use in source and binary forms, with or without
|
|
13 |
* modification, are permitted provided that the following conditions
|
|
14 |
* are met:
|
|
15 |
*
|
|
16 |
* * Redistributions of source code must retain the above copyright
|
|
17 |
* notice, this list of conditions and the following disclaimer.
|
|
18 |
* * Redistributions in binary form must reproduce the above copyright
|
|
19 |
* notice, this list of conditions and the following disclaimer in
|
|
20 |
* the documentation and/or other materials provided with the
|
|
21 |
* distribution.
|
|
22 |
* * Neither the name Texas Instruments nor the names of its
|
|
23 |
* contributors may be used to endorse or promote products derived
|
|
24 |
* from this software without specific prior written permission.
|
|
25 |
*
|
|
26 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
27 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
28 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
29 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
30 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
31 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
32 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
33 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
34 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
35 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37 |
*/
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
/** \file CmdQueue_api.h
|
|
42 |
* \brief CmdQueue api
|
|
43 |
*
|
|
44 |
* \see CmdQueue.c
|
|
45 |
*/
|
|
46 |
|
|
47 |
#ifndef _CMDQUEUE_API_H_
|
|
48 |
#define _CMDQUEUE_API_H_
|
|
49 |
|
|
50 |
#include "public_commands.h"
|
|
51 |
|
|
52 |
|
|
53 |
/*****************************************************************************
|
|
54 |
** Structures **
|
|
55 |
*****************************************************************************/
|
|
56 |
|
|
57 |
/* User Callback for Queue */
|
|
58 |
typedef void (*TCmdQueueInterrogateCb) (TI_HANDLE handle, TI_UINT16 status, void *pItrBuf);
|
|
59 |
|
|
60 |
|
|
61 |
/*****************************************************************************
|
|
62 |
** APIs definitions **
|
|
63 |
*****************************************************************************/
|
|
64 |
|
|
65 |
/*
|
|
66 |
* \brief Create the TCmdQueue object
|
|
67 |
*
|
|
68 |
* \param hOs - OS module object handle
|
|
69 |
* \return Handle to the created object
|
|
70 |
*
|
|
71 |
* \par Description
|
|
72 |
* Calling this function creates a CmdQueue object
|
|
73 |
*
|
|
74 |
* \sa cmdQueue_Destroy
|
|
75 |
*/
|
|
76 |
TI_HANDLE cmdQueue_Create (TI_HANDLE hOS);
|
|
77 |
|
|
78 |
|
|
79 |
/*
|
|
80 |
* \brief Destroys the cmdQueue object
|
|
81 |
*
|
|
82 |
* \param hCmdMbox - The object to free
|
|
83 |
* \return TI_OK
|
|
84 |
*
|
|
85 |
* \par Description
|
|
86 |
* Calling this function destroys the cmdQueue object
|
|
87 |
*
|
|
88 |
* \sa cmdQueue_Create
|
|
89 |
*/
|
|
90 |
TI_STATUS cmdQueue_Destroy (TI_HANDLE hCmdQueue);
|
|
91 |
|
|
92 |
|
|
93 |
/*
|
|
94 |
* \brief Configure the CmdQueue object
|
|
95 |
*
|
|
96 |
* \param hCmdQueue - Handle to CmdQueue
|
|
97 |
* \param hCmdMbox - Handle to CmdMbox
|
|
98 |
* \param hReport - Handle to report module
|
|
99 |
* \param hTwIf - Handle to TwIf
|
|
100 |
* \param hTimer - Handle to os timer
|
|
101 |
* \return TI_OK on success or TI_NOK on failure
|
|
102 |
*
|
|
103 |
* \par Description
|
|
104 |
*
|
|
105 |
* \sa
|
|
106 |
*/
|
|
107 |
TI_STATUS cmdQueue_Init (TI_HANDLE hCmdQueue,
|
|
108 |
TI_HANDLE hCmdMbox,
|
|
109 |
TI_HANDLE hReport,
|
|
110 |
TI_HANDLE hTwIf,
|
|
111 |
TI_HANDLE hTimer);
|
|
112 |
|
|
113 |
|
|
114 |
/*
|
|
115 |
* \brief Prepere the command queue for recovery.
|
|
116 |
*
|
|
117 |
* \param hCmdQueue - Handle to CmdQueue
|
|
118 |
* \return TI_OK
|
|
119 |
*
|
|
120 |
* \par Description
|
|
121 |
* Copy the queue nodes to a recovery list, in order handle
|
|
122 |
* the commands CB's after recovery has finished
|
|
123 |
*
|
|
124 |
* \sa cmdQueue_EndReconfig
|
|
125 |
*/
|
|
126 |
TI_STATUS cmdQueue_Restart (TI_HANDLE hCmdQueue);
|
|
127 |
|
|
128 |
|
|
129 |
/*
|
|
130 |
* \brief Call the stored CB to end the recovery of the MBox queue
|
|
131 |
*
|
|
132 |
* \param hCmdQueue - Handle to CmdQueue
|
|
133 |
* \return TI_OK
|
|
134 |
*
|
|
135 |
* \par Description
|
|
136 |
* Call the stored CB's with an error status
|
|
137 |
*
|
|
138 |
* \sa cmdQueue_StartReconfig
|
|
139 |
*/
|
|
140 |
TI_STATUS cmdQueue_EndReconfig (TI_HANDLE hCmdQueue);
|
|
141 |
|
|
142 |
|
|
143 |
/*
|
|
144 |
* \brief Register for a call back to be called when Command Complete occured and the CmdMboxCB was NULL
|
|
145 |
*
|
|
146 |
* \param hCmdQueue - Handle to CmdQueue
|
|
147 |
* \param fCb - The command's Cb function
|
|
148 |
* \param hCb - The command's Cb handle
|
|
149 |
* \return TI_OK
|
|
150 |
*
|
|
151 |
* \par Description
|
|
152 |
*
|
|
153 |
* \sa
|
|
154 |
*/
|
|
155 |
TI_STATUS cmdQueue_RegisterCmdCompleteGenericCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb);
|
|
156 |
|
|
157 |
|
|
158 |
/*
|
|
159 |
* \brief Register for a call back to be called when an Error (Timeout) occurs
|
|
160 |
*
|
|
161 |
* \param hCmdQueue - Handle to CmdQueue
|
|
162 |
* \param fCb - The command's Cb function
|
|
163 |
* \param hCb - The command's Cb handle
|
|
164 |
* \return TI_OK
|
|
165 |
*
|
|
166 |
* \par Description
|
|
167 |
*
|
|
168 |
* \sa
|
|
169 |
*/
|
|
170 |
TI_STATUS cmdQueue_RegisterForErrorCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb);
|
|
171 |
|
|
172 |
|
|
173 |
/*
|
|
174 |
* \brief Sends the command to the cmdMbox
|
|
175 |
*
|
|
176 |
* \param hCmdQueue - Handle to CmdQueue
|
|
177 |
* \param eMboxCmdType - The command type
|
|
178 |
* \param pMboxBuf - The command itself (parameters)
|
|
179 |
* \param uParamsLen - The command's length
|
|
180 |
* \param fCb - The command's Cb function
|
|
181 |
* \param hCb - The command's Cb handle
|
|
182 |
* \param pCb - Pointer to the results buffer (for interrogate commands)
|
|
183 |
* \return TI_OK on success or TI_NOK on failure
|
|
184 |
*
|
|
185 |
* \par Description
|
|
186 |
* Pushes the command to the command queue, which triggers the
|
|
187 |
* CmdQueue SM.
|
|
188 |
*
|
|
189 |
* \sa cmdQueue_Push
|
|
190 |
*/
|
|
191 |
TI_STATUS cmdQueue_SendCommand (TI_HANDLE hCmdQueue,
|
|
192 |
Command_e eMboxCmdType,
|
|
193 |
void *pMboxBuf,
|
|
194 |
TI_UINT32 uParamsLen,
|
|
195 |
void *fCb,
|
|
196 |
TI_HANDLE hCb,
|
|
197 |
void *pCb);
|
|
198 |
|
|
199 |
|
|
200 |
/*
|
|
201 |
* \brief Notify the CmdQueue SM on the result received.
|
|
202 |
*
|
|
203 |
* \param hCmdQueue - Handle to CmdQueue
|
|
204 |
* \return TI_OK on success or TI_NOK on failure
|
|
205 |
*
|
|
206 |
* \par Description
|
|
207 |
* Call the CmdQueue SM with CMDQUEUE_EVENT_COMPLETE
|
|
208 |
*
|
|
209 |
* \sa cmdQueue_SM
|
|
210 |
*/
|
|
211 |
TI_STATUS cmdQueue_ResultReceived (TI_HANDLE hCmdQueue);
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
/*
|
|
216 |
* \brief Returns maximum number of commands (ever) in TCmdQueue queue
|
|
217 |
*
|
|
218 |
* \param hCmdQueue - Handle to CmdQueue
|
|
219 |
* \return maximum number of commands (ever) in mailbox queue
|
|
220 |
*
|
|
221 |
* \par Description
|
|
222 |
* Used for debugging purposes
|
|
223 |
*
|
|
224 |
* \sa cmdQueue_Error
|
|
225 |
*/
|
|
226 |
TI_UINT32 cmdQueue_GetMaxNumberOfCommands (TI_HANDLE hCmdQueue);
|
|
227 |
|
|
228 |
|
|
229 |
/*
|
|
230 |
* \brief Enables the CmdMbox (on exit from init mode)
|
|
231 |
*
|
|
232 |
* \param hCmdQueue - Handle to CmdQueue
|
|
233 |
* \return TI_OK
|
|
234 |
*
|
|
235 |
* \par Description
|
|
236 |
*
|
|
237 |
* \sa cmdQueue_DisableMbox
|
|
238 |
*/
|
|
239 |
TI_STATUS cmdQueue_EnableMbox (TI_HANDLE hCmdQueue);
|
|
240 |
|
|
241 |
|
|
242 |
/*
|
|
243 |
* \brief Disables the CmdMbox (when stopping the driver)
|
|
244 |
*
|
|
245 |
* \param hCmdQueue - Handle to CmdQueue
|
|
246 |
* \return TI_OK
|
|
247 |
*
|
|
248 |
* \par Description
|
|
249 |
*
|
|
250 |
* \sa cmdQueue_EnableMbox
|
|
251 |
*/
|
|
252 |
TI_STATUS cmdQueue_DisableMbox (TI_HANDLE hCmdQueue);
|
|
253 |
|
|
254 |
|
|
255 |
/*
|
|
256 |
* \brief Called when a command timeout occur
|
|
257 |
*
|
|
258 |
* \param hCmdQueue - Handle to CmdQueue
|
|
259 |
* \return TI_OK
|
|
260 |
*
|
|
261 |
* \par Description
|
|
262 |
*
|
|
263 |
* \sa cmdQueue_Init, cmdMbox_TimeOut
|
|
264 |
*/
|
|
265 |
TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 status, void *param);
|
|
266 |
|
|
267 |
|
|
268 |
#ifdef TI_DBG
|
|
269 |
|
|
270 |
/*
|
|
271 |
* \brief Print the command queue & statistics
|
|
272 |
*
|
|
273 |
* \param hCmdQueue - Handle to CmdQueue
|
|
274 |
* \return void
|
|
275 |
*
|
|
276 |
* \par Description
|
|
277 |
* Used for debugging purposes
|
|
278 |
*
|
|
279 |
* \sa cmdQueue_PrintQueue
|
|
280 |
*/
|
|
281 |
void cmdQueue_Print (TI_HANDLE hCmdQueue);
|
|
282 |
|
|
283 |
|
|
284 |
/*
|
|
285 |
* \brief print the last uNumOfCmd commands
|
|
286 |
*
|
|
287 |
* \param hCmdQueue - Handle to CmdQueue
|
|
288 |
* \param uNumOfCmd - Number of commands to print
|
|
289 |
* \return void
|
|
290 |
*
|
|
291 |
* \par Description
|
|
292 |
* Used for debugging purposes
|
|
293 |
*
|
|
294 |
* \sa cmdQueue_Error
|
|
295 |
*/
|
|
296 |
void cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd);
|
|
297 |
|
|
298 |
|
|
299 |
#endif /* TI_DBG */
|
|
300 |
|
|
301 |
|
|
302 |
#endif /* _CMDQUEUE_API_H_ */
|