Microchip® Advanced Software Framework

unit_tests.c File Reference

Unit tests for TRNG driver.

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 <conf_clock.h>
#include <conf_board.h>
#include <conf_test.h>
#include <trng.h>

Functions

int main (void)
 Run TRNG driver unit tests. More...
 
static void run_trng_test (const struct test_case *test)
 Test TRNG setting. More...
 
void TRNG_Handler (void)
 Interrupt handler for the TRNG. More...
 

Variables

static volatile uint32_t trng_int_flag = 0U
 

static void run_trng_test ( const struct test_case test)
static

Test TRNG setting.

This test sets the TRNG to generate interrupt when new random value is completed.

Parameters
testCurrent test case.

References pmc_enable_periph_clk(), test_assert_true, trng_enable(), trng_enable_interrupt(), and trng_int_flag.

Referenced by main().

void TRNG_Handler ( void  )

Interrupt handler for the TRNG.

Display the random value on the terminal.

References trng_disable_interrupt(), trng_get_interrupt_status(), and trng_int_flag.

volatile uint32_t trng_int_flag = 0U
static

Referenced by run_trng_test(), and TRNG_Handler().