HeMPS  8.0
Functions | Variables
kernel_slave.c File Reference

Kernel slave is the system slave used to execute user's tasks. More...

#include "kernel_slave.h"
#include "../../../include/kernel_pkg.h"
#include "../../include/api.h"
#include "../../include/plasma.h"
#include "../../include/services.h"
#include "../../modules/task_location.h"
#include "../../modules/packet.h"
#include "../../modules/communication.h"
#include "../../modules/pending_service.h"
#include "../../modules/local_scheduler.h"
#include "../../modules/utils.h"
#include "../../modules/task_migration.h"
Include dependency graph for kernel_slave.c:

Functions

void send_task_terminated (TCB *terminated_task)
 
void send_task_allocated (TCB *allocated_task)
 
void send_message_delivery (int producer_task, int consumer_task, int consumer_PE, Message *msg_ptr)
 
void send_task_real_time_change (TCB *tcb_ptr)
 
void send_slack_time_report ()
 
void send_update_task_location (unsigned int target_proc, unsigned int task_id, unsigned int new_task_location)
 
void send_message_request (int producer_task, int consumer_task, unsigned int producer_PE, unsigned int sourcePE)
 
void write_local_msg_to_task (TCB *task_tcb_ptr, int msg_lenght, int *msg_data)
 
int Syscall (unsigned int service, unsigned int arg0, unsigned int arg1, unsigned int arg2)
 
int handle_packet (volatile ServiceHeader *p)
 
void Scheduler ()
 
void OS_InterruptServiceRoutine (unsigned int status)
 
unsigned int OS_InterruptMaskClear (unsigned int Mask)
 
unsigned int OS_InterruptMaskSet (unsigned int Mask)
 
void OS_Idle ()
 
int main ()
 

Variables

unsigned int net_address
 Store the current XY address.
 
unsigned int schedule_after_syscall
 Signals the syscall function (assembly implemented) to call the scheduler after the syscall.
 
unsigned int cluster_master_address
 Store the cluster master XY address.
 
unsigned int last_idle_time
 Store the last idle time duration.
 
unsigned int total_slack_time
 Store the total of the processor idle time.
 
TCB idle_tcb
 TCB pointer used to run idle task.
 
TCBcurrent
 TCB pointer used to store the current task executing into processor.
 
Message msg_write_pipe
 Message variable which is used to copy a message and send it by the NoC.
 

Detailed Description

Kernel slave is the system slave used to execute user's tasks.

HEMPS VERSION - 8.0 - support for RT applications

Distribution: June 2016

Edited by: Marcelo Ruaro - contact: marce.nosp@m.lo.r.nosp@m.uaro@.nosp@m.acad.nosp@m..pucr.nosp@m.s.br

Research group: GAPH-PUCRS - contact: ferna.nosp@m.ndo..nosp@m.morae.nosp@m.s@pu.nosp@m.crs.b.nosp@m.r

kernel_slave is the core of the OS running into the slave processors. Its job is to runs the user's task. It communicates whit the kernel_master to receive new tasks and also notifying its finish. The kernel_slave file uses several modules that implement specific functions

Function Documentation

int handle_packet ( volatile ServiceHeader p)

Handles a new packet from NoC

void OS_Idle ( )

Idle function

unsigned int OS_InterruptMaskClear ( unsigned int  Mask)

Clear a interruption mask

Parameters
MaskInterruption mask clear
unsigned int OS_InterruptMaskSet ( unsigned int  Mask)

Set a interruption mask

Parameters
MaskInterruption mask set
void OS_InterruptServiceRoutine ( unsigned int  status)

Function called by assembly (into interruption handler). Implements the routine to handle interruption in HeMPS

Parameters
statusStatus of the interruption. Signal the interruption type
void Scheduler ( )

Generic task scheduler call

void send_message_delivery ( int  producer_task,
int  consumer_task,
int  consumer_PE,
Message msg_ptr 
)

Assembles and sends a MESSAGE_DELIVERY packet to a consumer task located into a slave processor

Parameters
producer_taskID of the task that produce the message (Send())
consumer_taskID of the task that consume the message (Receive())
msg_ptrMessage pointer
void send_message_request ( int  producer_task,
int  consumer_task,
unsigned int  producer_PE,
unsigned int  sourcePE 
)

Assembles and sends a MESSAGE_REQUEST packet to producer task into a slave processor

Parameters
producer_taskProducer task ID (Send())
consumer_taskConsumer task ID (Receive())
producer_PEProcessor address of the producer task
sourcePEProcessor address of the consumer task
void send_slack_time_report ( )

Assembles and sends a SLACK_TIME_REPORT packet to the master kernel

void send_task_allocated ( TCB allocated_task)

Assembles and sends a TASK_ALLOCATED packet to the master kernel

Parameters
allocated_taskAllocated task TCB pointer
void send_task_real_time_change ( TCB tcb_ptr)

Assembles and sends a REAL_TIME_CHANGE packet to the master kernel

Parameters
tcb_ptrTCB pointer of the task that change its real-time parameters
void send_task_terminated ( TCB terminated_task)

Assembles and sends a TASK_TERMINATED packet to the master kernel

Parameters
terminated_taskTerminated task TCB pointer
void send_update_task_location ( unsigned int  target_proc,
unsigned int  task_id,
unsigned int  new_task_location 
)

Assembles and sends a UPDATE_TASK_LOCATION packet to a slave processor. Useful because task migration

Parameters
target_procTarget slave processor which the packet will be sent
task_idTask ID that have its location updated
new_task_locationNew location (slave processor address) of the task
int Syscall ( unsigned int  service,
unsigned int  arg0,
unsigned int  arg1,
unsigned int  arg2 
)

Syscall handler. It is called when a task calls a function defined into the api.h file

Parameters
serviceService of the syscall
arg0Generic argument
arg1Generic argument
arg2Generic argument
void write_local_msg_to_task ( TCB task_tcb_ptr,
int  msg_lenght,
int *  msg_data 
)

Useful function to writes a message into the task page space

Parameters
task_tcb_ptrTCB pointer of the task
msg_lenghtLenght of the message to be copied
msg_dataMessage data