ISIX-RTOS - small operating system for ARM microcontrollers 1.2
|
#include <isix/config.h>
#include <isix/printk.h>
#include <isix/types.h>
#include <prv/scheduler.h>
#include <isix/task.h>
#include <isix/memory.h>
#include <prv/list.h>
#include <prv/semaphore.h>
#include <prv/irqtimers.h>
#include <prv/multiple_objects.h>
Go to the source code of this file.
Defines | |
#define | ISIX_DEBUG_SCHEDULER ISIX_DBG_OFF |
#define | isix_printk(...) |
Functions | |
void | isix_bug (void) |
Halt system when critical error is found. | |
void | isixp_enter_critical (void) |
void | isixp_exit_critical (void) |
void | isixp_schedule (void) |
void | isixp_schedule_time (void) |
static task_ready_t * | alloc_task_ready_t (void) |
static void | free_task_ready_t (task_ready_t *prio) |
int | isixp_add_task_to_ready_list (task_t *task) |
void | isixp_delete_task_from_ready_list (task_t *task) |
void | isixp_add_task_to_waiting_list (task_t *task, tick_t timeout) |
void | isixp_add_task_to_sem_list (list_entry_t *sem_list, task_t *task) |
void | isixp_add_task_to_delete_list (task_t *task) |
static void | cleanup_tasks (void) |
ISIX_TASK_FUNC (idle_task, p) | |
tick_t | isix_get_jiffies (void) |
void | isix_init (prio_t num_priorities) |
void | isix_start_scheduler (void) |
Start the scheduler. | |
prio_t | isix_get_min_priority (void) |
bool | isix_is_scheduler_active (void) |
Variables | |
volatile bool | isix_scheduler_running |
task_t *volatile | isix_current_task = NULL |
static volatile unsigned short | critical_count = 0 |
static list_entry_t | ready_task |
static list_entry_t | wait_tasks [2] |
static list_entry_t * | p_waiting_task |
static list_entry_t * | pov_waiting_task |
static list_entry_t | dead_task |
static list_entry_t | free_prio_elem |
static volatile tick_t | jiffies |
static volatile unsigned | number_of_task_deleted |
static volatile prio_t | number_of_priorities |
#define ISIX_DEBUG_SCHEDULER ISIX_DBG_OFF |
Definition at line 13 of file scheduler.c.
#define isix_printk | ( | ... | ) |
Definition at line 90 of file scheduler.c.
Referenced by alloc_task_ready_t(), cleanup_tasks(), free_task_ready_t(), isix_bug(), isixp_add_task_to_ready_list(), isixp_add_task_to_sem_list(), isixp_add_task_to_waiting_list(), isixp_delete_task_from_ready_list(), isixp_schedule(), and isixp_schedule_time().
static task_ready_t* alloc_task_ready_t | ( | void | ) | [static] |
Definition at line 205 of file scheduler.c.
References task_ready_struct::inode, isix_bug(), isix_printk, list_delete(), list_get_first, list_isempty, NULL, and task_ready_struct::prio.
Referenced by isixp_add_task_to_ready_list().
static void cleanup_tasks | ( | void | ) | [inline, static] |
Definition at line 363 of file scheduler.c.
References isix_free(), isix_printk, isixp_enter_critical(), isixp_exit_critical(), list_delete(), list_get_first, list_isempty, number_of_task_deleted, and port_cleanup_task().
Referenced by ISIX_TASK_FUNC().
static void free_task_ready_t | ( | task_ready_t * | prio | ) | [inline, static] |
Definition at line 225 of file scheduler.c.
References task_ready_struct::inode, isix_printk, and list_insert_end().
Referenced by isixp_delete_task_from_ready_list().
void isix_bug | ( | void | ) |
Halt system when critical error is found.
Definition at line 62 of file scheduler.c.
References isix_printk, isixp_enter_critical(), list_for_each_entry, and task_ready_struct::prio.
Referenced by alloc_task_ready_t(), isix_sem_wait(), isix_wait_for_multiple_objects(), isixp_schedule(), isixp_schedule_time(), and isixp_sem_signal().
tick_t isix_get_jiffies | ( | void | ) |
Get current sytem ticks
Definition at line 401 of file scheduler.c.
References jiffies.
Referenced by add_vtimer_to_list(), and isix_wait().
prio_t isix_get_min_priority | ( | void | ) |
Function return the minimal available priority
Definition at line 461 of file scheduler.c.
References number_of_priorities.
Referenced by isix_task_create(), isixp_task_change_prio(), and isixp_wakeup_multiple_waiting_tasks().
void isix_init | ( | prio_t | num_priorities | ) |
Definition at line 415 of file scheduler.c.
References isix_alloc(), isix_alloc_init(), isix::ISIX_PORT_SCHED_MIN_STACK_DEPTH, isix_task_create(), isixp_vtimer_init(), ixixp_multiple_objects_init(), list_init(), list_insert_end(), NULL, and number_of_priorities.
bool isix_is_scheduler_active | ( | void | ) |
Functtion return scheduling state
Definition at line 467 of file scheduler.c.
References isix_scheduler_running.
void isix_start_scheduler | ( | void | ) |
Start the scheduler.
Definition at line 449 of file scheduler.c.
References isix_scheduler_running, jiffies, and isix::port_start_first_task().
ISIX_TASK_FUNC | ( | idle_task | , |
p | |||
) |
Definition at line 384 of file scheduler.c.
References cleanup_tasks(), isix::isix_yield(), and isix::port_idle_cpu().
void isixp_add_task_to_delete_list | ( | task_t * | task | ) |
Definition at line 351 of file scheduler.c.
References isixp_enter_critical(), isixp_exit_critical(), list_insert_end(), and number_of_task_deleted.
int isixp_add_task_to_ready_list | ( | task_t * | task | ) |
Definition at line 233 of file scheduler.c.
References alloc_task_ready_t(), task_ready_struct::inode, isix::ISIX_ENOMEM, isix::ISIX_ENOPRIO, isix::ISIX_EOK, isix_printk, isixp_enter_critical(), isixp_exit_critical(), list_for_each_entry, list_init(), list_insert_before(), list_insert_end(), NULL, number_of_priorities, task_ready_struct::prio, and task_ready_struct::task_list.
void isixp_add_task_to_sem_list | ( | list_entry_t * | sem_list, |
task_t * | task | ||
) |
Definition at line 332 of file scheduler.c.
References isix_printk, isixp_enter_critical(), isixp_exit_critical(), list_for_each_entry, and list_insert_before().
void isixp_add_task_to_waiting_list | ( | task_t * | task, |
tick_t | timeout | ||
) |
Definition at line 299 of file scheduler.c.
References isix_printk, isixp_enter_critical(), isixp_exit_critical(), jiffies, list_for_each_entry, and list_insert_before().
void isixp_delete_task_from_ready_list | ( | task_t * | task | ) |
Definition at line 280 of file scheduler.c.
References free_task_ready_t(), isix_printk, isixp_enter_critical(), isixp_exit_critical(), list_delete(), and list_isempty.
void isixp_enter_critical | ( | void | ) |
Definition at line 96 of file scheduler.c.
References critical_count, and isix::port_set_interrupt_mask().
Referenced by add_vtimer_to_list(), cleanup_tasks(), isix_bug(), isix_fifo_destroy(), isix_fifo_read(), isix_fifo_read_isr(), isix_fifo_write(), isix_fifo_write_isr(), isix_sem_destroy(), isix_sem_get_isr(), isix_sem_getval(), isix_sem_setval(), isix_sem_wait(), isix_systime_handler(), isix_task_create(), isix_task_delete(), isix_vtimer_destroy(), isix_vtimer_start(), isix_wait_for_multiple_objects(), isixp_add_task_to_delete_list(), isixp_add_task_to_ready_list(), isixp_add_task_to_sem_list(), isixp_add_task_to_waiting_list(), isixp_delete_from_multiple_wait_list(), isixp_delete_task_from_ready_list(), isixp_schedule(), isixp_sem_signal(), isixp_task_change_prio(), and isixp_wakeup_multiple_waiting_tasks().
void isixp_exit_critical | ( | void | ) |
Definition at line 107 of file scheduler.c.
References critical_count, and isix::port_clear_interrupt_mask().
Referenced by add_vtimer_to_list(), cleanup_tasks(), isix_fifo_destroy(), isix_fifo_read(), isix_fifo_read_isr(), isix_fifo_write(), isix_fifo_write_isr(), isix_sem_destroy(), isix_sem_get_isr(), isix_sem_getval(), isix_sem_setval(), isix_sem_wait(), isix_systime_handler(), isix_task_create(), isix_task_delete(), isix_vtimer_destroy(), isix_vtimer_start(), isix_wait_for_multiple_objects(), isixp_add_task_to_delete_list(), isixp_add_task_to_ready_list(), isixp_add_task_to_sem_list(), isixp_add_task_to_waiting_list(), isixp_delete_from_multiple_wait_list(), isixp_delete_task_from_ready_list(), isixp_schedule(), isixp_sem_signal(), isixp_task_change_prio(), and isixp_wakeup_multiple_waiting_tasks().
void isixp_schedule | ( | void | ) |
Definition at line 118 of file scheduler.c.
References task_struct::inode, isix_bug(), isix_current_task, isix_printk, isixp_enter_critical(), isixp_exit_critical(), list_delete(), list_get_first, list_insert_end(), task_struct::prio, task_ready_struct::prio, task_struct::prio_elem, task_struct::state, task_ready_struct::task_list, TASK_READY, and TASK_RUNNING.
Referenced by pend_svc_isr_vector(), port_start_first_task(), and port_yield().
void isixp_schedule_time | ( | void | ) |
Definition at line 149 of file scheduler.c.
References isix_bug(), isix_printk, isix_scheduler_running, isixp_add_task_to_ready_list(), isixp_vtimer_handle_time(), jiffies, list_delete(), list_get_first, list_isempty, NULL, p_waiting_task, pov_waiting_task, TASK_MULTIPLE_WKUP, TASK_READY, TASK_SEM_WKUP, TASK_SLEEPING, TASK_WAITING, and TASK_WAITING_MULTIPLE.
Referenced by isix_systime_handler().
volatile unsigned short critical_count = 0 [static] |
Definition at line 27 of file scheduler.c.
Referenced by isixp_enter_critical(), and isixp_exit_critical().
list_entry_t dead_task [static] |
Definition at line 43 of file scheduler.c.
list_entry_t free_prio_elem [static] |
Definition at line 47 of file scheduler.c.
task_t* volatile isix_current_task = NULL |
Definition at line 23 of file scheduler.c.
Referenced by isix_sem_wait(), isix_task_create(), isix_task_delete(), isix_task_self(), isix_wait_for_multiple_objects(), isixp_schedule(), isixp_sem_signal(), isixp_task_change_prio(), port_start_first_task(), port_yield(), and timer_interrupt().
volatile bool isix_scheduler_running |
Definition at line 19 of file scheduler.c.
Referenced by isix_is_scheduler_active(), isix_start_scheduler(), isix_systime_handler(), isix_task_create(), isix_wait(), isixp_schedule_time(), mem_lock(), mem_unlock(), and timer_interrupt().
volatile tick_t jiffies [static] |
Definition at line 51 of file scheduler.c.
Referenced by isix_get_jiffies(), isix_start_scheduler(), isixp_add_task_to_waiting_list(), and isixp_schedule_time().
volatile prio_t number_of_priorities [static] |
Definition at line 58 of file scheduler.c.
Referenced by isix_get_min_priority(), isix_init(), and isixp_add_task_to_ready_list().
volatile unsigned number_of_task_deleted [static] |
Definition at line 54 of file scheduler.c.
Referenced by cleanup_tasks(), and isixp_add_task_to_delete_list().
list_entry_t* p_waiting_task [static] |
Definition at line 38 of file scheduler.c.
Referenced by isixp_schedule_time().
list_entry_t* pov_waiting_task [static] |
Definition at line 39 of file scheduler.c.
Referenced by isixp_schedule_time().
list_entry_t ready_task [static] |
Definition at line 31 of file scheduler.c.
list_entry_t wait_tasks[2] [static] |
Definition at line 35 of file scheduler.c.