Skip to content

Commit d2dcce2

Browse files
committed
Add three marcos for ready queue bitmap operation
When a task is enqueued into or dequeued from the ready queue, the bitmap that indicates the ready queue state should be updated. These three marcos can be used in mo_task_dequeue() and mo_task_enqueue() APIs to improve readability and maintain consistency.
1 parent 69421e4 commit d2dcce2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/task.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ static kcb_t kernel_state = {
3131
};
3232
kcb_t *kcb = &kernel_state;
3333

34+
/* Bitmap operation */
35+
#define BITMAP_CHECK(prio) (kcb->ready_bitmap & 1U << prio)
36+
#define BITMAP_SET(prio) (kcb->ready_bitmap |= 1U << prio)
37+
#define BITMAP_CLEAN(prio) (kcb->ready_bitmap &= ~(1U << prio))
38+
3439
/* timer work management for reduced latency */
3540
static volatile uint32_t timer_work_pending = 0; /* timer work types */
3641
static volatile uint32_t timer_work_generation = 0; /* counter for coalescing */

0 commit comments

Comments
 (0)