David Fletcher / Mbed 2 deprecated cc3100_Test_websock_Camera_CM4F

Dependencies:   mbed

Committer:
dflet
Date:
Tue Sep 15 16:45:04 2015 +0000
Revision:
22:f9b5e0b80bf2
Parent:
0:50cedd586816
Removed some debug.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:50cedd586816 1 //*****************************************************************************
dflet 0:50cedd586816 2 // osi.h
dflet 0:50cedd586816 3 //
dflet 0:50cedd586816 4 // MACRO and Function prototypes for TI-RTOS and Free-RTOS API calls
dflet 0:50cedd586816 5 //
dflet 0:50cedd586816 6 // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 0:50cedd586816 7 //
dflet 0:50cedd586816 8 //
dflet 0:50cedd586816 9 // Redistribution and use in source and binary forms, with or without
dflet 0:50cedd586816 10 // modification, are permitted provided that the following conditions
dflet 0:50cedd586816 11 // are met:
dflet 0:50cedd586816 12 //
dflet 0:50cedd586816 13 // Redistributions of source code must retain the above copyright
dflet 0:50cedd586816 14 // notice, this list zof conditions and the following disclaimer.
dflet 0:50cedd586816 15 //
dflet 0:50cedd586816 16 // Redistributions in binary form must reproduce the above copyright
dflet 0:50cedd586816 17 // notice, this list of conditions and the following disclaimer in the
dflet 0:50cedd586816 18 // documentation and/or other materials provided with the
dflet 0:50cedd586816 19 // distribution.
dflet 0:50cedd586816 20 //
dflet 0:50cedd586816 21 // Neither the name of Texas Instruments Incorporated nor the names of
dflet 0:50cedd586816 22 // its contributors may be used to endorse or promote products derived
dflet 0:50cedd586816 23 // from this software without specific prior written permission.
dflet 0:50cedd586816 24 //
dflet 0:50cedd586816 25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 0:50cedd586816 26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 0:50cedd586816 27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 0:50cedd586816 28 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 0:50cedd586816 29 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 0:50cedd586816 30 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 0:50cedd586816 31 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 0:50cedd586816 32 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 0:50cedd586816 33 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 0:50cedd586816 34 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 0:50cedd586816 35 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 0:50cedd586816 36 //
dflet 0:50cedd586816 37 //*****************************************************************************
dflet 0:50cedd586816 38
dflet 0:50cedd586816 39 #ifndef __OSI_H__
dflet 0:50cedd586816 40 #define __OSI_H__
dflet 0:50cedd586816 41
dflet 0:50cedd586816 42 #ifdef __cplusplus
dflet 0:50cedd586816 43 extern "C" {
dflet 0:50cedd586816 44 #endif
dflet 0:50cedd586816 45
dflet 0:50cedd586816 46 #include <string.h>
dflet 0:50cedd586816 47 #include "portable.h"
dflet 0:50cedd586816 48
dflet 0:50cedd586816 49 #define OSI_WAIT_FOREVER (0xFFFFFFFF)
dflet 0:50cedd586816 50
dflet 0:50cedd586816 51 #define OSI_NO_WAIT (0)
dflet 0:50cedd586816 52
dflet 0:50cedd586816 53 #ifndef SPAWN_TASK_STACK
dflet 0:50cedd586816 54 #define STACK_LEN (2048) /*Stack Size*/
dflet 0:50cedd586816 55 #else
dflet 0:50cedd586816 56 #define STACK_LEN (SPAWN_TASK_STACK)
dflet 0:50cedd586816 57 #endif
dflet 0:50cedd586816 58
dflet 0:50cedd586816 59 typedef enum
dflet 0:50cedd586816 60 {
dflet 0:50cedd586816 61 OSI_OK = 0,
dflet 0:50cedd586816 62 OSI_FAILURE = -1,
dflet 0:50cedd586816 63 OSI_OPERATION_FAILED = -2,
dflet 0:50cedd586816 64 OSI_ABORTED = -3,
dflet 0:50cedd586816 65 OSI_INVALID_PARAMS = -4,
dflet 0:50cedd586816 66 OSI_MEMORY_ALLOCATION_FAILURE = -5,
dflet 0:50cedd586816 67 OSI_TIMEOUT = -6,
dflet 0:50cedd586816 68 OSI_EVENTS_IN_USE = -7,
dflet 0:50cedd586816 69 OSI_EVENT_OPEARTION_FAILURE = -8
dflet 0:50cedd586816 70 }OsiReturnVal_e;
dflet 0:50cedd586816 71
dflet 0:50cedd586816 72 //#define ENTER_CRITICAL_SECTION osi_EnterCritical()
dflet 0:50cedd586816 73 //#define EXIT_CRITICAL_SECTION osi_ExitCritical()
dflet 0:50cedd586816 74
dflet 0:50cedd586816 75 typedef void* OsiMsgQ_t;
dflet 0:50cedd586816 76
dflet 0:50cedd586816 77 /*!
dflet 0:50cedd586816 78 \brief type definition for a time value
dflet 0:50cedd586816 79
dflet 0:50cedd586816 80 \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
dflet 0:50cedd586816 81 */
dflet 0:50cedd586816 82 typedef uint32_t OsiTime_t;
dflet 0:50cedd586816 83 //typedef unsigned long OsiTime_t;
dflet 0:50cedd586816 84 /*!
dflet 0:50cedd586816 85 \brief type definition for a sync object container
dflet 0:50cedd586816 86
dflet 0:50cedd586816 87 Sync object is object used to synchronize between two threads or thread and interrupt handler.
dflet 0:50cedd586816 88 One thread is waiting on the object and the other thread send a signal, which then
dflet 0:50cedd586816 89 release the waiting thread.
dflet 0:50cedd586816 90 The signal must be able to be sent from interrupt context.
dflet 0:50cedd586816 91 This object is generally implemented by binary semaphore or events.
dflet 0:50cedd586816 92
dflet 0:50cedd586816 93 \note On each porting or platform the type could be whatever is needed - integer, structure etc.
dflet 0:50cedd586816 94 */
dflet 0:50cedd586816 95 //typedef unsigned int OsiSyncObj_t;
dflet 0:50cedd586816 96 typedef void * OsiSyncObj_t;
dflet 0:50cedd586816 97
dflet 0:50cedd586816 98 /*!
dflet 0:50cedd586816 99 \brief type definition for a locking object container
dflet 0:50cedd586816 100
dflet 0:50cedd586816 101 Locking object are used to protect a resource from mutual accesses of two or more threads.
dflet 0:50cedd586816 102 The locking object should support re-entrant locks by a signal thread.
dflet 0:50cedd586816 103 This object is generally implemented by mutex semaphore
dflet 0:50cedd586816 104
dflet 0:50cedd586816 105 \note On each porting or platform the type could be whatever is needed - integer, structure etc.
dflet 0:50cedd586816 106 */
dflet 0:50cedd586816 107 //typedef unsigned int OsiLockObj_t;
dflet 0:50cedd586816 108 typedef void * OsiLockObj_t;
dflet 0:50cedd586816 109
dflet 0:50cedd586816 110 /*!
dflet 0:50cedd586816 111 \brief type definition for a spawn entry callback
dflet 0:50cedd586816 112
dflet 0:50cedd586816 113 the spawn mechanism enable to run a function on different context.
dflet 0:50cedd586816 114 This mechanism allow to transfer the execution context from interrupt context to thread context
dflet 0:50cedd586816 115 or changing the context from an unknown user thread to general context.
dflet 0:50cedd586816 116 The implementation of the spawn mechanism depends on the user's system requirements and could varies
dflet 0:50cedd586816 117 from implementation of serialized execution using single thread to creating thread per call
dflet 0:50cedd586816 118
dflet 0:50cedd586816 119 \note The stack size of the execution thread must be at least of TBD bytes!
dflet 0:50cedd586816 120 */
dflet 0:50cedd586816 121 typedef void (*P_OSI_SPAWN_ENTRY)(void* pValue);
dflet 0:50cedd586816 122
dflet 0:50cedd586816 123 typedef void (*P_OSI_EVENT_HANDLER)(void* pValue);
dflet 0:50cedd586816 124
dflet 0:50cedd586816 125 typedef void (*P_OSI_TASK_ENTRY)(void* pValue);
dflet 0:50cedd586816 126
dflet 0:50cedd586816 127 typedef void (*P_OSI_INTR_ENTRY)(void);
dflet 0:50cedd586816 128
dflet 0:50cedd586816 129 typedef void* OsiTaskHandle;
dflet 0:50cedd586816 130
dflet 0:50cedd586816 131 /*!
dflet 0:50cedd586816 132 \brief This function registers an interrupt in NVIC table
dflet 0:50cedd586816 133
dflet 0:50cedd586816 134 The sync object is used for synchronization between different thread or ISR and
dflet 0:50cedd586816 135 a thread.
dflet 0:50cedd586816 136
dflet 0:50cedd586816 137 \param iIntrNum - Interrupt number to register
dflet 0:50cedd586816 138 \param pEntry - Pointer to the interrupt handler
dflet 0:50cedd586816 139
dflet 0:50cedd586816 140 \return upon successful creation the function should return 0
dflet 0:50cedd586816 141 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 142 \note
dflet 0:50cedd586816 143 \warning
dflet 0:50cedd586816 144 */
dflet 0:50cedd586816 145 OsiReturnVal_e osi_InterruptRegister(int iIntrNum,P_OSI_INTR_ENTRY pEntry,unsigned char ucPriority);
dflet 0:50cedd586816 146
dflet 0:50cedd586816 147 /*!
dflet 0:50cedd586816 148 \brief This function De-registers an interrupt in NVIC table
dflet 0:50cedd586816 149
dflet 0:50cedd586816 150 \param iIntrNum - Interrupt number to register
dflet 0:50cedd586816 151 \param pEntry - Pointer to the interrupt handler
dflet 0:50cedd586816 152
dflet 0:50cedd586816 153 \return upon successful creation the function should return Positive number
dflet 0:50cedd586816 154 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 155 \note
dflet 0:50cedd586816 156 \warning
dflet 0:50cedd586816 157 */
dflet 0:50cedd586816 158 void osi_InterruptDeRegister(int iIntrNum);
dflet 0:50cedd586816 159
dflet 0:50cedd586816 160
dflet 0:50cedd586816 161 /*!
dflet 0:50cedd586816 162 \brief This function creates a sync object
dflet 0:50cedd586816 163
dflet 0:50cedd586816 164 The sync object is used for synchronization between different thread or ISR and
dflet 0:50cedd586816 165 a thread.
dflet 0:50cedd586816 166
dflet 0:50cedd586816 167 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 168
dflet 0:50cedd586816 169 \return upon successful creation the function should return 0
dflet 0:50cedd586816 170 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 171 \note
dflet 0:50cedd586816 172 \warning
dflet 0:50cedd586816 173 */
dflet 0:50cedd586816 174 OsiReturnVal_e osi_SyncObjCreate(OsiSyncObj_t* pSyncObj);
dflet 0:50cedd586816 175
dflet 0:50cedd586816 176
dflet 0:50cedd586816 177 /*!
dflet 0:50cedd586816 178 \brief This function deletes a sync object
dflet 0:50cedd586816 179
dflet 0:50cedd586816 180 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 181
dflet 0:50cedd586816 182 \return upon successful deletion the function should return 0
dflet 0:50cedd586816 183 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 184 \note
dflet 0:50cedd586816 185 \warning
dflet 0:50cedd586816 186 */
dflet 0:50cedd586816 187 OsiReturnVal_e osi_SyncObjDelete(OsiSyncObj_t* pSyncObj);
dflet 0:50cedd586816 188
dflet 0:50cedd586816 189 /*!
dflet 0:50cedd586816 190 \brief This function generates a sync signal for the object.
dflet 0:50cedd586816 191
dflet 0:50cedd586816 192 All suspended threads waiting on this sync object are resumed
dflet 0:50cedd586816 193
dflet 0:50cedd586816 194 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 195
dflet 0:50cedd586816 196 \return upon successful signalling the function should return 0
dflet 0:50cedd586816 197 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 198 \note the function could be called from ISR context
dflet 0:50cedd586816 199 \warning
dflet 0:50cedd586816 200 */
dflet 0:50cedd586816 201 OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj);
dflet 0:50cedd586816 202
dflet 0:50cedd586816 203 /*!
dflet 0:50cedd586816 204 \brief This function generates a sync signal for the object.
dflet 0:50cedd586816 205 from ISR context.
dflet 0:50cedd586816 206
dflet 0:50cedd586816 207 All suspended threads waiting on this sync object are resumed
dflet 0:50cedd586816 208
dflet 0:50cedd586816 209 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 210
dflet 0:50cedd586816 211 \return upon successful signalling the function should return 0
dflet 0:50cedd586816 212 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 213 \note the function is called from ISR context
dflet 0:50cedd586816 214 \warning
dflet 0:50cedd586816 215 */
dflet 0:50cedd586816 216 OsiReturnVal_e osi_SyncObjSignalFromISR(OsiSyncObj_t* pSyncObj);
dflet 0:50cedd586816 217
dflet 0:50cedd586816 218 /*!
dflet 0:50cedd586816 219 \brief This function waits for a sync signal of the specific sync object
dflet 0:50cedd586816 220
dflet 0:50cedd586816 221 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 222 \param Timeout - numeric value specifies the maximum number of mSec to
dflet 0:50cedd586816 223 stay suspended while waiting for the sync signal
dflet 0:50cedd586816 224 Currently, the simple link driver uses only two values:
dflet 0:50cedd586816 225 - OSI_WAIT_FOREVER
dflet 0:50cedd586816 226 - OSI_NO_WAIT
dflet 0:50cedd586816 227
dflet 0:50cedd586816 228 \return upon successful reception of the signal within the timeout window return 0
dflet 0:50cedd586816 229 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 230 \note
dflet 0:50cedd586816 231 \warning
dflet 0:50cedd586816 232 */
dflet 0:50cedd586816 233 OsiReturnVal_e osi_SyncObjWait(OsiSyncObj_t* pSyncObj , OsiTime_t Timeout);
dflet 0:50cedd586816 234
dflet 0:50cedd586816 235 /*!
dflet 0:50cedd586816 236 \brief This function clears a sync object
dflet 0:50cedd586816 237
dflet 0:50cedd586816 238 \param pSyncObj - pointer to the sync object control block
dflet 0:50cedd586816 239
dflet 0:50cedd586816 240 \return upon successful clearing the function should return 0
dflet 0:50cedd586816 241 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 242 \note
dflet 0:50cedd586816 243 \warning
dflet 0:50cedd586816 244 */
dflet 0:50cedd586816 245 OsiReturnVal_e osi_SyncObjClear(OsiSyncObj_t* pSyncObj);
dflet 0:50cedd586816 246
dflet 0:50cedd586816 247 /*!
dflet 0:50cedd586816 248 \brief This function creates a locking object.
dflet 0:50cedd586816 249
dflet 0:50cedd586816 250 The locking object is used for protecting a shared resources between different
dflet 0:50cedd586816 251 threads.
dflet 0:50cedd586816 252
dflet 0:50cedd586816 253 \param pLockObj - pointer to the locking object control block
dflet 0:50cedd586816 254
dflet 0:50cedd586816 255 \return upon successful creation the function should return 0
dflet 0:50cedd586816 256 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 257 \note
dflet 0:50cedd586816 258 \warning
dflet 0:50cedd586816 259 */
dflet 0:50cedd586816 260 OsiReturnVal_e osi_LockObjCreate(OsiLockObj_t* pLockObj);
dflet 0:50cedd586816 261
dflet 0:50cedd586816 262 /*!
dflet 0:50cedd586816 263 \brief This function deletes a locking object.
dflet 0:50cedd586816 264
dflet 0:50cedd586816 265 \param pLockObj - pointer to the locking object control block
dflet 0:50cedd586816 266
dflet 0:50cedd586816 267 \return upon successful deletion the function should return 0
dflet 0:50cedd586816 268 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 269 \note
dflet 0:50cedd586816 270 \warning
dflet 0:50cedd586816 271 */
dflet 0:50cedd586816 272 OsiReturnVal_e osi_LockObjDelete(OsiLockObj_t* pLockObj);
dflet 0:50cedd586816 273
dflet 0:50cedd586816 274 /*!
dflet 0:50cedd586816 275 \brief This function locks a locking object.
dflet 0:50cedd586816 276
dflet 0:50cedd586816 277 All other threads that call this function before this thread calls
dflet 0:50cedd586816 278 the osi_LockObjUnlock would be suspended
dflet 0:50cedd586816 279
dflet 0:50cedd586816 280 \param pLockObj - pointer to the locking object control block
dflet 0:50cedd586816 281 \param Timeout - numeric value specifies the maximum number of mSec to
dflet 0:50cedd586816 282 stay suspended while waiting for the locking object
dflet 0:50cedd586816 283 Currently, the simple link driver uses only two values:
dflet 0:50cedd586816 284 - OSI_WAIT_FOREVER
dflet 0:50cedd586816 285 - OSI_NO_WAIT
dflet 0:50cedd586816 286
dflet 0:50cedd586816 287
dflet 0:50cedd586816 288 \return upon successful reception of the locking object the function should return 0
dflet 0:50cedd586816 289 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 290 \note
dflet 0:50cedd586816 291 \warning
dflet 0:50cedd586816 292 */
dflet 0:50cedd586816 293 OsiReturnVal_e osi_LockObjLock(OsiLockObj_t* pLockObj , OsiTime_t Timeout);
dflet 0:50cedd586816 294
dflet 0:50cedd586816 295 /*!
dflet 0:50cedd586816 296 \brief This function unlock a locking object.
dflet 0:50cedd586816 297
dflet 0:50cedd586816 298 \param pLockObj - pointer to the locking object control block
dflet 0:50cedd586816 299
dflet 0:50cedd586816 300 \return upon successful unlocking the function should return 0
dflet 0:50cedd586816 301 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 302 \note
dflet 0:50cedd586816 303 \warning
dflet 0:50cedd586816 304 */
dflet 0:50cedd586816 305 OsiReturnVal_e osi_LockObjUnlock(OsiLockObj_t* pLockObj);
dflet 0:50cedd586816 306
dflet 0:50cedd586816 307
dflet 0:50cedd586816 308 /*!
dflet 0:50cedd586816 309 \brief This function call the pEntry callback from a different context
dflet 0:50cedd586816 310
dflet 0:50cedd586816 311 \param pEntry - pointer to the entry callback function
dflet 0:50cedd586816 312
dflet 0:50cedd586816 313 \param pValue - pointer to any type of memory structure that would be
dflet 0:50cedd586816 314 passed to pEntry callback from the execution thread.
dflet 0:50cedd586816 315
dflet 0:50cedd586816 316 \param flags - execution flags - reserved for future usage
dflet 0:50cedd586816 317
dflet 0:50cedd586816 318 \return upon successful registration of the spawn the function should return 0
dflet 0:50cedd586816 319 (the function is not blocked till the end of the execution of the function
dflet 0:50cedd586816 320 and could be returned before the execution is actually completed)
dflet 0:50cedd586816 321 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 322 \note
dflet 0:50cedd586816 323 \warning
dflet 0:50cedd586816 324 */
dflet 0:50cedd586816 325 /*!
dflet 0:50cedd586816 326 \brief This function creates a Task.
dflet 0:50cedd586816 327
dflet 0:50cedd586816 328 Creates a new Task and add it to the last of tasks that are ready to run
dflet 0:50cedd586816 329
dflet 0:50cedd586816 330 \param pEntry - pointer to the Task Function
dflet 0:50cedd586816 331 \param pcName - Task Name String
dflet 0:50cedd586816 332 \param usStackDepth - Stack Size Stack Size in 32-bit long words
dflet 0:50cedd586816 333 \param pvParameters - pointer to structure to be passed to the Task Function
dflet 0:50cedd586816 334 \param uxPriority - Task Priority
dflet 0:50cedd586816 335
dflet 0:50cedd586816 336 \return upon successful unlocking the function should return 0
dflet 0:50cedd586816 337 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 338 \note
dflet 0:50cedd586816 339 \warning
dflet 0:50cedd586816 340 */
dflet 0:50cedd586816 341 OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry,const signed char * const pcName,unsigned short usStackDepth,void *pvParameters,uint32_t uxPriority,OsiTaskHandle *pTaskHandle);
dflet 0:50cedd586816 342
dflet 0:50cedd586816 343 /*!
dflet 0:50cedd586816 344 \brief This function Deletes a Task.
dflet 0:50cedd586816 345
dflet 0:50cedd586816 346 Deletes a Task and remove it from list of running task
dflet 0:50cedd586816 347
dflet 0:50cedd586816 348 \param pTaskHandle - Task Handle
dflet 0:50cedd586816 349
dflet 0:50cedd586816 350 \note
dflet 0:50cedd586816 351 \warning
dflet 0:50cedd586816 352 */
dflet 0:50cedd586816 353 void osi_TaskDelete(OsiTaskHandle* pTaskHandle);
dflet 0:50cedd586816 354
dflet 0:50cedd586816 355 /*!
dflet 0:50cedd586816 356 \brief This function call the pEntry callback from a different context
dflet 0:50cedd586816 357
dflet 0:50cedd586816 358 \param pEntry - pointer to the entry callback function
dflet 0:50cedd586816 359
dflet 0:50cedd586816 360 \param pValue - pointer to any type of memory structure that would be
dflet 0:50cedd586816 361 passed to pEntry callback from the execution thread.
dflet 0:50cedd586816 362
dflet 0:50cedd586816 363 \param flags - execution flags - reserved for future usage
dflet 0:50cedd586816 364
dflet 0:50cedd586816 365 \return upon successful registration of the spawn the function should return 0
dflet 0:50cedd586816 366 (the function is not blocked till the end of the execution of the function
dflet 0:50cedd586816 367 and could be returned before the execution is actually completed)
dflet 0:50cedd586816 368 Otherwise, a negative value indicating the error code shall be returned
dflet 0:50cedd586816 369 \note
dflet 0:50cedd586816 370 \warning
dflet 0:50cedd586816 371 */
dflet 0:50cedd586816 372 OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry , void* pValue , uint32_t flags);
dflet 0:50cedd586816 373
dflet 0:50cedd586816 374
dflet 0:50cedd586816 375 /*******************************************************************************
dflet 0:50cedd586816 376
dflet 0:50cedd586816 377 This function creates a message queue that is typically used for inter thread
dflet 0:50cedd586816 378 communication.
dflet 0:50cedd586816 379
dflet 0:50cedd586816 380 Parameters:
dflet 0:50cedd586816 381
dflet 0:50cedd586816 382 pMsgQ - pointer to the message queue control block
dflet 0:50cedd586816 383 pMsgQName - pointer to the name of the message queue
dflet 0:50cedd586816 384 MsgSize - the size of the message.
dflet 0:50cedd586816 385
dflet 0:50cedd586816 386 NOTICE: THE MESSGAE SIZE MUST BE SMALLER THAN 16
dflet 0:50cedd586816 387
dflet 0:50cedd586816 388 MaxMsgs - maximum number of messages.
dflet 0:50cedd586816 389
dflet 0:50cedd586816 390 Please note that this function allocates the entire memory required
dflet 0:50cedd586816 391 for the maximum number of messages (MsgSize * MaxMsgs).
dflet 0:50cedd586816 392
dflet 0:50cedd586816 393 ********************************************************************************/
dflet 0:50cedd586816 394 OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t* pMsgQ ,
dflet 0:50cedd586816 395 char* pMsgQName,
dflet 0:50cedd586816 396 uint32_t MsgSize,
dflet 0:50cedd586816 397 uint32_t MaxMsgs);
dflet 0:50cedd586816 398
dflet 0:50cedd586816 399 /*******************************************************************************
dflet 0:50cedd586816 400
dflet 0:50cedd586816 401 This function deletes a specific message queue.
dflet 0:50cedd586816 402 All threads suspended waiting for a message from this queue are resumed with
dflet 0:50cedd586816 403 an error return value.
dflet 0:50cedd586816 404
dflet 0:50cedd586816 405 Parameters:
dflet 0:50cedd586816 406
dflet 0:50cedd586816 407 pMsgQ - pointer to the message queue control block
dflet 0:50cedd586816 408
dflet 0:50cedd586816 409 ********************************************************************************/
dflet 0:50cedd586816 410 OsiReturnVal_e osi_MsgQDelete(OsiMsgQ_t* pMsgQ);
dflet 0:50cedd586816 411
dflet 0:50cedd586816 412
dflet 0:50cedd586816 413 /*******************************************************************************
dflet 0:50cedd586816 414
dflet 0:50cedd586816 415 This function writes a message to a specific message queue.
dflet 0:50cedd586816 416
dflet 0:50cedd586816 417 Notice that the message is copied to the queue from the memory area specified
dflet 0:50cedd586816 418 by pMsg pointer.
dflet 0:50cedd586816 419
dflet 0:50cedd586816 420 --------------------------------------------------------------------------------
dflet 0:50cedd586816 421 THIS FUNCTION COULD BE CALLED FROM ISR AS LONG AS THE TIMEOUT PARAMETER IS
dflet 0:50cedd586816 422 SET TO "OSI_NO_WAIT"
dflet 0:50cedd586816 423 --------------------------------------------------------------------------------
dflet 0:50cedd586816 424
dflet 0:50cedd586816 425 Parameters:
dflet 0:50cedd586816 426
dflet 0:50cedd586816 427 pMsgQ - pointer to the message queue control block
dflet 0:50cedd586816 428 pMsg - pointer to the message
dflet 0:50cedd586816 429 Timeout - numeric value specifies the maximum number of mSec to stay
dflet 0:50cedd586816 430 suspended while waiting for available space for the message
dflet 0:50cedd586816 431
dflet 0:50cedd586816 432 ********************************************************************************/
dflet 0:50cedd586816 433 OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout);
dflet 0:50cedd586816 434
dflet 0:50cedd586816 435
dflet 0:50cedd586816 436 /*******************************************************************************
dflet 0:50cedd586816 437
dflet 0:50cedd586816 438 This function retrieves a message from the specified message queue. The
dflet 0:50cedd586816 439 retrieved message is copied from the queue into the memory area specified by
dflet 0:50cedd586816 440 the pMsg pointer
dflet 0:50cedd586816 441
dflet 0:50cedd586816 442 Parameters:
dflet 0:50cedd586816 443
dflet 0:50cedd586816 444 pMsgQ - pointer to the message queue control block
dflet 0:50cedd586816 445 pMsg - pointer that specify the location where to copy the message
dflet 0:50cedd586816 446 Timeout - numeric value specifies the maximum number of mSec to stay
dflet 0:50cedd586816 447 suspended while waiting for a message to be available
dflet 0:50cedd586816 448
dflet 0:50cedd586816 449 ********************************************************************************/
dflet 0:50cedd586816 450 OsiReturnVal_e osi_MsgQRead(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout);
dflet 0:50cedd586816 451
dflet 0:50cedd586816 452 /*!
dflet 0:50cedd586816 453 \brief This function starts the OS Scheduler
dflet 0:50cedd586816 454 \param - void
dflet 0:50cedd586816 455 \return - void
dflet 0:50cedd586816 456 \note
dflet 0:50cedd586816 457 \warning
dflet 0:50cedd586816 458 */
dflet 0:50cedd586816 459 void osi_start(void);
dflet 0:50cedd586816 460
dflet 0:50cedd586816 461 /*!
dflet 0:50cedd586816 462 \brief Allocates Memory on Heap
dflet 0:50cedd586816 463 \param Size - Size of the Buffer to be allocated
dflet 0:50cedd586816 464 \sa
dflet 0:50cedd586816 465 \note
dflet 0:50cedd586816 466 \warning
dflet 0:50cedd586816 467 */
dflet 0:50cedd586816 468 void * mem_Malloc(uint32_t Size);
dflet 0:50cedd586816 469
dflet 0:50cedd586816 470
dflet 0:50cedd586816 471 /*!
dflet 0:50cedd586816 472 \brief Deallocates Memory
dflet 0:50cedd586816 473 \param pMem - Pointer to the Buffer to be freed
dflet 0:50cedd586816 474 \return void
dflet 0:50cedd586816 475 \sa
dflet 0:50cedd586816 476 \note
dflet 0:50cedd586816 477 \warning
dflet 0:50cedd586816 478 */
dflet 0:50cedd586816 479 void mem_Free(void *pMem);
dflet 0:50cedd586816 480
dflet 0:50cedd586816 481
dflet 0:50cedd586816 482 /*!
dflet 0:50cedd586816 483 \brief Set Memory
dflet 0:50cedd586816 484 \param pBuf - Pointer to the Buffer
dflet 0:50cedd586816 485 \param Val - Value to be set
dflet 0:50cedd586816 486 \param Size - Size of the memory to be set
dflet 0:50cedd586816 487 \sa
dflet 0:50cedd586816 488 \note
dflet 0:50cedd586816 489 \warning
dflet 0:50cedd586816 490 */
dflet 0:50cedd586816 491 void mem_set(void *pBuf,int Val,size_t Size);
dflet 0:50cedd586816 492
dflet 0:50cedd586816 493 /*!
dflet 0:50cedd586816 494 \brief Copy Memory
dflet 0:50cedd586816 495 \param pDst - Pointer to the Destination Buffer
dflet 0:50cedd586816 496 \param pSrc - Pointer to the Source Buffer
dflet 0:50cedd586816 497 \param Size - Size of the memory to be copied
dflet 0:50cedd586816 498 \return void
dflet 0:50cedd586816 499 \note
dflet 0:50cedd586816 500 \warning
dflet 0:50cedd586816 501 */
dflet 0:50cedd586816 502 void mem_copy(void *pDst, void *pSrc,size_t Size);
dflet 0:50cedd586816 503
dflet 0:50cedd586816 504 /*!
dflet 0:50cedd586816 505 \brief Enter Critical Section
dflet 0:50cedd586816 506 \sa
dflet 0:50cedd586816 507 \note
dflet 0:50cedd586816 508 \warning
dflet 0:50cedd586816 509 */
dflet 0:50cedd586816 510 uint32_t osi_EnterCritical(void);
dflet 0:50cedd586816 511
dflet 0:50cedd586816 512 /*!
dflet 0:50cedd586816 513 \brief Exit Critical Section
dflet 0:50cedd586816 514 \sa
dflet 0:50cedd586816 515 \note
dflet 0:50cedd586816 516 \warning
dflet 0:50cedd586816 517 */
dflet 0:50cedd586816 518 void osi_ExitCritical(uint32_t ulKey);
dflet 0:50cedd586816 519
dflet 0:50cedd586816 520 /*!
dflet 0:50cedd586816 521 \brief This function used to save the os context before sleep
dflet 0:50cedd586816 522 \param void
dflet 0:50cedd586816 523 \return void
dflet 0:50cedd586816 524 \note
dflet 0:50cedd586816 525 \warning
dflet 0:50cedd586816 526 */
dflet 0:50cedd586816 527 void osi_ContextSave(void);
dflet 0:50cedd586816 528 /*!
dflet 0:50cedd586816 529 \brief This function used to retrieve the context after sleep
dflet 0:50cedd586816 530 \param void
dflet 0:50cedd586816 531 \return void
dflet 0:50cedd586816 532 \note
dflet 0:50cedd586816 533 \warning
dflet 0:50cedd586816 534 */
dflet 0:50cedd586816 535 void osi_ContextRestore(void);
dflet 0:50cedd586816 536
dflet 0:50cedd586816 537 /*!
dflet 0:50cedd586816 538 \brief This function used to suspend the task for the specified number of milli secs
dflet 0:50cedd586816 539 \param MilliSecs - Time in millisecs to suspend the task
dflet 0:50cedd586816 540 \return void
dflet 0:50cedd586816 541 \note
dflet 0:50cedd586816 542 \warning
dflet 0:50cedd586816 543 */
dflet 0:50cedd586816 544 void osi_Sleep(unsigned int MilliSecs);
dflet 0:50cedd586816 545
dflet 0:50cedd586816 546 /*!
dflet 0:50cedd586816 547 \brief This function used to disable the tasks
dflet 0:50cedd586816 548 \param - void
dflet 0:50cedd586816 549 \return - Key with the suspended tasks
dflet 0:50cedd586816 550 \note
dflet 0:50cedd586816 551 \warning
dflet 0:50cedd586816 552 */
dflet 0:50cedd586816 553 uint32_t osi_TaskDisable(void);
dflet 0:50cedd586816 554
dflet 0:50cedd586816 555 /*!
dflet 0:50cedd586816 556 \brief This function used to enable all tasks
dflet 0:50cedd586816 557 \param unsigned long
dflet 0:50cedd586816 558 \return - void
dflet 0:50cedd586816 559 \note
dflet 0:50cedd586816 560 \warning
dflet 0:50cedd586816 561 */
dflet 0:50cedd586816 562 void osi_TaskEnable(uint32_t);
dflet 0:50cedd586816 563 /*!
dflet 0:50cedd586816 564 \brief structure definition for simple link spawn message
dflet 0:50cedd586816 565
dflet 0:50cedd586816 566 \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
dflet 0:50cedd586816 567 */
dflet 0:50cedd586816 568
dflet 0:50cedd586816 569 typedef struct
dflet 0:50cedd586816 570 {
dflet 0:50cedd586816 571 P_OSI_SPAWN_ENTRY pEntry;
dflet 0:50cedd586816 572 void* pValue;
dflet 0:50cedd586816 573 }tSimpleLinkSpawnMsg;
dflet 0:50cedd586816 574
dflet 0:50cedd586816 575 /* The queue used to send message to simple link spawn task. */
dflet 0:50cedd586816 576 extern void* xSimpleLinkSpawnQueue;
dflet 0:50cedd586816 577
dflet 0:50cedd586816 578 /* API for SL Task*/
dflet 0:50cedd586816 579 OsiReturnVal_e VStartSimpleLinkSpawnTask(unsigned portBASE_TYPE uxPriority);
dflet 0:50cedd586816 580 void VDeleteSimpleLinkSpawnTask( void );
dflet 0:50cedd586816 581
dflet 0:50cedd586816 582
dflet 0:50cedd586816 583
dflet 0:50cedd586816 584 #ifdef __cplusplus
dflet 0:50cedd586816 585 }
dflet 0:50cedd586816 586 #endif // __cplusplus
dflet 0:50cedd586816 587
dflet 0:50cedd586816 588 #endif
dflet 0:50cedd586816 589