My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
sw_wait.c File Reference
#include <task.h>
#include <sw_wait.h>
#include <sw_debug.h>
#include <sw_timer.h>
#include <global.h>

Functions

void sw_add_to_waitqueue (struct wait_queue_head *wq_head, struct wait_queue *wq)
 This function is called to add the wait queue element to the wait queue head. More...
 
void sw_remove_from_waitqueue (struct wait_queue_head *wq_head, struct wait_queue *wq)
 This function is called to remove the wait queue element from the wait queue head. More...
 
void sw_init_waitqueue_entry (struct wait_queue *wq)
 Initializes the wait queue element. More...
 
void sw_init_waitqueue_entry_func (struct wait_queue *wq, wait_queue_function func)
 Initializes the wait queue element. More...
 
void sw_set_task_state (int state)
 This function sets the state of the TASK. More...
 
void sw_prepare_for_wait (struct wait_queue_head *wq_head, struct wait_queue *wq, u32 state)
 This function sets the state of the TASK to the given state and adds the element to the waitqueue. More...
 
void sw_complete_wait (struct wait_queue_head *wq_head, struct wait_queue *wq)
 This function is called when the task is woken up and this function removes the waitqueue element from the waitqueue. More...
 
void sw_wakeup_all (struct wait_queue_head *wq_head, u32 wakeup_flag)
 This function wakes up all the elements attached to the given waitqueue head. More...
 
void sw_wakeup (struct wait_queue_head *wq_head, u32 wakeup_flag)
 This function wakes up an element from the given waitqueue. More...
 
void sw_default_wake_function (struct wait_queue *wq, u32 wakeup_flag)
 This function wakes up a task by changing the state of the task and adding it to the ready to run list. More...
 

Function Documentation

void sw_add_to_waitqueue ( struct wait_queue_head wq_head,
struct wait_queue wq 
)

This function is called to add the wait queue element to the wait queue head.

Parameters
wq_headWait queue list head to which the element need to be added
wqThe waitqueue element
void sw_complete_wait ( struct wait_queue_head wq_head,
struct wait_queue wq 
)

This function is called when the task is woken up and this function removes the waitqueue element from the waitqueue.

Parameters
wq_headThe waitqueue head to which this element is attached
wqThe wait queue element
void sw_default_wake_function ( struct wait_queue wq,
u32  wakeup_flag 
)

This function wakes up a task by changing the state of the task and adding it to the ready to run list.

Parameters
wqThe waitqueue element which need to be waken up
wakeup_flagIt says whether the element need to be woken up immediately or can be woken up later
void sw_init_waitqueue_entry ( struct wait_queue wq)

Initializes the wait queue element.

Parameters
wqThe wait queue element
void sw_init_waitqueue_entry_func ( struct wait_queue wq,
wait_queue_function  func 
)

Initializes the wait queue element.

Parameters
wqThe wait queue element
funcThe function to be called while waking up the element fom waitqueue
void sw_prepare_for_wait ( struct wait_queue_head wq_head,
struct wait_queue wq,
u32  state 
)

This function sets the state of the TASK to the given state and adds the element to the waitqueue.

Parameters
wq_headThe list head to which the element need to be added
wqThe waitqueue element
stateThe state to which the current TASK need to be set
void sw_remove_from_waitqueue ( struct wait_queue_head wq_head,
struct wait_queue wq 
)

This function is called to remove the wait queue element from the wait queue head.

Parameters
wq_headWait queue list head from which the element needs to be deleted
wqThe waitqueue element
void sw_set_task_state ( int  state)

This function sets the state of the TASK.

Parameters
stateThe state to which the current task need to be moved
void sw_wakeup ( struct wait_queue_head wq_head,
u32  wakeup_flag 
)

This function wakes up an element from the given waitqueue.

Parameters
wq_headThe waitqueue head from which all the elements need to be woken up
wakeup_flagIt says whether the element need to be woken up immediately or can be woken up later
void sw_wakeup_all ( struct wait_queue_head wq_head,
u32  wakeup_flag 
)

This function wakes up all the elements attached to the given waitqueue head.

Parameters
wq_headThe waitqueue head from which all the elements need to be woken up
wakeup_flagIt says whether the element need to be woken up immediately or can be woken up later