Replace backwards-compatible portTICK_RATE_MS with FreeRTOS v8+ portTICK_PERIOD_MS
Closes github #51 https://github.com/espressif/esp-idf/issues/51
This commit is contained in:
parent
6d0fd80af4
commit
06e03ff52e
21 changed files with 46 additions and 46 deletions
|
@ -80,7 +80,7 @@ static bt_status_t btc_task_post(btc_msg_t *msg)
|
|||
return BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
|
||||
if (xQueueSend(xBtcQueue, msg, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(xBtcQueue, msg, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
LOG_ERROR("Btc Post failed\n");
|
||||
return BT_STATUS_BUSY;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ void hci_hal_h4_task_post(void)
|
|||
evt.sig = 0xff;
|
||||
evt.par = 0;
|
||||
|
||||
if (xQueueSend(xHciH4Queue, &evt, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(xHciH4Queue, &evt, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
LOG_ERROR("xHciH4Queue failed\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ void hci_host_task_post(void)
|
|||
evt.sig = 0xff;
|
||||
evt.par = 0;
|
||||
|
||||
if (xQueueSend(xHciHostQueue, &evt, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(xHciHostQueue, &evt, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
LOG_ERROR("xHciHostQueue failed\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,9 +137,9 @@ osi_sem_wait(osi_sem_t *sem, uint32_t timeout)
|
|||
StartTime = xTaskGetTickCount();
|
||||
|
||||
if (timeout != 0) {
|
||||
if (xSemaphoreTake(*sem, timeout / portTICK_RATE_MS) == pdTRUE) {
|
||||
if (xSemaphoreTake(*sem, timeout / portTICK_PERIOD_MS) == pdTRUE) {
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -153,7 +153,7 @@ osi_sem_wait(osi_sem_t *sem, uint32_t timeout)
|
|||
while (xSemaphoreTake(*sem, portMAX_DELAY) != pdTRUE);
|
||||
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -190,7 +190,7 @@ osi_now(void)
|
|||
|
||||
void osi_delay_ms(uint32_t ms)
|
||||
{
|
||||
vTaskDelay(ms / portTICK_RATE_MS);
|
||||
vTaskDelay(ms / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ void btu_task_post(uint32_t sig)
|
|||
evt.sig = sig;
|
||||
evt.par = 0;
|
||||
|
||||
if (xQueueSend(xBtuQueue, &evt, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(xBtuQueue, &evt, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
LOG_ERROR("xBtuQueue failed\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
|
|||
|
||||
static int32_t IRAM_ATTR semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
|
||||
{
|
||||
return (int32_t)xSemaphoreTake(semphr, block_time_ms / portTICK_RATE_MS);
|
||||
return (int32_t)xSemaphoreTake(semphr, block_time_ms / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
static void *IRAM_ATTR mutex_create_wrapper(void)
|
||||
|
|
|
@ -98,7 +98,7 @@ static void timer_test(int flags) {
|
|||
esp_intr_get_intno(inth[0]), esp_intr_get_intno(inth[1]),
|
||||
esp_intr_get_intno(inth[2]), esp_intr_get_intno(inth[3]));
|
||||
printf("Timer values on start: %d %d %d %d\n", count[0], count[1], count[2], count[3]);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer values after 1 sec: %d %d %d %d\n", count[0], count[1], count[2], count[3]);
|
||||
TEST_ASSERT(count[0]==0);
|
||||
TEST_ASSERT(count[1]!=0);
|
||||
|
@ -110,7 +110,7 @@ static void timer_test(int flags) {
|
|||
esp_intr_disable(inth[1]);
|
||||
esp_intr_disable(inth[2]);
|
||||
for (x=0; x<4; x++) count[x]=0;
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer values after 1 sec: %d %d %d %d\n", count[0], count[1], count[2], count[3]);
|
||||
TEST_ASSERT(count[0]!=0);
|
||||
TEST_ASSERT(count[1]==0);
|
||||
|
@ -122,7 +122,7 @@ static void timer_test(int flags) {
|
|||
esp_intr_disable(inth[0]);
|
||||
esp_intr_disable(inth[3]);
|
||||
for (x=0; x<4; x++) count[x]=0;
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer values after 1 sec: %d %d %d %d\n", count[0], count[1], count[2], count[3]);
|
||||
TEST_ASSERT(count[0]==0);
|
||||
TEST_ASSERT(count[1]!=0);
|
||||
|
@ -152,18 +152,18 @@ void local_timer_test()
|
|||
printf("Int timer 1 intno %d\n", esp_intr_get_intno(ih));
|
||||
xthal_set_ccompare(1, xthal_get_ccount()+8000000);
|
||||
int_timer_ctr=0;
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer val after 1 sec: %d\n", int_timer_ctr);
|
||||
TEST_ASSERT(int_timer_ctr!=0);
|
||||
printf("Disabling int\n");
|
||||
esp_intr_disable(ih);
|
||||
int_timer_ctr=0;
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer val after 1 sec: %d\n", int_timer_ctr);
|
||||
TEST_ASSERT(int_timer_ctr==0);
|
||||
printf("Re-enabling\n");
|
||||
esp_intr_enable(ih);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer val after 1 sec: %d\n", int_timer_ctr);
|
||||
TEST_ASSERT(int_timer_ctr!=0);
|
||||
|
||||
|
@ -173,12 +173,12 @@ void local_timer_test()
|
|||
r=esp_intr_alloc(ETS_INTERNAL_TIMER1_INTR_SOURCE, ESP_INTR_FLAG_INTRDISABLED, int_timer_handler, NULL, &ih);
|
||||
TEST_ASSERT(r==ESP_OK);
|
||||
int_timer_ctr=0;
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer val after 1 sec: %d\n", int_timer_ctr);
|
||||
TEST_ASSERT(int_timer_ctr==0);
|
||||
printf("Re-enabling\n");
|
||||
esp_intr_enable(ih);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
printf("Timer val after 1 sec: %d\n", int_timer_ctr);
|
||||
TEST_ASSERT(int_timer_ctr!=0);
|
||||
r=esp_intr_free(ih);
|
||||
|
|
|
@ -585,7 +585,7 @@ void emac_link_check_func(void *pv_parameters)
|
|||
|
||||
static bool emac_link_check_timer_init(void)
|
||||
{
|
||||
emac_timer = xTimerCreate("emac_timer", (2000 / portTICK_RATE_MS),
|
||||
emac_timer = xTimerCreate("emac_timer", (2000 / portTICK_PERIOD_MS),
|
||||
pdTRUE, (void *)rand(), emac_link_check_func);
|
||||
if (emac_timer == NULL) {
|
||||
return false;
|
||||
|
@ -844,7 +844,7 @@ esp_err_t IRAM_ATTR emac_post(emac_sig_t sig, emac_par_t par)
|
|||
evt.sig = sig;
|
||||
evt.par = par;
|
||||
|
||||
if (xQueueSend(emac_xqueue, &evt, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(emac_xqueue, &evt, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ static void task_event_group_call_response(void *param)
|
|||
printf("Task %d done\n", task_num);
|
||||
|
||||
/* Delay is due to not-yet-fixed bug with deleting tasks at same time */
|
||||
vTaskDelay(100 / portTICK_RATE_MS);
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ static void task_test_sync(void *param)
|
|||
printf("Done %d = %x\n", task_num, after_done);
|
||||
|
||||
/* Delay is due to not-yet-fixed bug with deleting tasks at same time */
|
||||
vTaskDelay(100 / portTICK_RATE_MS);
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
|||
StartTime = xTaskGetTickCount();
|
||||
|
||||
if (timeout != 0) {
|
||||
if (xSemaphoreTake(*sem, timeout / portTICK_RATE_MS) == pdTRUE) {
|
||||
if (xSemaphoreTake(*sem, timeout / portTICK_PERIOD_MS) == pdTRUE) {
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -180,7 +180,7 @@ sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
|||
while (xSemaphoreTake(*sem, portMAX_DELAY) != pdTRUE);
|
||||
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -293,9 +293,9 @@ sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
|||
sys_mutex_lock(&(*mbox)->lock);
|
||||
|
||||
if (timeout != 0) {
|
||||
if (pdTRUE == xQueueReceive((*mbox)->os_mbox, &(*msg), timeout / portTICK_RATE_MS)) {
|
||||
if (pdTRUE == xQueueReceive((*mbox)->os_mbox, &(*msg), timeout / portTICK_PERIOD_MS)) {
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -323,7 +323,7 @@ sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
|||
}
|
||||
|
||||
EndTime = xTaskGetTickCount();
|
||||
Elapsed = (EndTime - StartTime) * portTICK_RATE_MS;
|
||||
Elapsed = (EndTime - StartTime) * portTICK_PERIOD_MS;
|
||||
|
||||
if (Elapsed == 0) {
|
||||
Elapsed = 1;
|
||||
|
@ -566,7 +566,7 @@ void sys_thread_sem_deinit(void)
|
|||
|
||||
void sys_delay_ms(uint32_t ms)
|
||||
{
|
||||
vTaskDelay(ms/portTICK_RATE_MS);
|
||||
vTaskDelay(ms / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ void hello_task(void *pvParameter)
|
|||
printf("Hello world!\n");
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
printf("Restarting now.\n");
|
||||
fflush(stdout);
|
||||
|
|
|
@ -33,10 +33,10 @@ void blink_task(void *pvParameter)
|
|||
while(1) {
|
||||
/* Blink off (output low) */
|
||||
gpio_set_level(BLINK_GPIO, 0);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
/* Blink on (output high) */
|
||||
gpio_set_level(BLINK_GPIO, 1);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ static void http_get_task(void *pvParameters)
|
|||
|
||||
if(err != 0 || res == NULL) {
|
||||
ESP_LOGE(TAG, "DNS lookup failed err=%d res=%p", err, res);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ static void http_get_task(void *pvParameters)
|
|||
if(s < 0) {
|
||||
ESP_LOGE(TAG, "... Failed to allocate socket.");
|
||||
freeaddrinfo(res);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
continue;
|
||||
}
|
||||
ESP_LOGI(TAG, "... allocated socket\r\n");
|
||||
|
@ -138,7 +138,7 @@ static void http_get_task(void *pvParameters)
|
|||
ESP_LOGE(TAG, "... socket connect failed errno=%d", errno);
|
||||
close(s);
|
||||
freeaddrinfo(res);
|
||||
vTaskDelay(4000 / portTICK_RATE_MS);
|
||||
vTaskDelay(4000 / portTICK_PERIOD_MS);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ static void http_get_task(void *pvParameters)
|
|||
if (write(s, REQUEST, strlen(REQUEST)) < 0) {
|
||||
ESP_LOGE(TAG, "... socket send failed");
|
||||
close(s);
|
||||
vTaskDelay(4000 / portTICK_RATE_MS);
|
||||
vTaskDelay(4000 / portTICK_PERIOD_MS);
|
||||
continue;
|
||||
}
|
||||
ESP_LOGI(TAG, "... socket send success");
|
||||
|
@ -166,7 +166,7 @@ static void http_get_task(void *pvParameters)
|
|||
close(s);
|
||||
for(int countdown = 10; countdown >= 0; countdown--) {
|
||||
ESP_LOGI(TAG, "%d... ", countdown);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
ESP_LOGI(TAG, "Starting again!");
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ static void https_get_task(void *pvParameters)
|
|||
|
||||
for(int countdown = 10; countdown >= 0; countdown--) {
|
||||
ESP_LOGI(TAG, "%d...", countdown);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
ESP_LOGI(TAG, "Starting again!");
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ void app_main()
|
|||
// Restart module
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
printf("Restarting now.\n");
|
||||
fflush(stdout);
|
||||
|
|
|
@ -164,7 +164,7 @@ void app_main()
|
|||
*/
|
||||
while (1) {
|
||||
if (gpio_get_level(GPIO_NUM_0) == 0) {
|
||||
vTaskDelay(1000 / portTICK_RATE_MS);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
if(gpio_get_level(GPIO_NUM_0) == 0) {
|
||||
err = save_run_time();
|
||||
if (err != ESP_OK) printf("Error (%d) saving run time blob to NVS!\n", err);
|
||||
|
@ -173,6 +173,6 @@ void app_main()
|
|||
esp_restart();
|
||||
}
|
||||
}
|
||||
vTaskDelay(200 / portTICK_RATE_MS);
|
||||
vTaskDelay(200 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ void rmt_nec_tx_task()
|
|||
rmt_wait_tx_done(channel);
|
||||
//before we free the data, make sure sending is already done.
|
||||
free(item);
|
||||
vTaskDelay(2000 / portTICK_RATE_MS);
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ static esp_err_t blufi_task_post(uint32_t sig, void *par, void *cb, void *arg)
|
|||
evt.cb = cb;
|
||||
evt.arg = arg;
|
||||
|
||||
if (xQueueSend(xBlufiTaskQueue, &evt, 10 / portTICK_RATE_MS) != pdTRUE) {
|
||||
if (xQueueSend(xBlufiTaskQueue, &evt, 10 / portTICK_PERIOD_MS) != pdTRUE) {
|
||||
LOG_ERROR("Blufi Post failed\n");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ void app_main()
|
|||
portBASE_TYPE res;
|
||||
while(1)
|
||||
{
|
||||
res = xQueueReceive(pcnt_evt_queue, &evt, 1000 / portTICK_RATE_MS);
|
||||
res = xQueueReceive(pcnt_evt_queue, &evt, 1000 / portTICK_PERIOD_MS);
|
||||
if(res == pdTRUE) {
|
||||
pcnt_get_counter_value(PCNT_TEST_UNIT, &count);
|
||||
printf("Event PCNT unit[%d]; cnt: %d\n", evt.unit, count);
|
||||
|
|
|
@ -108,11 +108,11 @@ void eth_task(void *pvParameter)
|
|||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
memset(&ip, 0, sizeof(tcpip_adapter_ip_info_t));
|
||||
vTaskDelay(2000 / portTICK_RATE_MS);
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
|
||||
while (1) {
|
||||
|
||||
vTaskDelay(2000 / portTICK_RATE_MS);
|
||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||
|
||||
if (tcpip_adapter_get_ip_info(ESP_IF_ETH, &ip) == 0) {
|
||||
ESP_LOGI(TAG, "\n~~~~~~~~~~~\n");
|
||||
|
|
|
@ -46,7 +46,7 @@ void app_main()
|
|||
while(1) {
|
||||
sigmadelta_set_duty(SIGMADELTA_CHANNEL_0, duty);
|
||||
/*by changing delay time, you can change the blink frequency of LED. */
|
||||
vTaskDelay(10 / portTICK_RATE_MS);
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
|
||||
duty += inc;
|
||||
if(duty == 127 || duty == -127) inc = (-1) * inc;
|
||||
|
|
Loading…
Reference in a new issue