forked from espressif/esp-idf
Merge branch 'contrib/github_pr_12500' into 'master'
change(components/esp_http_server): add task_caps configuration (GitHub PR) Closes IDFGH-11351 See merge request espressif/esp-idf!27621
This commit is contained in:
@@ -54,6 +54,7 @@ initializer that should be kept in sync
|
|||||||
.task_priority = tskIDLE_PRIORITY+5, \
|
.task_priority = tskIDLE_PRIORITY+5, \
|
||||||
.stack_size = 4096, \
|
.stack_size = 4096, \
|
||||||
.core_id = tskNO_AFFINITY, \
|
.core_id = tskNO_AFFINITY, \
|
||||||
|
.task_caps = (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT), \
|
||||||
.server_port = 80, \
|
.server_port = 80, \
|
||||||
.ctrl_port = ESP_HTTPD_DEF_CTRL_PORT, \
|
.ctrl_port = ESP_HTTPD_DEF_CTRL_PORT, \
|
||||||
.max_open_sockets = 7, \
|
.max_open_sockets = 7, \
|
||||||
@@ -168,6 +169,7 @@ typedef struct httpd_config {
|
|||||||
unsigned task_priority; /*!< Priority of FreeRTOS task which runs the server */
|
unsigned task_priority; /*!< Priority of FreeRTOS task which runs the server */
|
||||||
size_t stack_size; /*!< The maximum stack size allowed for the server task */
|
size_t stack_size; /*!< The maximum stack size allowed for the server task */
|
||||||
BaseType_t core_id; /*!< The core the HTTP server task will run on */
|
BaseType_t core_id; /*!< The core the HTTP server task will run on */
|
||||||
|
uint32_t task_caps; /*!< The memory capabilities to use when allocating the HTTP server task's stack */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCP Port number for receiving and transmitting HTTP traffic
|
* TCP Port number for receiving and transmitting HTTP traffic
|
||||||
|
@@ -519,7 +519,8 @@ esp_err_t httpd_start(httpd_handle_t *handle, const httpd_config_t *config)
|
|||||||
hd->config.stack_size,
|
hd->config.stack_size,
|
||||||
hd->config.task_priority,
|
hd->config.task_priority,
|
||||||
httpd_thread, hd,
|
httpd_thread, hd,
|
||||||
hd->config.core_id) != ESP_OK) {
|
hd->config.core_id,
|
||||||
|
hd->config.task_caps) != ESP_OK) {
|
||||||
/* Failed to launch task */
|
/* Failed to launch task */
|
||||||
httpd_delete(hd);
|
httpd_delete(hd);
|
||||||
return ESP_ERR_HTTPD_TASK;
|
return ESP_ERR_HTTPD_TASK;
|
||||||
|
@@ -25,9 +25,9 @@ typedef TaskHandle_t othread_t;
|
|||||||
static inline int httpd_os_thread_create(othread_t *thread,
|
static inline int httpd_os_thread_create(othread_t *thread,
|
||||||
const char *name, uint16_t stacksize, int prio,
|
const char *name, uint16_t stacksize, int prio,
|
||||||
void (*thread_routine)(void *arg), void *arg,
|
void (*thread_routine)(void *arg), void *arg,
|
||||||
BaseType_t core_id)
|
BaseType_t core_id, uint32_t caps)
|
||||||
{
|
{
|
||||||
int ret = xTaskCreatePinnedToCore(thread_routine, name, stacksize, arg, prio, thread, core_id);
|
int ret = xTaskCreatePinnedToCoreWithCaps(thread_routine, name, stacksize, arg, prio, thread, core_id, caps);
|
||||||
if (ret == pdPASS) {
|
if (ret == pdPASS) {
|
||||||
return OS_SUCCESS;
|
return OS_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ static inline int httpd_os_thread_create(othread_t *thread,
|
|||||||
/* Only self delete is supported */
|
/* Only self delete is supported */
|
||||||
static inline void httpd_os_thread_delete(void)
|
static inline void httpd_os_thread_delete(void)
|
||||||
{
|
{
|
||||||
vTaskDelete(xTaskGetCurrentTaskHandle());
|
vTaskDeleteWithCaps(xTaskGetCurrentTaskHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void httpd_os_thread_sleep(int msecs)
|
static inline void httpd_os_thread_sleep(int msecs)
|
||||||
|
@@ -21,7 +21,7 @@ typedef TaskHandle_t othread_t;
|
|||||||
static inline int httpd_os_thread_create(othread_t *thread,
|
static inline int httpd_os_thread_create(othread_t *thread,
|
||||||
const char *name, uint16_t stacksize, int prio,
|
const char *name, uint16_t stacksize, int prio,
|
||||||
void (*thread_routine)(void *arg), void *arg,
|
void (*thread_routine)(void *arg), void *arg,
|
||||||
BaseType_t core_id)
|
BaseType_t core_id, uint32_t caps)
|
||||||
{
|
{
|
||||||
pthread_attr_t thread_attr;
|
pthread_attr_t thread_attr;
|
||||||
pthread_attr_init(&thread_attr);
|
pthread_attr_init(&thread_attr);
|
||||||
|
@@ -131,6 +131,7 @@ typedef struct httpd_ssl_config httpd_ssl_config_t;
|
|||||||
.task_priority = tskIDLE_PRIORITY+5, \
|
.task_priority = tskIDLE_PRIORITY+5, \
|
||||||
.stack_size = 10240, \
|
.stack_size = 10240, \
|
||||||
.core_id = tskNO_AFFINITY, \
|
.core_id = tskNO_AFFINITY, \
|
||||||
|
.task_caps = (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT), \
|
||||||
.server_port = 0, \
|
.server_port = 0, \
|
||||||
.ctrl_port = ESP_HTTPD_DEF_CTRL_PORT+1, \
|
.ctrl_port = ESP_HTTPD_DEF_CTRL_PORT+1, \
|
||||||
.max_open_sockets = 4, \
|
.max_open_sockets = 4, \
|
||||||
|
Reference in New Issue
Block a user