aboutsummaryrefslogtreecommitdiffstats
path: root/src/sam3x8e/timer.c
Commit message (Collapse)AuthorAgeFilesLines
* sam3: Rename src/sam3x8e to src/sam3Kevin O'Connor2019-01-071-65/+0
| | | | | | | This is in preparation for merging sam3 and sam4 code into one directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Implement generic sleep mechanism based on tasks pendingKevin O'Connor2017-08-081-7/+0
| | | | | | | | | Track when tasks are pending and spin in irq_wait() when no tasks are pending. This improves the mechanism for sleeping the processor - it's simpler for the board specific code and it reduces the possibility of the processor sleeping when tasks are busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Support adding timers to the start of timer_listKevin O'Connor2017-08-081-13/+11
| | | | | | | | If sched_add_timer() is called on a timer that would make it the new head of the list, then add it and signal the board code that the timer should be rescheduled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Support sleeping when mcu is idleKevin O'Connor2017-07-171-0/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Use compile_time_request system for init, tasks, and shutdownKevin O'Connor2017-05-261-2/+2
| | | | | | | | Avoid using linker magic to define the init, task, and shutdown functions. Instead, use the compile_time_request system. This simplifies the build and produces more efficient code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e: Align the TC0_Handler timer irq handlerKevin O'Connor2017-03-301-1/+1
| | | | | | | | | | The code alignment of the TC0_Handler function seems to noticeably impact performance benchmarks. Set the function alignment to 16 bytes to improve testing consistency. An alignment of 16 doesn't necessarily improve performance, but it seems to improve testing consistency on code changes unrelated to timer dispatch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer_irq: Integrate timer_try_set_next() into timer_dispatch_many()Kevin O'Connor2017-03-301-12/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer_irq: Rename generic/timer.c to generic/timer_irq.cKevin O'Connor2017-03-301-3/+1
| | | | | | | Rename the file to make it clear that the code is helper functions for boards with irq based timers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Move timer dispatch loop to board codeKevin O'Connor2017-03-301-1/+4
| | | | | | | | Rename sched_timer_kick() to sched_timer_dispatch() and move its loop into its callers in the board code. This eliminates the need to export timer_try_set_next() from the board code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* generic: Move generic parts of sam3x8e timer.c to generic directoryKevin O'Connor2017-03-111-88/+11
| | | | | | | | Most of sam3x8e/timer.c is going to be platform agnostic for any board with standard irq handling. Move the generic code into a new file generic/timer.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Avoid rescheduling the currently active timerKevin O'Connor2017-03-101-31/+12
| | | | | | | | | It's tricky to reschedule the timer irq correctly (due to race conditions with the irq) and in practice it's very rarely needed. Handle the special cases in the generic sched.c code so that the board code doesn't have to handle it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* armcm_irq: Move ARM Cortex-M irq handling to new fileKevin O'Connor2017-02-191-1/+1
| | | | | | | | The irq handling in sam3x8e isn't specific to the sam3x8e proccessor - it's generic for all armcm type machines. So, move the definitions into a new file generic/armcm-irq.c Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e/timer: Be careful of races in timer_set_next()Kevin O'Connor2017-02-141-4/+16
| | | | | | | | | | | | | | It's possible for sched_del_timer() to be called on a timer that fires just after sched_del_timer disables irqs but before the next timer is scheduled. In this case be sure to clear the irq pending status flag after scheduling the next timer so that a delayed irq doesn't cause the wrong timer to be run. For the same reason, make sure to check the irq pending status flag at the start of the timer irq. Also, as a safety check, make sure timer_set_next() isn't called from within the timer irq dispatch loop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Define DECL_CONSTANT mechanism for defining exported constantsKevin O'Connor2016-12-231-0/+3
| | | | | | | | | Add a DECL_CONSTANT macro to allow the firmware to define constants that are to be exported to the host during the "identify" phase. This replaces the existing hardcoded mechanism of scanning the Kconfig header file for certain constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e: Rework timer priority code to use time instead of event countKevin O'Connor2016-10-311-11/+14
| | | | | | | | | Rework the timer prioritization code so that is compares against the current time instead of the number of repeat timers in a given interrupt. This makes the code slightly faster and it should provide better protection against task starvation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e: Add initial support for Arduino Due boardsKevin O'Connor2016-06-141-0/+142
This adds basic support for running on the Atmel SAM3x8e micro-controllers that are found in the Arudino Due boards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>