Skip to content

Commit 085dbd8

Browse files
Dazza0suren-gabrielyan-espressif
authored andcommitted
freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY. * Original commit: espressif/esp-idf@57fd78f
1 parent f78e8cf commit 085dbd8

File tree

6 files changed

+34
-57
lines changed

6 files changed

+34
-57
lines changed

components/mdns/host_test/components/freertos_linux/include/freertos/FreeRTOS.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146
#pragma once
157

168
#include <stdint.h>
@@ -21,13 +13,10 @@
2113
#define portTICK_PERIOD_MS 1
2214
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
2315

24-
typedef void * xSemaphoreHandle;
2516
typedef void * SemaphoreHandle_t;
26-
typedef void * xQueueHandle;
2717
typedef void * QueueHandle_t;
2818
typedef void * TaskHandle_t;
2919
typedef uint32_t TickType_t;
30-
typedef uint32_t portTickType;
3120

3221
typedef void (*TaskFunction_t)( void * );
3322
typedef unsigned int UBaseType_t;
@@ -39,7 +28,6 @@ typedef int BaseType_t;
3928
#define pdPASS ( pdTRUE )
4029
#define pdFAIL ( pdFALSE )
4130

42-
#define portTICK_RATE_MS portTICK_PERIOD_MS
4331
#define pdMS_TO_TICKS(tick) (tick)
4432

4533
uint32_t esp_get_free_heap_size(void);

components/mdns/host_test/components/freertos_linux/include/freertos/task.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146
#pragma once
157

168
#include "freertos/FreeRTOS.h"
179

18-
#define xTaskHandle TaskHandle_t
10+
#define TaskHandle_t TaskHandle_t
1911
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
2012

2113
void vTaskDelay( const TickType_t xTicksToDelay );

components/mdns/mdns.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ esp_err_t _mdns_send_rx_action(mdns_rx_packet_t * packet)
238238

239239
action->type = ACTION_RX_HANDLE;
240240
action->data.rx_handle.packet = packet;
241-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
241+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
242242
free(action);
243243
return ESP_ERR_NO_MEM;
244244
}
@@ -4672,7 +4672,7 @@ static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_o
46724672

46734673
action->type = type;
46744674
action->data.search_add.search = search;
4675-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
4675+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
46764676
free(action);
46774677
return ESP_ERR_NO_MEM;
46784678
}
@@ -4706,7 +4706,7 @@ static void _mdns_scheduler_run(void)
47064706
action->type = ACTION_TX_HANDLE;
47074707
action->data.tx_handle.packet = p;
47084708
p->queued = true;
4709-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
4709+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
47104710
free(action);
47114711
p->queued = false;
47124712
}
@@ -4854,7 +4854,7 @@ static esp_err_t _mdns_service_task_stop(void)
48544854
mdns_action_t action;
48554855
mdns_action_t * a = &action;
48564856
action.type = ACTION_TASK_STOP;
4857-
if (xQueueSend(_mdns_server->action_queue, &a, (portTickType)0) != pdPASS) {
4857+
if (xQueueSend(_mdns_server->action_queue, &a, (TickType_t)0) != pdPASS) {
48584858
vTaskDelete(_mdns_service_task_handle);
48594859
_mdns_service_task_handle = NULL;
48604860
}
@@ -4897,7 +4897,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
48974897
action->data.sys_event.interface = event->esp_netif;
48984898
}
48994899

4900-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
4900+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
49014901
free(action);
49024902
}
49034903
}
@@ -5056,7 +5056,7 @@ esp_err_t mdns_hostname_set(const char * hostname)
50565056
action->type = ACTION_HOSTNAME_SET;
50575057
action->data.hostname_set.hostname = new_hostname;
50585058
action->data.hostname_set.calling_task = xTaskGetCurrentTaskHandle();
5059-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5059+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
50605060
free(new_hostname);
50615061
free(action);
50625062
return ESP_ERR_NO_MEM;
@@ -5087,7 +5087,7 @@ esp_err_t mdns_delegate_hostname_add(const char * hostname, const mdns_ip_addr_t
50875087
action->type = ACTION_DELEGATE_HOSTNAME_ADD;
50885088
action->data.delegate_hostname.hostname = new_hostname;
50895089
action->data.delegate_hostname.address_list = copy_address_list(address_list);
5090-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5090+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
50915091
free(new_hostname);
50925092
free(action);
50935093
return ESP_ERR_NO_MEM;
@@ -5116,7 +5116,7 @@ esp_err_t mdns_delegate_hostname_remove(const char * hostname)
51165116
}
51175117
action->type = ACTION_DELEGATE_HOSTNAME_REMOVE;
51185118
action->data.delegate_hostname.hostname = new_hostname;
5119-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5119+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
51205120
free(new_hostname);
51215121
free(action);
51225122
return ESP_ERR_NO_MEM;
@@ -5150,7 +5150,7 @@ esp_err_t mdns_instance_name_set(const char * instance)
51505150
}
51515151
action->type = ACTION_INSTANCE_SET;
51525152
action->data.instance = new_instance;
5153-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5153+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
51545154
free(new_instance);
51555155
free(action);
51565156
return ESP_ERR_NO_MEM;
@@ -5202,7 +5202,7 @@ esp_err_t mdns_service_add_for_host(const char * instance, const char * service,
52025202
}
52035203
action->type = ACTION_SERVICE_ADD;
52045204
action->data.srv_add.service = item;
5205-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5205+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
52065206
_mdns_free_service(s);
52075207
free(item);
52085208
free(action);
@@ -5216,7 +5216,7 @@ esp_err_t mdns_service_add_for_host(const char * instance, const char * service,
52165216
if (expired >= timeout_ticks) {
52175217
return ESP_FAIL; // Timeout
52185218
}
5219-
vTaskDelay(MIN(10 / portTICK_RATE_MS, timeout_ticks - expired));
5219+
vTaskDelay(MIN(10 / portTICK_PERIOD_MS, timeout_ticks - expired));
52205220
}
52215221

