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 <pmc.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 |
int main | ( | void | ) |
Run TRNG driver unit tests.
References uart_rs232_options::baudrate, board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, run_trng_test(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), test_suite_run(), and usart_serial_options.
|
static |
Test TRNG setting.
This test sets the TRNG to generate interrupt when new random value is completed.
test | Current 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 status, trng_disable_interrupt(), trng_get_interrupt_status(), and trng_int_flag.
|
static |
Referenced by run_trng_test(), and TRNG_Handler().