aboutsummaryrefslogtreecommitdiffstats
path: root/src/sched.h
Commit message (Collapse)AuthorAgeFilesLines
* sched: Improve timer vs task priority checkKevin O'Connor2024-10-261-1/+1
| | | | | | | | | | | | | | | Rename sched_tasks_busy() to sched_check_set_tasks_busy() and change it to only return true if tasks are active (running or requested) for two consecutive calls. This makes it less likely that timers will yield to tasks except when tasks really are notably backlogged. This also makes it less likely that multiple steppers controlling the same rail will be interrupted by tasks mid-step. This should slightly improve the timing, and make it less likely that a halt during homing/probing will occur with these steppers taking a different number of total steps. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Support config_reset command to manually reset mcuKevin O'Connor2017-09-031-0/+1
| | | | | | | Add support for resetting the MCU via a software only mechanism. This is useful on the PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Implement generic sleep mechanism based on tasks pendingKevin O'Connor2017-08-081-0/+1
| | | | | | | | | 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: Introduce sched_wake_tasks() function to wake up tasksKevin O'Connor2017-08-081-0/+1
| | | | | | | | Add function to indicate when tasks need to be run. This will allow the scheduler code to know if there are any tasks that need to be processed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Don't count milliseconds in the periodic timerKevin O'Connor2017-08-081-1/+7
| | | | | | | It's not necessary to keep a millisecond counter. Replace the two users of sched_check_periodic() with explicit task wakeup flags. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Use compile_time_request system for init, tasks, and shutdownKevin O'Connor2017-05-261-14/+6
| | | | | | | | 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>
* sched: Allow shutdown_reason to be uint8Kevin O'Connor2017-05-261-5/+4
| | | | | | | Store the shutdown_reason code in an 8-bit integer - this produces better code on AVR. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Move timer dispatch loop to board codeKevin O'Connor2017-03-301-1/+1
| | | | | | | | 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>
* timer: Allow board code to define its own timer_is_before implementationKevin O'Connor2017-03-261-3/+0
| | | | | | | | | | | | 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: Rename sched_timer() to sched_add_timer()Kevin O'Connor2017-03-111-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Update declfuncs.lds.S to only use progmem sections on AVRKevin O'Connor2016-06-141-1/+1
| | | | | | | On non-avr platforms the declfunc stuff still needs to be in the binary in a rodata section. 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-1/+1
| | | | | | | | 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>
* sched: Change sched_from_ms() to sched_from_us()Kevin O'Connor2016-06-021-1/+1
| | | | | | | 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/+51
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>