Commit d8c7b0bc authored by yoogx's avatar yoogx
Browse files

* Update drivers for RTEMS 4.12

	Code contributed by Hariprasath SHANMUGASUNDARAM

	For openaadl/ocarina#123
parent 3bcc9bff
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
* *
* For more informations, please visit http://taste.tuxfamily.org/wiki * For more informations, please visit http://taste.tuxfamily.org/wiki
* *
* Copyright (C) 2010-2014 ESA & ISAE. * Copyright (C) 2010-2017 ESA & ISAE.
*/ */
#include <deployment.h> #include <deployment.h>
/* Generated code header */ /* Generated code header */
#if ((defined __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA) || \ #if ((defined __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA) || \
(defined __PO_HI_NEED_DRIVER_SERIAL_RASTA)) (defined __PO_HI_NEED_DRIVER_SERIAL_RASTA) || \
(defined __PO_HI_NEED_DRIVER_ETH_LEON ))
void __po_hi_c_driver_rasta_common_init (); void __po_hi_c_driver_rasta_common_init ();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* For more informations, please visit http://taste.tuxfamily.org/wiki * For more informations, please visit http://taste.tuxfamily.org/wiki
* *
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2017 ESA & ISAE.
*/ */
#ifndef __PO_HI_COMMON_H__ #ifndef __PO_HI_COMMON_H__
...@@ -31,10 +31,19 @@ ...@@ -31,10 +31,19 @@
#include <rtems.h> #include <rtems.h>
#include <inttypes.h> #include <inttypes.h>
#if defined GRLEON3 && defined RTEMS412
#include <drvmgr/drvmgr.h>
#include <amba.h>
#include <bsp/grspw.h>
#include <drvmgr/ambapp_bus.h>
#define CONFIGURE_INIT
#include <bsp.h>
#endif
#include <bsp.h> #include <bsp.h>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
// #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER // #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_DRIVERS 10 #define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 40 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 40
...@@ -61,12 +70,35 @@ ...@@ -61,12 +70,35 @@
#define CONFIGURE_INIT #define CONFIGURE_INIT
#include <rtems/confdefs.h> #include <rtems/confdefs.h>
/* Driver Manager configuration for rtems 4.12*/
#if defined GRLEON3 && defined RTEMS412
#ifdef __PO_HI_NEED_DRIVER_ETH_LEON
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRETH /* GRETH Driver enabled*/
#endif
#ifdef __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA
#define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver enabled*/
#endif
#include <drvmgr/drvmgr_confdefs.h>
#include <drvmgr/ambapp_bus.h>
#include <ambapp_ids.h>
#include <drvmgr/drvmgr.h>
#endif /*GRLEON3 && RTEMS412*/
#endif /* RTEMS_POSIX */ #endif /* RTEMS_POSIX */
#if defined(__PO_HI_RTEMS_CLASSIC_API) #if defined(__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h> #include <rtems.h>
#include <inttypes.h> #include <inttypes.h>
#define CONFIGURE_INIT #define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_STACK_SIZE 2*RTEMS_MINIMUM_STACK_SIZE
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
RTEMS_NO_TIMESLICE | \
RTEMS_NO_ASR | \
RTEMS_INTERRUPT_LEVEL(0))
#include <bsp.h> #include <bsp.h>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
...@@ -77,7 +109,7 @@ ...@@ -77,7 +109,7 @@
#define CONFIGURE_MAXIMUM_TIMERS 40 #define CONFIGURE_MAXIMUM_TIMERS 40
#ifndef XM3_RTEMS_MODE #ifndef XM3_RTEMS_MODE
#define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024) #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024) //either RAM SIZE or Stack_extras Macro should be present Rtems4.12
#endif #endif
/* /*
#define CONFIGURE_MAXIMUM_SEMAPHORES __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1 #define CONFIGURE_MAXIMUM_SEMAPHORES __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1
...@@ -97,7 +129,7 @@ ...@@ -97,7 +129,7 @@
#ifndef RTEMS411 #ifndef RTEMS411
rtems_task Init (rtems_task_argument no_argument); rtems_task Init (rtems_task_argument no_argument);
#endif #endif
#define CONFIGURE_STACK_CHECKER_ENABLED
#define CONFIGURE_EXTRA_TASK_STACKS __PO_HI_TASKS_STACK #define CONFIGURE_EXTRA_TASK_STACKS __PO_HI_TASKS_STACK
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
...@@ -110,6 +142,9 @@ ...@@ -110,6 +142,9 @@
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1 #if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
#include <rtems/rtems_bsdnet.h> #include <rtems/rtems_bsdnet.h>
#include <bsp.h> #include <bsp.h>
/*
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int); int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int);
static struct rtems_bsdnet_ifconfig loopback_config = static struct rtems_bsdnet_ifconfig loopback_config =
...@@ -127,6 +162,8 @@ struct rtems_bsdnet_ifconfig netdriver_config = ...@@ -127,6 +162,8 @@ struct rtems_bsdnet_ifconfig netdriver_config =
struct rtems_bsdnet_config rtems_bsdnet_config = struct rtems_bsdnet_config rtems_bsdnet_config =
{&netdriver_config,NULL,0,256 * 1024,256 * 1024,}; {&netdriver_config,NULL,0,256 * 1024,256 * 1024,};
*/
#endif /*(defined (X86_RTEMS) */ #endif /*(defined (X86_RTEMS) */
......
...@@ -19,6 +19,7 @@ endef ...@@ -19,6 +19,7 @@ endef
MANAGERS = all MANAGERS = all
LIBS = -lrtemsall -lc
CC = $(CC_FOR_TARGET) CC = $(CC_FOR_TARGET)
CPP = $(CXX_FOR_TARGET) CPP = $(CXX_FOR_TARGET)
...@@ -58,6 +59,13 @@ ifeq ($(RTEMS_API),4.12) ...@@ -58,6 +59,13 @@ ifeq ($(RTEMS_API),4.12)
TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm
endif endif
ifeq ($(RTEMS_BSP),leon3)
TARGET_CFLAGS += -DGRLEON3
endif
ifeq ($(RTEMS_BSP),leon2)
TARGET_CFLAGS += -DGRLEON2
endif
target-clean: target-clean:
......
...@@ -18,6 +18,7 @@ endef ...@@ -18,6 +18,7 @@ endef
MANAGERS = all MANAGERS = all
LIBS = -lrtemsall -lc
CC = $(CC_FOR_TARGET) CC = $(CC_FOR_TARGET)
CPP = $(CXX_FOR_TARGET) CPP = $(CXX_FOR_TARGET)
...@@ -57,7 +58,13 @@ ifeq ($(RTEMS_API),4.12) ...@@ -57,7 +58,13 @@ ifeq ($(RTEMS_API),4.12)
TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm
endif endif
ifeq ($(RTEMS_BSP),leon3)
TARGET_CFLAGS += -DGRLEON3
endif
ifeq ($(RTEMS_BSP),leon2)
TARGET_CFLAGS += -DGRLEON2
endif
ifdef USE_GPROF ifdef USE_GPROF
TARGET_LDFLAGS+=-Wl,--wrap,Clock_isr -pg TARGET_LDFLAGS+=-Wl,--wrap,Clock_isr -pg
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* For more informations, please visit http://taste.tuxfamily.org/wiki * For more informations, please visit http://taste.tuxfamily.org/wiki
* *
* Copyright (C) 2011-2016 ESA & ISAE. * Copyright (C) 2011-2017 ESA & ISAE.
*/ */
#include <deployment.h> #include <deployment.h>
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
#include <po_hi_transport.h> #include <po_hi_transport.h>
#include <po_hi_returns.h> #include <po_hi_returns.h>
#include <po_hi_gqueue.h> #include <po_hi_gqueue.h>
#include <po_hi_main.h>
#include <drivers/po_hi_driver_rasta_common.h>
#include <drivers/po_hi_rtems_utils.h>
#include <drivers/po_hi_driver_leon_eth.h> #include <drivers/po_hi_driver_leon_eth.h>
#include <drivers/po_hi_driver_sockets.h> #include <drivers/po_hi_driver_sockets.h>
#include <drivers/configuration/ip.h> #include <drivers/configuration/ip.h>
...@@ -50,7 +53,7 @@ __po_hi_inetnode_t nodes[__PO_HI_NB_DEVICES]; ...@@ -50,7 +53,7 @@ __po_hi_inetnode_t nodes[__PO_HI_NB_DEVICES];
__po_hi_inetnode_t rnodes[__PO_HI_NB_DEVICES]; __po_hi_inetnode_t rnodes[__PO_HI_NB_DEVICES];
__po_hi_device_id leon_eth_device_id; __po_hi_device_id leon_eth_device_id;
extern void rtems_stack_checker_report_usage(void);
#if defined (__PO_HI_NEED_DRIVER_ETH_LEON) || \ #if defined (__PO_HI_NEED_DRIVER_ETH_LEON) || \
defined (__PO_HI_NEED_DRIVER_ETH_LEON_RECEIVER) defined (__PO_HI_NEED_DRIVER_ETH_LEON_RECEIVER)
...@@ -60,22 +63,34 @@ __po_hi_device_id leon_eth_device_id; ...@@ -60,22 +63,34 @@ __po_hi_device_id leon_eth_device_id;
timeout.tv_usec = 0; \ timeout.tv_usec = 0; \
setsockopt (mysocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,sizeof (timeout)); } setsockopt (mysocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,sizeof (timeout)); }
#if ((defined GRLEON3)||((defined GRLEON2)&&(RTEMS412)))
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH
#define RTEMS_BSP_NETWORK_DRIVER_NAME RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH
#elif GRLEON2
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111
#define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1" #define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1"
#endif
#include <bsp.h> #include <bsp.h>
#include <rtems/rtems_bsdnet.h> #include <rtems/rtems_bsdnet.h>
#ifdef RTEMS48 #if defined RTEMS48 || defined RTEMS410
extern void rtems_bsdnet_loopattach(); extern void rtems_bsdnet_loopattach();
#else #else
extern void rtems_bsdnet_initialize_loop(); extern void rtems_bsdnet_initialize_loop();
#endif #endif
static struct rtems_bsdnet_ifconfig loopback_config = { static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */ "lo0", /* name */
#ifdef RTEMS48 #if defined RTEMS48 || defined RTEMS410
rtems_bsdnet_loopattach, /* attach function */ rtems_bsdnet_loopattach, /* attach function */
#else #else
rtems_bsdnet_initialize_loop, rtems_bsdnet_initialize_loop,
...@@ -86,13 +101,16 @@ static struct rtems_bsdnet_ifconfig loopback_config = { ...@@ -86,13 +101,16 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
"255.0.0.0", /* IP net mask */ "255.0.0.0", /* IP net mask */
}; };
#if defined RTEMS48 || defined RTEMS410
/* /*
* Default network interface * Default network interface
*/ */
static struct rtems_bsdnet_ifconfig netdriver_config = { static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */ RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */ RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function greth_interface_driver_attach */
0, /* link to next interface */ // 0, /* link to next interface */
loopback_config,
/* /*
#ifdef RTEMS48 #ifdef RTEMS48
loopback_config, loopback_config,
...@@ -105,6 +123,16 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { ...@@ -105,6 +123,16 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
NULL, /* Driver supplies hardware address */ NULL, /* Driver supplies hardware address */
0 /* Use default driver parameters */ 0 /* Use default driver parameters */
}; };
#elif defined RTEMS412
#include <bsp/network_interface_add.h>
struct ethernet_config interface_configs[]=
{
{ "255.255.255.255", "255.255.255.255", {0x80,0x80,0x80,0x80,0x80,0x80}},// NULL - take PHY address and IP from device
{NULL, NULL, {0,0,0,0,0,0}} // NULL - used for BOOTP
};
#endif
/* /*
* Network configuration * Network configuration
...@@ -114,12 +142,14 @@ static struct rtems_bsdnet_ifconfig netdriver_config = { ...@@ -114,12 +142,14 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
* for details on each field * for details on each field
* *
*/ */
struct rtems_bsdnet_config rtems_bsdnet_config = { struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config, #ifdef RTEMS412
NULL, NULL,
#ifdef RTEMS48 #else
&netdriver_config,
#endif
NULL, /* Bootp */
#if defined RTEMS48 || defined RTEMS410
100, /* Default network task priority */ 100, /* Default network task priority */
#else #else
150, 150,
...@@ -174,6 +204,9 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id) ...@@ -174,6 +204,9 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id)
rnodes[dev].socket = -1; rnodes[dev].socket = -1;
} }
__po_hi_bus_id bus_current_node, bus_connect_node;
bus_current_node = *__po_hi_transport_get_accessed_buses(leon_eth_device_id);
/* /*
* Create a socket for each node that will communicate with us. * Create a socket for each node that will communicate with us.
*/ */
...@@ -181,7 +214,9 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id) ...@@ -181,7 +214,9 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id)
{ {
if (dev != leon_eth_device_id) if (dev != leon_eth_device_id)
{ {
bus_connect_node = *__po_hi_transport_get_accessed_buses(dev);
if (bus_current_node == bus_connect_node)
{
__PO_HI_SET_SOCKET_TIMEOUT(nodes[leon_eth_device_id].socket,500000); __PO_HI_SET_SOCKET_TIMEOUT(nodes[leon_eth_device_id].socket,500000);
established = 0; established = 0;
...@@ -220,7 +255,8 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id) ...@@ -220,7 +255,8 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id)
{ {
max_socket = sock; max_socket = sock;
} }
} } /* check the bus */
} /* check the device */
} }
__DEBUGMSG ("[DRIVER ETH] Poller initialization finished, waiting for other tasks\n"); __DEBUGMSG ("[DRIVER ETH] Poller initialization finished, waiting for other tasks\n");
__po_hi_wait_initialization (); __po_hi_wait_initialization ();
...@@ -333,12 +369,22 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id) ...@@ -333,12 +369,22 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id)
ipconf = (__po_hi_c_ip_conf_t*)__po_hi_get_device_configuration (id); ipconf = (__po_hi_c_ip_conf_t*)__po_hi_get_device_configuration (id);
#if defined RTEMS48 || defined RTEMS410
netdriver_config.ip_address = ipconf->address; netdriver_config.ip_address = ipconf->address;
if (ipconf->exist.netmask == 1) if (ipconf->exist.netmask == 1)
{ {
netdriver_config.ip_netmask = ipconf->netmask; netdriver_config.ip_netmask = ipconf->netmask;
} }
#elif defined RTEMS412
interface_configs[0].ip_addr = ipconf->address;
if (ipconf->exist.netmask == 1)
{
interface_configs[0].ip_netmask= ipconf->netmask;
}
#endif
if (ipconf->exist.gateway == 1) if (ipconf->exist.gateway == 1)
{ {
...@@ -350,16 +396,17 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id) ...@@ -350,16 +396,17 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id)
rtems_bsdnet_config.name_server[0] = ipconf->dns; rtems_bsdnet_config.name_server[0] = ipconf->dns;
} }
__po_hi_c_driver_rasta_common_init();
rtems_bsdnet_initialize_network ();
/* rtems_bsdnet_initialize_network();
#ifdef __PO_HI_DEBUG_INFO /*
#ifdef __PO_HI_DEBUG_INFO
rtems_bsdnet_show_if_stats (); rtems_bsdnet_show_if_stats ();
rtems_bsdnet_show_inet_routes (); rtems_bsdnet_show_inet_routes ();
rtems_bsdnet_show_ip_stats (); rtems_bsdnet_show_ip_stats ();
rtems_bsdnet_show_mbuf_stats ();
#endif #endif
*/ */
leon_eth_device_id = id; leon_eth_device_id = id;
...@@ -417,20 +464,36 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id) ...@@ -417,20 +464,36 @@ void __po_hi_c_driver_eth_leon_init (__po_hi_device_id id)
__po_hi_initialize_add_task (); __po_hi_initialize_add_task ();
__po_hi_create_generic_task // __po_hi_create_generic_task
(-1, 0,__PO_HI_MAX_PRIORITY, 0, 0, (void* (*)(void)) __po_hi_c_driver_eth_leon_poller, NULL); // (-1, 0,__PO_HI_MAX_PRIORITY, 0, 0, (void* (*)(void)) __po_hi_c_driver_eth_leon_poller, NULL);
__po_hi_create_generic_task(-1, 0, 2, 2*RTEMS_MINIMUM_STACK_SIZE, 0, (void* (*)(void)) __po_hi_c_driver_eth_leon_poller, NULL);
} }
/* /*
* For each node in the sytem that may communicate with the current * For each node in the sytem that may communicate with the current
* node we create a socket. This socket will be used to send data. * node we create a socket. This socket will be used to send data.
*/ */
__po_hi_bus_id bus_current_node, bus_connect_node;
bus_current_node = *__po_hi_transport_get_accessed_buses(id);
__DEBUGMSG("[DRIVER ETH] Device %d is connected to bus: %d\n", id,bus_current_node);
for (dev = 0 ; dev < __PO_HI_NB_DEVICES ; dev++ ) for (dev = 0 ; dev < __PO_HI_NB_DEVICES ; dev++ )
{ {
if (dev == id) if (dev == id)
{ {
continue; continue;
} }
bus_connect_node= *__po_hi_transport_get_accessed_buses(dev);
__DEBUGMSG("[DRIVER ETH] Device %d is connected to bus: %d\n", dev, bus_connect_node);
if (bus_current_node != bus_connect_node)
{
continue;
}
__DEBUGMSG ("[DRIVER ETH] Will initialize connection with device %d\n", dev); __DEBUGMSG ("[DRIVER ETH] Will initialize connection with device %d\n", dev);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* For more informations, please visit http://taste.tuxfamily.org/wiki * For more informations, please visit http://taste.tuxfamily.org/wiki
* *
* Copyright (C) 2010-2014 ESA & ISAE. * Copyright (C) 2010-2017 ESA & ISAE.
*/ */
#include <drivers/po_hi_driver_linux_serial.h> #include <drivers/po_hi_driver_linux_serial.h>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <marshallers.h> #include <marshallers.h>
#include <deployment.h> #include <deployment.h>
/* generated files */ /* generated files */
#include <linux/ioctl.h>
#include <termios.h> #include <termios.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -59,12 +59,14 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id) ...@@ -59,12 +59,14 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id)
__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); __po_hi_msg_reallocate (&__po_hi_c_driver_serial_linux_poller_msg);
n = 0; n = 0;
while (n < __PO_HI_MESSAGES_MAX_SIZE) while (n < __PO_HI_MESSAGES_MAX_SIZE)
{ {
if (read (po_hi_c_driver_serial_fd_read, &(__po_hi_c_driver_serial_linux_poller_msg.content[n]), 1) != 1) if (read (po_hi_c_driver_serial_fd_read, &(__po_hi_c_driver_serial_linux_poller_msg.content[n]), 1) != 1)
{ {
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Cannot read on socket !\n"); __PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Cannot read !\n");
return; return;
} }
...@@ -86,6 +88,7 @@ void __po_hi_c_driver_serial_linux_poller (const __po_hi_device_id dev_id) ...@@ -86,6 +88,7 @@ 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); __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_pointer = (unsigned long*) &__po_hi_c_driver_serial_linux_poller_msg.content[0];
swap_value = *swap_pointer; swap_value = *swap_pointer;
*swap_pointer = __po_hi_swap_byte (swap_value); *swap_pointer = __po_hi_swap_byte (swap_value);
...@@ -204,7 +207,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id) ...@@ -204,7 +207,7 @@ void __po_hi_c_driver_serial_linux_init_sender (__po_hi_device_id id)
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Error in tcsetattr()\n"); __PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Error in tcsetattr()\n");
} }
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] End of init\n"); __PO_HI_DEBUG_INFO ("[LINUX SERIAL] End of sender init\n");
} }
#endif #endif
...@@ -285,7 +288,7 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id) ...@@ -285,7 +288,7 @@ void __po_hi_c_driver_serial_linux_init_receiver (__po_hi_device_id id)
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Error in tcsetattr()\n");