Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove uneccesary task{ENTER | EXIT}_CRITICAL() #1140

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/third_party_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ team.
| Tool | Website | Getting Started |
|------|---------|-----------------|
| Code Sonar | [Link](https://codesecure.com/our-products/codesonar/) | [Link](https://github.com/CodeSecure-SE/FreeRTOS-Kernel/blob/main/examples/codesonar/README.md) |
| Coverity | [Link](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html) | [Link](../examples/coverity/README.md) |
| Coverity | [Link](https://www.blackduck.com/static-analysis-tools-sast/coverity.html) | [Link](../examples/coverity/README.md) |
2 changes: 1 addition & 1 deletion examples/coverity/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MISRA Compliance for FreeRTOS-Kernel
FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to
run [Synopsys Coverity](https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html)
run [Synopsys Coverity](https://www.blackduck.com/static-analysis-tools-sast/coverity.html)
for checking MISRA compliance.

> **Note**
Expand Down
8 changes: 8 additions & 0 deletions include/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
#define portARCH_NAME NULL
#endif

#ifndef portBASE_TYPE_ENTER_CRITICAL
#define portBASE_TYPE_ENTER_CRITICAL() taskENTER_CRITICAL()
#endif

#ifndef portBASE_TYPE_EXIT_CRITICAL
#define portBASE_TYPE_EXIT_CRITICAL() taskEXIT_CRITICAL()
#endif

#ifndef configSTACK_DEPTH_TYPE
#define configSTACK_DEPTH_TYPE StackType_t
#endif
Expand Down
8 changes: 4 additions & 4 deletions queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -2202,11 +2202,11 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )

configASSERT( xQueue );

taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting;
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_uxQueueMessagesWaiting( uxReturn );

Expand All @@ -2223,11 +2223,11 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )

configASSERT( pxQueue );

taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
uxReturn = ( UBaseType_t ) ( pxQueue->uxLength - pxQueue->uxMessagesWaiting );
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_uxQueueSpacesAvailable( uxReturn );

Expand Down
12 changes: 6 additions & 6 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2623,14 +2623,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,

traceENTER_uxTaskPriorityGet( xTask );

taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
/* If null is passed in here then it is the priority of the task
* that called uxTaskPriorityGet() that is being queried. */
pxTCB = prvGetTCBFromHandle( xTask );
uxReturn = pxTCB->uxPriority;
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_uxTaskPriorityGet( uxReturn );

Expand Down Expand Up @@ -2697,14 +2697,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,

traceENTER_uxTaskBasePriorityGet( xTask );

taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
/* If null is passed in here then it is the base priority of the task
* that called uxTaskBasePriorityGet() that is being queried. */
pxTCB = prvGetTCBFromHandle( xTask );
uxReturn = pxTCB->uxBasePriority;
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_uxTaskBasePriorityGet( uxReturn );

Expand Down Expand Up @@ -3040,12 +3040,12 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,

traceENTER_vTaskCoreAffinityGet( xTask );

taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
pxTCB = prvGetTCBFromHandle( xTask );
uxCoreAffinityMask = pxTCB->uxCoreAffinityMask;
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_vTaskCoreAffinityGet( uxCoreAffinityMask );

Expand Down
8 changes: 4 additions & 4 deletions timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@
traceENTER_xTimerGetReloadMode( xTimer );

configASSERT( xTimer );
taskENTER_CRITICAL();
portBASE_TYPE_ENTER_CRITICAL();
{
if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) == 0U )
{
Expand All @@ -614,7 +614,7 @@
xReturn = pdTRUE;
}
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_xTimerGetReloadMode( xReturn );

Expand Down Expand Up @@ -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 )
{
Expand All @@ -1180,7 +1180,7 @@
xReturn = pdTRUE;
}
}
taskEXIT_CRITICAL();
portBASE_TYPE_EXIT_CRITICAL();

traceRETURN_xTimerIsTimerActive( xReturn );

Expand Down
Loading