FreeRTOS-Kernel/portable/template/port.c
Aniruddha Kanhere 2fcb0f48b1
Fix small bugs in Kernel (#998)
* Fix small bugs

* Cast sizeof to BaseType_t

* Test removing assert to fix UT

* Revert change to tasks.c

Since configIDLE_TASK_NAME must be defined as a string according to
the documentation, the macro will always be NULL terminated. Which
means that the check `if( cIdleName[ xIdleTaskNameIndex ] == ( char ) 0x00 )`
will catch the end of string.

* Update coverity config; Add coverity version; Update pvPortMalloc declaration to match the definitions.

* Add port files to sed command

* Remove warnings about unused parameters in port code

---------

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
2024-02-20 22:19:41 +05:30

83 lines
2 KiB
C

/*
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
* license and copyright intentionally withheld to promote copying into user code.
*/
#include "FreeRTOS.h"
#include "task.h"
BaseType_t xPortStartScheduler( void )
{
return pdTRUE;
}
void vPortEndScheduler( void )
{
}
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
TaskFunction_t pxCode,
void * pvParameters )
{
( void ) pxTopOfStack;
( void ) pvParameters;
( void ) * pxCode;
return NULL;
}
void vPortYield( void )
{
/* Save the current Context */
/* Switch to the highest priority task that is ready to run. */
#if ( configNUMBER_OF_CORES == 1 )
{
vTaskSwitchContext();
}
#else
{
vTaskSwitchContext( portGET_CORE_ID() );
}
#endif
/* Start executing the task we have just switched to. */
}
static void prvTickISR( void )
{
/* Interrupts must have been enabled for the ISR to fire, so we have to
* save the context with interrupts enabled. */
#if ( configNUMBER_OF_CORES == 1 )
{
/* Maintain the tick count. */
if( xTaskIncrementTick() != pdFALSE )
{
/* Switch to the highest priority task that is ready to run. */
vTaskSwitchContext();
}
}
#else
{
UBaseType_t ulPreviousMask;
/* Tasks or ISRs running on other cores may still in critical section in
* multiple cores environment. Incrementing tick needs to performed in
* critical section. */
ulPreviousMask = taskENTER_CRITICAL_FROM_ISR();
/* Maintain the tick count. */
if( xTaskIncrementTick() != pdFALSE )
{
/* Switch to the highest priority task that is ready to run. */
vTaskSwitchContext( portGET_CORE_ID() );
}
taskEXIT_CRITICAL_FROM_ISR( ulPreviousMask );
}
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
/* start executing the new task */
}