no-OS
no-OS copied to clipboard
peripheral drivers should have a config() API
There is an issue with UART being needlessly reinitialized by calling remove() and init() API's only to change the baudrate. This kind of problem could be solved by adding a mandatory config() API to the peripheral drivers so that the minimal API set would look like this:
init(**dev, *init_param) - allocate memory, calls config() internally
config(*dev, *init_param) - configure the peripheral
remove(*dev) - deallocate memory (and put the hardware in a good state, if needed)
The user could then reconfigure the peripheral with a new set of init_param structure without deallocating/reallocating memory.