Commit d8c7b0bc authored by yoogx's avatar yoogx

* Update drivers for RTEMS 4.12

	Code contributed by Hariprasath SHANMUGASUNDARAM

	For openaadl/ocarina#123
parent 3bcc9bff
......@@ -5,14 +5,15 @@
*
* 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>
/* Generated code header */
#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 ();
......
......@@ -5,7 +5,7 @@
*
* 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__
......@@ -31,10 +31,19 @@
#include <rtems.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>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_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_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 40
......@@ -61,12 +70,35 @@
#define CONFIGURE_INIT
#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 */
#if defined(__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#include <inttypes.h>
#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>
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
......@@ -77,7 +109,7 @@
#define CONFIGURE_MAXIMUM_TIMERS 40
#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
/*
#define CONFIGURE_MAXIMUM_SEMAPHORES __PO_HI_NB_TASKS + (__PO_HI_NB_PORTS + 1) * 2 + __PO_HI_NB_PROTECTED + 1
......@@ -97,7 +129,7 @@
#ifndef RTEMS411
rtems_task Init (rtems_task_argument no_argument);
#endif
#define CONFIGURE_STACK_CHECKER_ENABLED
#define CONFIGURE_EXTRA_TASK_STACKS __PO_HI_TASKS_STACK
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
......@@ -110,6 +142,9 @@
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
#include <rtems/rtems_bsdnet.h>
#include <bsp.h>
/*
int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig*, int);
static struct rtems_bsdnet_ifconfig loopback_config =
......@@ -127,6 +162,8 @@ struct rtems_bsdnet_ifconfig netdriver_config =
struct rtems_bsdnet_config rtems_bsdnet_config =
{&netdriver_config,NULL,0,256 * 1024,256 * 1024,};
*/
#endif /*(defined (X86_RTEMS) */
......
......@@ -19,6 +19,7 @@ endef
MANAGERS = all
LIBS = -lrtemsall -lc
CC = $(CC_FOR_TARGET)
CPP = $(CXX_FOR_TARGET)
......@@ -58,6 +59,13 @@ ifeq ($(RTEMS_API),4.12)
TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm
endif
ifeq ($(RTEMS_BSP),leon3)
TARGET_CFLAGS += -DGRLEON3
endif
ifeq ($(RTEMS_BSP),leon2)
TARGET_CFLAGS += -DGRLEON2
endif
target-clean:
......
......@@ -18,6 +18,7 @@ endef
MANAGERS = all
LIBS = -lrtemsall -lc
CC = $(CC_FOR_TARGET)
CPP = $(CXX_FOR_TARGET)
......@@ -57,7 +58,13 @@ ifeq ($(RTEMS_API),4.12)
TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm
endif
ifeq ($(RTEMS_BSP),leon3)
TARGET_CFLAGS += -DGRLEON3
endif
ifeq ($(RTEMS_BSP),leon2)
TARGET_CFLAGS += -DGRLEON2
endif
ifdef USE_GPROF
TARGET_LDFLAGS+=-Wl,--wrap,Clock_isr -pg
......
......@@ -5,7 +5,7 @@
*
* 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>
......@@ -22,6 +22,9 @@
#include <po_hi_transport.h>
#include <po_hi_returns.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_sockets.h>
#include <drivers/configuration/ip.h>
......@@ -50,7 +53,7 @@ __po_hi_inetnode_t nodes[__PO_HI_NB_DEVICES];
__po_hi_inetnode_t rnodes[__PO_HI_NB_DEVICES];
__po_hi_device_id leon_eth_device_id;
extern void rtems_stack_checker_report_usage(void);
#if defined (__PO_HI_NEED_DRIVER_ETH_LEON) || \
defined (__PO_HI_NEED_DRIVER_ETH_LEON_RECEIVER)
......@@ -60,22 +63,34 @@ __po_hi_device_id leon_eth_device_id;
timeout.tv_usec = 0; \
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_NAME "open_eth1"
#endif
#include <bsp.h>
#include <rtems/rtems_bsdnet.h>
#ifdef RTEMS48
#if defined RTEMS48 || defined RTEMS410
extern void rtems_bsdnet_loopattach();
#else
extern void rtems_bsdnet_initialize_loop();
#endif
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
#ifdef RTEMS48
#if defined RTEMS48 || defined RTEMS410
rtems_bsdnet_loopattach, /* attach function */
#else
rtems_bsdnet_initialize_loop,
......@@ -86,13 +101,16 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
"255.0.0.0", /* IP net mask */
};
#if defined RTEMS48 || defined RTEMS410
/*
* Default network interface
*/
static struct rtems_bsdnet_ifconfig netdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
0, /* link to next interface */
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function greth_interface_driver_attach */
// 0, /* link to next interface */
loopback_config,
/*
#ifdef RTEMS48
loopback_config,
......@@ -105,6 +123,16 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
NULL, /* Driver supplies hardware address */
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
......@@ -114,12 +142,14 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
* for details on each field
*
*/
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config,
NULL,
#ifdef RTEMS48
#ifdef RTEMS412
NULL,
#else
&netdriver_config,
#endif
NULL, /* Bootp */
#if defined RTEMS48 || defined RTEMS410
100, /* Default network task priority */
#else
150,
......@@ -174,6 +204,9 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id)
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.
*/
......@@ -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)
{
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);
established = 0;
......@@ -220,7 +255,8 @@ void __po_hi_c_driver_eth_leon_poller (const __po_hi_device_id dev_id)
{
max_socket = sock;
}
}
} /* check the bus */
} /* check the device */
}
__DEBUGMSG ("[DRIVER ETH] Poller initialization finished, waiting for other tasks\n");
__po_hi_wait_initialization ();
......@@ -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);
#if defined RTEMS48 || defined RTEMS410
netdriver_config.ip_address = ipconf->address;
if (ipconf->exist.netmask == 1)
{
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)
{
......@@ -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_initialize_network ();
/*
#ifdef __PO_HI_DEBUG_INFO
__po_hi_c_driver_rasta_common_init();
rtems_bsdnet_initialize_network();
/*
#ifdef __PO_HI_DEBUG_INFO
rtems_bsdnet_show_if_stats ();
rtems_bsdnet_show_inet_routes ();
rtems_bsdnet_show_ip_stats ();
rtems_bsdnet_show_mbuf_stats ();
#endif
*/
leon_eth_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_create_generic_task
(-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,__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
* 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++ )
{
if (dev == id)
{
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);
......
......@@ -5,7 +5,7 @@
*
* 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>
......@@ -28,7 +28,7 @@
#include <marshallers.h>
#include <deployment.h>
/* generated files */
#include <linux/ioctl.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -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_msg_reallocate (&__po_hi_c_driver_serial_linux_poller_msg);
n = 0;
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)
{
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Cannot read on socket !\n");
__PO_HI_DEBUG_CRITICAL ("[LINUX SERIAL] Cannot read !\n");
return;
}
......@@ -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);
/*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);
......@@ -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_INFO ("[LINUX SERIAL] End of init\n");
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] End of sender init\n");
}
#endif
......@@ -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");
}
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] End of init\n");
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] End of receiver init\n");
}
#endif
......@@ -301,7 +304,6 @@ void __po_hi_c_driver_serial_linux_init (__po_hi_device_id id)
}
#endif
#if defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX) || \
defined (__PO_HI_NEED_DRIVER_SERIAL_LINUX_SENDER)
......@@ -323,7 +325,7 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
if (request->port == -1)
{
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] Send output task %d, port %d (local_port=%d): no value to send\n", task_id, port, local_port);
__PO_HI_DEBUG_DEBUG("[LINUX SERIAL] Send output task %d, port %d (local_port=%d): no value to send\n", task_id, port, local_port);
return __PO_HI_SUCCESS;
}
......@@ -335,7 +337,7 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
__po_hi_marshall_request (request, &__po_hi_c_driver_serial_linux_sender_msg);
/* Swap only the port (first 32 bytes) */
/* Swap only the port (first 32 bits) */
swap_pointer = (unsigned long*) &__po_hi_c_driver_serial_linux_sender_msg.content[0];
swap_value = *swap_pointer;
*swap_pointer = __po_hi_swap_byte (swap_value);
......@@ -346,12 +348,35 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
{
write (po_hi_c_driver_serial_fd_write, &(__po_hi_c_driver_serial_linux_sender_msg.content[n]), 1);
usleep (po_hi_c_driver_serial_sending_wait);
fsync(po_hi_c_driver_serial_fd_write);
if (n <= 0)
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] failed to write !\n");
}
}
}
else
{
n = write (po_hi_c_driver_serial_fd_write, &__po_hi_c_driver_serial_linux_sender_msg, __PO_HI_MESSAGES_MAX_SIZE);
n = write (po_hi_c_driver_serial_fd_write, &(__po_hi_c_driver_serial_linux_sender_msg.content[0]), __PO_HI_MESSAGES_MAX_SIZE);
fsync(po_hi_c_driver_serial_fd_write);
if (n < 0)
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] failed !\n");
}
else if((0 <= n)&(n < __PO_HI_MESSAGES_MAX_SIZE))
{
__PO_HI_DEBUG_CRITICAL (" [LINUX SERIAL] Unable write !\n");
}
else
{
__PO_HI_DEBUG_DEBUG (" [LINUX SERIAL] OK !\n");
}
}
__PO_HI_DEBUG_DEBUG ("[LINUX SERIAL] write() returns %d, message sent: 0x", n);
......
......@@ -5,26 +5,92 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2016 ESA & ISAE.
* Copyright (C) 2010-2017 ESA & ISAE.
*/
#include <deployment.h>
/* Generated code header */
#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 ))
#include <rtems.h>
#include <rtems/bspIo.h>
#include <pci.h>
#include <rasta.h>
#include <ambapp.h>
#include <grspw_rasta.h>
#ifdef GRLEON2
#include <grspw_rasta.h>
#include <pci.h>
#include <rasta.h>
#include <apbuart_rasta.h>
#endif
/* Rasta includes from GAISLER drivers */
#if defined GRLEON3 && defined RTEMS412
#include <amba.h>
#include <ambapp.h>
#include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus_grlib.h>
#include <drvmgr/ambapp_bus.h>
/* GRSPW0 resources */
struct drvmgr_key grlib_grspw0_res[] =
{
{"txDesc", DRVMGR_KT_INT, {(unsigned int)16}},
{"rxDesc", DRVMGR_KT_INT, {(unsigned int)32}},
DRVMGR_KEY_EMPTY
};
/* GRSPW1 and GRSPW2 resources */
struct drvmgr_key grlib_grspw1_res[] =
{
{"txDesc", DRVMGR_KT_INT, {(unsigned int)16}},
{"rxDesc", DRVMGR_KT_INT, {(unsigned int)32}},
DRVMGR_KEY_EMPTY
};
/* GRSPW1 and GRSPW2 resources */
struct drvmgr_key grlib_grspw2_res[] =
{
{"txDesc", DRVMGR_KT_INT, {(unsigned int)16}},
{"rxDesc", DRVMGR_KT_INT, {(unsigned int)32}},
DRVMGR_KEY_EMPTY
};
struct drvmgr_key grlib_greth0_res[] =
{
{"txDescs", DRVMGR_KT_INT, {(unsigned int)16}},
{"rxDescs", DRVMGR_KT_INT, {(unsigned int)32}},
DRVMGR_KEY_EMPTY
};
struct drvmgr_key grlib_grcan0_res[] =
{
{"txDescs", DRVMGR_KT_INT, {(unsigned int)16}},
{"rxDescs", DRVMGR_KT_INT, {(unsigned int)32}},
DRVMGR_KEY_EMPTY
};
/* GRLIB Plug & Play bus driver resources */
struct drvmgr_drv_res grlib_drv_resources[] =
{
{DRIVER_AMBAPP_GAISLER_GRSPW2_ID, 0, &grlib_grspw0_res[0]},
{DRIVER_AMBAPP_GAISLER_GRSPW2_ID, 1, &grlib_grspw1_res[0]},
{DRIVER_AMBAPP_GAISLER_GRSPW2_ID, 2, &grlib_grspw2_res[0]},
{DRIVER_AMBAPP_GAISLER_GRCAN_ID, 0, &grlib_grcan0_res[0]},
{DRIVER_AMBAPP_GAISLER_GRETH_ID, 0, &grlib_greth0_res[0]},
DRVMGR_RES_EMPTY
};
struct grlib_config grlib_bus_config =
{
&ambapp_plb, /* AMBAPP bus setup */
&grlib_drv_resources, /* Driver configuration */
};
#endif
#include <po_hi_debug.h>
/* PolyORB-HI-C includes */
......@@ -52,7 +118,7 @@
int __po_hi_c_driver_rasta_common_is_init = 0;
#ifdef RTEMS48
#if defined RTEMS48 || defined RTEMS410
int apbuart_rasta_register(amba_confarea_type *bus);
static amba_confarea_type abus;
extern LEON3_IrqCtrl_Regs_Map *irq;
......@@ -73,6 +139,8 @@ struct ambapp_bus * __po_hi_driver_rasta_common_get_bus ()
{
return &abus;
}
#elif RTEMS412
;
#else
#error "o<"
#endif
......@@ -322,6 +390,24 @@ void __po_hi_c_driver_rasta_common_init ()
return;
}
#if defined GRLEON3 && defined RTEMS412
/* Register GRLIB root bus */
ambapp_grlib_root_register(&grlib_bus_config);
/* Initializing Driver Manager if not alread performed by BSP */
__PO_HI_DEBUG_DEBUG("Initializing Driver manager...\n");
if ( drvmgr_init() ) {
__PO_HI_DEBUG_DEBUG ("Driver manager Failed to initialize\n");
exit(-1);
}
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_DEBUG
/* Print Driver manager drivers and their assigned devices */
__PO_HI_DEBUG_DEBUG("[drvmgr] ");
drvmgr_summary();
#endif
#elif GRLEON2
__PO_HI_DEBUG_DEBUG ("[RASTA COMMON] Init\n");
init_pci();
__PO_HI_DEBUG_DEBUG ("[RASTA COMMON] Initializing RASTA ...");
......@@ -336,7 +422,7 @@ void __po_hi_c_driver_rasta_common_init ()
__PO_HI_DEBUG_DEBUG(" ERROR !\n");
return;
}
#endif
__PO_HI_DEBUG_DEBUG (" OK !\n");
__po_hi_c_driver_rasta_common_is_init = 1;
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2016 ESA & ISAE.
* Copyright (C) 2010-2017 ESA & ISAE.
*/
#include <deployment.h>
......@@ -32,20 +32,29 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
/* POSIX-style files */
#include <rtems/bspIo.h>
#include <ambapp.h>
#ifdef GRLEON2
#include <pci.h>
#include <rasta.h>
#include <grspw_rasta.h>
#include <apbuart_rasta.h>
/* Rasta includes from GAISLER drivers */
#endif
#if defined GRLEON3 && defined RTEMS412
#include <rtems.h>
#include <bsp/grspw.h>
#endif
#define __PO_HI_DRIVER_SPACEWIRE_RASTA_DEVICE "/dev/grspwrasta0"
/* Rasta includes from GAISLER drivers */
__po_hi_request_t __po_hi_c_driver_spacewire_rasta_request;
__po_hi_msg_t __po_hi_c_driver_spacewire_rasta_poller_msg;
......@@ -70,7 +79,7 @@ void __po_hi_c_driver_spacewire_rasta_poller (const __po_hi_device_id dev_id)
__PO_HI_DEBUG_DEBUG ("[RASTA SPACEWIRE] Poller received a message, len=%d\n", len);
if (len < 0)
{
__PO_HI_DEBUG_DEBUG ("[RASTA SPACEWIRE] Error while reading\n");
__PO_HI_DEBUG_CRITICAL ("[RASTA SPACEWIRE] Error while reading\n");
}
else