Modules | |
SPI hal tests | |
The SPI HAL tests ensure driver conformance to defined behaviour. | |
Functions | |
void | spi_get_capabilities (PinName ssel, bool slave, spi_capabilities_t *cap) |
Fills the given spi_capabilities_t structure with the capabilities of the given peripheral. More... | |
void | spi_init_direct (spi_t *obj, const spi_pinmap_t *pinmap) |
Initialize the SPI peripheral. More... | |
void | spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) |
Initialize the SPI peripheral. More... | |
void | spi_free (spi_t *obj) |
Release a SPI object. More... | |
void | spi_format (spi_t *obj, int bits, int mode, int slave) |
Configure the SPI format. More... | |
void | spi_frequency (spi_t *obj, int hz) |
Set the SPI baud rate. More... | |
spi_capabilities_t
instance - Verified by fpga_spi_test_common_no_ss and fpga_spi_test_commonssel
pin when evaluation the support_slave_mode
and hw_cs_handle
capability - TBD (basic test)ssel
pin cannot be managed by hardware, support_slave_mode
and hw_cs_handle
should be false - TBD (basic test)tx_length
words to the bus - Verified by fpga_spi_test_common_no_ss and fpga_spi_test_commonrx_length
words from the bus - Verified by fpga_spi_test_common_no_ss and fpga_spi_test_commontx_len
words to the bus - Verified by fpga_spi_test_common_no_ss and fpga_spi_test_commonrx_len
words from the bus - Verified by fpga_spi_test_common_no_ss and fpga_spi_test_commonDMAUsage
hint to select the appropriate async algorithm - Not testablespi_t
without spi_freespi_t
obj
to any functionhandler
to spi_master_transfervoid spi_format | ( | spi_t * | obj, |
int | bits, | ||
int | mode, | ||
int | slave | ||
) |
Configure the SPI format.
Set the number of bits per frame, configure clock polarity and phase, shift order and master/slave mode. The default bit order is MSB.
[in,out] | obj | The SPI object to configure |
[in] | bits | The number of bits per frame |
[in] | mode | The SPI mode (clock polarity, phase, and shift direction) |
[in] | slave | Zero for master mode or non-zero for slave mode |
void spi_free | ( | spi_t * | obj | ) |
Release a SPI object.
TODO: spi_free is currently unimplemented This will require reference counting at the C++ level to be safe
Return the pins owned by the SPI object to their reset state Disable the SPI peripheral Disable the SPI clock
[in] | obj | The SPI object to deinitialize |
void spi_frequency | ( | spi_t * | obj, |
int | hz | ||
) |
Set the SPI baud rate.
Actual frequency may differ from the desired frequency due to available dividers and bus clock Configures the SPI peripheral's baud rate
[in,out] | obj | The SPI object to configure |
[in] | hz | The baud rate in Hz |
void spi_get_capabilities | ( | PinName | ssel, |
bool | slave, | ||
spi_capabilities_t * | cap | ||
) |
Fills the given spi_capabilities_t structure with the capabilities of the given peripheral.
void spi_init | ( | spi_t * | obj, |
PinName | mosi, | ||
PinName | miso, | ||
PinName | sclk, | ||
PinName | ssel | ||
) |
Initialize the SPI peripheral.
Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral
[out] | obj | The SPI object to initialize |
[in] | mosi | The pin to use for MOSI |
[in] | miso | The pin to use for MISO |
[in] | sclk | The pin to use for SCLK |
[in] | ssel | The pin to use for SSEL |
void spi_init_direct | ( | spi_t * | obj, |
const spi_pinmap_t * | pinmap | ||
) |
Initialize the SPI peripheral.
Configures the pins used by SPI, sets a default format and frequency, and enables the peripheral
[out] | obj | The SPI object to initialize |
[in] | pinmap | pointer to structure which holds static pinmap |