Unit tests for FreeRTOS TWI 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 <twi.h>
#include <conf_test.h>
#include <conf_board.h>
#include <conf_example.h>
#include "FreeRTOS.h"
#include "task.h"
#include "freertos_twi_master.h"
#include "at24cxx.h"
Macros | |
#define | INTERNAL_WRITE_DELAY (7 / portTICK_RATE_MS) |
#define | PAGE_SIZE 128 |
#define | TOTAL_EEPROM_SIZE 65536 |
#define | TWI_CLOCK_HZ 400000 |
Functions | |
static void | create_twi_task (Twi *twi_base, uint16_t stack_depth_words, unsigned portBASE_TYPE task_priority) |
int | main (void) |
Run TWI unit tests. More... | |
static void | prvSetupHardware (void) |
static void | read_page_from_eeprom (uint16_t page) |
static void | run_twi_test (const struct test_case *test) |
static void | twi_eeprom_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... | |
static void | write_page_to_eeprom (uint16_t page) |
Variables | |
static uint8_t | data_buffer [PAGE_SIZE] |
static uint32_t | error_detected = pdFALSE |
static freertos_twi_if | freertos_twi |
#define INTERNAL_WRITE_DELAY (7 / portTICK_RATE_MS) |
Referenced by write_page_to_eeprom().
#define PAGE_SIZE 128 |
Referenced by read_page_from_eeprom(), run_twi_test(), and write_page_to_eeprom().
#define TOTAL_EEPROM_SIZE 65536 |
Referenced by run_twi_test().
#define TWI_CLOCK_HZ 400000 |
Referenced by create_twi_task().
|
static |
References configASSERT, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY, freertos_twi, freertos_twi_master_init(), NULL, sysclk_get_cpu_hz(), TWI_CLOCK_HZ, twi_eeprom_task(), TWI_I2C_MASTER, twi_set_speed(), USE_RX_ACCESS_MUTEX, USE_TX_ACCESS_SEM, WAIT_RX_COMPLETE, WAIT_TX_COMPLETE, and xTaskCreate.
Referenced by main().
int main | ( | void | ) |
Run TWI unit tests.
References create_twi_task(), prvSetupHardware(), tskIDLE_PRIORITY, and vTaskStartScheduler().
|
static |
References at24cxx_reset(), uart_rs232_options::baudrate, board_init(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and usart_serial_options.
Referenced by main().
|
static |
References twi_packet::addr, twi_packet::addr_length, BOARD_AT24C_ADDRESS, twi_packet::buffer, twi_packet::chip, data_buffer, error_detected, freertos_twi, freertos_twi_read_packet, twi_packet::length, PAGE_SIZE, pdTRUE, portTICK_RATE_MS, portTickType, and STATUS_OK.
Referenced by run_twi_test().
|
static |
References data_buffer, error_detected, PAGE_SIZE, pdFALSE, pdTRUE, read_page_from_eeprom(), test_assert_true, TOTAL_EEPROM_SIZE, and write_page_to_eeprom().
Referenced by twi_eeprom_task().
|
static |
References DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_twi_test(), test_suite_run(), UNUSED, and vTaskDelete().
Referenced by create_twi_task().
void vApplicationIdleHook | ( | void | ) |
void vApplicationMallocFailedHook | ( | void | ) |
void vApplicationStackOverflowHook | ( | xTaskHandle | pxTask, |
signed char * | pcTaskName | ||
) |
void vApplicationTickHook | ( | void | ) |
This function is called by FreeRTOS each tick.
|
static |
References twi_packet::addr, twi_packet::addr_length, BOARD_AT24C_ADDRESS, twi_packet::buffer, twi_packet::chip, data_buffer, error_detected, freertos_twi, freertos_twi_write_packet, INTERNAL_WRITE_DELAY, twi_packet::length, PAGE_SIZE, pdTRUE, portTICK_RATE_MS, portTickType, STATUS_OK, and vTaskDelay().
Referenced by run_twi_test().
|
static |
Referenced by read_page_from_eeprom(), run_twi_test(), and write_page_to_eeprom().
|
static |
Referenced by read_page_from_eeprom(), run_twi_test(), and write_page_to_eeprom().
|
static |
Referenced by create_twi_task(), read_page_from_eeprom(), and write_page_to_eeprom().