From d6637ad4395732097197e2eac5f8aa9186b07ce4 Mon Sep 17 00:00:00 2001 From: Ramon de Araujo Borba Date: Fri, 6 Sep 2024 12:14:03 -0300 Subject: [PATCH] src: app: structs: Protect eps buffer read/write with critical sections #197 --- firmware/app/structs/eps2_data.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firmware/app/structs/eps2_data.c b/firmware/app/structs/eps2_data.c index 0ddaedc..9d65ef5 100644 --- a/firmware/app/structs/eps2_data.c +++ b/firmware/app/structs/eps2_data.c @@ -34,6 +34,8 @@ * \{ */ +#include +#include #include #include "eps2_data.h" @@ -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: @@ -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) @@ -551,6 +556,7 @@ int eps_buffer_read(uint8_t id, uint32_t *value) sys_log_new_line(); return -1; } + taskEXIT_CRITICAL(); return 0; }