The SPI tests to check the implementation against the defined behavior. More...
Data Structures | |
struct | test_config_t |
Functions | |
void | spi_test_get_module () |
Test that spi_get_module() returns the SPIName - unique identifier to the peripheral associated to this SPI channel. More... | |
void | spi_test_get_capabilities () |
Test that spi_get_capabilities() fills the given spi_capabilities_t instance with capabilities of the specified SPI peripheral. More... | |
void | spi_test_init_free () |
Test that spi_init() successfully initializes the pins and spi_free() can successfully reset the pins to their default state. More... | |
void | spi_test_set_format () |
Test that spi_format() sets/updates the transmission format of the SPI peripheral. More... | |
void | spi_test_set_frequency () |
Test that spi_test_set_frequency() sets the frequency used during the SPI transfer. More... | |
void | spi_test_transfer_master () |
Test that spi_transfer() can successfully perform transfer in master mode (TX/RX buffers are defined and have the same sizes) and returns the number of symbols clocked on the bus during this transfer. More... | |
void | spi_test_transfer_master_fill_sym () |
Test that spi_transfer() can successfully perform transfer in master mode (TX/RX buffers are undefined or have different sizes) and returns the number of symbols clocked on the bus during this transfer. More... | |
void | spi_test_transfer_master_async () |
Test that spi_transfer_async() can successfully perform asynchronous transfer in master mode. More... | |
void | spi_test_transfer_master_async_abort () |
Test that spi_transfer_async_abort() can successfully abort an on-going async transfer. More... | |
void | test_spi_transfer () |
Test that the SPI transfer can be performed in various configurations. More... | |
void | fpga_spi_master_test_init_free (PinName mosi, PinName miso, PinName sclk) |
Test that the spi-Master can be initialized/de-initialized using all possible SPI pins. More... | |
void | fpga_spi_test_capabilities_ssel (PinName mosi, PinName miso, PinName sclk) |
Test that the spi_get_capabilities() indicates that slave mode is unsupported if the given ssel pin cannot be managed by hardware. More... | |
void | fpga_spi_master_test_freq (PinName mosi, PinName miso, PinName sclk) |
Test that the spi_frequency() returns actual SPI frequency. More... | |
void | fpga_spi_master_test_common (PinName mosi, PinName miso, PinName sclk) |
Test that the SPI-Master transfer can be performed in various configurations. More... | |
void | fpga_spi_slave_test_init_free (PinName mosi, PinName miso, PinName sclk, PinName cs) |
Test that the spi-Slave can be initialized/de-initialized using all possible SPI pins. More... | |
void | fpga_spi_slave_test_common (const test_config_t *tc_config) |
Test that the SPI-Slave transfer can be performed in various configurations. More... | |
The SPI tests to check the implementation against the defined behavior.
To run the spi hal tests use the command:
mbed test -t <toolchain> -m <target> -n tests-mbed_hal-spi, tests-mbed_hal_fpga_ci_test_shield-spi*
void fpga_spi_master_test_common | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk | ||
) |
Test that the SPI-Master transfer can be performed in various configurations.
Given board provides SPI-Master support. When SPI transmission is performed using different settings. Then data is successfully transfered.
Additionally we check that spi_frequency() updates the baud rate generator leaving other configurations (format) unchanged.
void fpga_spi_master_test_freq | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk | ||
) |
Test that the spi_frequency() returns actual SPI frequency.
Given board provides SPI-Master support. When specified frequency is selected by means of spi_frequency(). Then frequency returned by spi_frequency() is used for the transmission.
Additionally we check that spi_format() updates the configuration of the peripheral (format) except the baud rate generator.
void fpga_spi_master_test_init_free | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk | ||
) |
Test that the spi-Master can be initialized/de-initialized using all possible SPI pins.
Given board provides SPI-Master support. When SPI-Master is initialized (and then de-initialized) using valid set of SPI pins. Then the operation is successfull.
void fpga_spi_slave_test_common | ( | const test_config_t * | tc_config | ) |
Test that the SPI-Slave transfer can be performed in various configurations.
Given board provides SPI-Slave support. When SPI transmission is performed using different settings. Then data is successfully transferred.
void fpga_spi_slave_test_init_free | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | cs | ||
) |
Test that the spi-Slave can be initialized/de-initialized using all possible SPI pins.
Given board provides SPI-Slave support. When SPI-Slave is initialized (and then de-initialized) using valid set of SPI pins. Then the operation is successfull.
void fpga_spi_test_capabilities_ssel | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk | ||
) |
Test that the spi_get_capabilities() indicates that slave mode is unsupported if the given ssel
pin cannot be managed by hardware.
Given board provides SPI support. When ssel
pin passed to spi_get_capabilities() cannot be managed by hardware. Then capabilities should indicate that slave mode is unsupported.
void spi_test_get_capabilities | ( | ) |
Test that spi_get_capabilities() fills the given spi_capabilities_t instance with capabilities of the specified SPI peripheral.
Given is platform with SPI support. When spi_get_capabilities() is called with the valid SPI name (and SS pin). Then function fills the given spi_capabilities_t instance with capabilities of the specified SPI peripheral.
ssel
pin when evaluation the support_slave_mode capability. void spi_test_get_module | ( | ) |
Test that spi_get_module() returns the SPIName - unique identifier to the peripheral associated to this SPI channel.
Given is platform with SPI support. When spi_get_module() is called with valid SPI pins. Then function returns the SPIName - unique identifier to the peripheral associated to this SPI channel.
mosi
or miso
pin can be undefined (but not both). mclk
must be defined. void spi_test_init_free | ( | ) |
Test that spi_init() successfully initializes the pins and spi_free() can successfully reset the pins to their default state.
Given is platform with SPI support. When spi_init() is called with the valid pins configuration and then spi_free() is called on the created SPI object. Then both operations are successfully performed.
void spi_test_set_format | ( | ) |
Test that spi_format() sets/updates the transmission format of the SPI peripheral.
Given is platform with SPI support. When spi_format() is called and valid format is specified. Then function is executed successfully.
void spi_test_set_frequency | ( | ) |
Test that spi_test_set_frequency() sets the frequency used during the SPI transfer.
Given is platform with SPI support. When spi_test_set_frequency() is called and valid frequency is specified. Then function is executed successfully and actual frequency which will be used during the transfer is returned.
void spi_test_transfer_master | ( | ) |
Test that spi_transfer() can successfully perform transfer in master mode (TX/RX buffers are defined and have the same sizes) and returns the number of symbols clocked on the bus during this transfer.
Given is platform with SPI support. When spi_transfer() is called for SPI peripheral operating in master mode and both TX/RX buffers are specified and have equal sizes. Then function is executed successfully and returns number of symbols clocked on the bus during this transfer.
void spi_test_transfer_master_async | ( | ) |
Test that spi_transfer_async() can successfully perform asynchronous transfer in master mode.
Given is platform with SPI support. When spi_transfer_async() is called for SPI peripheral operating in master mode. Then function returns true on success, performs transfer and invokes specified callback when the transfer completes (passing the operation status).
void spi_test_transfer_master_async_abort | ( | ) |
Test that spi_transfer_async_abort() can successfully abort an on-going async transfer.
Given is platform with SPI support. When spi_transfer_async() is called for SPI peripheral operating in master mode and operation is aborted immediately by means of spi_transfer_async_abort(). Then operation is successfully performed and specified callback is invoked with the status which indicates that the transfer has been aborted.
void spi_test_transfer_master_fill_sym | ( | ) |
Test that spi_transfer() can successfully perform transfer in master mode (TX/RX buffers are undefined or have different sizes) and returns the number of symbols clocked on the bus during this transfer.
Given is platform with SPI support. When spi_transfer() is called for SPI peripheral operating in master mode and TX/RX buffers are undefined or have different sizes. Then function is executed successfully and returns number of symbols clocked on the bus during this transfer.
void test_spi_transfer | ( | ) |
Test that the SPI transfer can be performed in various configurations.
Given board provides at least 2 SPI peripherals, SPI slave and master mode. When SPI transmission is performed using specified configuration. Then data is successfully transfered.