mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
Merge branch 'bugfix/can_critical_section_compliance_backport_v4.0' into 'release/v4.0'
CAN: Fix critical section compliance (backport v4.0) See merge request espressif/esp-idf!6568
This commit is contained in:
@@ -136,8 +136,10 @@ typedef struct {
|
|||||||
|
|
||||||
static can_obj_t *p_can_obj = NULL;
|
static can_obj_t *p_can_obj = NULL;
|
||||||
static portMUX_TYPE can_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
static portMUX_TYPE can_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||||
#define CAN_ENTER_CRITICAL() portENTER_CRITICAL(&can_spinlock)
|
#define CAN_ENTER_CRITICAL_ISR() portENTER_CRITICAL_ISR(&can_spinlock)
|
||||||
#define CAN_EXIT_CRITICAL() portEXIT_CRITICAL(&can_spinlock)
|
#define CAN_EXIT_CRITICAL_ISR() portEXIT_CRITICAL_ISR(&can_spinlock)
|
||||||
|
#define CAN_ENTER_CRITICAL() portENTER_CRITICAL(&can_spinlock)
|
||||||
|
#define CAN_EXIT_CRITICAL() portEXIT_CRITICAL(&can_spinlock)
|
||||||
|
|
||||||
/* ------------------- Configuration Register Functions---------------------- */
|
/* ------------------- Configuration Register Functions---------------------- */
|
||||||
|
|
||||||
@@ -479,7 +481,7 @@ static void can_intr_handler_main(void *arg)
|
|||||||
can_status_reg_t status;
|
can_status_reg_t status;
|
||||||
can_intr_reg_t intr_reason;
|
can_intr_reg_t intr_reason;
|
||||||
|
|
||||||
CAN_ENTER_CRITICAL();
|
CAN_ENTER_CRITICAL_ISR();
|
||||||
status.val = can_get_status();
|
status.val = can_get_status();
|
||||||
intr_reason.val = (p_can_obj != NULL) ? can_get_interrupt_reason() : 0; //Incase intr occurs whilst driver is being uninstalled
|
intr_reason.val = (p_can_obj != NULL) ? can_get_interrupt_reason() : 0; //Incase intr occurs whilst driver is being uninstalled
|
||||||
|
|
||||||
@@ -519,7 +521,7 @@ static void can_intr_handler_main(void *arg)
|
|||||||
}
|
}
|
||||||
/* Todo: Check possible bug where transmitting self reception request then
|
/* Todo: Check possible bug where transmitting self reception request then
|
||||||
clearing rx buffer will cancel the transmission. */
|
clearing rx buffer will cancel the transmission. */
|
||||||
CAN_EXIT_CRITICAL();
|
CAN_EXIT_CRITICAL_ISR();
|
||||||
|
|
||||||
if (p_can_obj->alert_semphr != NULL && alert_req) {
|
if (p_can_obj->alert_semphr != NULL && alert_req) {
|
||||||
//Give semaphore if alerts were triggered
|
//Give semaphore if alerts were triggered
|
||||||
|
Reference in New Issue
Block a user