Commit 8b9eb2e6 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files
parents cbd9c0e5 5ea1cc1f
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2011-2014 ESA & ISAE.
* Copyright (C) 2011-2018 ESA & ISAE.
*/
......@@ -13,14 +13,6 @@
#ifndef __PO_HI_DRIVER_SERIAL_COMMON_H__
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_RECEIVER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_SENDER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_RASTA) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_RECEIVER)
#include <po_hi_debug.h>
#include <drivers/configuration/serial.h>
......@@ -43,6 +35,4 @@ int __po_hi_c_driver_serial_common_get_speed (const __po_hi_device_id id);
* valid, it returns __PO_HI_DRIVER_SERIAL_COMMON_SPEED_UNKNWON
*/
#endif
#endif
......@@ -75,9 +75,6 @@
#ifdef __PO_HI_NEED_DRIVER_ETH_LEON
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH /* GRETH Driver enabled*/
#else
#undef ENABLE_NETWORK
#undef ENABLE_NETWORK_SMC_LEON3
#endif
#ifdef __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA
......@@ -102,6 +99,10 @@ void *POSIX_Init (void);
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_SPW_ROUTER /* SpaceWire Router */
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW2 /* SpaceWire Packet driver */
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH /* GRETH Driver enabled*/
#define CONFIGURE_DRIVER_PCI_GR_LEON4_N2X /* GR-CPCI-LEON4-N2X has two GRETH network MACs */
#define ENABLE_NETWORK
#endif /*GRLEON3 && RTEMS412*/
......@@ -111,10 +112,8 @@ void *POSIX_Init (void);
/* config.c is directly provided by RCC1.3 and initialized drivers per
* drvmgr convention for RASTA (LEON3), N2X and GR740 boards
*/
#undef ENABLE_NETWORK
#undef ENABLE_NETWORK_SMC_LEON3
#include "config.c"
#include "../src/config.c"
#endif /* RTEMS_POSIX */
......
......@@ -29,7 +29,7 @@ TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS $(GCC_GENERIC_FLAGS) $(CPU_FLAGS) $(AM_FLAGS) $(GCCSPECS)
TARGET_INCLUDE = -I $(RUNTIME_PATH)/config/leon-rtems/
TARGET_INCLUDE =
TARGET_LDFLAGS = -lrtemsbsp -lc -lm
......
......@@ -25,7 +25,10 @@ C_FILES = $(srcdir)/po_hi_driver_linux_serial.c \
$(srcdir)/config.c $(srcdir)/config_leon3_drvmgr.c \
$(srcdir)/spwrouter_custom_config.c \
$(srcdir)/po_hi_driver_drvmgr_common.c \
$(srcdir)/po_hi_driver_rtems_drvmgr_spacewire.c
$(srcdir)/po_hi_driver_rtems_drvmgr_spacewire.c \
$(srcdir)/po_hi_driver_rtems_drvmgr_serial.c \
$(srcdir)/po_hi_driver_rtems_drvmgr_ethernet.c \
$(srcdir)/config_leon4_n2x.c
csrc = ${shell $(CYGPATH_U) '$(OCARINA_RUNTIME)/polyorb-hi-c/src/drivers'}
csrc2 = ${shell $(CYGPATH_U) '$(OCARINA_RUNTIME)/polyorb-hi-c/src'}
......
......@@ -21,7 +21,11 @@
/* Configure Network if enabled */
#ifdef ENABLE_NETWORK
#include <bsp/network_interface_add.h>
#include "networkconfig.h"
//#include "networkconfig.h"
// Gaisler uses this file, user provided. for the moment, config done
// in driver to be discussed
#else
#undef ENABLE_NETWORK_SMC_LEON2
#undef ENABLE_NETWORK_SMC_LEON3
......@@ -123,6 +127,7 @@ void system_init(void)
printf("\n");
rtems_bsdnet_show_if_stats();
printf("\n\n");
#endif
}
#include <bsp/gr_leon4_n2x.h>
#include <drvmgr/ambapp_bus.h>
/* GR-CPCI-LEON4-N2X boards configuration example. Note that this is
* optional, we only override defaults. If default are ok, nothing
* is need to be done.
*/
/*** Driver resources for GR-LEON4-N2X 0 AMBA PnP bus ***/
struct drvmgr_bus_res gr_leon4_n2x0_res =
{
.next = NULL,
.resource = {
DRVMGR_RES_EMPTY
},
};
/* Use GPTIMER core 4 (not present in most systems) as a high
* resoulution timer */
struct drvmgr_key leon4_n2x1_gptimer1[] =
{
{"prescaler", DRVMGR_KT_INT, {(unsigned int)4}},
DRVMGR_KEY_EMPTY
};
/*** Driver resources for GR-LEON4-N2X 1 AMBA PnP bus ***/
struct drvmgr_bus_res gr_leon4_n2x1_res =
{
.next = NULL,
.resource = {
{DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 0, NULL}, /*disable GPT[0]*/
{DRIVER_AMBAPP_GAISLER_GPTIMER_ID, 1, &leon4_n2x1_gptimer1[0]},
DRVMGR_RES_EMPTY
},
};
/* Tell GR-CPCI-LEON4-N2X driver about the bus resources.
* Resources for two GR-CPCI-LEON4-N2X board are available.
* AMBAPP->PCI->GR-CPCI-LEON4-N2X->AMBAPP bus resources
*
* The resources will be used by the drivers for the
* cores found on the GR-CPCI-LEON4-N2X->AMBAPP bus.
*
* The "weak defaults" are overriden here.
*/
struct drvmgr_bus_res *gr_leon4_n2x_resources[] =
{
&gr_leon4_n2x0_res, /* GR-LEON4-N2X board 1 resources */
&gr_leon4_n2x1_res, /* GR-LEON4-N2X board 2 resources */
NULL, /* End of table */
};
......@@ -26,7 +26,7 @@
#include <rtems.h>
/** SpaceWire parameters */
#define SPW_PROT_ID 155
#define SPW_PROT_ID 3
/*****************************************************************************/
/* Configuration of the driver */
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2017 ESA & ISAE.
* Copyright (C) 2010-2018 ESA & ISAE.
*/
#include <drivers/po_hi_driver_linux_serial.h>
......@@ -46,6 +46,7 @@ uint32_t po_hi_c_driver_serial_sending_wait;
__po_hi_request_t __po_hi_c_driver_serial_linux_request;
__po_hi_msg_t __po_hi_c_driver_serial_linux_poller_msg;
void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
{
(void) dev_id;
......@@ -55,8 +56,8 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
unsigned long* swap_pointer;
unsigned long swap_value;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Hello, i'm the serial poller , must read %d bytes!\n", __PO_HI_MESSAGES_MAX_SIZE);
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Hello, i'm the serial poller , must read %d bytes!\n",
__PO_HI_MESSAGES_MAX_SIZE);
__po_hi_msg_reallocate (&__po_hi_c_driver_serial_linux_poller_msg);
......@@ -88,14 +89,9 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] read() returns %d\n", n);
/*Swap only the first 2 bytes of data*/
swap_pointer = (unsigned long*) &__po_hi_c_driver_serial_linux_poller_msg.content[0];
swap_value = *swap_pointer;
*swap_pointer = __po_hi_swap_byte (swap_value);
__po_hi_c_driver_serial_linux_poller_msg.length = n;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Message after swapped port: 0x");
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Message after swapped port: 0x");
for (ts = 0 ; ts < __po_hi_c_driver_serial_linux_poller_msg.length ; ts++)
{
__PO_HI_DEBUG_DEBUG ("%x", __po_hi_c_driver_serial_linux_poller_msg.content[ts]);
......@@ -108,7 +104,8 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
if (__po_hi_c_driver_serial_linux_request.port > __PO_HI_NB_PORTS)
{
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Invalid port number !\n");
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Invalid port number %d !\n",
__po_hi_c_driver_serial_linux_request.port);
return;
}
......@@ -278,12 +275,12 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id)
break;
}
if (tcflush (po_hi_c_driver_serial_fd_read, TCIOFLUSH) == -1)
if (tcflush (po_hi_c_driver_serial_fd_read, TCIOFLUSH) < 0)
{
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Error in tcflush()\n");
}
if (tcsetattr (po_hi_c_driver_serial_fd_read, TCSANOW, &newtio) == -1)
if (tcsetattr (po_hi_c_driver_serial_fd_read, TCSANOW, &newtio) < 0)
{
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Error in tcsetattr()\n");
}
......
This diff is collapsed.
/*
* This is a part of PolyORB-HI-C distribution, a minimal
* middleware written for generated code from AADL models.
* You should use it with the Ocarina toolsuite.
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2018 ESA & ISAE.
*/
#include <deployment.h>
/* Generated code header */
#include <activity.h>
#include <marshallers.h>
#include <po_hi_debug.h>
#include <po_hi_transport.h>
#include <po_hi_gqueue.h>
#include <po_hi_messages.h>
#include <po_hi_returns.h>
#include <po_hi_utils.h>
#include <drivers/po_hi_rtems_utils.h>
#include <po_hi_driver_drvmgr_common.h>
/* Common drvmgr initialization */
#include <drivers/po_hi_driver_serial_common.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <termios.h>
/* POSIX-style files */
#include <drivers/configuration/serial.h>
int po_hi_c_driver_rtems_drvmgr_serial_fd_read[__PO_HI_NB_DEVICES];
int po_hi_c_driver_rtems_drvmgr_serial_fd_write[__PO_HI_NB_DEVICES];
__po_hi_request_t __po_hi_c_driver_rtems_drvmgr_serial_request;
__po_hi_msg_t __po_hi_c_driver_rtems_drvmgr_serial_poller_msg;
/*!
* \fn void __po_hi_c_driver_rtems_drvmgr_serial_poller (const __po_hi_device_id dev_id)
* \brief Polling function for the RTEMS DRVMGR SERIAL.
*
* This function is the poller for the serial interface of the RTEMS DRVMGR SERIAL board.
* It is supposed to be called by the underlying AADL code at a given period/rate.
* The argument dev_id is the device_id handled by the device driver. By using
* such an argument, we can use this function on a single node that uses several
* driver instances (several serial interfaces connected to different serial buses).
*/
void __po_hi_c_driver_rtems_drvmgr_serial_poller (const __po_hi_device_id dev_id)
{
int n;
int ts;
uint8_t* ptr;
ts = __PO_HI_MESSAGES_MAX_SIZE;
ptr = &(__po_hi_c_driver_rtems_drvmgr_serial_poller_msg.content[0]);
__po_hi_msg_reallocate (&__po_hi_c_driver_rtems_drvmgr_serial_poller_msg);
while (ts > 0) {
__PO_HI_DEBUG_DEBUG
("[DRVMGR SERIAL] Poller waits for incoming message (%d bytes are required)!\n", ts);
n = read (po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], ptr, ts);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] read() %d returns %d!\n",
po_hi_c_driver_rtems_drvmgr_serial_fd_read[dev_id], n);
if (n == -1) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Cannot read on socket !\n");
return;
} else {
ptr += n;
ts -= n;
}
}
__po_hi_c_driver_rtems_drvmgr_serial_poller_msg.length = __PO_HI_MESSAGES_MAX_SIZE;
__po_hi_unmarshall_request (&__po_hi_c_driver_rtems_drvmgr_serial_request,
&__po_hi_c_driver_rtems_drvmgr_serial_poller_msg);
if (__po_hi_c_driver_rtems_drvmgr_serial_request.port > __PO_HI_NB_PORTS) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Invalid port number (%d), will not deliver",
__po_hi_c_driver_rtems_drvmgr_serial_request.port);
}
__po_hi_main_deliver (&__po_hi_c_driver_rtems_drvmgr_serial_request);
}
__po_hi_msg_t __po_hi_c_driver_rtems_drvmgr_serial_sender_msg;
/*!
* \fn int __po_hi_c_driver_rtems_drvmgr_serial_sender (const __po_hi_task_id task_id, const __po_hi_port_t port)
* \brief Function related to the RTEMS DRVMGR SERIAL serial driver - sender function.
*
* This function implements the sender function to send bytes through the serial line using
* the RTEMS DRVMGR SERIAL device.
* There are the description of the arguments used by the function:
* - task_id: task that actually sends the data (emitter/producer task)
* - port : (global) port that contains the data
* It returns the following possible values :
* - __PO_HI_UNAVAILABLE : the driver does not handle the device connected to argument port.
* - __PO_HI_SUCCESS : either no value was available to be sent or the function
* send the message successfully over the network.
*/
int __po_hi_c_driver_rtems_drvmgr_serial_sender (const __po_hi_task_id task_id, const __po_hi_port_t port)
{
int n;
int ts;
__po_hi_local_port_t local_port;
__po_hi_request_t* request;
__po_hi_port_t destination_port;
__po_hi_device_id dev_id;
dev_id = __po_hi_get_device_from_port (port);
if (dev_id == invalid_device_id) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Invalid device id for sending\n");
return __PO_HI_UNAVAILABLE;
}
local_port = __po_hi_get_local_port_from_global_port (port);
request = __po_hi_gqueue_get_most_recent_value (task_id, local_port);
if (request->port == -1)
{
__PO_HI_DEBUG_DEBUG
("[DRVMGR SERIAL] Send output task %d, port %d (local_port=%d): no value to send\n",
task_id, port, local_port);
return __PO_HI_SUCCESS;
}
destination_port = __po_hi_gqueue_get_destination (task_id, local_port, 0);
__po_hi_msg_reallocate (&__po_hi_c_driver_rtems_drvmgr_serial_sender_msg);
request->port = destination_port;
__po_hi_marshall_request (request, &__po_hi_c_driver_rtems_drvmgr_serial_sender_msg);
__PO_HI_DEBUG_DEBUG
("[DRVMGR SERIAL] Destination port= %d, msg size %d send through device %d (fd=%d)\n",
destination_port,
__po_hi_c_driver_rtems_drvmgr_serial_sender_msg.length,
dev_id, po_hi_c_driver_rtems_drvmgr_serial_fd_write[dev_id]);
n = write (po_hi_c_driver_rtems_drvmgr_serial_fd_write[dev_id],
&__po_hi_c_driver_rtems_drvmgr_serial_sender_msg,
__PO_HI_MESSAGES_MAX_SIZE);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] write() returns %d\n", n);
request->port = __PO_HI_GQUEUE_INVALID_PORT;
return 1;
}
/*!
* \fn void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
* \brief Initialization function for the RTEMS DRVMGR SERIAL serial driver.
*
* This function is used to initialize the device driver connected to the
* serial interface to a RTEMS DRVMGR SERIAL board. It uses the configuration properties
* from its associated configuration parameters (using the
* __po_hi_get_device_configuration function).
*/
void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
{
uint32_t max_size;
struct termios oldtio,newtio;
__po_hi_c_serial_conf_t* serialconf;
/* Initializes drvmgr subsystem */
__po_hi_c_driver_drvmgr_init ();
serialconf = (__po_hi_c_serial_conf_t*)__po_hi_get_device_configuration (id);
if (serialconf == NULL) {
__PO_HI_DEBUG_INFO ("[DRVMGR SERIAL] Cannot get the name of the device !\n");
return;
}
__po_hi_transport_set_sending_func (id, __po_hi_c_driver_rtems_drvmgr_serial_sender);
/* provide the spacewire driver with AMBA Plug&Play
* info so that it can find the GRSPW cores.
*/
__PO_HI_DEBUG_INFO ("[DRVMGR SERIAL] Initialization starts !\n");
po_hi_c_driver_rtems_drvmgr_serial_fd_write[id] =
po_hi_c_driver_rtems_drvmgr_serial_fd_read[id] = open (serialconf->devname, O_RDWR);
if (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id] < 0) {
__PO_HI_DEBUG_CRITICAL ("[DRVMGR SERIAL] Error while opening device %s for reading\n",
serialconf->devname);
}
if (po_hi_c_driver_rtems_drvmgr_serial_fd_write[id] < 0) {
__PO_HI_DEBUG_CRITICAL ("[DRVMGR SERIAL] Error while opening device %s for writing\n",
serialconf->devname);
}
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Device opened for read (%s), fd=%d\n",
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_read[id]);
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Device opened for write (%s), fd=%d\n",
serialconf->devname , po_hi_c_driver_rtems_drvmgr_serial_fd_write[id]);
tcgetattr (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], &oldtio); /* save current serial port settings */
tcgetattr (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], &newtio); /* save current serial port settings */
newtio.c_cflag |= CREAD ;
newtio.c_iflag = IGNPAR | IGNBRK;
newtio.c_lflag |= ICANON;
newtio.c_cc[VMIN]=1;
newtio.c_cc[VTIME]=0;
cfmakeraw (&newtio);
switch (__po_hi_c_driver_serial_common_get_speed (id))
{
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_19200:
newtio.c_cflag |= B19200;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 19200\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_38400:
newtio.c_cflag |= B38400;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 38400\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_57600:
newtio.c_cflag |= B57600;
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 57600\n");
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_115200:
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Set speed to 115200\n");
newtio.c_cflag |= B115200;
break;
case __PO_HI_DRIVER_SERIAL_COMMON_SPEED_UNKNWON:
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Unknwon speed for the serial line\n");
break;
}
max_size = 1024;
#ifdef __PO_HI_MESSAGES_MAX_SIZE
max_size = 4 * __PO_HI_MESSAGES_MAX_SIZE;
#endif
if (tcflush (po_hi_c_driver_rtems_drvmgr_serial_fd_read[id], TCIOFLUSH) != 0) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Error when trying to flush read part\n");
}
if (tcflush (po_hi_c_driver_rtems_drvmgr_serial_fd_write[id], TCIOFLUSH) != 0) {
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Error when trying to flush write part\n");
}
__PO_HI_DEBUG_DEBUG ("[DRVMGR SERIAL] Initialization complete !\n");
}
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2011-2014 ESA & ISAE.
* Copyright (C) 2011-2018 ESA & ISAE.
*/
......@@ -14,14 +14,6 @@
#include <drivers/po_hi_driver_serial_common.h>
#include <drivers/configuration/serial.h>
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_RECEIVER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_SENDER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_RASTA) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_SENDER) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LEON_RECEIVER)
#include <po_hi_transport.h>
#include <po_hi_debug.h>
......@@ -61,5 +53,3 @@ int __po_hi_c_driver_serial_common_get_speed (const __po_hi_device_id id)
return __PO_HI_DRIVER_SERIAL_COMMON_SPEED_DEFAULT;
}
#endif
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2017 ESA & ISAE.
* Copyright (C) 2010-2018 ESA & ISAE.
*/
#include <deployment.h>
......@@ -405,14 +405,17 @@ void* __po_hi_sockets_poller (__po_hi_device_id* dev_id_addr)
for (dev = 0; dev < __PO_HI_NB_DEVICES ; dev++)
{
__DEBUGMSG ("[DRIVER SOCKETS] Try to watch if it comes from device %d (socket=%d)\n", dev, __po_hi_c_sockets_read_sockets[dev]);
if ( (__po_hi_c_sockets_read_sockets[dev] != -1 ) && FD_ISSET(__po_hi_c_sockets_read_sockets[dev], &selector))
__DEBUGMSG ("[DRIVER SOCKETS] Try to watch if it comes from device %d (socket=%d)\n",
dev, __po_hi_c_sockets_read_sockets[dev]);
if ( (__po_hi_c_sockets_read_sockets[dev] != -1 ) &&
FD_ISSET(__po_hi_c_sockets_read_sockets[dev], &selector))
{
__DEBUGMSG ("[DRIVER SOCKETS] Receive message from dev %d\n", dev);
#ifdef __PO_HI_USE_PROTOCOL_MYPROTOCOL_I
{
protocol_conf = __po_hi_transport_get_protocol_configuration (virtual_bus_myprotocol_i);
protocol_conf = __po_hi_transport_get_protocol_configuration
(virtual_bus_myprotocol_i);
int datareceived;
len = recv (__po_hi_c_sockets_read_sockets[dev], &datareceived, sizeof (int), MSG_WAITALL);
......@@ -432,16 +435,19 @@ void* __po_hi_sockets_poller (__po_hi_device_id* dev_id_addr)
memset (__po_hi_c_sockets_poller_msg.content, '\0', __PO_HI_MESSAGES_MAX_SIZE);
#ifdef _WIN32
len = recv (__po_hi_c_sockets_read_sockets[dev], __po_hi_c_sockets_poller_msg.content, __PO_HI_MESSAGES_MAX_SIZE, 0);
len = recv (__po_hi_c_sockets_read_sockets[dev],
__po_hi_c_sockets_poller_msg.content, __PO_HI_MESSAGES_MAX_SIZE, 0);
#else
/* In the following, we first retrieve the size of the
payload, then the payload itself */
int datareceived;
len = recv (__po_hi_c_sockets_read_sockets[dev], &datareceived, sizeof (int), MSG_WAITALL);
len = recv (__po_hi_c_sockets_read_sockets[dev], &datareceived, sizeof (int),
MSG_WAITALL);
datareceived = __po_hi_swap_byte (datareceived);
len = recv (__po_hi_c_sockets_read_sockets[dev], __po_hi_c_sockets_poller_msg.content, datareceived, MSG_WAITALL);
len = recv (__po_hi_c_sockets_read_sockets[dev],
__po_hi_c_sockets_poller_msg.content, datareceived, MSG_WAITALL);
#endif
__po_hi_c_sockets_poller_msg.length = len;
......
......@@ -43,7 +43,6 @@ extern __po_hi_protocol_conf_t __po_hi_protocols_configuration[__PO_HI_NB_PROT
#if __PO_HI_NB_DEVICES > 0
__po_hi_transport_sending_func __po_hi_transport_devices_sending_funcs[__PO_HI_NB_DEVICES];
extern __po_hi_port_t __po_hi_devices_to_nodes[__PO_HI_NB_DEVICES];
extern __po_hi_port_t __po_hi_devices_to_nodes[__PO_HI_NB_DEVICES];
extern __po_hi_device_id __po_hi_port_to_device[__PO_HI_NB_PORTS];
extern char* __po_hi_devices_naming[__PO_HI_NB_DEVICES];
extern __po_hi_uint32_t* __po_hi_devices_configuration_values[__PO_HI_NB_DEVICES];
......@@ -117,8 +116,21 @@ int __po_hi_transport_send (__po_hi_task_id id, __po_hi_port_t port)
if (__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (port)) ==
__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (destination_port)))
{
#if __PO_HI_NB_DEVICES > 0
/* If the application defines devices for communication, and
the port uses one, forces remote delivery */
if (__po_hi_port_to_device[port] != -1) {
__PO_HI_DEBUG_DEBUG (" [deliver remotely]\n");
__po_hi_transport_call_sending_func_by_port (id, port);
} else {
__PO_HI_DEBUG_DEBUG (" [deliver locally]\n");
__po_hi_main_deliver (request);
}
#else
__PO_HI_DEBUG_DEBUG (" [deliver locally]\n");
__po_hi_main_deliver (request);
#endif
}
#ifndef XM3_RTEMS_MODE
else
......@@ -465,10 +477,10 @@ __po_hi_protocol_conf_t* __po_hi_transport_get_protocol_configuration (const
#if __PO_HI_NB_PROTOCOLS > 0
if (p == invalid_protocol)