HeMPS  8.0
Classes | Macros | Enumerations | Functions
communication.h File Reference

Defines the PipeSlot and MessageRequest structures. More...

#include "../../include/kernel_pkg.h"
#include "../include/api.h"
Include dependency graph for communication.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PipeSlot
 This structure store a task message (Message) in a kernel memory area called PIPE. More...
 
struct  MessageRequest
 This structure stores the message requests used to implement the blocking Receive MPI. More...
 

Macros

#define PIPE_SIZE   MAX_LOCAL_TASKS * 3
 
#define REQUEST_SIZE   MAX_LOCAL_TASKS*(MAX_TASKS_APP-1)
 
#define MAX_TASK_SLOTS   PIPE_SIZE/MAX_LOCAL_TASKS
 Maximum number of pipe slots that a task have.
 

Enumerations

enum  PipeSlotStatus { EMPTY, LOCKED, USED }
 This enum stores the pipe status.
 

Functions

void init_communication ()
 
int add_PIPE (int, int, Message *)
 
unsigned int search_PIPE_producer (int)
 
unsigned int PIPE_msg_number ()
 
PipeSlotremove_PIPE (int, int)
 
PipeSlotget_PIPE_free_position ()
 
int insert_message_request (int, int, int)
 
int search_message_request (int, int)
 
int remove_message_request (int, int)
 
int remove_all_requested_msgs (int, unsigned int *)
 

Detailed Description

Defines the PipeSlot and MessageRequest structures.

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

PipeSlot stores the user's messages produced by not consumed yet. MessageRequest stores the requested messages send to the consumer task by not produced yet

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