#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "power_clocks_lib.h"
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
#include "serial.h"
#include "integer.h"
#include "comtest.h"
#include "flash.h"
#include "PollQ.h"
#include "semtest.h"
#include "dynamic.h"
#include "BlockQ.h"
#include "death.h"
#include "flop.h"
Macros | |
#define | mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS ) |
The period between executions of the check task. More... | |
#define | mainCHECK_TASK_LED ( 6 ) |
LED that is toggled by the check task. More... | |
#define | mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 57600 ) |
Baud rate used by the serial port tasks. More... | |
#define | mainCOM_TEST_LED ( 3 ) |
LED used by the serial port tasks. More... | |
#define | mainERROR_FLASH_RATE ( (portTickType) 500 / portTICK_RATE_MS ) |
If an error is detected in a task, the vErrorChecks task will enter in an infinite loop flashing the LED at this rate. More... | |
#define | mainERROR_LED ( 7 ) |
LED that is set upon error. More... | |
Priority definitions for most of the tasks in the demo application. | |
Some tasks just use the idle priority. | |
#define | mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
#define | mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
#define | mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
#define | mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
#define | mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 3 ) |
#define | mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) |
#define | mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) |
Constants used by the vMemCheckTask() task. | |
#define | mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 ) |
#define | mainNO_TASK ( 0 ) |
The size of the memory blocks allocated by the vMemCheckTask() task. | |
#define | mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) |
#define | mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) |
#define | mainMEM_CHECK_SIZE_3 ( ( size_t ) 15 ) |
Functions | |
int | main (void) |
static portBASE_TYPE | prvCheckOtherTasksAreStillRunning (void) |
Checks that all the demo application tasks are still executing without error. More... | |
static void | prvIndicateError (void) |
static void | vErrorChecks (void *pvParameters) |
The task function for the "Check" task. More... | |
static void | vMemCheckTask (void *pvParameters) |
Dynamically created and deleted during each cycle of the vErrorChecks() task. This is done to check the operation of the memory allocator. See the top of vErrorChecks for more details. More... | |
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 3 ) |
Referenced by main().
#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS ) |
The period between executions of the check task.
Referenced by vErrorChecks().
#define mainCHECK_TASK_LED ( 6 ) |
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 toggles faster.
Referenced by prvIndicateError(), and vErrorChecks().
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) |
Referenced by main().
#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 57600 ) |
Baud rate used by the serial port tasks.
Referenced by main().
#define mainCOM_TEST_LED ( 3 ) |
LED used by the serial port tasks.
This is toggled on each character Tx, and mainCOM_TEST_LED + 1 is toggled on each character Rx.
Referenced by main().
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
Referenced by main().
#define mainCOUNT_INITIAL_VALUE ( ( unsigned portLONG ) 0 ) |
Referenced by vErrorChecks(), and vMemCheckTask().
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) |
Referenced by vErrorChecks().
#define mainERROR_FLASH_RATE ( (portTickType) 500 / portTICK_RATE_MS ) |
If an error is detected in a task, the vErrorChecks task will enter in an infinite loop flashing the LED at this rate.
Referenced by prvIndicateError().
#define mainERROR_LED ( 7 ) |
LED that is set upon error.
Referenced by prvIndicateError().
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
Referenced by main().
#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) |
Referenced by vMemCheckTask().
#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) |
Referenced by vMemCheckTask().
#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 15 ) |
Referenced by vMemCheckTask().
#define mainNO_TASK ( 0 ) |
Referenced by vErrorChecks().
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) |
Referenced by main().
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
Referenced by main().
int main | ( | void | ) |
References configMINIMAL_STACK_SIZE, EXAMPLE_TARGET_DFLL_FREQ_HZ, EXAMPLE_TARGET_MCUCLK_FREQ_HZ, EXAMPLE_TARGET_PBACLK_FREQ_HZ, FOSC0, gc_dfllif_ref_opt, mainBLOCK_Q_PRIORITY, mainCHECK_TASK_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED, mainCOM_TEST_PRIORITY, mainLED_TASK_PRIORITY, mainQUEUE_POLL_PRIORITY, mainSEM_TEST_PRIORITY, NULL, pcl_configure_clocks(), pcl_dfll_freq_param, pcl_freq_param_t, PCL_MC_DFLL0, PCL_OSC0, pcl_switch_to_osc(), tskIDLE_PRIORITY, vAltStartComTestTasks(), vErrorChecks(), vParTestInitialise(), vStartBlockingQueueTasks(), vStartDynamicPriorityTasks(), vStartIntegerMathTasks(), vStartLEDFlashTasks(), vStartMathTasks(), vStartPolledQueueTasks(), vStartSemaphoreTasks(), vTaskStartScheduler(), and xTaskCreate.
|
static |
Checks that all the demo application tasks are still executing without error.
References pdFALSE, pdTRUE, xAreBlockingQueuesStillRunning(), xAreComTestTasksStillRunning(), xAreDynamicPriorityTasksStillRunning(), xAreIntegerMathsTaskStillRunning(), xAreMathsTaskStillRunning(), xArePollingQueuesStillRunning(), xAreSemaphoreTasksStillRunning(), and xIsCreateTaskStillRunning().
Referenced by vErrorChecks().
|
static |
References mainCHECK_TASK_LED, mainERROR_FLASH_RATE, mainERROR_LED, pdTRUE, vParTestSetLED(), vParTestToggleLED(), and vTaskDelay().
Referenced by vErrorChecks().
|
static |
The task function for the "Check" task.
References configMINIMAL_STACK_SIZE, mainCHECK_PERIOD, mainCHECK_TASK_LED, mainCOUNT_INITIAL_VALUE, mainCREATOR_TASK_PRIORITY, mainNO_TASK, pdFALSE, pdPASS, prvCheckOtherTasksAreStillRunning(), prvIndicateError(), tskIDLE_PRIORITY, vCreateSuicidalTasks(), vMemCheckTask(), vParTestToggleLED(), vTaskDelay(), vTaskDelete(), xCreatedTask, and xTaskCreate.
Referenced by main().
|
static |
Dynamically created and deleted during each cycle of the vErrorChecks() task. This is done to check the operation of the memory allocator. See the top of vErrorChecks for more details.
*pvParameters | Parameters for the task (can be of any kind) |
References mainCOUNT_INITIAL_VALUE, mainMEM_CHECK_SIZE_1, mainMEM_CHECK_SIZE_2, mainMEM_CHECK_SIZE_3, NULL, pdFALSE, pdTRUE, pvPortMalloc(), vPortFree(), vTaskSuspendAll(), and xTaskResumeAll().
Referenced by vErrorChecks().