Ollah Seniores!
i was unable to find any tutorial or documentation about how to “best” write a driver
for an FreeRTOS system. Are there any guidlines, concepts, tutorial of any kind? ( i even bought the book, but nothing their either, why? )
They only thing I found is this ( http://hroch.sh.cvut.cz/replicator/index.php?option=com_content&view=article&id=14:uart-driver&catid=8:drivers&Itemid=12 ) and i dont think the uartDriver is using the mutex end semaphores as they should be used …
Thx for any help.
Concept/Structure of FreeRTOS Driver
Concept/Structure of FreeRTOS Driver
There is no fixed driver model that you have to stick to rigidly, the best method will depend on the requirements of your actual application.
FreeRTOS provides primitives for passing messages between and synchronizing between tasks and interrupts, how you use the primitives is up to you. Generally each demo application includes at least one ISR as an example scheme, although these are not always optimised and can just be to show how the API functions can be used.
If your ISR is fast then all processing can be done in the ISR itself. If the ISR requires some processing to be performed then it is often best to use a FreeRTOS API to do nothing else in the ISR than unblock a task, and have the processing actually performed in the task. The task that does the processing can be set to a high priority if necessary, so the ISR interrupts one task but returns directly to the ISR handler task, so the processing is done all in one go just as if it had all been done in the ISR. The demo application will show you how to do that.