@@ -108,9 +108,69 @@ extern "C" {
108108
109109/**
110110 * \defgroup hal_GeneralSerial Serial Configuration Functions
111+ *
112+ * # Defined behaviour
113+ * * ::serial_init initializes the serial peripheral
114+ * * ::serial_init sets the default parameters for serial peripheral
115+ * * ::serial_init configures its specified pins
116+ * * ::serial_free releases the serial peripheral
117+ * * ::serial_baud configures the baud rate
118+ * * ::serial_format configures the transmission format (number of bits, parity and the number of stop bits)
119+ * * ::serial_irq_handler registers the interrupt handler which will be invoked when the interrupt fires
120+ * * ::serial_irq_set enables or disables serial irq (RX or TX)
121+ * * ::serial_getc returns the character from serial buffer
122+ * * ::serial_getc is a blocking call (waits for the character)
123+ * * ::serial_putc sends a character
124+ * * ::serial_putc is a blocking call (waits for a peripheral to be available)
125+ * * ::serial_readable returns non-zero value if a character can be read, 0 if nothing to read
126+ * * ::serial_writable returns non-zero value if a character can be written, 0 otherwise
127+ * * ::serial_clear clears the serial peripheral
128+ * * ::serial_break_set sets the break signal
129+ * * ::serial_pinout_tx configures the TX pin for UART function
130+ * * ::serial_set_flow_control configures serial flow control
131+ * * ::serial_set_flow_control sets flow control in the hardware if a serial peripheral supports it, otherwise software emulation is used
132+ * * ::serial_tx_asynch starts the serial asynchronous transfer
133+ * * ::serial_tx_asynch writes `tx_length` bytes from the `tx` to the bus
134+ * * The callback given to ::serial_tx_asynch is invoked when the transfer completes
135+ * * ::serial_tx_asynch specifies the logical OR of events to be registered
136+ * * The ::serial_tx_asynch function may use the `DMAUsage` hint to select the appropriate async algorithm
137+ * * ::serial_rx_asynch starts the serial asynchronous transfer
138+ * * ::serial_rx_asynch reads `rx_length` bytes to the `rx`buffer
139+ * * The callback given to ::serial_rx_asynch is invoked when the transfer completes
140+ * * ::serial_tx_asynch specifies the logical OR of events to be registered
141+ * * The ::serial_tx_asynch function may use the `DMAUsage` hint to select the appropriate async algorithm
142+ * * ::serial_tx_asynch specifies the character in range 0-254 to be matched
143+ * * ::serial_tx_active returns non-zero if the TX transaction is ongoing, 0 otherwise
144+ * * ::serial_rx_active returns non-zero if the RX transaction is ongoing, 0 otherwise
145+ * * ::serial_irq_handler_asynch returns event flags if an RX transfer termination condition was met, otherwise returns 0
146+ * * ::serial_tx_abort_asynch aborts the ongoing TX transaction
147+ * * ::serial_tx_abort_asynch disables the enabled interupt for TX
148+ * * ::serial_tx_abort_asynch flushes the TX hardware buffer if TX FIFO is used
149+ * * ::serial_rx_abort_asynch aborts the ongoing RX transaction
150+ * * ::serial_rx_abort_asynch disables the enabled interupt for RX
151+ * * ::serial_rx_abort_asynch flushes the TX hardware buffer if RX FIFO is used
152+ *
153+ * # Undefined behaviour
154+ *
155+ * * Calling ::serial_init multiple times on the same `serial_t` without ::serial_free
156+ * * Passing invalid pin to ::serial_init, ::serial_pinout_tx
157+ * * Calling any function other than ::serial_init on a non-initialized or freed `serial_t`
158+ * * Passing an invalid pointer as `obj` to any function
159+ * * Passing an invalid pointer as `handler` to ::serial_irq_handler, ::serial_tx_asynch, ::serial_rx_asynch
160+ * * Calling ::spi_abort while no async transfer is being processed (no transfer or a synchronous transfer)
111161 * @{
112162 */
113163
164+ /**
165+ * \defgroup hal_GeneralSerial_tests Serial hal tests
166+ * The Serial HAL tests ensure driver conformance to defined behaviour.
167+ *
168+ * To run the Serial hal tests use the command:
169+ *
170+ * mbed test -t <toolchain> -m <target> -n tests-mbed_hal_fpga_ci_test_shield-uart
171+ *
172+ */
173+
114174/** Initialize the serial peripheral. It sets the default parameters for serial
115175 * peripheral, and configures its specifieds pins.
116176 *
0 commit comments