Skip to content

Commit

Permalink
src: app: structs: Protect eps buffer read/write with critical sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon de Araujo Borba committed Sep 6, 2024
1 parent 1c71da4 commit d6637ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware/app/structs/eps2_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* \{
*/

#include <FreeRTOS.h>
#include <task.h>
#include <system/sys_log/sys_log.h>

#include "eps2_data.h"
Expand Down Expand Up @@ -64,6 +66,7 @@ eps_data_t eps_data_buff = {

int eps_buffer_write(uint8_t id, uint32_t *value)
{
taskENTER_CRITICAL();
switch(id)
{
case EPS2_PARAM_ID_TIME_COUNTER:
Expand Down Expand Up @@ -230,12 +233,14 @@ int eps_buffer_write(uint8_t id, uint32_t *value)
sys_log_new_line();
return -1;
}
taskEXIT_CRITICAL();

return 0;
}

int eps_buffer_read(uint8_t id, uint32_t *value)
{
taskENTER_CRITICAL();

#if CONFIG_SET_DUMMY_EPS == 1
switch(id)
Expand Down Expand Up @@ -551,6 +556,7 @@ int eps_buffer_read(uint8_t id, uint32_t *value)
sys_log_new_line();
return -1;
}
taskEXIT_CRITICAL();

return 0;
}
Expand Down

0 comments on commit d6637ad

Please sign in to comment.