This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Description
Description
Presently, the UartDriver class provides synchronization with interrupts (i.e. it will block a thread until the callback function is executed or the transfer times out), but does not provide synchronization between threads (i.e., there is nothing stopping Thread 1 from executing a UartDriver method while Thread 2 is halfway through a transfer). In our present situation this is fine since we know exactly which thread is using which UartDriver instance, but this class will be difficult to use in more general scenarios because of this shortcoming.
The idea here is to not block a thread immediately after it initiates a transfer and unblock it after the transfer is complete, but instead, to block a thread if it tries to initiate a transfer while one is already in progress. One way to achieve this is using a binary semaphore to guard accesses to a particular UART channel (i.e. RX and TX have different semaphores). I know that FreeRTOS has a semaphore implementation which uses task notifications, but based on what I see here this is suitable for synchronization with an interrupt but not between different threads.
Timeline
Ideally beginning of December. It is not urgent but it would be nice to have this done before our next release.
Additional information
Semaphores seems to behave slightly differently depending on the FreeRTOS memory allocation scheme. So be careful to test early instead of assuming anything about the initial semaphore count.