| 1 |
threadapi_freertos |
| 2 |
================= |
| 3 |
|
| 4 |
## Overview |
| 5 |
|
| 6 |
threadapi_freertos implements a wrapper function for the FreeRTOS `vTaskDelay` function. FreeRTOS is not guaranteed to support threading, so it returns an error for the other ThreadAPI functions. |
| 7 |
|
| 8 |
## References |
| 9 |
|
| 10 |
[vTaskDelay](http://www.freertos.org/a00127.html) |
| 11 |
|
| 12 |
### Exposed API |
| 13 |
|
| 14 |
**SRS_THREADAPI_FREERTOS_30_001: [** The threadapi_freertos shall implement the method `ThreadAPI_Sleep` defined in `threadapi.h`. |
| 15 |
```c |
| 16 |
/** |
| 17 |
* @brief Sleeps the current thread for the given number of milliseconds. |
| 18 |
* |
| 19 |
* @param milliseconds The number of milliseconds to sleep. |
| 20 |
*/ |
| 21 |
void ThreadAPI_Sleep(unsigned int milliseconds); |
| 22 |
``` |
| 23 |
**]** |
| 24 |
|
| 25 |
|
| 26 |
### ThreadAPI_Sleep |
| 27 |
|
| 28 |
```c |
| 29 |
void ThreadAPI_Sleep(unsigned int milliseconds); |
| 30 |
``` |
| 31 |
|
| 32 |
**SRS_THREADAPI_FREERTOS_30_002: [** The ThreadAPI_Sleep shall receive a time in milliseconds. **]** |
| 33 |
|
| 34 |
**SRS_THREADAPI_FREERTOS_30_003: [** The ThreadAPI_Sleep shall stop the thread for the specified time. **]** |
| 35 |
|
| 36 |
|
| 37 |
### ThreadAPI_Create |
| 38 |
|
| 39 |
```c |
| 40 |
THREADAPI_RESULT ThreadAPI_Create(THREAD_HANDLE* threadHandle, THREAD_START_FUNC func, void* arg); |
| 41 |
``` |
| 42 |
|
| 43 |
**SRS_THREADAPI_FREERTOS_30_004: [** FreeRTOS is not guaranteed to support threading, so ThreadAPI_Create shall return THREADAPI_ERROR. **]** |
| 44 |
|
| 45 |
|
| 46 |
### ThreadAPI_Join |
| 47 |
|
| 48 |
```c |
| 49 |
THREADAPI_RESULT ThreadAPI_Join(THREAD_HANDLE threadHandle, int* res); |
| 50 |
``` |
| 51 |
|
| 52 |
**SRS_THREADAPI_FREERTOS_30_005: [** FreeRTOS is not guaranteed to support threading, so ThreadAPI_Join shall return THREADAPI_ERROR. **]** |
| 53 |
|
| 54 |
|
| 55 |
### ThreadAPI_Exit |
| 56 |
|
| 57 |
```c |
| 58 |
void ThreadAPI_Exit(int res); |
| 59 |
``` |
| 60 |
|
| 61 |
**SRS_THREADAPI_FREERTOS_30_006: [** FreeRTOS is not guaranteed to support threading, so ThreadAPI_Exit shall do nothing. **]** |