Ciao,
the documentation refers only to those fields which are common on every platform. Let me do a step back...
Each driver of ChibiOS/HAL is mainly configured on the xxxStart call which requires two parameters:
- A pointer to the Driver instance
- A pointer to the configuration structure
The configuration structure is composed of two parts:
- A common part which is independent of the underlying hardware
- Some fields strictly dependent on the underlying hardware
What you find in the documentation is the first one, while the second one basically could be retrieved directly from examples or in the proper header files.
For example, the STM32F4xx uses the USARTv1 LLD thus you could find the definition fo the configuration structure exploring the file
[chibios]\os\hal\ports\STM32\LLD\USARTv1\hal_serial_lld.h
Where you will find this:
Code: Select all
/**
* @brief STM32 Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
* @note This structure content is architecture dependent, each driver
* implementation defines its own version and the custom static
* initializers.
*/
typedef struct {
/**
* @brief Bit rate.
*/
uint32_t speed;
/* End of the mandatory fields.*/
/**
* @brief Initialization value for the CR1 register.
*/
uint16_t cr1;
/**
* @brief Initialization value for the CR2 register.
*/
uint16_t cr2;
/**
* @brief Initialization value for the CR3 register.
*/
uint16_t cr3;
} SerialConfig;
Now, to answer your question the cr1, cr2, and c3 fields represent the value of the registers of the UART you are going to configure and through them, you could change all the configurations you were talking about.
Some further readings:
How is made HAL and how to identify which file you should explore for configurations structures:
https://www.playembedded.org/blog/chibioshal-design-an-object-oriented-approach/An article about ChibiOS serial driver:
http://www.playembedded.org/blog/stm32-usart-chibios-serial/Some additional examples:
https://www.playembedded.org/blog/vcp-stm32-chibios/>
Question 2:
UART and Serial are two different drivers based on the same peripheral. Let's say, UART is more about exposing IRQ to the user while Serial offers integrated IO buffering.