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@57fd78f5ba
This commit is contained in:
Darian Leung
2022-02-08 17:39:38 +08:00
committed by suren-gabrielyan-espressif
parent f78e8cfce8
commit 085dbd8c4e
6 changed files with 34 additions and 57 deletions

View File

@ -1,16 +1,8 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
@ -21,13 +13,10 @@
#define portTICK_PERIOD_MS 1
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
typedef void * xSemaphoreHandle;
typedef void * SemaphoreHandle_t;
typedef void * xQueueHandle;
typedef void * QueueHandle_t;
typedef void * TaskHandle_t;
typedef uint32_t TickType_t;
typedef uint32_t portTickType;
typedef void (*TaskFunction_t)( void * );
typedef unsigned int UBaseType_t;
@ -39,7 +28,6 @@ typedef int BaseType_t;
#define pdPASS ( pdTRUE )
#define pdFAIL ( pdFALSE )
#define portTICK_RATE_MS portTICK_PERIOD_MS
#define pdMS_TO_TICKS(tick) (tick)
uint32_t esp_get_free_heap_size(void);

View File

@ -1,21 +1,13 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "freertos/FreeRTOS.h"
#define xTaskHandle TaskHandle_t
#define TaskHandle_t TaskHandle_t
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
void vTaskDelay( const TickType_t xTicksToDelay );

View File

@ -238,7 +238,7 @@ esp_err_t _mdns_send_rx_action(mdns_rx_packet_t * packet)
action->type = ACTION_RX_HANDLE;
action->data.rx_handle.packet = packet;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
return ESP_ERR_NO_MEM;
}
@ -4672,7 +4672,7 @@ static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_o
action->type = type;
action->data.search_add.search = search;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
return ESP_ERR_NO_MEM;
}
@ -4706,7 +4706,7 @@ static void _mdns_scheduler_run(void)
action->type = ACTION_TX_HANDLE;
action->data.tx_handle.packet = p;
p->queued = true;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
p->queued = false;
}
@ -4854,7 +4854,7 @@ static esp_err_t _mdns_service_task_stop(void)
mdns_action_t action;
mdns_action_t * a = &action;
action.type = ACTION_TASK_STOP;
if (xQueueSend(_mdns_server->action_queue, &a, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &a, (TickType_t)0) != pdPASS) {
vTaskDelete(_mdns_service_task_handle);
_mdns_service_task_handle = NULL;
}
@ -4897,7 +4897,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
action->data.sys_event.interface = event->esp_netif;
}
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
}
}
@ -5056,7 +5056,7 @@ esp_err_t mdns_hostname_set(const char * hostname)
action->type = ACTION_HOSTNAME_SET;
action->data.hostname_set.hostname = new_hostname;
action->data.hostname_set.calling_task = xTaskGetCurrentTaskHandle();
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(new_hostname);
free(action);
return ESP_ERR_NO_MEM;
@ -5087,7 +5087,7 @@ esp_err_t mdns_delegate_hostname_add(const char * hostname, const mdns_ip_addr_t
action->type = ACTION_DELEGATE_HOSTNAME_ADD;
action->data.delegate_hostname.hostname = new_hostname;
action->data.delegate_hostname.address_list = copy_address_list(address_list);
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(new_hostname);
free(action);
return ESP_ERR_NO_MEM;
@ -5116,7 +5116,7 @@ esp_err_t mdns_delegate_hostname_remove(const char * hostname)
}
action->type = ACTION_DELEGATE_HOSTNAME_REMOVE;
action->data.delegate_hostname.hostname = new_hostname;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(new_hostname);
free(action);
return ESP_ERR_NO_MEM;
@ -5150,7 +5150,7 @@ esp_err_t mdns_instance_name_set(const char * instance)
}
action->type = ACTION_INSTANCE_SET;
action->data.instance = new_instance;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(new_instance);
free(action);
return ESP_ERR_NO_MEM;
@ -5202,7 +5202,7 @@ esp_err_t mdns_service_add_for_host(const char * instance, const char * service,
}
action->type = ACTION_SERVICE_ADD;
action->data.srv_add.service = item;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
_mdns_free_service(s);
free(item);
free(action);
@ -5216,7 +5216,7 @@ esp_err_t mdns_service_add_for_host(const char * instance, const char * service,
if (expired >= timeout_ticks) {
return ESP_FAIL; // Timeout
}
vTaskDelay(MIN(10 / portTICK_RATE_MS, timeout_ticks - expired));
vTaskDelay(MIN(10 / portTICK_PERIOD_MS, timeout_ticks - expired));
}
return ESP_OK;
@ -5260,7 +5260,7 @@ esp_err_t mdns_service_port_set_for_host(const char *instance, const char * serv
action->type = ACTION_SERVICE_PORT_SET;
action->data.srv_port.service = s;
action->data.srv_port.port = port;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
return ESP_ERR_NO_MEM;
}
@ -5304,7 +5304,7 @@ esp_err_t mdns_service_txt_set_for_host(const char * instance, const char * serv
action->data.srv_txt_replace.service = s;
action->data.srv_txt_replace.txt = new_txt;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
_mdns_free_linked_txt(new_txt);
free(action);
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
action->data.srv_txt_set.value = NULL;
action->data.srv_txt_set.value_len = 0;
}
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action->data.srv_txt_set.key);
free(action->data.srv_txt_set.value);
free(action);
@ -5417,7 +5417,7 @@ esp_err_t mdns_service_txt_item_remove_for_host(const char * instance, const cha
free(action);
return ESP_ERR_NO_MEM;
}
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action->data.srv_txt_del.key);
free(action);
return ESP_ERR_NO_MEM;
@ -5458,7 +5458,7 @@ esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const cha
free(action);
return ESP_ERR_NO_MEM;
}
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action->data.srv_subtype_add.subtype);
free(action);
return ESP_ERR_NO_MEM;
@ -5493,7 +5493,7 @@ esp_err_t mdns_service_instance_name_set_for_host(const char * instance_old, con
action->type = ACTION_SERVICE_INSTANCE_SET;
action->data.srv_instance.service = s;
action->data.srv_instance.instance = new_instance;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(new_instance);
free(action);
return ESP_ERR_NO_MEM;
@ -5526,7 +5526,7 @@ esp_err_t mdns_service_remove_for_host(const char * instance, const char * servi
}
action->type = ACTION_SERVICE_DEL;
action->data.srv_del.service = s;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
return ESP_ERR_NO_MEM;
}
@ -5556,7 +5556,7 @@ esp_err_t mdns_service_remove_all(void)
return ESP_ERR_NO_MEM;
}
action->type = ACTION_SERVICES_CLEAR;
if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
if (xQueueSend(_mdns_server->action_queue, &action, (TickType_t)0) != pdPASS) {
free(action);
return ESP_ERR_NO_MEM;
}

