pthread: remove ESP32_ prefix from Kconfig options

pthread implementation is not chip-specific, so this prefix is not
needed.
This commit is contained in:
Ivan Grokhotkov 2019-07-28 11:22:51 +02:00
parent 661769527c
commit e9de7b1df3
5 changed files with 33 additions and 26 deletions

View File

@ -1,46 +1,46 @@
menu "PThreads"
config ESP32_PTHREAD_TASK_PRIO_DEFAULT
config PTHREAD_TASK_PRIO_DEFAULT
int "Default task priority"
range 0 255
default 5
help
Priority used to create new tasks with default pthread parameters.
config ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT
config PTHREAD_TASK_STACK_SIZE_DEFAULT
int "Default task stack size"
default 3072
help
Stack size used to create new tasks with default pthread parameters.
config ESP32_PTHREAD_STACK_MIN
config PTHREAD_STACK_MIN
int "Minimum allowed pthread stack size"
default 768
help
Minimum allowed pthread stack size set in attributes passed to pthread_create
choice ESP32_PTHREAD_TASK_CORE_DEFAULT
choice PTHREAD_TASK_CORE_DEFAULT
bool "Default pthread core affinity"
default ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY
default PTHREAD_DEFAULT_CORE_NO_AFFINITY
depends on !FREERTOS_UNICORE
help
The default core to which pthreads are pinned.
config ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY
config PTHREAD_DEFAULT_CORE_NO_AFFINITY
bool "No affinity"
config ESP32_DEFAULT_PTHREAD_CORE_0
config PTHREAD_DEFAULT_CORE_0
bool "Core 0"
config ESP32_DEFAULT_PTHREAD_CORE_1
config PTHREAD_DEFAULT_CORE_1
bool "Core 1"
endchoice
config ESP32_PTHREAD_TASK_CORE_DEFAULT
config PTHREAD_TASK_CORE_DEFAULT
int
default -1 if ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY || FREERTOS_UNICORE
default 0 if ESP32_DEFAULT_PTHREAD_CORE_0
default 1 if ESP32_DEFAULT_PTHREAD_CORE_1
default -1 if PTHREAD_DEFAULT_CORE_NO_AFFINITY || FREERTOS_UNICORE
default 0 if PTHREAD_DEFAULT_CORE_0
default 1 if PTHREAD_DEFAULT_CORE_1
config ESP32_PTHREAD_TASK_NAME_DEFAULT
config PTHREAD_TASK_NAME_DEFAULT
string "Default name of pthreads"
default "pthread"
help

View File

@ -22,7 +22,7 @@ extern "C" {
#endif
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN CONFIG_ESP32_PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN
#endif
/** pthread configuration structure that influences pthread creation */

View File

@ -170,14 +170,14 @@ esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
static int get_default_pthread_core()
{
return CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT == -1 ? tskNO_AFFINITY : CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT;
return CONFIG_PTHREAD_TASK_CORE_DEFAULT == -1 ? tskNO_AFFINITY : CONFIG_PTHREAD_TASK_CORE_DEFAULT;
}
esp_pthread_cfg_t esp_pthread_get_default_config()
{
esp_pthread_cfg_t cfg = {
.stack_size = CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT,
.prio = CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT,
.stack_size = CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT,
.prio = CONFIG_PTHREAD_TASK_PRIO_DEFAULT,
.inherit_cfg = false,
.thread_name = NULL,
.pin_to_core = get_default_pthread_core()
@ -233,10 +233,10 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return ENOMEM;
}
uint32_t stack_size = CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT;
BaseType_t prio = CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT;
uint32_t stack_size = CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT;
BaseType_t prio = CONFIG_PTHREAD_TASK_PRIO_DEFAULT;
BaseType_t core_id = get_default_pthread_core();
const char *task_name = CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT;
const char *task_name = CONFIG_PTHREAD_TASK_NAME_DEFAULT;
esp_pthread_cfg_t *pthread_cfg = pthread_getspecific(s_pthread_cfg_key);
if (pthread_cfg) {
@ -256,7 +256,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
task_name = pthread_cfg->thread_name;
}
} else if (pthread_cfg->thread_name == NULL) {
task_name = CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT;
task_name = CONFIG_PTHREAD_TASK_NAME_DEFAULT;
} else {
task_name = pthread_cfg->thread_name;
}
@ -758,7 +758,7 @@ int pthread_attr_init(pthread_attr_t *attr)
{
if (attr) {
/* Nothing to allocate. Set everything to default */
attr->stacksize = CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT;
attr->stacksize = CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT;
attr->detachstate = PTHREAD_CREATE_JOINABLE;
return 0;
}
@ -769,7 +769,7 @@ int pthread_attr_destroy(pthread_attr_t *attr)
{
if (attr) {
/* Nothing to deallocate. Reset everything to default */
attr->stacksize = CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT;
attr->stacksize = CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT;
attr->detachstate = PTHREAD_CREATE_JOINABLE;
return 0;
}

View File

@ -1,4 +1,11 @@
# sdkconfig replacement configurations for deprecated options formatted as
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
CONFIG_PTHREAD_STACK_MIN CONFIG_ESP32_PTHREAD_STACK_MIN
CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT CONFIG_PTHREAD_TASK_PRIO_DEFAULT
CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT
CONFIG_ESP32_PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN
CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT CONFIG_PTHREAD_TASK_CORE_DEFAULT
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 CONFIG_PTHREAD_DEFAULT_CORE_0
CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 CONFIG_PTHREAD_DEFAULT_CORE_1
CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT CONFIG_PTHREAD_TASK_NAME_DEFAULT

View File

@ -485,8 +485,8 @@ CONFIG_OPENSSL_ASSERT_EXIT=
#
# PThreads
#
CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
#
# SPI Flash driver