refactor: change methods ENTER|EXIT critical (#1140)

refactor: change methods ENTER|EXIT critical

The read and write of BaseType_t are atomic for a number of ports
and therefore, do not require taskENTER_CRITICAL/taskEXIT_CRITICAL.
This PR introduces portBASE_TYPE_ENTER_CRITICAL and
portBASE_TYPE_EXIT_CRITICAL which default to  taskENTER_CRITICAL
and taskEXIT_CRITICAL. The APIs that read/write BaseType_t are updated
to use these new macros. 

The next change would to be to define portBASE_TYPE_ENTER_CRITICAL and
portBASE_TYPE_EXIT_CRITICAL to nothing for ports where BaseType_t 
read and write are atomic.

Signed-off-by: guilherme giacomo simoes <trintaeoitogc@gmail.com>
This commit is contained in:
Guilherme Giácomo Simões 2024-10-07 02:07:50 -03:00 committed by GitHub
parent 1cb8042961
commit e81ad46b0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 16 deletions

View file

@ -601,7 +601,7 @@
traceENTER_xTimerGetReloadMode( xTimer );
configASSERT( xTimer );
taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) == 0U )
{
@ -614,7 +614,7 @@
xReturn = pdTRUE;
}
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();
traceRETURN_xTimerGetReloadMode( xReturn );
@ -1169,7 +1169,7 @@
configASSERT( xTimer );
/* Is the timer in the list of active timers? */
taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
if( ( pxTimer->ucStatus & tmrSTATUS_IS_ACTIVE ) == 0U )
{
@ -1180,7 +1180,7 @@
xReturn = pdTRUE;
}
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();
traceRETURN_xTimerIsTimerActive( xReturn );