Commit ac3b8492 authored by Jerome Hugues's avatar Jerome Hugues

* Update drivers configuration for RTEMS5 variants

    Patch contributed by Thanassis Tsiodras
parent edfb2899
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2018 ESA & ISAE.
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-2020 ESA & ISAE.
*/
#ifndef __PO_HI_COMMON_H__
......@@ -33,9 +33,20 @@
#if defined GRLEON3 && defined RTEMS412
#include <drvmgr/drvmgr.h>
#include <amba.h>
#include <bsp/grspw.h>
// #include <amba.h>
// #include <bsp/grspw.h>
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/ambapp_bus.h>
#else
#include <drvmgr/ambapp_bus.h>
#endif
#endif
#define CONFIGURE_INIT
......
......@@ -6,19 +6,16 @@
## This file has been built for a generic RTEMS integration
MANAGERS = sem rtmon msg timer io
LIBS = #-lrtemsall -lc
RTEMS_USES_NEWLIB = no
MANAGERS = all
LIBS = -lrtemsall -lc
# PolyORB-HI/C specific flags
POHI_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS $(GCC_GENERIC_FLAGS)
# PolyORb-HI/C specific flags
POHI_CFLAGS = -DRTEMS_POSIX -DLEON_RTEMS $(GCC_GENERIC_FLAGS) -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar
# RTEMS/AIR specific flags
POHI_CFLAGS += -DAIR_HYPERVISOR -I$(AIR_ROOT)/pmk/core/include \
-I$(AIR_ROOT)/pmk/arch/sparc/include \
-I$(AIR_ROOT)/install/libs/imaspex/include/ -I./ -B./ -I../common/ \
-B../common/ -DRTEMS5 -B$(AIR_LIBS)/imaspex/ -B$(AIR_LIBS)/libprintf/ \
-B$(AIR_LIBS)/libair/
POHI_CFLAGS += -DAIR_HYPERVISOR -I$(AIR_ROOT)/pmk/core/include \
-I$(AIR_ROOT)/pmk/arch/sparc/include \
-I$(AIR_ROOT)/install/libs/imaspex/include/
LD_LIBS = $(AIR_LIBS)/libprintf/libprintf.a \
$(AIR_LIBS)/libair/libair.a $(AIR_LIBS)/imaspex/imaspex.a
......@@ -26,19 +23,12 @@ $(AIR_LIBS)/libair/libair.a $(AIR_LIBS)/imaspex/imaspex.a
LINK_LIBS += $(AIR_LIBS)/libprintf/libprintf.a \
$(AIR_LIBS)/libair/libair.a $(AIR_LIBS)/imaspex/imaspex.a
# The RTEMS_MAKEFILE_PATH is defined by the user for the specific CPU and BSP
RTEMS_MAKEFILE_PATH=$(AIR_POS)/rtems5/rtems5-install/sparc-rtems5/leon3
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg
-include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
-include $(RTEMS_CUSTOM)
-include $(PROJECT_ROOT)/make/leaf.cfg
CPPFLAGS += -DAIR_HYPERVISOR./ -I./ -B./ -I../common/ -B../common/ \
-DRTEMS5 -B$(AIR_LIBS)/imaspex/ -B$(AIR_LIBS)/libprintf/ \
-B$(AIR_LIBS)/libair/
TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--wrap=printf -Wl,--wrap=puts \
-Wl,--wrap=putchar
CPPFLAGS += -DAIR_HYPERVISOR./ -I./ -B./ -I../common/ -B../common/ -B$(AIR_LIBS)/libprintf/ -B$(AIR_LIBS)/libair/
##############################################################################
# RTEMS_API is defined as part of RTEMS BSP Makefile. It reports the
......@@ -71,8 +61,8 @@ ifeq ($(RTEMS_API),4.12)
endif
ifeq ($(RTEMS_API),5)
POHI_CFLAGS += -DRTEMS5
TARGET_LDFLAGS += -lm
POHI_CFLAGS += -DRTEMS412
TARGET_LDFLAGS += -L$(RUNTIME_PATH)/libs/leon-rtems4.12/ -lm
endif
##############################################################################
......@@ -101,8 +91,17 @@ ifeq ($(RTEMS_BSP),leon2)
POHI_CFLAGS += -DGRLEON2
endif
ifdef USE_GPROF
TARGET_LDFLAGS+=-Wl,--wrap,Clock_isr -pg
EXTERNAL_OBJECTS+=po_hi_gprof_rtems_leon.o
TARGET_INCLUDE+=-I$(RTEMS_MAKEFILE_PATH)/lib/include/
target-objects:
$(CC) $(INCLUDE) $(TARGET_INCLUDE) -D__PO_HI_USE_GPROF -Wall -c -o po_hi_gprof_rtems_leon.o $(RUNTIME_PATH)/src/po_hi_gprof_rtems_leon.c
else
target-objects:
endif
LINK_LIBS+=-lm
target-clean:
target-objects:
/*
* 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) 2020 ESA & ISAE.
*/
/* Note, this file is from RCC1.3rc4 sample directory.
*
* Any modification there should be carefully weighted.
......@@ -20,7 +30,18 @@
/*#define LEON2_GRLIB*/
/* Configure Network if enabled */
#ifdef ENABLE_NETWORK
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/network_interface_add.h>
#else
#include <bsp/network_interface_add.h>
#endif
//#include "networkconfig.h"
// Gaisler uses this file, user provided. for the moment, config done
......
/*
* 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) 2020 ESA & ISAE.
*/
/* Note, this file is from RCC1.3rc4 sample directory.
*
* Any modification there should be carefully weighted.
*/
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/ambapp_bus_grlib.h>
#include <grlib/ambapp_bus.h>
#include <grlib/ambapp_ids.h>
#else
#include <drvmgr/ambapp_bus_grlib.h>
#include <drvmgr/ambapp_bus.h>
#include <ambapp_ids.h>
#endif
/* B1553RT driver configuration (optional) */
struct drvmgr_key grlib_drv_res_b1553rt0[] =
......
/*
* 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) 2020 ESA & ISAE.
*/
#include <bsp/gr_leon4_n2x.h>
#include <drvmgr/ambapp_bus.h>
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/ambapp_bus.h>
#else
#include <drvmgr/ambapp_bus.h>
#endif
/* GR-CPCI-LEON4-N2X boards configuration example. Note that this is
* optional, we only override defaults. If default are ok, nothing
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2018 ESA & ISAE.
* Copyright (C) 2018-2020 ESA & ISAE.
*/
/* This driver relies on the GRSPW2 Packet library proposed in RTEMS
......@@ -500,55 +500,37 @@ size_t grspw_receiving(int device,void *message){
rtems_semaphore_obtain(dma_sync_rx, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
rtems_semaphore_obtain(dma_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
size_t message_size_received = 0;
int actual_device;
struct grspw_pkt *pkt;
/* Get a RX packet buffer from the HEAD */
/* For the time being, we ignore device and scan all devices, this disable routing for the moment */
for (actual_device = 0; actual_device < nospw; actual_device++) {
pkt = devs[actual_device].rx_buf_list.head;
if (pkt != NULL) {
/* The new head is the following pkt, pkt->next */
devs[actual_device].rx_buf_list.head = pkt->next;
devs[actual_device].rx_buf_list_cnt--;
if (pkt->next == NULL){
/* It was the last RX packet */
devs[actual_device].rx_buf_list.tail = NULL;
}
/* Assuming 1 byte = 1 char */
int offset = HEADER_SIZE - 1;
while ( ( ((char *) pkt->data)[offset] != SPW_PROT_ID) && (offset >= 0))
offset--;
offset += 3;
/*
computation of the offset to determine where is value '155'
we need to add two bytes after the 155 for the offset
*/
/* The header is included in the dlen on HEADER_SIZE bytes */
message_size_received = pkt->dlen - offset;
if (message_size_received <= PKT_SIZE - HEADER_SIZE){
memcpy (message,pkt->data + offset, message_size_received);
}
else{
printf("Message too long not received ");
}
/* Reschedule packet by adding it to the rx_list */
grspw_list_append(&devs[actual_device].rx_list, pkt);
devs[actual_device].rx_list_cnt++;
rtems_semaphore_release(dma_sem);
return message_size_received;
pkt = devs[device].rx_buf_list.head;
if (pkt != NULL) {
/* The new head is the following pkt, pkt->next */
devs[device].rx_buf_list.head = pkt->next;
devs[device].rx_buf_list_cnt--;
if (pkt->next == NULL){
/* It was the last RX packet */
devs[device].rx_buf_list.tail = NULL;
}
/* Assuming 1 byte = 1 char */
/* The header is included in the dlen on HEADER_SIZE bytes */
message_size_received = pkt->dlen - HEADER_SIZE;
if (message_size_received <= PKT_SIZE - HEADER_SIZE){
memcpy (message,pkt->data + HEADER_SIZE, message_size_received);
}
else{
printf("Message too long not received ");
}
/* Reschedule packet by adding it to the rx_list */
grspw_list_append(&devs[device].rx_list, pkt);
devs[device].rx_list_cnt++;
}
else{
/* rx_buf_list is empty */
printf(" No free received buffers available, size 0\n");
//continue;
}
rtems_semaphore_release(dma_sem);
return message_size_received;
}
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2011-2018 ESA & ISAE.
* Copyright (C) 2011-2020 ESA & ISAE.
*/
#include <deployment.h>
......@@ -124,7 +124,17 @@ static struct rtems_bsdnet_ifconfig netdriver_config = {
0 /* Use default driver parameters */
};
#elif defined RTEMS412
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/network_interface_add.h>
#else
#include <bsp/network_interface_add.h>
#endif
struct ethernet_config interface_configs[]=
{
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2018 ESA & ISAE.
* Copyright (C) 2010-2020 ESA & ISAE.
*/
#include <deployment.h>
......@@ -35,7 +35,18 @@
#include <ambapp.h>
#include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus_grlib.h>
#include <drvmgr/ambapp_bus.h>
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/ambapp_bus.h>
#else
#include <drvmgr/ambapp_bus.h>
#endif
/* GRSPW0 resources */
struct drvmgr_key grlib_grspw0_res[] =
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2010-2018 ESA & ISAE.
* Copyright (C) 2010-2020 ESA & ISAE.
*/
#include <deployment.h>
......@@ -161,14 +161,13 @@ void __po_hi_c_driver_spacewire_rasta_init (__po_hi_device_id id)
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_COREFREQ,30000);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_RXBLOCK,1);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_TXBLOCK,1);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_NODEADDR, node_addr);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_PROMISCUOUS,1);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_NODEADDR, (unsigned char)node_addr); //
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_PROMISCUOUS,1); //
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_CLKDIV, 0);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL,1);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_SET_RM_PROT_ID,0);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_START,2000);
#ifdef RTEMS412
spw_config *cnf = (spw_config *)malloc(sizeof(spw_config));
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_spacewire_fd[id],SPACEWIRE_IOCTRL_GET_CONFIG,cnf);
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2018 ESA & ISAE.
* Copyright (C) 2018-2020 ESA & ISAE.
*/
#include <stdio.h>
......@@ -79,7 +79,16 @@ __po_hi_device_id leon_eth_device_id;
#include <bsp.h>
#include <rtems/rtems_bsdnet.h>
// Things are always moving around in RTEMS - adapt.
// The latest RTEMS (2019/07) has restructured Leon/AMBA
// headers under grlib. Detect this by a combination of checks,
// that depends on the fact that our custom cross build in TASTE
// enabled Ada (which Gaisler's RCC doesn't).
#if ((__RTEMS_ADA__ != 0) && (((__RTEMS_MAJOR__ << 8) | (__RTEMS_MINOR__ << 0)) >= 0x0500))
#include <grlib/network_interface_add.h>
#else
#include <bsp/network_interface_add.h>
#endif
#ifdef RTEMS_USE_LOOPBACK
/*
......
......@@ -5,7 +5,7 @@
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
* Copyright (C) 2018 ESA & ISAE.
* Copyright (C) 2018-2020 ESA & ISAE.
*/
#include <deployment.h>
......@@ -249,6 +249,7 @@ void __po_hi_c_driver_rtems_drvmgr_serial_init (__po_hi_device_id id)
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Unknwon speed for the serial line\n");
break;
}
cfmakeraw (&newtio);
cfmakeraw (&newtio);
......
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