1
6
7
8
9
10
15
16
17
18
19
20
21
22
23
24
25
26
27
28
36
37
38
42
43
47
48
52
53
54
55
56
57
/* ... */
#ifndef _OSAL_H_
#define _OSAL_H_
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <unistd.h>
#include <stdint.h>
#include <esp_timer.h>5 includes
#ifdef __cplusplus
extern "C" {
#endif
#define OS_SUCCESS ESP_OK
#define OS_FAIL ESP_FAIL
typedef TaskHandle_t othread_t;
static inline int httpd_os_thread_create(othread_t *thread,
const char *name, uint16_t stacksize, int prio,
void (*thread_routine)(void *arg), void *arg,
BaseType_t core_id, uint32_t caps)
{
int ret = xTaskCreatePinnedToCoreWithCaps(thread_routine, name, stacksize, arg, prio, thread, core_id, caps);
if (ret == pdPASS) {
return OS_SUCCESS;
}{...}
return OS_FAIL;
}{ ... }
static inline void httpd_os_thread_delete(void)
{
vTaskDeleteWithCaps(xTaskGetCurrentTaskHandle());
}{ ... }
static inline void httpd_os_thread_sleep(int msecs)
{
vTaskDelay(msecs / portTICK_PERIOD_MS);
}{ ... }
static inline othread_t httpd_os_thread_handle(void)
{
return xTaskGetCurrentTaskHandle();
}{ ... }
#ifdef __cplusplus
}{...}
#endif
/* ... */
#endif