My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros | Typedefs | Enumerations | Functions | Variables
global.h File Reference
#include <sw_list.h>
#include <sw_board.h>
#include <cpu_data.h>
#include <sw_types.h>
#include <sw_timer.h>

Go to the source code of this file.

Classes

struct  sw_global
 Global variables structure. More...
 
struct  acl_device
 
struct  acl_group
 
struct  acl_user
 

Macros

#define TASK_ID_START   0x111
 

Typedefs

typedef void( irq_handler )(int interrupt, void *data)
 Task IRQ handler. More...
 
typedef struct acl_device acl_device
 
typedef struct acl_group acl_group
 
typedef struct acl_user acl_user
 

Enumerations

enum  timer_mode {
  MODE_FREE_RUNNING, MODE_PERIODIC, MODE_ONESHOT, MODE_FREE_RUNNING,
  MODE_PERIODIC, MODE_ONESHOT
}
 

Functions

void global_init (void)
 Global initialization. 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 update_current_task (struct sw_task *)
 Update the current task ID. More...
 
int get_current_task_id (void)
 Returnd the ID of the current task. 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 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...
 
void scheduler (void *regs)
 Scheduler function. More...
 
void enable_timer (void)
 Enable secure kernel timer. More...
 
void disable_timer (void)
 Disable secure kernel timer. More...
 
void timer_init (void)
 Init secure kernel timer. More...
 
void schedule (void)
 Invoke scheduler. More...
 
void clockcycles_to_timeval (pa_t clockcycles, timeval_t *timeval)
 This function converts the clockcycles to time in seconds and nanoseconds This function definition depends on clock used. More...
 
void timeval_to_clockcycles (timeval_t *time, pa_t *ret_clockcycles)
 It converts the time (seconds and nanoseconds) to the number of clockcycles. More...
 
void read_freerunning_cntr (pa_t *val)
 It reads and returns the value of the timer which is used as the free running counter. More...
 
void trigger_tick (u64 usecs)
 This function writes the number of clockcycles to be expired before the next tick to the tick timer and enables the tick timer. More...
 
u64 get_timer_period (void)
 This function returns the maximum time that can be kept track of before it gets expired. (Eg : The time taken for running from 0xFFFFFFFF to 0x00000000) More...
 
u64 get_clock_period (void)
 This function returns the resolution which can be obtained with the given clock. More...
 
u32 read_timer_value (u32 timer_base)
 
s32 get_clock_period_ns (void)
 
void secure_timer_irq_handler (int irq)
 
void sw_timer_init (u32 timer_base)
 
void sw_timer_disable (u32 timer_base, u32 timer_index)
 
void sw_set_timer (u32 timer_base, u32 tim_mod_index, u32 mode, ulong clockcycles)
 
void sw_timer_enable (u32 timer_base, u32 timer_index)
 

Variables

struct sw_global global_val
 Global variable structure. More...
 

Macro Definition Documentation

#define TASK_ID_START   0x111

Typedef Documentation

typedef struct acl_device acl_device
typedef struct acl_group acl_group
typedef struct acl_user acl_user
typedef void( irq_handler)(int interrupt, void *data)

Task IRQ handler.

Parameters
interruptInterrupt number
dataIRQ handler parameter

Enumeration Type Documentation

enum timer_mode
Enumerator
MODE_FREE_RUNNING 
MODE_PERIODIC 
MODE_ONESHOT 
MODE_FREE_RUNNING 
MODE_PERIODIC 
MODE_ONESHOT 

Function Documentation

void clockcycles_to_timeval ( pa_t  clockcycles,
timeval_t ret_timeval 
)

This function converts the clockcycles to time in seconds and nanoseconds This function definition depends on clock used.

Parameters
clockcyclesNumber of clockcycles
Returns
The converted time in seconds and nanoseconds
Parameters
clockcycles
Returns
void disable_timer ( void  )

Disable secure kernel timer.

This function disables the secure kernel timer

void enable_timer ( void  )

Enable secure kernel timer.

This function enables the secure kernel timer

u64 get_clock_period ( void  )

This function returns the resolution which can be obtained with the given clock.

Returns
s32 get_clock_period_ns ( void  )
Returns
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  )

Returnd the ID of the current task.

Returns
Returns the current task ID

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
u64 get_timer_period ( void  )

This function returns the maximum time that can be kept track of before it gets expired. (Eg : The time taken for running from 0xFFFFFFFF to 0x00000000)

Returns
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 read_freerunning_cntr ( pa_t *  val)

It reads and returns the value of the timer which is used as the free running counter.

Returns
u32 read_timer_value ( u32  timer_base)
Parameters
timer_base
Returns
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
interrupt: Interrupt ID
handlerFunction pointer to IRQ handler
dataIRQ handler data

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 ( void  )

Invoke scheduler.

This function invokes the scheduler to schedule the next ready task

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.

This function implements the functionality of scheduling the given task

Parameters
task_idID of the task
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 scheduler ( void *  regs)

Scheduler function.

This function implements the round-robin scheduler

void secure_timer_irq_handler ( int  irq)
Parameters
irq
data
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 sw_set_timer ( u32  timer_base,
u32  tim_mod_index,
u32  mode,
ulong  clockcycles 
)
Parameters
timer_base
tim_mod_index
mode
clockcycles
void sw_timer_disable ( u32  timer_base,
u32  timer_index 
)
Parameters
timer_base
timer_index
void sw_timer_enable ( u32  timer_base,
u32  timer_index 
)
Parameters
timer_base
timer_index
void sw_timer_init ( u32  timer_base)
Parameters
timer_base
void timer_init ( void  )

Init secure kernel timer.

This function initialize the secure kernel timer

void timeval_to_clockcycles ( timeval_t time,
pa_t *  ret_clockcycles 
)

It converts the time (seconds and nanoseconds) to the number of clockcycles.

Parameters
time
Returns
void trigger_tick ( u64  usecs)

This function writes the number of clockcycles to be expired before the next tick to the tick timer and enables the tick timer.

Parameters
usecs
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.