Microchip® Advanced Software Framework

twi_unit_tests.c File Reference

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
#define TOTAL_EEPROM_SIZE   65536

Referenced by run_twi_test().

#define TWI_CLOCK_HZ   400000

Referenced by create_twi_task().

static void create_twi_task ( Twi *  twi_base,
uint16_t  stack_depth_words,
unsigned portBASE_TYPE  task_priority 
)
static
int main ( void  )
static void run_twi_test ( const struct test_case test)
static
static void twi_eeprom_task ( void *  pvParameters)
static
void vApplicationIdleHook ( void  )
void vApplicationMallocFailedHook ( void  )
void vApplicationStackOverflowHook ( xTaskHandle  pxTask,
signed char *  pcTaskName 
)
void vApplicationTickHook ( void  )

This function is called by FreeRTOS each tick.

uint8_t data_buffer[PAGE_SIZE]
static
uint32_t error_detected = pdFALSE
static