My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions | Variables
global.c File Reference
#include <sw_types.h>
#include <sw_debug.h>
#include <sw_mem_functions.h>
#include <task.h>
#include <global.h>
#include <cpu_task.h>
#include <sw_buddy.h>
#include <sw_timer.h>
#include <mem_mng.h>
#include <unused.h>

Functions

void global_init (void)
 Global initialization. More...
 
void schedule_task (struct sw_task *task)
 Schedules the task. More...
 
void schedule_task_next (struct sw_task *task)
 This function adds the task to the ready to run list as the first element so that the next task scheduled will be this. More...
 
void schedule_task_id (int task_id)
 Schedules the task. More...
 
void suspend_task (int task_id, int state)
 Suspends the task. More...
 
void update_current_task (struct sw_task *task)
 Update the current task ID. More...
 
int get_current_task_id (void)
 Returns the id of the current running task. More...
 
struct sw_taskget_current_task (void)
 Get the current task. More...
 
struct sw_taskget_next_task (void)
 Get the next ready to run task. More...
 
void print_task_list (void)
 Prints the all task names. More...
 
void register_irq (u32 interrupt, irq_handler handler, void *data)
 Register IRQ handler for the specificed interrupt ID. More...
 
void invoke_irq_handler (u32 interrupt, struct swi_temp_regs *regs)
 Invoke the registered IRQ handler of specified interrupt number. More...
 

Variables

struct sw_global global_val
 Global variable structure. More...
 

Function Documentation

struct sw_task* get_current_task ( void  )

Get the current task.

This function returns the current task which is running

Returns
: Pointer to the task structure or NULL
int get_current_task_id ( void  )

Returns the id of the current running task.

Returnd the ID of the current task.

Returns
task id
struct sw_task* get_next_task ( void  )

Get the next ready to run task.

This function returns the next task which is ready to run

Returns
: Pointer to the task structure or NULL
void global_init ( void  )

Global initialization.

This function initializes the global variables structure

void invoke_irq_handler ( u32  interrupt,
struct swi_temp_regs regs 
)

Invoke the registered IRQ handler of specified interrupt number.

This function invokes the corresponding registered IRQ handler of the specified interrupt ID.

Parameters
interruptInterrupt ID
regsContext registers
void print_task_list ( void  )

Prints the all task names.

void register_irq ( u32  interrupt,
irq_handler  handler,
void *  data 
)

Register IRQ handler for the specificed interrupt ID.

This function register the IRQ handler for the specified interrupt ID. This could be a function from any task.

Parameters
interruptInterrupt ID
handlerFunction pointer to IRQ handler
dataIRQ handler data
void schedule_task ( struct sw_task task)

Schedules the task.

This function implements the functionality of scheduling the given task

Parameters
taskPointer to task structure
void schedule_task_id ( int  task_id)

Schedules the task.

Parameters
task_id
void schedule_task_next ( struct sw_task task)

This function adds the task to the ready to run list as the first element so that the next task scheduled will be this.

Parameters
taskPointer to the Next structure
void suspend_task ( int  task_id,
int  state 
)

Suspends the task.

This function suspend the given task

Parameters
task_idTask ID
stateState of the task
void update_current_task ( struct sw_task task)

Update the current task ID.

Parameters
taskPointer to the task structure

Variable Documentation

struct sw_global global_val

Global variable structure.