HeMPS  8.0
Functions | Variables
communication.c File Reference

Implements the PIPE and MessageRequest structures management. This module is only used by slave kernel. More...

#include "communication.h"
#include "../include/plasma.h"
#include "utils.h"
Include dependency graph for communication.c:

Functions

void init_communication ()
 
int add_PIPE (int producer_task, int consumer_task, Message *msg)
 
unsigned int search_PIPE_producer (int producer_task)
 
unsigned int PIPE_msg_number ()
 
PipeSlotremove_PIPE (int producer_task, int consumer_task)
 
PipeSlotget_PIPE_free_position ()
 
int insert_message_request (int producer_task, int consumer_task, int requester_proc)
 
int search_message_request (int producer_task, int consumer_task)
 
int remove_message_request (int producer_task, int consumer_task)
 
int remove_all_requested_msgs (int requested_task, unsigned int *removed_msgs)
 

Variables

PipeSlot pipe [PIPE_SIZE]
 pipe array
 
MessageRequest message_request [REQUEST_SIZE]
 message request array
 
unsigned int pipe_free_positions = PIPE_SIZE
 Stores the number of free position in the pipe.
 

Detailed Description

Implements the PIPE and MessageRequest structures management. This module is only used by slave kernel.

HEMPS VERSION - 8.0 - support for RT applications

Distribution: June 2016

Created 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

Function Documentation

int add_PIPE ( int  producer_task,
int  consumer_task,
Message msg 
)

Add a message to the PIPE if it have available space

Parameters
producer_taskID of the producer task
consumer_taskID of the consumer task
msgMessage pointer for the message to be stored
Returns
0 if pipe is full, 1 if the message was stored with success
PipeSlot* get_PIPE_free_position ( )

Gets a pipe free position pointer

Returns
PipeSlot free position pointer
void init_communication ( )

Initializes the message request and the pipe array

int insert_message_request ( int  producer_task,
int  consumer_task,
int  requester_proc 
)

Inserts a message request into the message_request array

Parameters
producer_taskID of the producer task of the message
consumer_taskID of the consumer task of the message
requester_procProcessor of the consumer task
Returns
0 if the message_request array is full, 1 if the message was successfully inserted
unsigned int PIPE_msg_number ( )

Counts the number of message in the pipe

Returns
The number of messages in the pipe
int remove_all_requested_msgs ( int  requested_task,
unsigned int *  removed_msgs 
)

Remove all message request of a requested task ID and copies such messages to the removed_msgs array. This function is used for task migration only, when a task need to be moved to other processor

Parameters
requested_taskID of the requested task
removed_msgsarray pointer of the removed messages
Returns
number of removed messages
int remove_message_request ( int  producer_task,
int  consumer_task 
)

Remove a message request

Parameters
producer_taskID of the producer task of the message
consumer_taskID of the consumer task of the message
Returns
-1 if the message was not found or the requester processor address (processor of the consumer task)
PipeSlot* remove_PIPE ( int  producer_task,
int  consumer_task 
)

Remove the next message from the pipe. The remotion occurs following the order of insertion of the message

Parameters
producer_taskID of the producer task of the message
consumer_taskID of the consumer task of the message
Returns
0 if it not found any message, or the PipeSlot pointer if the message was successfully removed
int search_message_request ( int  producer_task,
int  consumer_task 
)

Searches for a message request

Parameters
producer_taskID of the producer task of the message
consumer_taskID of the consumer task of the message
Returns
0 if the message was not found, 1 if the message was found
unsigned int search_PIPE_producer ( int  producer_task)

Tells if the producer task have some message in the pipe

Parameters
producer_taskID of the producer task
Returns
0 if it not has, 1 if it has