GeMRTOS
Related Functions
Task Class Reference

Related Functions

(Note that these are not member functions.)

Friends And Related Function Documentation

◆ gk_CODE_IDLE_TASK()

void gk_CODE_IDLE_TASK ( void*  pdata)
related

IDLE task. This code is executed when no task is ready. The processor is halted.

gk_CODE_IDLE_TASK

Parameters
[in]pdataPointer to data

Task can be changed. The processors run this task with different stacks

Definition at line 880 of file grtos_kernel.c.

◆ gk_CreateTask()

GS_TCB* gk_CreateTask ( void *  TaskCode,
void *  p_arg,
void *  StkBotton,
unsigned int  StkSize,
unsigned int  TCBType,
INT64  TCBReadyPriority,
INT64  TCBRunPriority,
INT64  TCBDeadline,
INT64  TCBPeriod,
GS_LCB TCB_RDY_LCB_Index,
int  TCB_Abort_w_Deadline,
INT64  TCBInherPriority,
int  TCB_INTNumber 
)
related

Kernel Function: creates a new task initializing TCB features.

gk_CreateTask

Parameters
[in]TaskCodePointer to the beginning of the task code
[in]p_argPointer to the argument of the first call
[in]StkBottonBotton of the Stack of the Task
[in]StkSizeSize of the stack in words
[in]TCBTypeType of the Task
[in]TCBReadyPriorityInitial Priority of the task
[in]TCBRunPriorityPriority of the task when it is executing
[in]TCBDeadlineDeadline of the task
[in]TCBPeriodPeriod of the task
[in]TCB_RDY_LCB_IndexReady list that should be inserted
[in]TCB_Abort_w_DeadlineTrue when task is aborted when deadline
[in]TCBInherPriorityInhereted priority
[in]TCB_INTNumberInterrupt Number if task is ISR
Returns
Pointer to the TCB
Todo:
TCBInherPriority has no sense

< Botton of the Stack of the Task

< Top of the Stack of the task

< Pointer to tha begining of the task code

< Pointer to the argument of the first call

< Type of the Task

< Initial Priority of the task

< Priority of the task when it is executing

< Deadline of the task

< Period of the task

< number of the ready list that should be inserted

< True when task is aborted when deadline, false otherwise

Definition at line 334 of file gemrtos_core.c.

◆ gk_PCB_GetCurrentTCB()

GS_TCB* gk_PCB_GetCurrentTCB ( void  )
related

Returns the task that the current processor was executing.

Returns
pointer to TCB of task executed by processor gk_PCB_GetCurrentTCB
Pointer to the TCB of the task being executed by the current processor
See also
Processor

Definition at line 2262 of file listfunctions.c.

◆ gk_TASK_GRANTED_PRIORITY_GET()

INT64 gk_TASK_GRANTED_PRIORITY_GET ( GS_TCB ptcb)
related

Determine the priority of a taks according to the resources granted.

gk_TASK_GRANTED_PRIORITY_GET

Parameters
[in]ptcbPointer to the TCB of the task
Returns
Priority determined
Todo:
Check according the type of reource

Definition at line 2912 of file listfunctions.c.

◆ gk_TASK_INHERENCE_PRIORITY_SET()

INT32 gk_TASK_INHERENCE_PRIORITY_SET ( GS_TCB ptcb)
related

Sets the inherence priority of TCB according the priority of granted resources.

gk_TASK_INHERENCE_PRIORITY_SET

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Verify kind of resource

Definition at line 2435 of file listfunctions.c.

◆ gk_TASK_Kill()

INT32 gk_TASK_Kill ( GS_TCB ptcb)
related

Destroys a task and return the data structure to the TCB free list.

Parameters
[in]ptcbPointer to the TCB of the task to destroy
Returns
G_TRUE if successful, G_FALSE otherwise

Unlinks all the linked lists and link to the Free TCB list

Todo:
Implement G_FALSE return

Definition at line 2855 of file listfunctions.c.

◆ gk_TASK_PRIORITY_SET()

INT32 gk_TASK_PRIORITY_SET ( GS_TCB ptcb,
INT32  task_state 
)
related

Computes the current priority of the task.

gk_TASK_PRIORITY_SET

Parameters
[in]ptcbPointer to the TCB
[in]task_stateState of the task (G_TCBState_READY, G_TCBState_RUNNING)
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Check if state is valid

