aboutsummaryrefslogtreecommitdiffstats
path: root/src/linux/timer.c
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>
* linux: Use Unix signals to notify when a timer is pendingKevin O'Connor2021-11-021-23/+87
| | | | | | | Use Unix signals in software timer implementation. This makes the code a little more efficient. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Don't use timer_repeat_until for linux "irq" pollingKevin O'Connor2021-04-211-29/+9
| | | | | | Use a simpler counter system to prioritize tasks and irqs when busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Rework timer_check_periodic() to use ticksKevin O'Connor2021-04-191-11/+11
| | | | | | Avoid using a 'struct timespec' to simplify the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Move timer fields into a structKevin O'Connor2021-04-191-31/+37
| | | | | | Storing the fields in a struct allows gcc to optimize memory pointers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Avoid calling timer_read_time() in timer_dispatch() when not neededKevin O'Connor2021-04-181-3/+15
| | | | | | | The timer_read_time() call can be expensive - when the next timer is definitely pending, avoid making that call. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Simplify timer dispatch codeKevin O'Connor2021-04-181-54/+50
| | | | | | | | Implement rescheduling math using the simple 32-bit timer instead of the Unix timespec struct. This makes the code simpler and doesn't adversely impact the overall performance. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Fix local timer_repeat_until cache in timer.cKevin O'Connor2021-04-181-1/+1
| | | | | | | Make sure to update the local copy of timer_repeat_until when updating it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Wait in timer dispatch for up to 2usKevin O'Connor2020-06-071-2/+2
| | | | | | | Use 2us in the linux timer dispatch code to unify linux timer dispatch logic with the common timer_irq.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: add support for Linux hardware PWMJanne Grunau2019-04-051-3/+0
| | | | | | | | | | The replicape servo pins (P9_14/P9_16) are muxed to the SOCs hardware PWM unit driven by a 13MHz GP timer. They have to be driven by the linux host mcu. This commits adds hardware PWM support using the linux sysfs user space interface. Signed-off-by: Janne Grunau <janne-3d@jannau.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Always pass a string to the DECL_CONSTANT() macroKevin O'Connor2019-03-171-1/+1
| | | | | | | | Make it clear that the name of the constant being defined is a string. When the value being defined is also a string, use a new DECL_CONSTANT_STR() macro. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Remove unneeded includes from timer.cKevin O'Connor2017-10-231-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Don't shutdown on a "timer in the past" if already shutdownKevin O'Connor2017-10-121-3/+2
| | | | | | A shutdown will not help if the mcu is already in a shutdown state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Initial support for running Klipper in a Linux real-time processKevin O'Connor2017-09-201-0/+233
Add support for compiling the Klipper micro-controller code as a real-time process capable of running on standard Linux systems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>