Hello, i have looked into periph drivers and found a lot of single line "while" statements waiting for finishing things.
stm32f4 -> 26 statements nrf51822 -> 4 statements atmega2560 -> 8 statements cc2538 -> 4 statements sam3x8e -> 13 statements ... Slow devices like ADC, Flash, UART or Random number generation are wasting a lot of CPU cycles while waiting to finish an action. This blocks task switching(right?) and preventing to go into sleep mode. What about an architecture for asynchronous drivers? An asynchronous driver can be initialized, but it brings hardware into sleep mode. The hardware is powered on when an process is added to queue and powered off when noting listens to queue. It should be possbile to add more than one process to an queue. This gives the availability to debug things, implement an work flow to decrypt or route radio packages or use ADC values to generate better random data when ADC is enabled. An queue can be centralized and handle an event-type, the priority and an pointer to an call back function. When an event is triggered any function with same event type is called with an identifier like pin number and an value or pointer to expected data structure. Every function can determine with return code if other functions with same event type are called. This is needed for random numbers to make sure that an random number is not used twice. When it's possible to change an event type and re queue an event an work flow can implemented. Regards, Frank _______________________________________________ devel mailing list [email protected] http://lists.riot-os.org/mailman/listinfo/devel
