mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-10 15:04:53 +00:00

The HTTP server is not a critical component, it would be nice if we can control the task caps by using configuration. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Signed-off-by: Harshit Malpani <harshit.malpani@espressif.com>
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef _OSAL_H_
|
|
#define _OSAL_H_
|
|
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/task.h>
|
|
#include <unistd.h>
|
|
#include <stdint.h>
|
|
#include <esp_timer.h>
|
|
|
|
#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;
|
|
}
|
|
|
|
/* Only self delete is supported */
|
|
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 /* ! _OSAL_H_ */
|