mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-16 17:57:44 -04:00
* Added explicit cast to allow roll over and avoid integer promotion during cycles counters comparison in recmutex.c. * Fixed type mismatch between declaration and definition of function xAreSemaphoreTasksStillRunning( void ). * Added Atmel Studio demo projects for ATMega4809 and AVR128DA48. * Per https://www.freertos.org/upgrading-to-FreeRTOS-V8.html, I'm updating portBASE_TYPE to BaseType_t. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Update register test for ATmega4809 - to cover r28, r29, r31. - call public API taskYIELD() instead of portYIELD(). * Update ATmega4809 readme.md to include info for serial port setup, and minor wording fix. Co-authored-by: Alexandru Niculae - M17336 <alexandru.niculae@microchip.com>
104 lines
No EOL
3.1 KiB
C
104 lines
No EOL
3.1 KiB
C
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
#include "partest.h"
|
|
#include "semtest.h"
|
|
#include "TaskNotify.h"
|
|
#include "regtest.h"
|
|
#include "recmutex.h"
|
|
|
|
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
|
|
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
|
|
|
/* The period between executions of the check task. */
|
|
#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS )
|
|
|
|
/* LED that is toggled by the check task. The check task periodically checks
|
|
that all the other tasks are operating without error. If no errors are found
|
|
the LED is toggled. If an error is found at any time the LED is never toggles
|
|
again. */
|
|
#define mainCHECK_TASK_LED ( 6 )
|
|
|
|
/*
|
|
* The check task, as described at the top of this file.
|
|
*/
|
|
static void prvCheckTask( void *pvParameters );
|
|
|
|
void main_full( void )
|
|
{
|
|
vStartSemaphoreTasks(mainSEM_TEST_PRIORITY);
|
|
vStartTaskNotifyTask();
|
|
vStartRegTestTasks();
|
|
vStartRecursiveMutexTasks();
|
|
|
|
/* Create the task that performs the 'check' functionality, as described at
|
|
the top of this file. */
|
|
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
|
|
|
vTaskStartScheduler();
|
|
|
|
/* If all is well, the scheduler will now be running, and the following
|
|
line will never be reached. If the following line does execute, then
|
|
there was either insufficient FreeRTOS heap memory available for the idle
|
|
and/or timer tasks to be created, or vTaskStartScheduler() was called from
|
|
User mode. See the memory management section on the FreeRTOS web site for
|
|
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
|
|
mode from which main() is called is set in the C start up code and must be
|
|
a privileged mode (not user mode). */
|
|
for( ;; );
|
|
}
|
|
|
|
void init_full( void )
|
|
{
|
|
vParTestInitialise();
|
|
}
|
|
|
|
static void prvCheckTask( void *pvParameters )
|
|
{
|
|
TickType_t xLastExecutionTime;
|
|
unsigned long ulErrorFound = pdFALSE;
|
|
|
|
/* Just to stop compiler warnings. */
|
|
( void ) pvParameters;
|
|
|
|
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
|
works correctly. */
|
|
xLastExecutionTime = xTaskGetTickCount();
|
|
|
|
/* Cycle for ever, delaying then checking all the other tasks are still
|
|
operating without error. The onboard LED is toggled on each iteration
|
|
unless an error occurred. */
|
|
for( ;; )
|
|
{
|
|
/* Delay until it is time to execute again. */
|
|
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_PERIOD );
|
|
|
|
/* Check all the demo tasks (other than the flash tasks) to ensure
|
|
that they are all still running, and that none have detected an error. */
|
|
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
|
{
|
|
ulErrorFound |= 1UL << 0UL;
|
|
}
|
|
|
|
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
|
{
|
|
ulErrorFound |= 1UL << 1UL;
|
|
}
|
|
|
|
if( xAreRegTestTasksStillRunning() != pdTRUE )
|
|
{
|
|
ulErrorFound |= 1UL << 2UL;
|
|
}
|
|
|
|
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
|
{
|
|
ulErrorFound |= 1UL << 3UL;
|
|
}
|
|
|
|
if( ulErrorFound == pdFALSE )
|
|
{
|
|
/* Toggle the LED if everything is okay so we know if an error occurs even if not
|
|
using console IO. */
|
|
vParTestToggleLED( mainCHECK_TASK_LED );
|
|
}
|
|
}
|
|
} |