Workaround SDCC bug.
SDCC would fail to initialize the first element of the process list.
Swap some conditions so the compiler can figure it out. Sigh.
diff --git a/contiki/ek/ek.c b/contiki/ek/ek.c
index c570dc6..d9d313e 100644
--- a/contiki/ek/ek.c
+++ b/contiki/ek/ek.c
@@ -182,19 +182,19 @@
procs_add(struct ek_proc *p)
{
static struct ek_proc *q, *r;
-
+
/* The process should be placed on the process list according to the
process' priority. The higher the priority, the earlier on the
list. */
r = NULL;
for(q = ek_procs; q != NULL; q = q->next) {
- if(p->prio >= q->prio) {
- p->next = q;
- if(r == NULL) {
- ek_procs = p;
+ if(q->prio < p->prio) {
+ if(r) {
+ r->next = p;
} else {
- r->next = p;
+ ek_procs = p;
}
+ p->next = q;
return;
}
r = q;
@@ -209,6 +209,7 @@
p->next = NULL;
}
}
+
}
/*-----------------------------------------------------------------------------------*/
@@ -273,7 +274,7 @@
/* Post an asynchronous event to the process. */
ek_post(id, EK_EVENT_INIT, p);
-
+
return id;
}
/*-----------------------------------------------------------------------------------*/
@@ -455,7 +456,6 @@
/* Call poll handlers. */
for(p = ek_procs; p != NULL; p = p->next) {
-
if(ek_poll_request) {
ek_poll_request = 0;
p = ek_procs;