Skip to content

Commit 57fd78f

Browse files
committed
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.
1 parent 5810ed1 commit 57fd78f

File tree

169 files changed

+635
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+635
-706
lines changed

components/bt/common/osi/include/osi/mutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define osi_mutex_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
3131
#define osi_mutex_set_invalid( x ) ( ( *x ) = NULL )
3232

33-
typedef xSemaphoreHandle osi_mutex_t;
33+
typedef SemaphoreHandle_t osi_mutex_t;
3434

3535
int osi_mutex_new(osi_mutex_t *mutex);
3636

components/bt/common/osi/include/osi/semaphore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#define OSI_SEM_MAX_TIMEOUT 0xffffffffUL
2828

29-
typedef xSemaphoreHandle osi_sem_t;
29+
typedef SemaphoreHandle_t osi_sem_t;
3030

3131
#define osi_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )
3232
#define osi_sem_set_invalid( x ) ( ( *x ) = NULL )

components/bt/common/osi/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const char *osi_thread_name(osi_thread_t *thread)
264264
{
265265
assert(thread != NULL);
266266

267-
return pcTaskGetTaskName(thread->thread_handle);
267+
return pcTaskGetName(thread->thread_handle);
268268
}
269269

270270
int osi_thread_queue_wait_size(osi_thread_t *thread, int wq_idx)

