Realtime multitask monitor for mruby/c. More...
Go to the source code of this file.
Macros | |
| #define | MRBC_SCHEDULER_EXIT 0 |
| #define | MRBC_MUTEX_TRACE(...) |
| #define | DEPRECATED(msg) |
| #define | NUM_TCB_QUEUE 4 |
| #define | q_dormant_ (tcb_queue_[0]) |
| #define | q_ready_ (tcb_queue_[1]) |
| #define | q_waiting_ (tcb_queue_[2]) |
| #define | q_suspended_ (tcb_queue_[3]) |
Variables | |
| static mrbc_tcb * | tcb_queue_ [NUM_TCB_QUEUE] |
| static volatile uint32_t | tick_ |
| static volatile uint32_t | wakeup_tick_ = ((uint32_t)1 << 16) |
Realtime multitask monitor for mruby/c.
Copyright (C) 2015- Kyushu Institute of Technology. Copyright (C) 2015-2026 Shimane IT Open-Innovation Center. Copyright (C) 2026- Shimane Institute for Industrial Technology. This file is distributed under BSD 3-Clause License.
Definition in file rrt0.c.
| #define DEPRECATED | ( | msg | ) |
| #define q_dormant_ (tcb_queue_[0]) |
| #define q_ready_ (tcb_queue_[1]) |
| #define q_suspended_ (tcb_queue_[3]) |
| #define q_waiting_ (tcb_queue_[2]) |
|
static |
|
static |
Get the timed wakeup tick of a waiting task, if it has one.
A SLEEP task always has a deadline; a QUEUE task has one only when popped with a timeout (queue.wakeup_tick != MRBC_WAIT_FOREVER). Other wait reasons have no timed wakeup.
| t | task control block. |
| out | receives the wakeup tick when the function returns non-zero. |
Definition at line 191 of file rrt0.c.
| void mrbc_change_priority | ( | mrbc_tcb * | tcb, |
| int | priority ) |
| void mrbc_cleanup | ( | void | ) |
| uint32_t mrbc_deadline_after_ms | ( | mrbc_int_t | ms, |
| int * | p_overflow ) |
Convert a millisecond timeout into an absolute wakeup tick (deadline).
| ms | timeout in milliseconds (must be >= 0). |
| p_overflow | set to non-zero when the deadline is too far ahead to be expressed in the 31-bit signed tick window. |
| int mrbc_deadline_reached | ( | uint32_t | deadline | ) |
Test whether an absolute deadline tick has been reached.
| deadline | absolute deadline tick from mrbc_deadline_after_ms(). |
| int mrbc_delete_task | ( | mrbc_tcb * | tcb | ) |
| mrbc_tcb * mrbc_find_task | ( | const char * | name | ) |
| void mrbc_init | ( | void * | heap_ptr, |
| unsigned int | size ) |
| mrbc_mutex * mrbc_mutex_init | ( | mrbc_mutex * | mutex | ) |
mutex initialize
| mutex | pointer to mrbc_mutex or NULL. |
Definition at line 814 of file rrt0.c.
| int mrbc_mutex_lock | ( | mrbc_mutex * | mutex, |
| mrbc_tcb * | tcb ) |
| int mrbc_mutex_trylock | ( | mrbc_mutex * | mutex, |
| mrbc_tcb * | tcb ) |
| int mrbc_mutex_unlock | ( | mrbc_mutex * | mutex, |
| mrbc_tcb * | tcb ) |
| void mrbc_register_wakeup | ( | uint32_t | wakeup_tick | ) |
| void mrbc_relinquish | ( | mrbc_tcb * | tcb | ) |
| void mrbc_resume_task | ( | mrbc_tcb * | tcb | ) |
| int mrbc_run | ( | void | ) |
| void mrbc_set_task_name | ( | mrbc_tcb * | tcb, |
| const char * | name ) |
| void mrbc_sleep_ms | ( | mrbc_tcb * | tcb, |
| uint32_t | ms ) |
| int mrbc_start_task | ( | mrbc_tcb * | tcb | ) |
| void mrbc_suspend_task | ( | mrbc_tcb * | tcb | ) |
| void mrbc_task_q_delete | ( | mrbc_tcb * | p_tcb | ) |
| void mrbc_task_q_insert | ( | mrbc_tcb * | p_tcb | ) |
Insert task(TCB) to task queue
| p_tcb | Pointer to target TCB |
Put the task (TCB) into a queue by each state. TCB must be free. (must not be in another queue) The queue is sorted in priority_preemption order. If the same priority_preemption value is in the TCB and queue, it will be inserted at the end of the same value in queue.
Definition at line 94 of file rrt0.c.
| mrbc_tcb * mrbc_task_q_waiting_head | ( | void | ) |
get the head of the WAITING task queue.
Provided so that out-of-file features (e.g. Task::Queue) can scan the tasks that are currently in the WAITING state.
Definition at line 163 of file rrt0.c.
| mrbc_tcb * mrbc_tcb_new | ( | int | regs_size, |
| enum MrbcTaskState | task_state, | ||
| int | priority ) |
create (allocate) TCB.
| regs_size | num of allocated registers. |
| task_state | task initial state. |
| priority | task priority. |
Code example
Definition at line 273 of file rrt0.c.
| void mrbc_terminate_task | ( | mrbc_tcb * | tcb | ) |
| void mrbc_tick | ( | void | ) |
| void mrbc_wakeup_task | ( | mrbc_tcb * | tcb | ) |
|
inlinestatic |
|
static |
|
static |
|
static |