Microchip® Advanced Software Framework

drivers/extint/unit_test/unit_test.c File Reference

SAM External Interrupt Unit test.

Copyright (c) 2013-2020 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <stdio_serial.h>
#include <string.h>
#include "conf_test.h"

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 void cdc_uart_init ( void  )
static
static void cleanup_extint_callback_mode_test ( const struct test_case test)
static

Cleanup function for callback mode test.

This function disables the callback & external interrupt channel.

Parameters
testCurrent 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 void cleanup_extint_polled_mode_test ( const struct test_case test)
static

Cleanup function for polled mode test.

This function disables the external interrupt channel.

Parameters
testCurrent test case.

References extint_chan_conf::detection_criteria, eic_conf, extint_chan_set_config(), and EXTINT_DETECT_NONE.

Referenced by main().

static void extint_user_callback ( void  )
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  )
static void run_extint_callback_mode_test ( const struct test_case test)
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.

Parameters
testCurrent 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 void run_extint_polled_mode_test ( const struct test_case test)
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.

Parameters
testCurrent 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 void setup_extint_polled_mode_test ( const struct test_case test)
static

struct usart_module cdc_uart_module
volatile bool interrupt_flag = false
volatile bool result = false

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().