components/driver/adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -479,7 +479,7 @@ esp_err_t adc_digi_read_bytes(uint8_t *buf, uint32_t length_max, uint32_t *out_l
479479
uint8_t *data = NULL;
480480
size_t size = 0;
481481

482-
ticks_to_wait = timeout_ms / portTICK_RATE_MS;
482+
ticks_to_wait = timeout_ms / portTICK_PERIOD_MS;
483483
if (timeout_ms == ADC_MAX_DELAY) {
484484
ticks_to_wait = portMAX_DELAY;
485485
}

components/driver/esp32/touch_sensor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ esp_err_t touch_pad_config(touch_pad_t touch_num, uint16_t threshold)
272272
//If the FSM mode is 'TOUCH_FSM_MODE_TIMER', The data will be ready after one measurement cycle
273273
//after this function is executed, otherwise, the "touch_value" by "touch_pad_read" is 0.
274274
wait_time_ms = sleep_time / (rtc_clk / 1000) + meas_cycle / (RTC_FAST_CLK_FREQ_APPROX / 1000);
275-
wait_tick = wait_time_ms / portTICK_RATE_MS;
275+
wait_tick = wait_time_ms / portTICK_PERIOD_MS;
276276
vTaskDelay(wait_tick ? wait_tick : 1);
277277
s_touch_pad_init_bit |= (1 << touch_num);
278278
} else {

components/driver/i2c.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ typedef struct {
153153
int intr_alloc_flags; /*!< Used to allocate the interrupt */
154154
StaticQueue_t evt_queue_buffer; /*!< The buffer that will hold the queue structure*/
155155
#endif
156-
xSemaphoreHandle cmd_mux; /*!< semaphore to lock command process */
156+
SemaphoreHandle_t cmd_mux; /*!< semaphore to lock command process */
157157
#ifdef CONFIG_PM_ENABLE
158158
esp_pm_lock_handle_t pm_lock;
159159
#endif
160160

161-
xSemaphoreHandle slv_rx_mux; /*!< slave rx buffer mux */
162-
xSemaphoreHandle slv_tx_mux; /*!< slave tx buffer mux */
161+
SemaphoreHandle_t slv_rx_mux; /*!< slave rx buffer mux */
162+
SemaphoreHandle_t slv_tx_mux; /*!< slave tx buffer mux */
163163
size_t rx_buf_length; /*!< rx buffer length */
164164
RingbufHandle_t rx_ring_buf; /*!< rx ringbuffer handler of slave mode */
165165
size_t tx_buf_length; /*!< tx buffer length */
@@ -1403,7 +1403,7 @@ esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle,
14031403
static uint8_t clear_bus_cnt = 0;
14041404
esp_err_t ret = ESP_FAIL;
14051405
i2c_obj_t *p_i2c = p_i2c_obj[i2c_num];
1406-
portTickType ticks_start = xTaskGetTickCount();
1406+
TickType_t ticks_start = xTaskGetTickCount();
14071407
portBASE_TYPE res = xSemaphoreTake(p_i2c->cmd_mux, ticks_to_wait);
14081408
if (res == pdFALSE) {
14091409
return ESP_ERR_TIMEOUT;
@@ -1503,7 +1503,7 @@ int i2c_slave_write_buffer(i2c_port_t i2c_num, const uint8_t *data, int size, Ti
15031503

15041504
portBASE_TYPE res;
15051505
int cnt = 0;
1506-
portTickType ticks_end = xTaskGetTickCount() + ticks_to_wait;
1506+
TickType_t ticks_end = xTaskGetTickCount() + ticks_to_wait;
15071507

15081508
res = xSemaphoreTake(p_i2c->slv_tx_mux, ticks_to_wait);
15091509
if (res == pdFALSE) {
@@ -1536,8 +1536,8 @@ int i2c_slave_read_buffer(i2c_port_t i2c_num, uint8_t *data, size_t max_size, Ti
15361536
if (xSemaphoreTake(p_i2c->slv_rx_mux, ticks_to_wait) == pdFALSE) {
15371537
return 0;
15381538
}
1539-
portTickType ticks_rem = ticks_to_wait;
1540-
portTickType ticks_end = xTaskGetTickCount() + ticks_to_wait;
1539+
TickType_t ticks_rem = ticks_to_wait;
1540+
TickType_t ticks_end = xTaskGetTickCount() + ticks_to_wait;
15411541
I2C_ENTER_CRITICAL(&(i2c_context[i2c_num].spinlock));
15421542
i2c_hal_enable_slave_rx_it(&(i2c_context[i2c_num].hal));
15431543
I2C_EXIT_CRITICAL(&(i2c_context[i2c_num].spinlock));

components/driver/i2s.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef struct {
7070
volatile int rw_pos;
7171
volatile void *curr_ptr;
7272
SemaphoreHandle_t mux;
73-
xQueueHandle queue;
73+
QueueHandle_t queue;
7474
lldesc_t **desc;
7575
} i2s_dma_t;
7676

@@ -1568,12 +1568,12 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_
15681568
cfg->total_chan = 2;
15691569
#endif
15701570
if (cfg->mode & I2S_MODE_TX) {
1571-
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (portTickType)portMAX_DELAY);
1571+
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (TickType_t)portMAX_DELAY);
15721572
i2s_hal_tx_set_channel_style(&(p_i2s[i2s_num]->hal), cfg);
15731573
xSemaphoreGive(p_i2s[i2s_num]->tx->mux);
15741574
}
15751575
if (cfg->mode & I2S_MODE_RX) {
1576-
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (portTickType)portMAX_DELAY);
1576+
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (TickType_t)portMAX_DELAY);
15771577
i2s_hal_rx_set_channel_style(&(p_i2s[i2s_num]->hal), cfg);
15781578
xSemaphoreGive(p_i2s[i2s_num]->rx->mux);
15791579
}
@@ -1598,7 +1598,7 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_
15981598
if (cfg->mode & I2S_MODE_TX) {
15991599
ESP_RETURN_ON_FALSE(p_i2s[i2s_num]->tx, ESP_ERR_INVALID_ARG, TAG, "I2S TX DMA object has not initialized yet");
16001600
/* Waiting for transmit finish */
1601-
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (portTickType)portMAX_DELAY);
1601+
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (TickType_t)portMAX_DELAY);
16021602
i2s_tx_set_clk_and_channel(i2s_num, &clk_cfg);
16031603
/* If buffer size changed, the DMA buffer need realloc */
16041604
if (need_realloc) {
@@ -1618,7 +1618,7 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_
16181618
if (cfg->mode & I2S_MODE_RX) {
16191619
ESP_RETURN_ON_FALSE(p_i2s[i2s_num]->rx, ESP_ERR_INVALID_ARG, TAG, "I2S TX DMA object has not initialized yet");
16201620
/* Waiting for receive finish */
1621-
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (portTickType)portMAX_DELAY);
1621+
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (TickType_t)portMAX_DELAY);
16221622
i2s_rx_set_clk_and_channel(i2s_num, &clk_cfg);
16231623
/* If buffer size changed, the DMA buffer need realloc */
16241624
if (need_realloc) {
@@ -2012,7 +2012,7 @@ esp_err_t i2s_write(i2s_port_t i2s_num, const void *src, size_t size, size_t *by
20122012
*bytes_written = 0;
20132013
ESP_RETURN_ON_FALSE((i2s_num < I2S_NUM_MAX), ESP_ERR_INVALID_ARG, TAG, "i2s_num error");
20142014
ESP_RETURN_ON_FALSE((p_i2s[i2s_num]->tx), ESP_ERR_INVALID_ARG, TAG, "TX mode is not enabled");
2015-
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (portTickType)portMAX_DELAY);
2015+
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (TickType_t)portMAX_DELAY);
20162016
#ifdef CONFIG_PM_ENABLE
20172017
esp_pm_lock_acquire(p_i2s[i2s_num]->pm_lock);
20182018
#endif
@@ -2094,7 +2094,7 @@ esp_err_t i2s_write_expand(i2s_port_t i2s_num, const void *src, size_t size, siz
20942094
src_bytes = src_bits / 8;
20952095
aim_bytes = aim_bits / 8;
20962096
zero_bytes = aim_bytes - src_bytes;
2097-
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (portTickType)portMAX_DELAY);
2097+
xSemaphoreTake(p_i2s[i2s_num]->tx->mux, (TickType_t)portMAX_DELAY);
20982098
size = size * aim_bytes / src_bytes;
20992099
ESP_LOGD(TAG, "aim_bytes %d src_bytes %d size %d", aim_bytes, src_bytes, size);
21002100
while (size > 0) {
@@ -2148,7 +2148,7 @@ esp_err_t i2s_read(i2s_port_t i2s_num, void *dest, size_t size, size_t *bytes_re
21482148
dest_byte = (char *)dest;
21492149
ESP_RETURN_ON_FALSE((i2s_num < I2S_NUM_MAX), ESP_ERR_INVALID_ARG, TAG, "i2s_num error");
21502150
ESP_RETURN_ON_FALSE((p_i2s[i2s_num]->rx), ESP_ERR_INVALID_ARG, TAG, "RX mode is not enabled");
2151-
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (portTickType)portMAX_DELAY);
2151+
xSemaphoreTake(p_i2s[i2s_num]->rx->mux, (TickType_t)portMAX_DELAY);
21522152
#ifdef CONFIG_PM_ENABLE
21532153
esp_pm_lock_acquire(p_i2s[i2s_num]->pm_lock);
21542154
#endif

components/driver/ledc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ typedef struct {
4040
int cycle_num;
4141
int scale;
4242
ledc_fade_mode_t mode;
43-
xSemaphoreHandle ledc_fade_sem;
44-
xSemaphoreHandle ledc_fade_mux;
43+
SemaphoreHandle_t ledc_fade_sem;
44+
SemaphoreHandle_t ledc_fade_mux;
4545
#if CONFIG_SPIRAM_USE_MALLOC
4646
StaticQueue_t ledc_fade_sem_storage;
4747
#endif

components/driver/rmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef struct {
7777
bool loop_autostop; // mark whether loop auto-stop is enabled
7878
rmt_channel_t channel;
7979
const rmt_item32_t *tx_data;
80-
xSemaphoreHandle tx_sem;
80+
SemaphoreHandle_t tx_sem;
8181
#if CONFIG_SPIRAM_USE_MALLOC
8282
int intr_alloc_flags;
8383
StaticSemaphore_t tx_sem_buffer;

components/driver/test/adc_dma_test/test_esp32s2.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -269,7 +269,7 @@ static esp_err_t adc_dma_data_multi_st_check(adc_unit_t adc, void *dma_addr, uin
269269
}
270270
TEST_ESP_OK( adc_digi_start() );
271271
while (1) {
272-
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_RATE_MS), pdTRUE );
272+
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_PERIOD_MS), pdTRUE );
273273
if (evt.int_msk & SPI_IN_SUC_EOF_INT_ENA) {
274274
break;
275275
}
@@ -285,7 +285,7 @@ static esp_err_t adc_dma_data_multi_st_check(adc_unit_t adc, void *dma_addr, uin
285285
}
286286
TEST_ESP_OK( adc_digi_start() );
287287
while (1) {
288-
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_RATE_MS), pdTRUE );
288+
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_PERIOD_MS), pdTRUE );
289289
if (evt.int_msk & SPI_IN_SUC_EOF_INT_ENA) {
290290
break;
291291
}
@@ -301,7 +301,7 @@ static esp_err_t adc_dma_data_multi_st_check(adc_unit_t adc, void *dma_addr, uin
301301
}
302302
TEST_ESP_OK( adc_digi_start() );
303303
while (1) {
304-
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_RATE_MS), pdTRUE );
304+
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_PERIOD_MS), pdTRUE );
305305
if (evt.int_msk & SPI_IN_SUC_EOF_INT_ENA) {
306306
break;
307307
}
@@ -317,7 +317,7 @@ static esp_err_t adc_dma_data_multi_st_check(adc_unit_t adc, void *dma_addr, uin
317317
}
318318
TEST_ESP_OK( adc_digi_start() );
319319
while (1) {
320-
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_RATE_MS), pdTRUE );
320+
TEST_ASSERT_EQUAL( xQueueReceive(que_adc, &evt, SAR_SIMPLE_TIMEOUT_MS / portTICK_PERIOD_MS), pdTRUE );
321321
if (evt.int_msk & SPI_IN_SUC_EOF_INT_ENA) {
322322
break;
323323
}
@@ -460,7 +460,7 @@ int test_adc_dig_dma_single_unit(adc_unit_t adc)
460460
adc_dac_dma_linker_deinit();
461461
adc_dac_dma_isr_deregister(adc_dma_isr, NULL);
462462
TEST_ESP_OK( adc_digi_deinit() );
463-
vTaskDelay(10 / portTICK_RATE_MS);
463+
vTaskDelay(10 / portTICK_PERIOD_MS);
464464

