Commit 2da24629 authored by yoogx's avatar yoogx

* Added support for QUEUING ports

	For openaadl/ocarina#160
parent 1225a7ad
......@@ -253,19 +253,33 @@ int __po_hi_initialize ()
switch (pkind)
{
case __PO_HI_IN_DATA_INTER_PROCESS:
portno = XM_create_sampling_port (__po_hi_transport_get_model_name (tmp), __po_hi_transport_get_queue_size (tmp), XM_DESTINATION_PORT);
portno = XM_create_sampling_port
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_queue_size (tmp),
XM_DESTINATION_PORT);
break;
case __PO_HI_OUT_DATA_INTER_PROCESS:
portno = XM_create_sampling_port (__po_hi_transport_get_model_name (tmp), __po_hi_transport_get_queue_size (tmp), XM_SOURCE_PORT);
portno = XM_create_sampling_port
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_queue_size (tmp),
XM_SOURCE_PORT);
break;
case __PO_HI_IN_EVENT_DATA_INTER_PROCESS:
portno = XM_create_queuing_port (__po_hi_transport_get_model_name (tmp), __po_hi_transport_get_queue_size (tmp), __po_hi_transport_get_data_size (tmp), XM_DESTINATION_PORT);
portno = XM_create_queuing_port
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_queue_size (tmp),
__po_hi_transport_get_data_size (tmp),
XM_DESTINATION_PORT);
break;
case __PO_HI_OUT_EVENT_DATA_INTER_PROCESS:
portno = XM_create_queuing_port (__po_hi_transport_get_model_name (tmp), __po_hi_transport_get_queue_size (tmp), __po_hi_transport_get_data_size (tmp), XM_SOURCE_PORT);
portno = XM_create_queuing_port
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_queue_size (tmp),
__po_hi_transport_get_data_size (tmp),
XM_SOURCE_PORT);
break;
default:
......@@ -273,20 +287,150 @@ int __po_hi_initialize ()
break;
}
if (portno < 0)
{
__DEBUGMSG ("[MAIN] Cannot open port %d, name=%s, return=%d\n", tmp, __po_hi_transport_get_model_name (tmp), portno);
}
else
{
__po_hi_transport_xtratum_port_init (tmp, portno);
__DEBUGMSG ("[MAIN] Port %d (name=%s) created, identifier = %d\n", tmp, __po_hi_transport_get_model_name (tmp), portno);
if (portno < 0) {
__DEBUGMSG ("[MAIN] Cannot open port %d, name=%s, return=%d\n",
tmp, __po_hi_transport_get_model_name (tmp), portno);
} else {
__po_hi_transport_xtratum_port_init (tmp, portno);
__DEBUGMSG ("[MAIN] Port %d (name=%s) created, identifier = %d\n",
tmp, __po_hi_transport_get_model_name (tmp), portno);
}
}
}
#endif
#if (defined (AIR_HYPERVISOR) && (__PO_HI_NB_PORTS > 0))
#include <deployment.h>
#include <po_hi_types.h>
#include <po_hi_transport.h>
#include <a653.h>
#include <air.h>
#include <imaspex.h>
__po_hi_port_kind_t pkind;
__po_hi_port_t tmp;
__po_hi_node_t tmpnode;
__po_hi_node_t mynode;
int portno;
int rc;
SYSTEM_TIME_TYPE PERIOD = 1000000;
PARTITION_ID_TYPE self_id;
/* Initialize inter-partition communication subsystem */
imaspex_init();
GET_PARTITION_ID(&self_id, &rc);
if(NO_ERROR != rc) {
printf("GET_PARTITION_ID error %d\n", rc);
}
printf("Initializing partition %d...\n", self_id);
mynode = __po_hi_transport_get_mynode ();
for (tmp = 0 ; tmp < __PO_HI_NB_PORTS ; tmp++)
{
pkind = __po_hi_transport_get_port_kind (tmp);
tmpnode = __po_hi_transport_get_node_from_entity
(__po_hi_get_entity_from_global_port (tmp));
if ((tmpnode == mynode) &&
( (pkind == __PO_HI_IN_DATA_INTER_PROCESS) ||
(pkind == __PO_HI_OUT_DATA_INTER_PROCESS) ||
(pkind == __PO_HI_IN_EVENT_DATA_INTER_PROCESS) ||
(pkind == __PO_HI_OUT_EVENT_DATA_INTER_PROCESS)
)) {
__DEBUGMSG ("[MAIN] Should init port %d\n", tmp);
portno = -1;
switch (pkind) {
case __PO_HI_IN_DATA_INTER_PROCESS:
CREATE_SAMPLING_PORT
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_data_size (tmp),
DESTINATION,
PERIOD,
&portno,
&rc);
if (rc != NO_ERROR) {
__DEBUGMSG("=>>> CREATE_SAMPLING_PORT error %d %d %d %d\n",
rc, INVALID_MODE, INVALID_CONFIG,
__po_hi_transport_get_queue_size (tmp));
}
break;
case __PO_HI_OUT_DATA_INTER_PROCESS:
CREATE_SAMPLING_PORT
(__po_hi_transport_get_model_name (tmp),
__po_hi_transport_get_data_size (tmp),
SOURCE,
PERIOD,
&portno,
&rc);
if (rc != NO_ERROR) {
__DEBUGMSG("CREATE_SAMPLING_PORT error %d\n", rc);
}
break;
case __PO_HI_IN_EVENT_DATA_INTER_PROCESS:
CREATE_QUEUING_PORT
(__po_hi_transport_get_model_name (tmp),
1024,
__po_hi_transport_get_queue_size (tmp),
DESTINATION,
FIFO,
&portno,
&rc);
if (rc != NO_ERROR) {
__DEBUGMSG("CREATE_QUEUING_PORT error %d\n", rc);
}
break;
case __PO_HI_OUT_EVENT_DATA_INTER_PROCESS:
CREATE_QUEUING_PORT
(__po_hi_transport_get_model_name (tmp),
1024, //__po_hi_transport_get_data_size (tmp),
__po_hi_transport_get_queue_size (tmp),
SOURCE,
FIFO,
&portno,
&rc);
if (rc != NO_ERROR) {
__DEBUGMSG("CREATE_QUEUING_PORT error %d\n", rc);
}
break;
default:
__DEBUGMSG ("[MAIN] Port kind not handled for port %d\n", tmp);
break;
}
if (portno < 0) {
__DEBUGMSG ("[MAIN] Cannot open port %d, name=%s, return=%d\n",
tmp, __po_hi_transport_get_model_name (tmp), portno);
} else {
__po_hi_transport_xtratum_port_init (tmp, portno);
__DEBUGMSG ("[MAIN] Port %d (name=%s) created, identifier = %d\n",
tmp, __po_hi_transport_get_model_name (tmp), portno);
}
}
}
SET_PARTITION_MODE(NORMAL, &rc);
if (NO_ERROR != rc) {
__DEBUGMSG("SET_PARTITION_MODE error %d\n", rc);
}
#endif
/*!
* Initialize the monitoring trace if needed
*/
......
......@@ -58,12 +58,22 @@ extern __po_hi_bus_id* __po_hi_devices_accessed_buses[__PO_HI
extern __po_hi_protocol_t __po_hi_ports_protocols[__PO_HI_NB_PORTS][__PO_HI_NB_PORTS];
#endif
#ifdef XM3_RTEMS_MODE
#if defined(XM3_RTEMS_MODE) || defined(AIR_HYPERVISOR)
#include <deployment.h>
#include <po_hi_types.h>
#include <po_hi_transport.h>
#if defined(AIR_HYPERVISOR)
#include <air.h>
#include <a653.h>
#endif
#ifdef XM3_RTEMS_MODE
#include <xm.h>
#endif
int __po_hi_xtratum_port[__PO_HI_NB_PORTS];
#endif
......@@ -136,41 +146,75 @@ int __po_hi_transport_send (__po_hi_task_id id, __po_hi_port_t port)
#endif
}
#ifndef XM3_RTEMS_MODE
else
{
__PO_HI_DEBUG_DEBUG (" [deliver remotely]\n");
__po_hi_transport_call_sending_func_by_port (id, port);
}
#else /* for XTratuM */
else
{
__po_hi_port_kind_t pkind = __po_hi_transport_get_port_kind (port);
int ret;
ret = -1;
if (pkind == __PO_HI_OUT_DATA_INTER_PROCESS)
{
ret = XM_write_sampling_message (__po_hi_xtratum_port[port], request, sizeof (__po_hi_request_t));
#ifdef XM3_RTEMS_MODE /* for XTratuM */
else {
__po_hi_port_kind_t pkind = __po_hi_transport_get_port_kind (port);
int ret = -1;
if (pkind == __PO_HI_OUT_DATA_INTER_PROCESS) {
ret = XM_write_sampling_message
(__po_hi_xtratum_port[port],
request, sizeof (__po_hi_request_t));
}
if (pkind == __PO_HI_OUT_EVENT_DATA_INTER_PROCESS) {
ret = XM_send_queuing_message
(__po_hi_xtratum_port[port],
request, sizeof (__po_hi_request_t));
}
if (pkind == __PO_HI_OUT_EVENT_DATA_INTER_PROCESS)
{
ret = XM_send_queuing_message (__po_hi_xtratum_port[port], request, sizeof (__po_hi_request_t));
if (ret < 0) {
__PO_HI_DEBUG_CRITICAL
("[GQUEUE] Error delivering using inter-partitions ports, %d\n",
ret);
} else {
__PO_HI_DEBUG_DEBUG
("[GQUEUE] Data delivered using inter-partitions ports, %d\n",
ret);
}
}
if (ret < 0)
{
__PO_HI_DEBUG_CRITICAL ("[GQUEUE] Cannot deliver the data using inter-partitions ports, return=%d\n", ret);
#elif defined (AIR_HYPERVISOR) /* for AIR */
else {
__po_hi_port_kind_t pkind = __po_hi_transport_get_port_kind (port);
int ret = -1;
if (pkind == __PO_HI_OUT_DATA_INTER_PROCESS) {
WRITE_SAMPLING_MESSAGE
(__po_hi_xtratum_port[port],
request, sizeof (__po_hi_request_t),
&ret);
}
if (pkind == __PO_HI_OUT_EVENT_DATA_INTER_PROCESS) {
SEND_QUEUING_MESSAGE
(__po_hi_xtratum_port[port],
request, sizeof (__po_hi_request_t),
INFINITE_TIME_VALUE, &ret);
}
else
{
__PO_HI_DEBUG_DEBUG ("[GQUEUE] Data delivered using inter-partitions ports, return=%d\n", ret);
if (ret != 0) {
__PO_HI_DEBUG_CRITICAL
("[GQUEUE] Error delivering using inter-partitions ports, %d\n",
ret);
} else {
__PO_HI_DEBUG_DEBUG
("[GQUEUE] Data delivered using inter-partitions ports, %d\n",
ret);
}
}
#else
else {
__PO_HI_DEBUG_DEBUG (" [deliver remotely]\n");
__po_hi_transport_call_sending_func_by_port (id, port);
}
#endif
/** The trace_managing is done for every step of the for loop */
/** The trace_managing is done for every step of the for loop */
#if defined (MONITORING)
record_event(ANY, TRANSPORT_SEND, id, port, destination_port, local_port, __po_hi_get_local_port_from_global_port (destination_port), request);
record_event
(ANY, TRANSPORT_SEND, id, port, destination_port, local_port,
__po_hi_get_local_port_from_global_port (destination_port), request);
#endif
}
......@@ -497,7 +541,7 @@ __po_hi_protocol_conf_t* __po_hi_transport_get_protocol_configuration (const
#endif
}
#ifdef XM3_RTEMS_MODE
#if defined(XM3_RTEMS_MODE) || defined(AIR_HYPERVISOR)
void __po_hi_transport_xtratum_port_init (const __po_hi_port_t portno, int val)
{
__po_hi_xtratum_port[portno] = val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment