@@ -49,7 +49,7 @@ static void *wifi_msgq_buffer;
49
49
50
50
static struct k_thread wifi_task_handle ;
51
51
52
- static void esp_wifi_free (void * mem );
52
+ static void wifi_free (void * mem );
53
53
54
54
IRAM_ATTR void * wifi_malloc (size_t size )
55
55
{
@@ -81,16 +81,12 @@ IRAM_ATTR void *wifi_calloc(size_t n, size_t size)
81
81
82
82
static void * IRAM_ATTR wifi_zalloc_wrapper (size_t size )
83
83
{
84
- void * ptr = wifi_malloc (size );
85
-
86
- if (ptr ) {
87
- memset (ptr , 0 , size );
88
- }
84
+ void * ptr = wifi_calloc (1 , size );
89
85
90
86
return ptr ;
91
87
}
92
88
93
- static void esp_wifi_free (void * mem )
89
+ static void wifi_free (void * mem )
94
90
{
95
91
esp_wifi_free_func (mem );
96
92
}
@@ -99,21 +95,24 @@ wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size)
99
95
{
100
96
wifi_static_queue_t * queue = NULL ;
101
97
102
- queue = (wifi_static_queue_t * ) wifi_malloc (sizeof (wifi_static_queue_t ));
98
+ queue = (wifi_static_queue_t * ) k_malloc (sizeof (wifi_static_queue_t ));
99
+
103
100
if (!queue ) {
104
101
LOG_ERR ("msg buffer allocation failed" );
105
102
return NULL ;
106
103
}
107
104
108
- wifi_msgq_buffer = wifi_malloc (queue_len * item_size );
105
+ wifi_msgq_buffer = k_malloc (queue_len * item_size );
106
+
109
107
if (wifi_msgq_buffer == NULL ) {
110
108
LOG_ERR ("msg buffer allocation failed" );
111
109
return NULL ;
112
110
}
113
111
114
- queue -> handle = wifi_malloc (sizeof (struct k_msgq ));
112
+ queue -> handle = k_malloc (sizeof (struct k_msgq ));
113
+
115
114
if (queue -> handle == NULL ) {
116
- esp_wifi_free (wifi_msgq_buffer );
115
+ k_free (wifi_msgq_buffer );
117
116
LOG_ERR ("queue handle allocation failed" );
118
117
return NULL ;
119
118
}
@@ -126,8 +125,8 @@ wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size)
126
125
void wifi_delete_queue (wifi_static_queue_t * queue )
127
126
{
128
127
if (queue ) {
129
- esp_wifi_free (queue -> handle );
130
- esp_wifi_free (queue );
128
+ k_free (queue -> handle );
129
+ k_free (queue );
131
130
}
132
131
}
133
132
@@ -214,7 +213,7 @@ static void *mutex_create_wrapper(void)
214
213
215
214
static void mutex_delete_wrapper (void * mutex )
216
215
{
217
- esp_wifi_free (mutex );
216
+ wifi_free (mutex );
218
217
}
219
218
220
219
static int32_t IRAM_ATTR mutex_lock_wrapper (void * mutex )
@@ -250,7 +249,7 @@ static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
250
249
static void queue_delete_wrapper (void * handle )
251
250
{
252
251
if (handle != NULL ) {
253
- esp_wifi_free (handle );
252
+ wifi_free (handle );
254
253
}
255
254
}
256
255
@@ -408,12 +407,12 @@ static void *IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
408
407
409
408
static void * IRAM_ATTR calloc_internal_wrapper (size_t n , size_t size )
410
409
{
411
- return wifi_calloc (n , size );
410
+ return k_calloc (n , size );
412
411
}
413
412
414
413
static void * IRAM_ATTR zalloc_internal_wrapper (size_t size )
415
414
{
416
- return wifi_calloc (1 , size );
415
+ return k_calloc (1 , size );
417
416
}
418
417
419
418
uint32_t uxQueueMessagesWaiting (void * queue )
@@ -746,7 +745,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
746
745
._ints_off = intr_off ,
747
746
._is_from_isr = k_is_in_isr ,
748
747
._spin_lock_create = esp_coex_common_spin_lock_create_wrapper ,
749
- ._spin_lock_delete = esp_wifi_free ,
748
+ ._spin_lock_delete = wifi_free ,
750
749
._wifi_int_disable = esp_coex_common_int_disable_wrapper ,
751
750
._wifi_int_restore = esp_coex_common_int_restore_wrapper ,
752
751
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper ,
@@ -781,7 +780,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
781
780
._task_get_current_task = (void * (* )(void ))k_current_get ,
782
781
._task_get_max_priority = task_get_max_priority_wrapper ,
783
782
._malloc = wifi_malloc ,
784
- ._free = esp_wifi_free ,
783
+ ._free = wifi_free ,
785
784
._event_post = esp_event_post_wrapper ,
786
785
._get_free_heap_size = esp_get_free_heap_size ,
787
786
._rand = sys_rand32_get ,
0 commit comments