Commit 37fd1851 authored by julien.delange's avatar julien.delange

* src/drivers/po_hi_driver_rasta_serial.c

   src/drivers/po_hi_driver_rasta_spacewire.c
   - Initialize the card only once

 * src/drivers/po_hi_driver_rasta_common.c
   include/drivers/po_hi_driver_rasta_common.h
   - Introduce common function for initialization
     to avoid multiple initialization from different
     RASTA drivers

 * src/drivers/Makefile.am
   include/drivers/Makefile.am
   - include new sources and headers in pohic release

 * include/po_hi_common.h
   - Update max number of drivers we can use inside RTEMS

 * share/make/Makefile.common
   - Automatically compile po_hi_driver_rasta_common.c file




git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@1432 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 06a66573
......@@ -8,6 +8,7 @@ EXTRA_DIST = $(srcdir)/po_hi_driver_linux_serial.h \
$(srcdir)/po_hi_driver_rasta_1553_brmlib.h \
$(srcdir)/po_hi_driver_xc4v_fpga.h \
$(srcdir)/po_hi_driver_rasta_serial.h \
$(srcdir)/po_hi_driver_rasta_common.h \
$(srcdir)/po_hi_driver_sockets.h \
$(srcdir)/po_hi_driver_keyboard.h \
$(srcdir)/po_hi_driver_sockets_common.h \
......
/*
* 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.
*
* Copyright (C) 2010, European Space Agency
*/
#include <deployment.h>
/* Generated code header */
#if ((defined __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA) || \
(defined __PO_HI_NEED_DRIVER_SERIAL_RASTA))
void __po_hi_c_driver_rasta_common_init ();
#endif
......@@ -28,6 +28,7 @@
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_TIMERS 40
#define CONFIGURE_MAXIMUM_TIMERS 40
#define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
......@@ -74,9 +75,7 @@
#include <inttypes.h>
#include <bsp.h>
#include <rtems/confdefs.h>
#endif /* RTEMS_POSIX */
#endif /* RTEMS_PURE */
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
#include <rtems/rtems_bsdnet.h>
......
......@@ -93,6 +93,7 @@ ifeq ($(NEED_TRANSPORT), yes)
drivers/po_hi_driver_sockets_asn1.o \
drivers/po_hi_driver_rtems_ne2000.o \
drivers/po_hi_driver_rasta_serial.o \
drivers/po_hi_driver_rasta_common.o \
drivers/po_hi_driver_rasta_1553.o \
drivers/po_hi_driver_xc4v_fpga.o \
drivers/po_hi_driver_rasta_1553_brmlib.o \
......
......@@ -6,6 +6,7 @@ C_FILES = $(srcdir)/po_hi_driver_linux_serial.c \
$(srcdir)/po_hi_driver_sockets_asn1.c \
$(srcdir)/po_hi_driver_rtems_ne2000.c \
$(srcdir)/po_hi_driver_rasta_spacewire.c \
$(srcdir)/po_hi_driver_rasta_common.c \
$(srcdir)/po_hi_driver_exarm.c \
$(srcdir)/po_hi_driver_keyboard.c \
$(srcdir)/po_hi_driver_exarm_ni_6071e_analog.c \
......
/*
* 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.
*
* Copyright (C) 2010, European Space Agency
*/
#include <deployment.h>
/* Generated code header */
#if ((defined __PO_HI_NEED_DRIVER_SPACEWIRE_RASTA) || \
(defined __PO_HI_NEED_DRIVER_SERIAL_RASTA))
#include <pci.h>
#include <rasta.h>
#include <apbuart_rasta.h>
/* Rasta includes from GAISLER drivers */
#include <po_hi_debug.h>
/* PolyORB-HI-C includes */
int __po_hi_c_driver_rasta_common_is_init = 0;
void __po_hi_c_driver_rasta_common_init ()
{
if (__po_hi_c_driver_rasta_common_is_init == 1)
{
return;
}
__DEBUGMSG ("[RASTA SERIAL] Init\n");
init_pci();
__DEBUGMSG ("[RASTA SERIAL] Initializing RASTA ...\n");
if ( rasta_register() ){
__DEBUGMSG(" ERROR !\n");
return;
}
__DEBUGMSG(" OK !\n");
__po_hi_c_driver_rasta_common_is_init = 1;
}
#endif
......@@ -21,6 +21,7 @@
#include <po_hi_utils.h>
#include <drivers/po_hi_rtems_utils.h>
#include <drivers/po_hi_driver_rasta_serial.h>
#include <drivers/po_hi_driver_rasta_common.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
......@@ -46,7 +47,7 @@ void __po_hi_c_driver_serial_rasta_poller (void)
int n;
int ts;
__DEBUGMSG ("[RASTA SERIAL] Hello, i'm the poller !\n");
__DEBUGMSG ("[RASTA SERIAL] Hello, i'm the serial poller !\n");
n = read (po_hi_c_driver_rasta_serial_fd, &(msg.content), __PO_HI_MESSAGES_MAX_SIZE);
......@@ -75,16 +76,8 @@ void __po_hi_c_driver_serial_rasta_poller (void)
void __po_hi_c_driver_serial_rasta_init (__po_hi_device_id id)
{
__DEBUGMSG ("[RASTA SERIAL] Init\n");
init_pci();
__DEBUGMSG ("[RASTA SERIAL] Initializing RASTA ...\n");
if ( rasta_register() ){
__DEBUGMSG(" ERROR !\n");
return;
}
__DEBUGMSG(" OK !\n");
po_hi_c_driver_rasta_serial_fd = open (__PO_HI_DRIVER_SERIAL_RASTA_DEVICE, O_RDWR);
__po_hi_c_driver_rasta_common_init ();
po_hi_c_driver_rasta_serial_fd = open (__PO_HI_DRIVER_SERIAL_RASTA_DEVICE, O_RDWR);
if (po_hi_c_driver_rasta_serial_fd < 0)
{
......
......@@ -21,6 +21,7 @@
#include <po_hi_messages.h>
#include <drivers/po_hi_rtems_utils.h>
#include <drivers/po_hi_driver_rasta_spacewire.h>
#include <drivers/po_hi_driver_rasta_common.h>
#include <stdlib.h>
#include <sys/ioctl.h>
......@@ -45,6 +46,9 @@ int po_hi_c_driver_rasta_spacewire_fd;
void po_hi_c_driver_rasta_spacewire_init_pkt(__po_hi_c_driver_spacewire_pkt_hdr_t *p, __po_hi_port_t destination_port)
{
p->addr = atoi (__po_hi_get_device_naming (destination_port));
__DEBUGMSG ("[RASTA SPACEWIRE] Init packet with address %d !\n", p->addr);
p->protid = 50;
p->dummy = 0x01;
p->channel = 0x01;
......@@ -60,7 +64,7 @@ void __po_hi_c_driver_spacewire_rasta_poller (void)
__po_hi_msg_t msg;
__po_hi_request_t request;
__DEBUGMSG ("[RASTA SPACEWIRE] Hello, i'm the poller !\n");
__DEBUGMSG ("[RASTA SPACEWIRE] Hello, i'm the spacewire poller !\n");
len = read (po_hi_c_driver_rasta_spacewire_fd,
&po_hi_c_driver_spacewire_rxpkt[0],
......@@ -100,16 +104,7 @@ void __po_hi_c_driver_spacewire_rasta_init (__po_hi_device_id id)
__DEBUGMSG ("[RASTA SPACEWIRE] Init\n");
init_pci();
__DEBUGMSG ("[RASTA SPACEWIRE] Initializing RASTA ...");
if (rasta_register ())
{
__DEBUGMSG(" ERROR !\n");
return;
}
__DEBUGMSG(" OK !\n");
__po_hi_c_driver_rasta_common_init ();
__DEBUGMSG ("[RASTA SPACEWIRE] Open spacewire device ...");
......
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