Definition at line 2474 of file listfunctions.c.

◆ gk_TASK_RELEASE()

INT32 gk_TASK_RELEASE ( GS_TCB ptcb)
related

Release a new invocation of the task. Preserves the Associated signal list. If task is not completed, then the Abort signal is triggered.

gk_TASK_RELEASE

Parameters
[in]ptcbPointer to the TCB of the task to release
Returns
G_TRUE if successful
Todo:
Check Ready and Running state to trigger the abort signal

Definition at line 897 of file listfunctions.c.

◆ gk_TASK_STK_Init()

INT32 gk_TASK_STK_Init ( GS_TCB ptcb)
related

Initializes the Task Stack acording to the TCB parameters.

gk_TASK_STK_Init

Parameters
[in]ptcbPointer to the TCB of the task to initilise
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Implement validity checks

Definition at line 2805 of file listfunctions.c.

◆ gk_TCB_in_RCBGEL()

GS_ECB* gk_TCB_in_RCBGEL ( G_RCB presource,
GS_TCB ptcb 
)
related

Returns the event of the TCB that grants the resource.

gk_TCB_in_RCBGEL

Parameters
[in]presourcePointer to RCB
[in]ptcbPointer to TCB
Returns
Pointer to the ECB granted the resource or NULL if not granted
See also
Resource

Definition at line 2081 of file listfunctions.c.

◆ gk_TCB_List_Unlink()

INT32 gk_TCB_List_Unlink ( GS_TCB ptcb)
related

Unlinks the TCB from events and signals and links them to the free lists respectively.

gk_TCB_List_Unlink

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE if successfull, G_FALSE otherwise
Todo:
Check unlink for different resources (semaphore and messages) when they are granted

Definition at line 1460 of file listfunctions.c.

◆ gk_TCB_Unlink()

INT32 gk_TCB_Unlink ( GS_TCB ptcb)
related

Unlinks the TCB according to the list it is linked.

gk_TCB_Unlink

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Implement the G_FALSE when no linked

Definition at line 2550 of file listfunctions.c.

◆ gk_TCBAEL_Link()

INT32 gk_TCBAEL_Link ( GS_ECB pevent,
GS_TCB ptcb 
)
related

Links an ECB to the associated ECB list of TCB.

gk_TCBAEL_Link

Parameters
[in]peventPointer to the ECB
[in]ptcbPonter to the TCB
Returns
G_TRUE when sucessful, G_FALSE otherwise
Todo:
Check validity of XCB
See also
Event

Definition at line 1284 of file listfunctions.c.

◆ gk_TCBASL_GetSCB()

GS_SCB* gk_TCBASL_GetSCB ( GS_TCB ptcb,
INT32  SignalType 
)
related

Returns the pointer to the SCB associated to a task, NULL otherwise.

gk_TCBASL_GetSCB

Parameters
[in]ptcbPointer to the TCB
[in]SignalTypeSignal type to search in the associated signal list of the TCB
Returns
Returns the pointer to the SCB associated to a task, NULL otherwise
See also
Signal

Definition at line 2709 of file listfunctions.c.

◆ gk_TCBASL_Link()

INT32 gk_TCBASL_Link ( GS_TCB ptcb,
GS_SCB psignal 
)
related

Links SCB to TCB Associated Signal List.

gk_TCBASL_Link

Parameters
[in]ptcbPointer to the TCB
[in]psignalPointer to the SCB
Returns
G_TRUE if successful, G_FALSE otherwise
See also
Signal

Definition at line 1346 of file listfunctions.c.

◆ gk_TCBASL_Unlink()

INT32 gk_TCBASL_Unlink ( GS_TCB ptcb,
GS_SCB psignal 
)
related

Unlinks SCB from a TCB Associated Signal List.

gk_TCBASL_Unlink

Parameters
[in]ptcbPointer to the TCB of the task
[in]psignalPointer to the SCB of the signal
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Define the G_FALSE return when signal is not associated with the TCB
See also
Signal

Definition at line 1411 of file listfunctions.c.

◆ gk_TCBFL_Link()

INT32 gk_TCBFL_Link ( GS_TCB ptcb)
related

Links a TCB to the Free TCB List removing associated and pending SCBs and ECBs.

gk_TCBFL_Link

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE if successful, G_FALSE otherwise

TCBs linked list for debugging

freed the structure

Definition at line 1504 of file listfunctions.c.

