aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-06-08 21:33:50 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-06-14 14:00:53 -0400
commitb0524947e5a86bdbdd58dab42de3363a627e6910 (patch)
tree1187da49413ab45f0133372ce2778e19a34097c4
parentfa85094cbb139c734150802b02e22913abcfccb3 (diff)
downloadkutter-b0524947e5a86bdbdd58dab42de3363a627e6910.tar.gz
kutter-b0524947e5a86bdbdd58dab42de3363a627e6910.tar.xz
kutter-b0524947e5a86bdbdd58dab42de3363a627e6910.zip
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>
-rw-r--r--src/basecmd.c2
-rw-r--r--src/endstop.c2
-rw-r--r--src/gpiocmds.c10
-rw-r--r--src/sched.c4
-rw-r--r--src/sched.h2
-rw-r--r--src/stepper.c6
-rw-r--r--src/stepper.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/src/basecmd.c b/src/basecmd.c
index ab31efc2..2c9562b6 100644
--- a/src/basecmd.c
+++ b/src/basecmd.c
@@ -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");
diff --git a/src/endstop.c b/src/endstop.c
index 6f155cda..c8aa58e6 100644
--- a/src/endstop.c
+++ b/src/endstop.c
@@ -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);
diff --git a/src/gpiocmds.c b/src/gpiocmds.c
index 864d6526..a86e12c9 100644
--- a/src/gpiocmds.c
+++ b/src/gpiocmds.c
@@ -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);
diff --git a/src/sched.c b/src/sched.c
index 99e37dd6..6b9ec16f 100644
--- a/src/sched.c
+++ b/src/sched.c
@@ -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
diff --git a/src/sched.h b/src/sched.h
index be73ce65..aabb17b0 100644
--- a/src/sched.h
+++ b/src/sched.h
@@ -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;
};
diff --git a/src/stepper.c b/src/stepper.c
index 0d4754f9..5b5203f1 100644
--- a/src/stepper.c
+++ b/src/stepper.c
@@ -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;
}
diff --git a/src/stepper.h b/src/stepper.h
index 9a81b56e..f4019ae5 100644
--- a/src/stepper.h
+++ b/src/stepper.h
@@ -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);