Merge branch 'wifi' of ssh://gitlab.espressif.cn:27227/idf/esp-idf into wifi

pull/21/head
xiaxiaotian 2016-08-19 19:27:35 +08:00 zatwierdzone przez Wu Jian Gang
commit 3ba06efd7d
4 zmienionych plików z 53 dodań i 42 usunięć

Wyświetl plik

@ -206,10 +206,6 @@ typedef struct tskTaskControlBlock
volatile eNotifyValue eNotifyState;
#endif
#if (configESP32_PER_TASK_DATA == 1)
void *data;
#endif
} tskTCB;
/* The old tskTCB name is maintained above then typedefed to the new TCB_t name
@ -611,9 +607,6 @@ BaseType_t i;
if( pxNewTCB != NULL )
{
#if (configESP32_PER_TASK_DATA == 1)
pxNewTCB->data = NULL;
#endif
#if( portUSING_MPU_WRAPPERS == 1 )
/* Should the task be created in privileged mode? */
BaseType_t xRunPrivileged;
@ -799,11 +792,6 @@ BaseType_t i;
being deleted. */
pxTCB = prvGetTCBFromHandle( xTaskToDelete );
#if (configESP32_PER_TASK_DATA == 1)
if (pxTCB->data){
vSemaphoreDelete( pxTCB->data );
}
#endif
/* Remove task from the ready list and place in the termination list.
This will stop the task from be scheduled. The idle task will check
the termination list and free up any memory allocated by the
@ -4592,23 +4580,6 @@ TickType_t uxReturn;
#endif /* configUSE_TASK_NOTIFICATIONS */
/*-----------------------------------------------------------*/
#if (configESP32_PER_TASK_DATA == 1)
void* xTaskGetPerTaskData(void)
{
TCB_t *pxTCB = (TCB_t*)(xTaskGetCurrentTaskHandle());
if (pxTCB){
if (!pxTCB->data){
vSemaphoreCreateBinary(pxTCB->data);
}
return (void*)(&pxTCB->data);
}
return NULL;
}
#endif /* configESP32_PER_TASK_DATA */
/*-----------------------------------------------------------*/
#ifdef FREERTOS_MODULE_TEST
#include "tasks_test_access_functions.h"
#endif

Wyświetl plik

@ -188,9 +188,9 @@ struct dns_api_msg {
#if LWIP_NETCONN_SEM_PER_THREAD
#ifdef LWIP_ESP8266
#define LWIP_NETCONN_THREAD_SEM_GET() sys_thread_sem()
#define LWIP_NETCONN_THREAD_SEM_ALLOC()
#define LWIP_NETCONN_THREAD_SEM_FREE()
#define LWIP_NETCONN_THREAD_SEM_GET() sys_thread_sem_get()
#define LWIP_NETCONN_THREAD_SEM_ALLOC() sys_thread_sem_init()
#define LWIP_NETCONN_THREAD_SEM_FREE() sys_thread_sem_deinit()
#endif
#endif

Wyświetl plik

@ -64,10 +64,10 @@ typedef struct sys_mbox_s {
void sys_arch_assert(const char *file, int line);
uint32_t system_get_time(void);
sys_sem_t* sys_thread_sem(void);
void sys_delay_ms(uint32_t ms);
void* xTaskGetPerTaskData(void);
sys_sem_t* sys_thread_sem_init(void);
void sys_thread_sem_deinit(void);
sys_sem_t* sys_thread_sem_get(void);
#endif /* __SYS_ARCH_H__ */

Wyświetl plik

@ -475,17 +475,57 @@ sys_arch_assert(const char *file, int line)
while(1);
}
/* This is a super hacky thread-local-storage repository
FreeRTOS 8.2.3 & up have thread local storage in the
OS, which is how we should do this. Once we upgrade FreeRTOS,
we can drop this hacky store and use the FreeRTOS TLS API.
*/
sys_sem_t* sys_thread_sem(void)
/*
* get per thread semphore
*/
sys_sem_t* sys_thread_sem_get(void)
{
sys_sem_t *sem = (sys_sem_t*)xTaskGetPerTaskData();
sys_sem_t *sem = (sys_sem_t*)pvTaskGetThreadLocalStoragePointer(xTaskGetCurrentTaskHandle(), 0);
if (!sem){
sem = sys_thread_sem_init();
}
LWIP_DEBUGF(THREAD_SAFE_DEBUG, ("sem_get s=%p\n", sem));
return sem;
}
sys_sem_t* sys_thread_sem_init(void)
{
sys_sem_t *sem = (sys_sem_t*)malloc(sizeof(sys_sem_t*));
if (!sem){
printf("sem f1\n");
return 0;
}
*sem = xSemaphoreCreateBinary();
if (!(*sem)){
free(sem);
printf("sem f2\n");
return 0;
}
LWIP_DEBUGF(THREAD_SAFE_DEBUG, ("sem init %p %p\n", sem, *sem));
vTaskSetThreadLocalStoragePointer(xTaskGetCurrentTaskHandle(), 0, sem);
return sem;
}
void sys_thread_sem_deinit(void)
{
sys_sem_t *sem = sys_thread_sem_get();
if (sem && *sem){
LWIP_DEBUGF(THREAD_SAFE_DEBUG, ("sem del:%p %p\n", sem, *sem));
vSemaphoreDelete(*sem);
}
if (sem){
free(sem);
}
vTaskSetThreadLocalStoragePointer(xTaskGetCurrentTaskHandle(), 0, 0);
return;
}
void sys_delay_ms(uint32_t ms)
{
vTaskDelay(ms/portTICK_RATE_MS);