no-OS icon indicating copy to clipboard operation
no-OS copied to clipboard

peripheral drivers should have a config() API

Open buha opened this issue 1 year ago • 0 comments

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.

buha avatar Oct 16 '24 08:10 buha