52225222
return ESP_OK;
@@ -5260,7 +5260,7 @@ esp_err_t mdns_service_port_set_for_host(const char *instance, const char * serv
52605260
action->type = ACTION_SERVICE_PORT_SET;
52615261
action->data.srv_port.service = s;
52625262
action->data.srv_port.port = port;
5263-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5263+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
52645264
free(action);
52655265
return ESP_ERR_NO_MEM;
52665266
}
@@ -5304,7 +5304,7 @@ esp_err_t mdns_service_txt_set_for_host(const char * instance, const char * serv
53045304
action->data.srv_txt_replace.service = s;
53055305
action->data.srv_txt_replace.txt = new_txt;
53065306

5307-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5307+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
53085308
_mdns_free_linked_txt(new_txt);
53095309
free(action);
53105310
return ESP_ERR_NO_MEM;
@@ -5358,7 +5358,7 @@ esp_err_t mdns_service_txt_item_set_for_host_with_explicit_value_len(const char
53585358
action->data.srv_txt_set.value = NULL;
53595359
action->data.srv_txt_set.value_len = 0;
53605360
}
5361-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5361+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
53625362
free(action->data.srv_txt_set.key);
53635363
free(action->data.srv_txt_set.value);
53645364
free(action);
@@ -5417,7 +5417,7 @@ esp_err_t mdns_service_txt_item_remove_for_host(const char * instance, const cha
54175417
free(action);
54185418
return ESP_ERR_NO_MEM;
54195419
}
5420-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5420+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
54215421
free(action->data.srv_txt_del.key);
54225422
free(action);
54235423
return ESP_ERR_NO_MEM;
@@ -5458,7 +5458,7 @@ esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const cha
54585458
free(action);
54595459
return ESP_ERR_NO_MEM;
54605460
}
5461-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5461+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
54625462
free(action->data.srv_subtype_add.subtype);
54635463
free(action);
54645464
return ESP_ERR_NO_MEM;
@@ -5493,7 +5493,7 @@ esp_err_t mdns_service_instance_name_set_for_host(const char * instance_old, con
54935493
action->type = ACTION_SERVICE_INSTANCE_SET;
54945494
action->data.srv_instance.service = s;
54955495
action->data.srv_instance.instance = new_instance;
5496-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5496+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
54975497
free(new_instance);
54985498
free(action);
54995499
return ESP_ERR_NO_MEM;
@@ -5526,7 +5526,7 @@ esp_err_t mdns_service_remove_for_host(const char * instance, const char * servi
55265526
}
55275527
action->type = ACTION_SERVICE_DEL;
55285528
action->data.srv_del.service = s;
5529-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5529+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
55305530
free(action);
55315531
return ESP_ERR_NO_MEM;
55325532
}
@@ -5556,7 +5556,7 @@ esp_err_t mdns_service_remove_all(void)
55565556
return ESP_ERR_NO_MEM;
55575557
}
55585558
action->type = ACTION_SERVICES_CLEAR;
5559-
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
5559+
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
55605560
free(action);
55615561
return ESP_ERR_NO_MEM;
55625562
}

components/mdns/private_include/mdns_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ typedef struct {
396396
union {
397397
struct {
398398
char * hostname;
399-
xTaskHandle calling_task;
399+
TaskHandle_t calling_task;
400400
} hostname_set;
401401
char * instance;
402402
struct {

components/mdns/test_afl_fuzz_host/esp32_mock.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#define INC_TASK_H
5454

5555
#define pdMS_TO_TICKS(a) a
56-
#define portTICK_RATE_MS 10
56+
#define portTICK_PERIOD_MS 10
5757
#define xSemaphoreTake(s,d) true
5858
#define xTaskDelete(a)
5959
#define vTaskDelete(a) free(a)
@@ -73,19 +73,16 @@
7373
#define ESP_TASK_PRIO_MAX 25
7474
#define ESP_TASKD_EVENT_PRIO 5
7575
#define _mdns_udp_pcb_write(tcpip_if, ip_protocol, ip, port, data, len) len
76-
#define xTaskHandle TaskHandle_t
76+
#define TaskHandle_t TaskHandle_t
7777

7878

7979
typedef int32_t esp_err_t;
8080

81-
typedef void * xSemaphoreHandle;
8281
typedef void * SemaphoreHandle_t;
83-
typedef void * xQueueHandle;
8482
typedef void * QueueHandle_t;
8583
typedef void * TaskHandle_t;
8684
typedef int BaseType_t;
8785
typedef uint32_t TickType_t;
88-
typedef uint32_t portTickType;
8986

9087

9188
extern const char * WIFI_EVENT;

examples/common_components/protocol_examples_common/connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
#endif
8282

8383
static int s_active_interfaces = 0;
84-
static xSemaphoreHandle s_semph_get_ip_addrs;
84+
static SemaphoreHandle_t s_semph_get_ip_addrs;
8585
static esp_netif_t *s_example_esp_netif = NULL;
8686

8787
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6

0 commit comments

Comments
 (0)