◆ gk_TCBLowerPriorityThanTCB()

INT32 gk_TCBLowerPriorityThanTCB ( GS_TCB ptcb1,
GS_TCB ptcb2 
)
related

Return G_TRUE if current priority of ptct1 is greater than the current priority of ptcb2, otherwise returns G_FALSE.

gk_TCBLowerPriorityThanTCB

Parameters
[in]ptcb1Pointer to the TCB of task 1
[in]ptcb2Pointer to the TCB of task 2
Returns
G_TRUE if current priority of ptct1 is greater than the current priority of ptcb2, otherwise returns G_FALSE

Definition at line 2307 of file listfunctions.c.

◆ gk_TCBPSL_GetSCB()

GS_SCB* gk_TCBPSL_GetSCB ( GS_TCB ptcb,
INT32  SignalType 
)
related

Returns pointer to the SCB in te TCBPSL.

gk_TCBPSL_GetSCB

Parameters
[in]ptcbPointer to the TCB
[in]SignalTypeType of the signal to search in the TCB
Returns
Pointer to the SCB or NULL if no signal type associated with the task
See also
Signal

Definition at line 2615 of file listfunctions.c.

◆ gk_TCBPSL_Link()

INT32 gk_TCBPSL_Link ( GS_TCB ptcb,
GS_SCB psignal 
)
related

Link a SCB to TCB Pending Signal List.

gk_TCBPSL_Link

Parameters
[in]ptcbPointer to the TCB
[in]psignalPointer to the SCB
Returns
G_TRUE
See also
Signal

Definition at line 1543 of file listfunctions.c.

◆ gk_TCBPSL_Unlink()

INT32 gk_TCBPSL_Unlink ( GS_TCB ptcb,
GS_SCB psignal 
)
related

Unlinks SCB from TCB Pending Signal List.

gk_TCBPSL_Unlink

Parameters
[in]ptcbPointer to the TCB
[in]psignalPointer to the SCB
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Return G_FALSE when it is not associated SCB to TCB
See also
Signal

Definition at line 1606 of file listfunctions.c.

◆ gk_TCBRDYL_Link()

INT32 gk_TCBRDYL_Link ( GS_TCB ptcb)
related

Links the TCB in the Ready Task List sorted by its priority.

gk_TCBRDYL_Link

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Implement G_FALSE return

If there exist a free processor, then trigger its interrupt

Definition at line 1653 of file listfunctions.c.

◆ gk_TCBRDYL_Unlink()

INT32 gk_TCBRDYL_Unlink ( GS_TCB ptcb)
related

Unlinks the TCB from the Ready Task List.

gk_TCBRDYL_Unlink

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Implement G_FALSE return when error

Definition at line 1740 of file listfunctions.c.

◆ gk_TCBRUNL_Link()

INT32 gk_TCBRUNL_Link ( GS_TCB ptcb)
related

Links the TCB to the Run Task List.

gk_TCBRUNL_Link

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Implement G_FALSE return

Definition at line 1786 of file listfunctions.c.

◆ gk_TCBRUNL_Unlink()

INT32 gk_TCBRUNL_Unlink ( GS_TCB ptcb)
related

Unlinks TCB from Running List.

gk_TCBRUNL_Unlink

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Include G_FALSE when TCB is not in RUN list

Stop the processor executing running task triggering its interrupt

Definition at line 1915 of file listfunctions.c.

◆ gk_TCBWL_Link()

INT32 gk_TCBWL_Link ( GS_TCB ptcb,
unsigned int  state 
)
related

Links a TCB in the waiting list.

gk_TCBWL_Link

Parameters
[in]ptcbPointer to the TCB of the task
[in]stateType of the waiting state
Returns
G_TRUE if successful, G_FALSE otherwise
Todo:
Define the types of waiting states

Definition at line 1990 of file listfunctions.c.

◆ gk_TCBWL_Unlink()

INT32 gk_TCBWL_Unlink ( GS_TCB ptcb)
related

Unlinks the TCB from the waiting list.

gk_TCBWL_Unlink

Parameters
[in]ptcbPointer to the TCB
Returns
G_TRUE when successful, G_FALSE otherwise
Todo:
Implement G_FALSE return when is not waiting

Definition at line 2020 of file listfunctions.c.

◆ GRTOS_Task_GetPendingSCB()

void GRTOS_Task_GetPendingSCB ( void  )
related

Configures system to execute next pending signal. Call from switch routine.

