Unit tests for FreeRTOS USART Interface Layer.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include <board.h>
#include <sysclk.h>
#include <string.h>
#include <unit_test/suite.h>
#include <stdio_serial.h>
#include <usart.h>
#include <conf_test.h>
#include <conf_board.h>
#include <conf_example.h>
#include "FreeRTOS.h"
#include "task.h"
#include "freertos_usart_serial.h"
Macros | |
#define | RX_BUFFER_SIZE (78) |
#define | USART_BAUD_RATE (115200) |
Functions | |
static void | create_usart_tasks (Usart *usart_base, uint16_t stack_depth_words, unsigned portBASE_TYPE task_priority) |
int | main (void) |
Run USART unit tests. More... | |
static void | prvSetupHardware (void) |
static void | run_usart_test (const struct test_case *test) |
static void | usart_echo_tx_task (void *pvParameters) |
static void | usart_task (void *pvParameters) |
void | vApplicationIdleHook (void) |
void | vApplicationMallocFailedHook (void) |
void | vApplicationStackOverflowHook (xTaskHandle pxTask, signed char *pcTaskName) |
void | vApplicationTickHook (void) |
This function is called by FreeRTOS each tick. More... | |
Variables | |
const uint8_t * | echo_strings [] |
static freertos_usart_if | freertos_usart |
static uint8_t | receive_buffer [RX_BUFFER_SIZE] = {0} |
#define RX_BUFFER_SIZE (78) |
Referenced by create_usart_tasks(), run_usart_test(), and usart_echo_tx_task().
#define USART_BAUD_RATE (115200) |
Referenced by create_usart_tasks().
|
static |
int main | ( | void | ) |
Run USART unit tests.
References create_usart_tasks(), prvSetupHardware(), tskIDLE_PRIORITY, and vTaskStartScheduler().
|
static |
References uart_rs232_options::baudrate, board_init(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and usart_serial_options.
Referenced by main().
|
static |
References echo_strings, freertos_usart, freertos_usart_serial_read_packet(), RX_BUFFER_SIZE, and test_assert_true.
Referenced by usart_task().
|
static |
References configASSERT, echo_strings, freertos_usart, freertos_usart_write_packet_async(), NULL, portTICK_RATE_MS, portTickType, RX_BUFFER_SIZE, STATUS_OK, UNUSED, vSemaphoreCreateBinary, vTaskDelay(), vTaskDelete(), and xSemaphoreTake.
Referenced by create_usart_tasks().
|
static |
References DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_usart_test(), test_suite_run(), UNUSED, and vTaskDelete().
Referenced by create_usart_tasks().
void vApplicationIdleHook | ( | void | ) |
void vApplicationMallocFailedHook | ( | void | ) |
vApplicationMallocFailedHook() will only be called if configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook function that will get called if a call to pvPortMalloc() fails. pvPortMalloc() is called internally by the kernel whenever a task, queue, timer or semaphore is created. It is also called by various parts of the demo application. If heap_1.c or heap_2.c are used, then the size of the heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used to query the size of free heap space that remains (although it does not provide information on how the remaining heap might be fragmented).
void vApplicationStackOverflowHook | ( | xTaskHandle | pxTask, |
signed char * | pcTaskName | ||
) |
Run time stack overflow checking is performed if configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is called if a stack overflow is detected.
void vApplicationTickHook | ( | void | ) |
This function is called by FreeRTOS each tick.
This function will be called by each tick interrupt if configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be added here, but the tick hook is called from an interrupt context, so code must not attempt to block, and only the interrupt safe FreeRTOS API functions can be used (those that end in FromISR()).
const uint8_t* echo_strings[] |
Referenced by run_usart_test(), and usart_echo_tx_task().
|
static |
Referenced by create_usart_tasks(), run_usart_test(), and usart_echo_tx_task().
|
static |
Referenced by create_usart_tasks().