aboutsummaryrefslogtreecommitdiffstats
path: root/src/sched.c
Commit message (Collapse)AuthorAgeFilesLines
* sched: Be explicit with loading of the waketime variableKevin O'Connor2017-03-261-21/+21
| | | | | | | | | Explicilty load the timer waketime variable into local variables in sched_timer_kick(). Change the optimization level from Os to O2. This helps gcc to avoid unnecessary reloads from memory in the common stepper_event() case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Introduce optimized timer_is_before()Kevin O'Connor2017-03-261-3/+3
| | | | | | | | | Provide hand-coded assembler for timer_is_before() on AVR as that code is used frequently in the time-critical timer dispatch loop and gcc doesn't do a good job at compiling that comparison code. Remove the no longer needed waketime+1 hack from reschedule_timer(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer: Allow board code to define its own timer_is_before implementationKevin O'Connor2017-03-261-30/+7
| | | | | | | | | | | | Move sched_is_before() from sched.c to timer_is_before() in the board specific timer code. This allows the board code to provide its own definition. Also, remove the sched_from_us() and sched_read_time() wrapper functions and change the callers to directly invoke timer_from_us() / timer_read_time(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Report the time of a shutdownKevin O'Connor2017-03-241-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Move functions within sched.cKevin O'Connor2017-03-111-40/+38
| | | | | | Just code movement - no code changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Rename sched_timer() to sched_add_timer()Kevin O'Connor2017-03-111-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Don't overwrite shutdown reason if shutdown called while shutdownKevin O'Connor2017-03-101-1/+2
| | | | | | | If a shutdown occurs while the machine is already shutdown, then keep the original shutdown reason code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Avoid rescheduling the currently active timerKevin O'Connor2017-03-101-22/+29
| | | | | | | | | 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>
* sched: Use a sentinel timer at the end of the timer_listKevin O'Connor2017-03-101-9/+29
| | | | | | | | Introduce a dummy sentinel timer object that is always the last item on timer_list. This optimizes the timer_list walking code as it no longer needs to check for NULL when traversing the list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Minor change - remove unneeded header filesKevin O'Connor2017-01-141-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Improve AVR optimization of reschedule_timer()Kevin O'Connor2016-10-191-7/+11
| | | | | | | | Tweak the AVR register pressure optimization in reschedule_timer() to optimize it further. This improves the performance of AVR timers when there are several pending timers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Use 'unsigned int' instead of 'uint16_t' for shutdown reasonKevin O'Connor2016-06-141-2/+2
| | | | | | | Use 'unsigned int' instead of 'uint16_t' as is faster on some platforms. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Use uint_fast8_t for return type of timersKevin O'Connor2016-06-141-2/+2
| | | | | | | | Some architectures are faster passing regular integers than 8bit integers. Use uint_fast8_t so that the architecture chooses the appropriate type. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Allow boards to define the return type of irq_save()Kevin O'Connor2016-06-131-3/+3
| | | | | | | | The AVR wants a uint8_t return type for irq_save(), but other architectures will generally prefer int. Allow the board to configure the size of the flag by introducing an irqstatus_t typedef. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* generic: Move board timer.h files into generic/misc.hKevin O'Connor2016-06-131-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Optimize timer list handlingKevin O'Connor2016-06-131-39/+50
| | | | | | Rework the timer list rescheduling to be more optimized. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Change sched_from_ms() to sched_from_us()Kevin O'Connor2016-06-021-6/+6
| | | | | | | Some code may require micro-second precision so update sched_from_ms() to use micro-seconds. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+282
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>