X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=task.h;h=d08a36307ce65f97b15d44c4e4801f97bc7ed3e1;hb=a3982b963fd174f5d267e88ad97388f1697f6f83;hp=f95d7159fa710ad879a7e330f76b840be8e82a6d;hpb=d7221e9aeb82c97fbbff18963ef69a300b3d0cd3;p=rgblamp.git diff --git a/task.h b/task.h index f95d715..d08a363 100644 --- a/task.h +++ b/task.h @@ -34,17 +34,17 @@ #include "task_defs.h" #include "bit.h" -typedef unsigned char task_id_t; +typedef signed char task_id_t; /* Do not use directly; only for the 'inline' functions below */ extern unsigned long _task_ids; extern task_id_t _task_bitno; -/* Post task t from ISR */ -#define _task_post(t) do { _task_ids |= 1UL << t; } while (0) +/* Post task t. No need for ndi() since bit_set is a single instruction. */ +#define task_post(t) (bit_set(_task_ids, t)) /* Initialize the task subsystem */ -#define task_init() do { _task_ids = 0; _task_bitno = 0; } while (0) +#define task_init() (_task_ids = 0) /* Returns non-zero if one or more tasks are posted. Does not block. */ bit task_check(); @@ -57,7 +57,4 @@ bit task_check(); */ task_id_t task_get(unsigned char block); -/* Post task t from user code */ -void task_post(task_id_t t); - #endif