@@ -59,9 +59,63 @@ extern "C" {
5959
6060/**
6161 * \defgroup hal_GeneralSPI SPI Configuration Functions
62+ *
63+ * # Defined behavior
64+ * * ::spi_init initialize the SPI peripheral
65+ * * ::spi_init configures the pins used by SPI
66+ * * ::spi_init sets a default format and frequency
67+ * * ::spi_init enables the peripheral
68+ * * ::spi_free returns the pins owned by the SPI object to their reset state
69+ * * ::spi_format sets the number of bits per frame
70+ * * ::spi_format configures clock polarity and phase
71+ * * ::spi_format configures master/slave mode
72+ * * ::spi_frequency sets the SPI baud rate
73+ * * ::spi_master_write writes a symbol out in master mode and receives a symbol
74+ * * ::spi_master_block_write writes `tx_length` words to the bus
75+ * * ::spi_master_block_write reads `rx_length` words from the bus
76+ * * ::spi_master_block_write returns the maximum of tx_length and rx_length
77+ * * ::spi_master_block_write specifies the write_fill which is default data transmitted while performing a read
78+ * * ::spi_get_module returns non-zero if a value is available to read from SPI channel, 0 otherwise
79+ * * ::spi_slave_read returns a received value out of the SPI receive buffer in slave mode
80+ * * ::spi_slave_read blocks until a value is available
81+ * * ::spi_slave_write writes a value to the SPI peripheral in slave mode
82+ * * ::spi_slave_write blocks until the SPI peripheral can be written to
83+ * * ::spi_busy returns non-zero if the peripheral is currently transmitting, 0 otherwise
84+ * * ::spi_master_transfer starts the SPI asynchronous transfer
85+ * * ::spi_master_transfer writes `tx_len` words to the bus
86+ * * ::spi_master_transfer reads `rx_len` words from the bus
87+ * * ::spi_master_transfer specifies the bit width of buffer words
88+ * * The callback given to ::spi_master_transfer is invoked when the transfer completes (with a success or an error)
89+ * * ::spi_master_transfer specifies the logical OR of events to be registered
90+ * * The ::spi_master_transfer function may use the `DMAUsage` hint to select the appropriate async algorithm
91+ * * ::spi_irq_handler_asynch reads the received values out of the RX FIFO
92+ * * ::spi_irq_handler_asynch writes values into the TX FIFO
93+ * * ::spi_irq_handler_asynch checks for transfer termination conditions, such as buffer overflows or transfer complete
94+ * * ::spi_irq_handler_asynch returns event flags if a transfer termination condition was met, otherwise 0
95+ * * ::spi_abort_asynch aborts an on-going async transfer
96+ * * ::spi_active returns non-zero if the SPI port is active or zero if it is not
97+ *
98+ * # Undefined behavior
99+ * * Calling ::spi_init multiple times on the same `spi_t` without ::spi_free
100+ * * Calling any function other than ::spi_init on a non-initialized or freed `spi_t`
101+ * * Passing pins that cannot be on the same peripheral
102+ * * Passing an invalid pointer as `obj` to any function
103+ * * Passing an invalid pointer as `handler` to ::spi_master_transfer
104+ * * Calling ::spi_abort while no async transfer is being processed (no transfer or a synchronous transfer)
105+ *
62106 * @{
63107 */
64108
109+ /**
110+ * \defgroup hal_GeneralSPI_tests SPI hal tests
111+ * The SPI HAL tests ensure driver conformance to defined behaviour.
112+ *
113+ * To run the SPI hal tests use the command:
114+ *
115+ * mbed test -t <toolchain> -m <target> -n tests-mbed_hal_fpga_ci_test_shield-spi
116+ *
117+ */
118+
65119#ifdef DEVICE_SPI_COUNT
66120/**
67121 * Returns a variant of the SPIName enum uniquely identifying a SPI peripheral of the device.
0 commit comments