osi_freertos.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. //*****************************************************************************
  2. // osi_freertos.c
  3. //
  4. // Interface APIs for free-rtos function calls
  5. //
  6. // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  7. //
  8. //
  9. // Redistribution and use in source and binary forms, with or without
  10. // modification, are permitted provided that the following conditions
  11. // are met:
  12. //
  13. // Redistributions of source code must retain the above copyright
  14. // notice, this list of conditions and the following disclaimer.
  15. //
  16. // Redistributions in binary form must reproduce the above copyright
  17. // notice, this list of conditions and the following disclaimer in the
  18. // documentation and/or other materials provided with the
  19. // distribution.
  20. //
  21. // Neither the name of Texas Instruments Incorporated nor the names of
  22. // its contributors may be used to endorse or promote products derived
  23. // from this software without specific prior written permission.
  24. //
  25. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. //
  37. //*****************************************************************************
  38. #include <stdio.h>
  39. #include <stdlib.h>
  40. #include <string.h>
  41. #include "FreeRTOS.h"
  42. #include "task.h"
  43. #include "semphr.h"
  44. #include "portmacro.h"
  45. #include "osi.h"
  46. #include "rom_map.h"
  47. #include "inc/hw_types.h"
  48. #include "interrupt.h"
  49. #include "pybwdt.h"
  50. #include "debug.h"
  51. portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
  52. //Local function definition
  53. static void vSimpleLinkSpawnTask( void *pvParameters );
  54. //Queue Handler
  55. QueueHandle_t xSimpleLinkSpawnQueue = NULL;
  56. TaskHandle_t xSimpleLinkSpawnTaskHndl = NULL;
  57. // Queue size
  58. #define slQUEUE_SIZE ( 3 )
  59. #define SL_SPAWN_MAX_WAIT_MS ( 200 )
  60. // This is the static memory (TCB and stack) for the SL spawn task
  61. static StaticTask_t spawnTaskTCB __attribute__ ((section (".rtos_heap")));
  62. static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
  63. /*!
  64. \brief This function registers an interrupt in NVIC table
  65. The sync object is used for synchronization between different thread or ISR and
  66. a thread.
  67. \param iIntrNum - Interrupt number to register
  68. \param pEntry - Pointer to the interrupt handler
  69. \param ucPriority - priority of the interrupt
  70. \return upon successful creation the function should return 0
  71. Otherwise, a negative value indicating the error code shall be returned
  72. \note
  73. \warning
  74. */
  75. OsiReturnVal_e osi_InterruptRegister(int iIntrNum,P_OSI_INTR_ENTRY pEntry,unsigned char ucPriority)
  76. {
  77. MAP_IntRegister(iIntrNum,(void(*)(void))pEntry);
  78. MAP_IntPrioritySet(iIntrNum, ucPriority);
  79. MAP_IntEnable(iIntrNum);
  80. return OSI_OK;
  81. }
  82. /*!
  83. \brief This function De registers an interrupt in NVIC table
  84. \param iIntrNum - Interrupt number to De register
  85. \return none
  86. \note
  87. \warning
  88. */
  89. void osi_InterruptDeRegister(int iIntrNum)
  90. {
  91. MAP_IntDisable(iIntrNum);
  92. MAP_IntUnregister(iIntrNum);
  93. }
  94. /*!
  95. \brief This function creates a sync object
  96. The sync object is used for synchronization between different thread or ISR and
  97. a thread.
  98. \param pSyncObj - pointer to the sync object control block
  99. \return upon successful creation the function should return 0
  100. Otherwise, a negative value indicating the error code shall be returned
  101. \note
  102. \warning
  103. */
  104. OsiReturnVal_e osi_SyncObjCreate(OsiSyncObj_t* pSyncObj)
  105. {
  106. SemaphoreHandle_t *pl_SyncObj = (SemaphoreHandle_t *)pSyncObj;
  107. *pl_SyncObj = xSemaphoreCreateBinary();
  108. ASSERT (*pSyncObj != NULL);
  109. return OSI_OK;
  110. }
  111. /*!
  112. \brief This function deletes a sync object
  113. \param pSyncObj - pointer to the sync object control block
  114. \return upon successful deletion the function should return 0
  115. Otherwise, a negative value indicating the error code shall be returned
  116. \note
  117. \warning
  118. */
  119. OsiReturnVal_e osi_SyncObjDelete(OsiSyncObj_t* pSyncObj)
  120. {
  121. vSemaphoreDelete(*pSyncObj );
  122. return OSI_OK;
  123. }
  124. /*!
  125. \brief This function generates a sync signal for the object.
  126. All suspended threads waiting on this sync object are resumed
  127. \param pSyncObj - pointer to the sync object control block
  128. \return upon successful signaling the function should return 0
  129. Otherwise, a negative value indicating the error code shall be returned
  130. \note the function could be called from ISR context
  131. \warning
  132. */
  133. OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj)
  134. {
  135. xSemaphoreGive( *pSyncObj );
  136. return OSI_OK;
  137. }
  138. /*!
  139. \brief This function generates a sync signal for the object
  140. from ISR context.
  141. All suspended threads waiting on this sync object are resumed
  142. \param pSyncObj - pointer to the sync object control block
  143. \return upon successful signalling the function should return 0
  144. Otherwise, a negative value indicating the error code shall be returned
  145. \note the function is called from ISR context
  146. \warning
  147. */
  148. OsiReturnVal_e osi_SyncObjSignalFromISR(OsiSyncObj_t* pSyncObj)
  149. {
  150. xHigherPriorityTaskWoken = pdFALSE;
  151. if(pdTRUE == xSemaphoreGiveFromISR( *pSyncObj, &xHigherPriorityTaskWoken ))
  152. {
  153. if( xHigherPriorityTaskWoken )
  154. {
  155. taskYIELD ();
  156. }
  157. }
  158. return OSI_OK;
  159. }
  160. /*!
  161. \brief This function waits for a sync signal of the specific sync object
  162. \param pSyncObj - pointer to the sync object control block
  163. \param Timeout - numeric value specifies the maximum number of mSec to
  164. stay suspended while waiting for the sync signal
  165. Currently, the simple link driver uses only two values:
  166. - OSI_WAIT_FOREVER
  167. - OSI_NO_WAIT
  168. \return upon successful reception of the signal within the timeout window return 0
  169. Otherwise, a negative value indicating the error code shall be returned
  170. \note
  171. \warning
  172. */
  173. OsiReturnVal_e osi_SyncObjWait(OsiSyncObj_t* pSyncObj , OsiTime_t Timeout)
  174. {
  175. if(pdTRUE == xSemaphoreTake( (SemaphoreHandle_t)*pSyncObj, ( TickType_t )Timeout))
  176. {
  177. return OSI_OK;
  178. }
  179. else
  180. {
  181. return OSI_OPERATION_FAILED;
  182. }
  183. }
  184. /*!
  185. \brief This function clears a sync object
  186. \param pSyncObj - pointer to the sync object control block
  187. \return upon successful clearing the function should return 0
  188. Otherwise, a negative value indicating the error code shall be returned
  189. \note
  190. \warning
  191. */
  192. OsiReturnVal_e osi_SyncObjClear(OsiSyncObj_t* pSyncObj)
  193. {
  194. if (OSI_OK == osi_SyncObjWait(pSyncObj,0) )
  195. {
  196. return OSI_OK;
  197. }
  198. else
  199. {
  200. return OSI_OPERATION_FAILED;
  201. }
  202. }
  203. /*!
  204. \brief This function creates a locking object.
  205. The locking object is used for protecting a shared resources between different
  206. threads.
  207. \param pLockObj - pointer to the locking object control block
  208. \return upon successful creation the function should return 0
  209. Otherwise, a negative value indicating the error code shall be returned
  210. \note
  211. \warning
  212. */
  213. OsiReturnVal_e osi_LockObjCreate(OsiLockObj_t* pLockObj)
  214. {
  215. SemaphoreHandle_t *pl_LockObj = (SemaphoreHandle_t *)pLockObj;
  216. vSemaphoreCreateBinary(*pl_LockObj);
  217. ASSERT (*pLockObj != NULL);
  218. return OSI_OK;
  219. }
  220. /*!
  221. \brief This function creates a Task.
  222. Creates a new Task and add it to the last of tasks that are ready to run
  223. \param pEntry - pointer to the Task Function
  224. \param pcName - Task Name String
  225. \param usStackDepth - Stack Size in bytes
  226. \param pvParameters - pointer to structure to be passed to the Task Function
  227. \param uxPriority - Task Priority
  228. \return upon successful creation the function should return 0
  229. Otherwise, a negative value indicating the error code shall be returned
  230. \note
  231. \warning
  232. */
  233. OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry,const signed char * const pcName,
  234. unsigned short usStackDepth, void *pvParameters,
  235. unsigned long uxPriority,OsiTaskHandle* pTaskHandle)
  236. {
  237. ASSERT (pdPASS == xTaskCreate( pEntry, (char const*)pcName,
  238. (usStackDepth/(sizeof( portSTACK_TYPE ))),
  239. pvParameters,(unsigned portBASE_TYPE)uxPriority,
  240. (TaskHandle_t*)pTaskHandle ));
  241. return OSI_OK;
  242. }
  243. /*!
  244. \brief This function Deletes a Task.
  245. Deletes a Task and remove it from list of running task
  246. \param pTaskHandle - Task Handle
  247. \note
  248. \warning
  249. */
  250. void osi_TaskDelete(OsiTaskHandle* pTaskHandle)
  251. {
  252. vTaskDelete((TaskHandle_t)*pTaskHandle);
  253. }
  254. /*!
  255. \brief This function deletes a locking object.
  256. \param pLockObj - pointer to the locking object control block
  257. \return upon successful deletion the function should return 0
  258. Otherwise, a negative value indicating the error code shall be returned
  259. \note
  260. \warning
  261. */
  262. OsiReturnVal_e _osi_LockObjDelete(OsiLockObj_t* pLockObj)
  263. {
  264. vSemaphoreDelete((SemaphoreHandle_t)*pLockObj );
  265. return OSI_OK;
  266. }
  267. /*!
  268. \brief This function locks a locking object.
  269. All other threads that call this function before this thread calls
  270. the osi_LockObjUnlock would be suspended
  271. \param pLockObj - pointer to the locking object control block
  272. \param Timeout - numeric value specifies the maximum number of mSec to
  273. stay suspended while waiting for the locking object
  274. Currently, the simple link driver uses only two values:
  275. - OSI_WAIT_FOREVER
  276. - OSI_NO_WAIT
  277. \return upon successful reception of the locking object the function should return 0
  278. Otherwise, a negative value indicating the error code shall be returned
  279. \note
  280. \warning
  281. */
  282. OsiReturnVal_e _osi_LockObjLock(OsiLockObj_t* pLockObj , OsiTime_t Timeout)
  283. {
  284. //Take Semaphore
  285. if(pdTRUE == xSemaphoreTake( *pLockObj, ( TickType_t ) Timeout ))
  286. {
  287. return OSI_OK;
  288. }
  289. else
  290. {
  291. return OSI_OPERATION_FAILED;
  292. }
  293. }
  294. /*!
  295. \brief This function unlock a locking object.
  296. \param pLockObj - pointer to the locking object control block
  297. \return upon successful unlocking the function should return 0
  298. Otherwise, a negative value indicating the error code shall be returned
  299. \note
  300. \warning
  301. */
  302. OsiReturnVal_e _osi_LockObjUnlock(OsiLockObj_t* pLockObj)
  303. {
  304. //Release Semaphore
  305. if(pdTRUE == xSemaphoreGive( *pLockObj ))
  306. {
  307. return OSI_OK;
  308. }
  309. else
  310. {
  311. return OSI_OPERATION_FAILED;
  312. }
  313. }
  314. /*!
  315. \brief This function call the pEntry callback from a different context
  316. \param pEntry - pointer to the entry callback function
  317. \param pValue - pointer to any type of memory structure that would be
  318. passed to pEntry callback from the execution thread.
  319. \param flags - execution flags - reserved for future usage
  320. \return upon successful registration of the spawn the function should return 0
  321. (the function is not blocked till the end of the execution of the function
  322. and could be returned before the execution is actually completed)
  323. Otherwise, a negative value indicating the error code shall be returned
  324. \note
  325. \warning
  326. */
  327. OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry , void* pValue , unsigned long flags)
  328. {
  329. tSimpleLinkSpawnMsg Msg;
  330. Msg.pEntry = pEntry;
  331. Msg.pValue = pValue;
  332. xHigherPriorityTaskWoken = pdFALSE;
  333. if(pdTRUE == xQueueSendFromISR( xSimpleLinkSpawnQueue, &Msg, &xHigherPriorityTaskWoken ))
  334. {
  335. if( xHigherPriorityTaskWoken )
  336. {
  337. taskYIELD ();
  338. }
  339. return OSI_OK;
  340. }
  341. return OSI_OPERATION_FAILED;
  342. }
  343. /*!
  344. \brief This is the simplelink spawn task to call SL callback from a different context
  345. \param pvParameters - pointer to the task parameter
  346. \return void
  347. \note
  348. \warning
  349. */
  350. void vSimpleLinkSpawnTask(void *pvParameters)
  351. {
  352. tSimpleLinkSpawnMsg Msg;
  353. portBASE_TYPE ret;
  354. for(;;)
  355. {
  356. ret = xQueueReceive( xSimpleLinkSpawnQueue, &Msg, SL_SPAWN_MAX_WAIT_MS);
  357. if(ret == pdPASS)
  358. {
  359. Msg.pEntry(Msg.pValue);
  360. }
  361. // set the alive flag for the wdt
  362. pybwdt_sl_alive();
  363. }
  364. }
  365. /*!
  366. \brief This is the API to create SL spawn task and create the SL queue
  367. \param uxPriority - task priority
  368. \return void
  369. \note
  370. \warning
  371. */
  372. __attribute__ ((section (".boot")))
  373. OsiReturnVal_e VStartSimpleLinkSpawnTask(unsigned portBASE_TYPE uxPriority)
  374. {
  375. xSimpleLinkSpawnQueue = xQueueCreate( slQUEUE_SIZE, sizeof( tSimpleLinkSpawnMsg ) );
  376. ASSERT (xSimpleLinkSpawnQueue != NULL);
  377. /*
  378. // This is the original code to create a task dynamically
  379. ASSERT (pdPASS == xTaskCreate( vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN",\
  380. 896 / sizeof(portSTACK_TYPE), NULL, uxPriority, &xSimpleLinkSpawnTaskHndl ));
  381. */
  382. // This code creates the task using static memory for the TCB and stack
  383. xSimpleLinkSpawnTaskHndl = xTaskCreateStatic(
  384. vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN",
  385. 896 / sizeof(portSTACK_TYPE), NULL, uxPriority,
  386. spawnTaskStack, &spawnTaskTCB);
  387. ASSERT(xSimpleLinkSpawnTaskHndl != NULL);
  388. return OSI_OK;
  389. }
  390. /*!
  391. \brief This is the API to delete SL spawn task and delete the SL queue
  392. \param none
  393. \return void
  394. \note
  395. \warning
  396. */
  397. void VDeleteSimpleLinkSpawnTask( void )
  398. {
  399. if(xSimpleLinkSpawnTaskHndl)
  400. {
  401. vTaskDelete( xSimpleLinkSpawnTaskHndl );
  402. xSimpleLinkSpawnTaskHndl = 0;
  403. }
  404. if(xSimpleLinkSpawnQueue)
  405. {
  406. vQueueDelete( xSimpleLinkSpawnQueue );
  407. xSimpleLinkSpawnQueue = 0;
  408. }
  409. }
  410. /*!
  411. \brief This function is used to create the MsgQ
  412. \param pMsgQ - pointer to the message queue
  413. \param pMsgQName - msg queue name
  414. \param MsgSize - size of message on the queue
  415. \param MaxMsgs - max. number of msgs that the queue can hold
  416. \return - OsiReturnVal_e
  417. \note
  418. \warning
  419. */
  420. OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t* pMsgQ ,
  421. char* pMsgQName,
  422. unsigned long MsgSize,
  423. unsigned long MaxMsgs)
  424. {
  425. QueueHandle_t handle;
  426. //Create Queue
  427. handle = xQueueCreate( MaxMsgs, MsgSize );
  428. ASSERT (handle != NULL);
  429. *pMsgQ = (OsiMsgQ_t)handle;
  430. return OSI_OK;
  431. }
  432. /*!
  433. \brief This function is used to delete the MsgQ
  434. \param pMsgQ - pointer to the message queue
  435. \return - OsiReturnVal_e
  436. \note
  437. \warning
  438. */
  439. OsiReturnVal_e osi_MsgQDelete(OsiMsgQ_t* pMsgQ)
  440. {
  441. vQueueDelete((QueueHandle_t) *pMsgQ );
  442. return OSI_OK;
  443. }
  444. /*!
  445. \brief This function is used to write data to the MsgQ
  446. \param pMsgQ - pointer to the message queue
  447. \param pMsg - pointer to the Msg strut to read into
  448. \param Timeout - timeout to wait for the Msg to be available
  449. \return - OsiReturnVal_e
  450. \note
  451. \warning
  452. */
  453. OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout)
  454. {
  455. xHigherPriorityTaskWoken = pdFALSE;
  456. if(pdPASS == xQueueSendFromISR((QueueHandle_t) *pMsgQ, pMsg, &xHigherPriorityTaskWoken ))
  457. {
  458. taskYIELD ();
  459. return OSI_OK;
  460. }
  461. else
  462. {
  463. return OSI_OPERATION_FAILED;
  464. }
  465. }
  466. /*!
  467. \brief This function is used to read data from the MsgQ
  468. \param pMsgQ - pointer to the message queue
  469. \param pMsg - pointer to the Msg strut to read into
  470. \param Timeout - timeout to wait for the Msg to be available
  471. \return - OsiReturnVal_e
  472. \note
  473. \warning
  474. */
  475. OsiReturnVal_e osi_MsgQRead(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout)
  476. {
  477. //Receive Item from Queue
  478. if( pdTRUE == xQueueReceive((QueueHandle_t)*pMsgQ,pMsg,Timeout) )
  479. {
  480. return OSI_OK;
  481. }
  482. else
  483. {
  484. return OSI_OPERATION_FAILED;
  485. }
  486. }
  487. /*!
  488. \brief This function to call the memory de-allocation function of the FREERTOS
  489. \param Size - size of memory to alloc in bytes
  490. \return - void *
  491. \note
  492. \warning
  493. */
  494. void * mem_Malloc(unsigned long Size)
  495. {
  496. return ( void * ) pvPortMalloc( (size_t)Size );
  497. }
  498. /*!
  499. \brief This function to call the memory de-allocation function of the FREERTOS
  500. \param pMem - pointer to the memory which needs to be freed
  501. \return - void
  502. \note
  503. \warning
  504. */
  505. void mem_Free(void *pMem)
  506. {
  507. vPortFree( pMem );
  508. }
  509. /*!
  510. \brief This function call the memset function
  511. \param pBuf - pointer to the memory to be fill
  512. \param Val - Value to be fill
  513. \param Size - Size of the memory which needs to be fill
  514. \return - void
  515. \note
  516. \warning
  517. */
  518. void mem_set(void *pBuf,int Val,size_t Size)
  519. {
  520. memset( pBuf,Val,Size);
  521. }
  522. /*!
  523. \brief This function call the memcopy function
  524. \param pDst - pointer to the destination
  525. \param pSrc - pointer to the source
  526. \param Size - Size of the memory which needs to be copy
  527. \return - void
  528. \note
  529. \warning
  530. */
  531. void mem_copy(void *pDst, void *pSrc,size_t Size)
  532. {
  533. memcpy(pDst,pSrc,Size);
  534. }
  535. /*!
  536. \brief This function use to entering into critical section
  537. \param void
  538. \return - void
  539. \note
  540. \warning
  541. */
  542. void osi_EnterCritical(void)
  543. {
  544. vPortEnterCritical();
  545. }
  546. /*!
  547. \brief This function use to exit critical section
  548. \param void
  549. \return - void
  550. \note
  551. \warning
  552. */
  553. void osi_ExitCritical(void)
  554. {
  555. vPortExitCritical();
  556. }
  557. /*!
  558. \brief This function used to start the scheduler
  559. \param void
  560. \return - void
  561. \note
  562. \warning
  563. */
  564. __attribute__ ((section (".boot")))
  565. void osi_start()
  566. {
  567. vTaskStartScheduler();
  568. }
  569. /*!
  570. \brief This function used to suspend the task for the specified number of milli secs
  571. \param MilliSecs - Time in millisecs to suspend the task
  572. \return - void
  573. \note
  574. \warning
  575. */
  576. void osi_Sleep(unsigned int MilliSecs)
  577. {
  578. vTaskDelay(MilliSecs);
  579. }
  580. /*!
  581. \brief This function used to disable the tasks
  582. \param - void
  583. \return - Key with the suspended tasks
  584. \note
  585. \warning
  586. */
  587. void osi_TaskDisable(void)
  588. {
  589. vTaskSuspendAll();
  590. }
  591. /*!
  592. \brief This function used to resume all the tasks
  593. \param key - returned from suspend tasks
  594. \return - void
  595. \note
  596. \warning
  597. */
  598. void osi_TaskEnable(void)
  599. {
  600. xTaskResumeAll();
  601. }
  602. /*!
  603. \brief This function used to save the OS context before sleep
  604. \param void
  605. \return - void
  606. \note
  607. \warning
  608. */
  609. void osi_ContextSave()
  610. {
  611. }
  612. /*!
  613. \brief This function used to restore the OS context after sleep
  614. \param void
  615. \return - void
  616. \note
  617. \warning
  618. */
  619. void osi_ContextRestore()
  620. {
  621. }