SAM External Interrupt Unit test.
Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.
Functions | |
static void | cdc_uart_init (void) |
Initialize the USART for unit test. More... | |
static void | cleanup_extint_callback_mode_test (const struct test_case *test) |
Cleanup function for callback mode test. More... | |
static void | cleanup_extint_polled_mode_test (const struct test_case *test) |
Cleanup function for polled mode test. More... | |
static void | extint_user_callback (void) |
External interrupt callback function. More... | |
int | main (void) |
Run External Interrupt unit tests. More... | |
static void | run_extint_callback_mode_test (const struct test_case *test) |
Test for external interrupt detection using callback. More... | |
static void | run_extint_polled_mode_test (const struct test_case *test) |
Test for external interrupt detection by polling. More... | |
static void | setup_extint_callback_mode_test (const struct test_case *test) |
Setup function for callback mode test. More... | |
static void | setup_extint_polled_mode_test (const struct test_case *test) |
Setup function for polled mode test. More... | |
Variables | |
struct usart_module | cdc_uart_module |
struct extint_chan_conf | eic_conf |
volatile bool | interrupt_flag = false |
struct port_config | pin_conf |
volatile bool | result = false |
|
static |
Initialize the USART for unit test.
Initializes the SERCOM USART (SERCOM4) 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, 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().
|
static |
Cleanup function for callback mode test.
This function disables the callback & external interrupt channel.
test | Current test case. |
References extint_chan_conf::detection_criteria, eic_conf, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_disable_callback(), extint_chan_set_config(), EXTINT_DETECT_NONE, extint_unregister_callback(), and extint_user_callback().
Referenced by main().
|
static |
Cleanup function for polled mode test.
This function disables the external interrupt channel.
test | Current test case. |
References extint_chan_conf::detection_criteria, eic_conf, extint_chan_set_config(), and EXTINT_DETECT_NONE.
Referenced by main().
|
static |
External interrupt callback function.
Called by external interrupt driver on interrupt detection.
References interrupt_flag.
Referenced by cleanup_extint_callback_mode_test(), and setup_extint_callback_mode_test().
int main | ( | void | ) |
Run External Interrupt unit tests.
Initializes the system and serial output, then sets up the External Interrupt unit test suite and runs it.
References cdc_uart_init(), cleanup_extint_callback_mode_test(), cleanup_extint_polled_mode_test(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, delay_init(), run_extint_callback_mode_test(), run_extint_polled_mode_test(), setup_extint_callback_mode_test(), setup_extint_polled_mode_test(), system_init(), and test_suite_run().
|
static |
Test for external interrupt detection using callback.
This test changes the logic level of PB05 from high to low so that the external interrupt channel detects the edge and calls the callback function.
Detection is tested for both rising and falling edges.
test | Current test case. |
References extint_chan_conf::detection_criteria, eic_conf, extint_chan_set_config(), EXTINT_DETECT_RISING, interrupt_flag, port_pin_set_output_level(), and test_assert_true.
Referenced by main().
|
static |
Test for external interrupt detection by polling.
This test changes the logic level of PB05 from high to low so that the external interrupt channel detects the edge.
Detection is tested for both rising and falling edges.
test | Current test case. |
References delay_ms, extint_chan_conf::detection_criteria, eic_conf, extint_chan_clear_detected(), extint_chan_is_detected(), extint_chan_set_config(), EXTINT_DETECT_RISING, port_pin_set_output_level(), result, and test_assert_true.
Referenced by main().
|
static |
Setup function for callback mode test.
This function sets up the GPIO pin, the external interrupt channel & the callback function.
test | Current test case. |
References extint_chan_conf::detection_criteria, port_config::direction, eic_conf, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_enable_callback(), extint_chan_get_config_defaults(), extint_chan_set_config(), EXTINT_DETECT_FALLING, EXTINT_PULL_UP, extint_register_callback(), extint_user_callback(), extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, extint_chan_conf::gpio_pin_pull, port_config::input_pull, pin_conf, port_get_config_defaults(), PORT_PIN_DIR_OUTPUT, PORT_PIN_PULL_NONE, port_pin_set_config(), and port_pin_set_output_level().
Referenced by main().
|
static |
Setup function for polled mode test.
This function sets up the GPIO pin and the external interrupt channel.
test | Current test case. |
References extint_chan_conf::detection_criteria, port_config::direction, eic_conf, extint_chan_get_config_defaults(), extint_chan_set_config(), EXTINT_DETECT_FALLING, EXTINT_PULL_UP, extint_chan_conf::gpio_pin, extint_chan_conf::gpio_pin_mux, extint_chan_conf::gpio_pin_pull, port_config::input_pull, pin_conf, port_get_config_defaults(), PORT_PIN_DIR_OUTPUT, PORT_PIN_PULL_NONE, port_pin_set_config(), and port_pin_set_output_level().
Referenced by main().
struct usart_module cdc_uart_module |
struct extint_chan_conf eic_conf |
struct port_config pin_conf |
Referenced by setup_extint_callback_mode_test(), and setup_extint_polled_mode_test().
Referenced by _http_client_request(), _http_client_send_wait(), adp_example_adc_get_value(), BM_APPLICATION_ResponseCheck(), bootGetChar(), bootScanInterfaces(), configure_mqtt(), GetTxChannelConfig1(), GetTxChannelConfig2(), interface_process_fifo_data(), LORAREG_EnableallChannels(), LORAREG_GetAttr(), LORAREG_GetAttr_BandwidthAttrT1(), LORAREG_GetAttr_BandwidthAttrT2(), LORAREG_GetAttr_ChIdStatus(), LORAREG_GetAttr_DataRange(), LORAREG_GetAttr_DlFrequency(), LORAREG_GetAttr_DRangeChBandT1(), LORAREG_GetAttr_DRangeChBandT2(), LORAREG_GetAttr_DutyCycleT2(), LORAREG_GetAttr_DutyCycleTimer(), LORAREG_GetAttr_FreeChannel1(), LORAREG_GetAttr_FreeChannel2(), LORAREG_GetAttr_FreqT1(), LORAREG_GetAttr_FreqT2(), LORAREG_GetAttr_FreqT3(), LORAREG_GetAttr_JoinDutyCycleRemainingTime(), LORAREG_GetAttr_MaxPayloadT1(), LORAREG_GetAttr_MaxPayloadT2(), LORAREG_GetAttr_MaxPayloadT3(), LORAREG_GetAttr_MinMaxDr(), LORAREG_GetAttr_MinNewChIndex(), LORAREG_GetAttr_ModulationAttrT1(), LORAREG_GetAttr_ModulationAttrT2(), LORAREG_GetAttr_NewTxChConfigT1(), LORAREG_GetAttr_NewTxChConfigT2(), LORAREG_GetAttr_Rx1WindowparamsType1(), LORAREG_GetAttr_Rx1WindowparamsType2(), LORAREG_GetAttr_Rx1WindowparamsType3(), LORAREG_GetAttr_Rx1WindowparamsType4(), LORAREG_GetAttr_RxWindowOffsetT1(), LORAREG_GetAttr_RxWindowOffsetT2(), LORAREG_GetAttr_RxWindowSizeT1(), LORAREG_GetAttr_RxWindowSizeT2(), LORAREG_GetAttr_SpreadFactorT1(), LORAREG_GetAttr_SpreadFactorT2(), LORAREG_Init(), LORAReg_InitAS(), LORAReg_InitAU(), LORAReg_InitIN(), LORAReg_InitJP(), LORAReg_InitKR(), LORAReg_InitNA(), LORAREG_SetAttr(), LORAREG_UnInit(), LORAREG_ValidateAttr(), main(), nm_bus_deinit(), nm_bus_init(), run_buffer_read_write_interrupt_test(), run_buffer_write_blocking_read_interrupt_test(), run_extint_polled_mode_test(), run_rtc_calendar_test(), run_rtc_count_test(), SearchAvailableChannel1(), SearchAvailableChannel2(), setDefaultTxPower(), setDlFrequency(), setDutyCycle(), setDutyCycleTimer(), setFrequency(), setJoinBackoffCntl(), setJoinBackOffTimer(), setJoinDutyCycleTimer(), setNewChannel(), system_interrupt_is_pending(), test_case_run(), ValidateChannelId(), ValidateChannelMaskCntl(), ValidateChannelMaskCntlT2(), ValidateChMaskChCntl(), ValidateDataRate(), ValidateDataRateRxT1(), ValidateDataRateRxT2(), ValidateDataRateTxT1(), ValidateDataRateTxT2(), ValidateFreqIN(), ValidateFreqJP(), ValidateFreqKR(), ValidateFrequencyAS(), ValidateRxFreqT1(), ValidateSupportedDr(), ValidateTxFreqT1(), and ValidateTxPower().