View File

@ -396,7 +396,7 @@ typedef struct {
union {
struct {
char * hostname;
xTaskHandle calling_task;
TaskHandle_t calling_task;
} hostname_set;
char * instance;
struct {

View File

@ -53,7 +53,7 @@
#define INC_TASK_H
#define pdMS_TO_TICKS(a) a
#define portTICK_RATE_MS 10
#define portTICK_PERIOD_MS 10
#define xSemaphoreTake(s,d) true
#define xTaskDelete(a)
#define vTaskDelete(a) free(a)
@ -73,19 +73,16 @@
#define ESP_TASK_PRIO_MAX 25
#define ESP_TASKD_EVENT_PRIO 5
#define _mdns_udp_pcb_write(tcpip_if, ip_protocol, ip, port, data, len) len
#define xTaskHandle TaskHandle_t
#define TaskHandle_t TaskHandle_t
typedef int32_t esp_err_t;
typedef void * xSemaphoreHandle;
typedef void * SemaphoreHandle_t;
typedef void * xQueueHandle;
typedef void * QueueHandle_t;
typedef void * TaskHandle_t;
typedef int BaseType_t;
typedef uint32_t TickType_t;
typedef uint32_t portTickType;
extern const char * WIFI_EVENT;

View File

@ -81,7 +81,7 @@
#endif
static int s_active_interfaces = 0;
static xSemaphoreHandle s_semph_get_ip_addrs;
static SemaphoreHandle_t s_semph_get_ip_addrs;
static esp_netif_t *s_example_esp_netif = NULL;
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6