465465
return 0;
466466
}
@@ -601,7 +601,7 @@ static void scope_output(int adc_num, int channel, int data)
601601
}
602602
if (i == adc_test_num) {
603603
test_tp_print_to_scope(scope_temp, adc_test_num);
604-
vTaskDelay(SCOPE_DEBUG_FREQ_MS / portTICK_RATE_MS);
604+
vTaskDelay(SCOPE_DEBUG_FREQ_MS / portTICK_PERIOD_MS);
605605
for (int i = 0; i < adc_test_num; i++) {
606606
scope_temp[i] = 0;
607607
}

components/driver/test/dac_dma_test/test_esp32s2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -182,7 +182,7 @@ void test_dac_dig_dma_intr_check(dac_digi_convert_mode_t mode)
182182

183183
/* Check interrupt type */
184184
while (int_mask) {
185-
TEST_ASSERT_EQUAL( xQueueReceive(que_dac, &evt, 2000 / portTICK_RATE_MS), pdTRUE );
185+
TEST_ASSERT_EQUAL( xQueueReceive(que_dac, &evt, 2000 / portTICK_PERIOD_MS), pdTRUE );
186186
ESP_LOGI(TAG, "DAC-DMA intr type 0x%x", evt.int_msk);
187187
if (evt.int_msk & int_mask) {
188188
int_mask &= (~evt.int_msk);

components/driver/test/test_adc2_with_wifi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static void i2s_adc_test(void)
251251
} else {
252252
gpio_set_pull_mode(ADC1_CHANNEL_4_IO, GPIO_PULLUP_ONLY);
253253
}
254-
vTaskDelay(200 / portTICK_RATE_MS);
254+
vTaskDelay(200 / portTICK_PERIOD_MS);
255255
// read data from adc, will block until buffer is full
256256
i2s_read(I2S_NUM_0, (void *)i2sReadBuffer, 1024 * sizeof(uint16_t), &bytesRead, portMAX_DELAY);
257257

0 commit comments

Comments
 (0)