GRTOS_Task_GetPendingSCB

Definition at line 835 of file grtos_kernel.c.

◆ gu_GetTask()

void* gu_GetTask ( void *  TaskCode,
void *  p_arg,
void *  StkBotton,
unsigned int  StkSize 
)
related

Return a pointer to a TCB for a new task.

gu_GetTask

Parameters
[in]TaskCodePointer to the beginning of the task code
[in]p_argPointer to the argument of the first call
[in]StkBottonBotton of the Stack of the Task
[in]StkSizeSize of the stack in words
Returns
Pointer to the TCB of the task created

Task is created but has to be activated with gu_StartTaskwithOffset

Definition at line 393 of file grtosuserfunctions.c.

◆ gu_SetTaskAbortwhenDeadline()

INT32 gu_SetTaskAbortwhenDeadline ( struct gs_tcb ptcb,
unsigned int  abort_when_deadline 
)
related

Set if task should be aborted when misses a deadline.

gu_SetTaskAbortwhenDeadline

Parameters
[in]ptcbPointer to the TCB of the task
[in]abort_when_deadlineG_TRUE when task should be aborted when deadline is missed, G_FALSE otherwise
Returns
G_TRUE if successfull, G_FALSE otherwise

Definition at line 372 of file grtosuserfunctions.c.

◆ gu_SetTaskDeadline()

INT32 gu_SetTaskDeadline ( struct gs_tcb ptcb,
unsigned int  hours,
unsigned int  minutes,
unsigned int  seconds,
unsigned int  ms 
)
related

Set the deadline of the task for the next invocation.

gu_SetTaskDeadline

Parameters
[in]ptcbPointer to the TCB of the task
[in]hoursHours of the deadline
[in]minutesMinutes of the deadline
[in]secondsSeconds of the deadline
[in]msmiliseconds for the deadline
Returns
G_TRUE

The current deadline remains. The new deadline is considered for the next invocation.

Todo:
Implement the change of the deadline in the currrent invocation. It should considered the difference with the current deadline

Definition at line 255 of file grtosuserfunctions.c.

◆ gu_SetTaskList()

INT32 gu_SetTaskList ( struct gs_tcb ptcb,
struct gs_lcb plcb 
)
related

Set the list of a task.

gu_SetTaskList

Parameters
[in]ptcbPointer to the TCB of the task
[in]plcbPointer to the CB of the list
Returns
G_TRUE if successfull, G_FALSE otherwise
Todo:

Check if index is valid

Unlinks from current list and link to the new link accordingly.

Definition at line 198 of file grtosuserfunctions.c.

◆ gu_SetTaskPeriod()

INT32 gu_SetTaskPeriod ( struct gs_tcb ptcb,
unsigned int  hours,
unsigned int  minutes,
unsigned int  seconds,
unsigned int  ms 
)
related

Set the task period for the next invocation.

gu_SetTaskPeriod

Parameters
[in]ptcbPointer to the TCB of the task
[in]hoursHours of the period
[in]minutesMinutes of the period
[in]secondsSeconds of the period
[in]msmiliseconds for the period
Returns
G_TRUE

The current period remains. The new period is considered for the next invocation

Todo:
Implement the change of the period in the currrent invocation. It should considered the difference with the current period

Definition at line 283 of file grtosuserfunctions.c.

◆ gu_SetTaskReadyPriority()

INT32 gu_SetTaskReadyPriority ( struct gs_tcb ptcb,
long long  priority 
)
related

Set the ready priority of a task.

gu_SetTaskReadyPriority

Parameters
[in]ptcbPointer to the TCB of the task
[in]priorityPriority to assing
Returns
G_TRUE
Todo:

Unlink and link if task is ready

Put priority as level and priority

Definition at line 216 of file grtosuserfunctions.c.

◆ gu_SetTaskRunPriority()

INT32 gu_SetTaskRunPriority ( struct gs_tcb ptcb,
long long  priority 
)
related

Set the run priority of a task.

gu_SetTaskRunPriority

Parameters
[in]ptcbPointer to the TCB of the task
[in]priorityPriority to assing
Returns
G_TRUE
Todo:

Unlink and link if task is running

Put priority as level and priority

Definition at line 234 of file grtosuserfunctions.c.

◆ gu_SetTaskType()

INT32 gu_SetTaskType ( struct gs_tcb ptcb,
unsigned int  type 
)
related

