sched: Use uint_fast8_t for return type of timers
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>
This commit is contained in:
parent
fa85094cbb
commit
b0524947e5
|
@ -156,7 +156,7 @@ DECL_COMMAND(command_finalize_config, "finalize_config crc=%u");
|
|||
|
||||
static struct timer group_timer;
|
||||
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
group_end_event(struct timer *timer)
|
||||
{
|
||||
shutdown("Missed scheduling of next event");
|
||||
|
|
|
@ -23,7 +23,7 @@ struct end_stop {
|
|||
enum { ESF_HOMING=1, ESF_REPORT=2 };
|
||||
|
||||
// Timer callback for an end stop
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
end_stop_event(struct timer *t)
|
||||
{
|
||||
struct end_stop *e = container_of(t, struct end_stop, time);
|
||||
|
|
|
@ -22,13 +22,13 @@ struct digital_out_s {
|
|||
uint8_t value, default_value;
|
||||
};
|
||||
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
digital_end_event(struct timer *timer)
|
||||
{
|
||||
shutdown("Missed scheduling of next pin event");
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
digital_out_event(struct timer *timer)
|
||||
{
|
||||
struct digital_out_s *d = container_of(timer, struct digital_out_s, timer);
|
||||
|
@ -103,10 +103,10 @@ enum {
|
|||
SPF_NEXT_ON=1<<4, SPF_NEXT_TOGGLING=1<<5, SPF_NEXT_CHECK_END=1<<6,
|
||||
};
|
||||
|
||||
static uint8_t soft_pwm_load_event(struct timer *timer);
|
||||
static uint_fast8_t soft_pwm_load_event(struct timer *timer);
|
||||
|
||||
// Normal pulse change event
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
soft_pwm_toggle_event(struct timer *timer)
|
||||
{
|
||||
struct soft_pwm_s *s = container_of(timer, struct soft_pwm_s, timer);
|
||||
|
@ -127,7 +127,7 @@ soft_pwm_toggle_event(struct timer *timer)
|
|||
}
|
||||
|
||||
// Load next pwm settings
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
soft_pwm_load_event(struct timer *timer)
|
||||
{
|
||||
struct soft_pwm_s *s = container_of(timer, struct soft_pwm_s, timer);
|
||||
|
|
|
@ -25,7 +25,7 @@ static uint16_t millis;
|
|||
// also simplifies the timer code by ensuring there is always at least
|
||||
// one timer on the timer list and that there is always a timer not
|
||||
// more than 1 ms in the future.
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
ms_event(struct timer *t)
|
||||
{
|
||||
millis++;
|
||||
|
@ -154,7 +154,7 @@ sched_timer_kick(void)
|
|||
struct timer *t = timer_list;
|
||||
for (;;) {
|
||||
// Invoke timer callback
|
||||
uint8_t res;
|
||||
uint_fast8_t res;
|
||||
if (CONFIG_INLINE_STEPPER_HACK && likely(!t->func))
|
||||
res = stepper_event(t);
|
||||
else
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Timer structure for scheduling timed events (see sched_timer() )
|
||||
struct timer {
|
||||
struct timer *next;
|
||||
uint8_t (*func)(struct timer*);
|
||||
uint_fast8_t (*func)(struct timer*);
|
||||
uint32_t waketime;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ enum { MF_DIR=1 };
|
|||
enum { SF_LAST_DIR=1, SF_NEXT_DIR=2, SF_INVERT_STEP=4, SF_HAVE_ADD=8 };
|
||||
|
||||
// Setup a stepper for the next move in its queue
|
||||
static uint8_t
|
||||
static uint_fast8_t
|
||||
stepper_load_next(struct stepper *s)
|
||||
{
|
||||
struct move *m = s->first;
|
||||
|
@ -64,7 +64,7 @@ stepper_load_next(struct stepper *s)
|
|||
}
|
||||
|
||||
// Timer callback - step the given stepper.
|
||||
uint8_t
|
||||
uint_fast8_t
|
||||
stepper_event(struct timer *t)
|
||||
{
|
||||
struct stepper *s = container_of(t, struct stepper, time);
|
||||
|
@ -78,7 +78,7 @@ stepper_event(struct timer *t)
|
|||
s->interval += s->add;
|
||||
return SF_RESCHEDULE;
|
||||
}
|
||||
uint8_t ret = stepper_load_next(s);
|
||||
uint_fast8_t ret = stepper_load_next(s);
|
||||
gpio_out_toggle(s->step_pin);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
enum { STEPPER_POSITION_BIAS=0x40000000 };
|
||||
|
||||
uint8_t stepper_event(struct timer *t);
|
||||
uint_fast8_t stepper_event(struct timer *t);
|
||||
void command_config_stepper(uint32_t *args);
|
||||
struct stepper;
|
||||
uint32_t stepper_get_position(struct stepper *s);
|
||||
|
|
Loading…
Reference in New Issue