Skip to content

Commit

Permalink
Upload abstraction-rtos [2654]
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlab-runner committed Aug 7, 2024
1 parent 9941284 commit 8498cc2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The this release of the RTOS Abstraction API includes support for the following:
* ThreadX

### What Changed?
#### v1.8.2
FreeRTOS: Fix start and stop of timer from within an ISR
#### v1.8.1
Extended full support on CAT5.
#### v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion props.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"core": {
"id": "83097955-1d6f-526e-97c4-75ce7920222f",
"name": "abstraction-rtos",
"version": "1.8.1.41337"
"version": "1.8.2.42767"
}
}
43 changes: 37 additions & 6 deletions source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,13 +1189,31 @@ cy_rslt_t cy_rtos_timer_start(cy_timer_t* timer, cy_time_t num_ms)
else
{
TickType_t ticks = convert_ms_to_ticks(num_ms);
BaseType_t ret = xTimerChangePeriod(*timer, ticks, 0);
BaseType_t ret;

if (ret == pdPASS)
if (is_in_isr())
{
ret = xTimerStart(*timer, 0);
BaseType_t taskWoken = pdFALSE;
ret = xTimerChangePeriodFromISR(*timer, ticks, &taskWoken);
if (ret == pdPASS)
{
portYIELD_FROM_ISR(taskWoken);
taskWoken = pdFALSE;
ret = xTimerStartFromISR(*timer, &taskWoken);
if (ret == pdPASS)
{
portYIELD_FROM_ISR(taskWoken);
}
}
}
else
{
ret = xTimerChangePeriod(*timer, ticks, 0);
if (ret == pdPASS)
{
ret = xTimerStart(*timer, 0);
}
}

if (ret == pdFALSE)
{
status = CY_RTOS_GENERAL_ERROR;
Expand All @@ -1221,8 +1239,20 @@ cy_rslt_t cy_rtos_timer_stop(cy_timer_t* timer)
}
else
{
BaseType_t ret = xTimerStop(*timer, 0);

BaseType_t ret;
if (is_in_isr())
{
BaseType_t taskWoken = pdFALSE;
ret = xTimerStopFromISR(*timer, &taskWoken);
if (pdPASS == ret)
{
portYIELD_FROM_ISR(taskWoken);
}
}
else
{
ret = xTimerStop(*timer, 0);
}
if (ret == pdFALSE)
{
status = CY_RTOS_GENERAL_ERROR;
Expand All @@ -1232,6 +1262,7 @@ cy_rslt_t cy_rtos_timer_stop(cy_timer_t* timer)
status = CY_RSLT_SUCCESS;
}
}

return status;
}

Expand Down

0 comments on commit 8498cc2

Please sign in to comment.