SAM True Random Number Generator (TRNG) Unit test.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
int | main (void) |
Run TRNG unit tests. More... | |
static void | run_trng_callback_read_test (const struct test_case *test) |
TRNG callback mode test function. More... | |
static void | run_trng_polling_read_test (const struct test_case *test) |
Test for TRNG polling mode read. More... | |
static void | trng_complete_callback (struct trng_module *const module_inst) |
TRNG callback function. More... | |
Variables | |
struct usart_module | cdc_uart_module |
volatile bool | interrupt_flag = false |
struct trng_module | trng_instance |
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART used for sending the unit test status to the computer via the EDBG CDC gateway.
References usart_config::baudrate, cdc_uart_module, CONF_STDIO_BAUDRATE, CONF_STDIO_MUX_SETTING, CONF_STDIO_PINMUX_PAD0, CONF_STDIO_PINMUX_PAD1, CONF_STDIO_PINMUX_PAD2, CONF_STDIO_PINMUX_PAD3, CONF_STDIO_USART, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, usart_enable(), and usart_get_config_defaults().
Referenced by main().
int main | ( | void | ) |
Run TRNG unit tests.
Initializes the system and serial output, then sets up the TRNG unit test suite and runs it.
References cdc_uart_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, run_trng_callback_read_test(), run_trng_polling_read_test(), system_init(), and test_suite_run().
|
static |
TRNG callback mode test function.
This test reads three random data in callback mode and check the result.
test | Current test case. |
References interrupt_flag, test_assert_true, TRNG_CALLBACK_READ_BUFFER, trng_complete_callback(), trng_disable(), trng_disable_callback(), trng_enable_callback(), trng_instance, trng_read_buffer_job(), and trng_register_callback().
Referenced by main().
|
static |
Test for TRNG polling mode read.
This test reads three random data in polling mode and check the result.
test | Current test case |
References STATUS_OK, test_assert_true, trng_enable(), trng_get_config_defaults(), trng_init(), trng_instance, and trng_read().
Referenced by main().
|
static |
TRNG callback function.
Called by TRNG driver on interrupt detection.
module | Pointer to the TRNG module (not used) |
References interrupt_flag, and UNUSED.
Referenced by run_trng_callback_read_test().
struct usart_module cdc_uart_module |
Referenced by cdc_uart_init().
Referenced by run_trng_callback_read_test(), and trng_complete_callback().
struct trng_module trng_instance |
Referenced by run_trng_callback_read_test(), and run_trng_polling_read_test().