Set the type of a task.

gu_SetTaskType

Parameters
[in]ptcbPointer to the TCB of the task
[in]typeType of task to assign
Returns
G_TRUE if successfull, G_FALSE otherwise
Todo:
Validate type previous to assign

Definition at line 180 of file grtosuserfunctions.c.

◆ gu_StartTaskwithOffset()

INT32 gu_StartTaskwithOffset ( struct gs_tcb ptcb,
unsigned int  hours,
unsigned int  minutes,
unsigned int  seconds,
unsigned int  ms 
)
related

Activates the execution of a task. An offset can be configured.

gu_StartTaskwithOffset

Parameters
[in]ptcbPointer to the TCB of the task
[in]hoursHours of the offset
[in]minutesMinutes of the offset
[in]secondsSeconds of the offset
[in]msmiliseconds for the offset
Returns
G_TRUE
Todo:

Include start of a ISR

Include start of an IDLE task??

Definition at line 311 of file grtosuserfunctions.c.

◆ gu_TASK_IS_BLOCKED()

INT32 gu_TASK_IS_BLOCKED ( GS_TCB ptcb)
related

Return G_TRUE if task is waiting for a resource, G_FALSE otherwise.

gu_TASK_IS_BLOCKED

Parameters
[in]ptcbPointer to the TCB of the task
Returns
G_TRUE if task is waiting for a resource, G_FALSE otherwise
Todo:
Check correcteness for diferent resources (semaphore and message queue)

Definition at line 532 of file grtosuserfunctions.c.

◆ gu_TASK_Kill()

INT32 gu_TASK_Kill ( GS_TCB ptcb)
related

The task is eliminated and all the structures involved are return to the free lists.

gu_TASK_Kill

Parameters
[in]ptcbPointer to the TCB of the task to be killed
Returns
G_TRUE
Todo:
Check that all the structures are adequatelly treated

Definition at line 498 of file grtosuserfunctions.c.

◆ gu_TASK_RESUME()

INT32 gu_TASK_RESUME ( GS_TCB ptcb)
related

Resume a task that it is in waiting state.

gu_TASK_RESUME

Parameters
[in]ptcbPointer to the TCB of the task to be resumed
Returns
G_TRUE if task was resumed, G_FALSE otherwise
Todo:
Check that GRTOS is running

Definition at line 550 of file grtosuserfunctions.c.

◆ gu_TASK_Sleep()

INT32 gu_TASK_Sleep ( INT32  hours,
INT32  minutes,
INT32  seconds,
INT32  ms 
)
related

Sleeps the current task the interval specified.

gu_TASK_Sleep

Parameters
[in]hoursHours to sleep
[in]minutesMinutes to sleep
[in]secondsSeconds to sleep
[in]msmiliseconds to sleep
Returns
G_TRUE

Definition at line 430 of file grtosuserfunctions.c.

◆ gu_TASK_Sleep_Time()

INT32 gu_TASK_Sleep_Time ( gt_time  ticks)
related

Set event to sleep the current task for a certain number of clock ticks.

gu_TASK_Sleep_Time

Parameters
[in]ticksNumber of clock ticks to sleep the task
Returns
G_TRUE if successful, G_FALSE otherwise

It is executed in user mode and gu_TASK_Sleep should be used instead

Todo:
Check if it can be implemented only with gk_KERNEL_TASK_SUSPEND instead of gk_KERNEL_TASK_SUSPEND_CURRENT

Definition at line 457 of file grtosuserfunctions.c.

◆ gu_TASK_SUSPEND()

INT32 gu_TASK_SUSPEND ( GS_TCB ptcb)
related

Change to waiting the state of a task.

gu_TASK_SUSPEND

Parameters
[in]ptcbPointer to the TCB of the task to suspend
Returns
G_TRUE
Todo:
Check gk_KERNEL_TASK_SUSPEND with current task

Definition at line 515 of file grtosuserfunctions.c.

◆ OPTIMEZE_CODE()

OPTIMEZE_CODE ( )
related

Creates a TCB and returns its pointer Returns a pointer to a Free TCB, NULL if it is not a TCB available.

gk_TCB_GetFree

Returns
A pointer to the TCB or NULL if no TCB is available

INITIALIZE THE TCB STRUCTURE

TCBs linked list for debugging

Definition at line 32 of file gemrtos_core.c.


The documentation for this class was generated from the following files: