Commit e29378ae authored by Guilherme Sanches's avatar Guilherme Sanches

Changes to try solve the makefile.inc problem. rtems48i is being

compiled by sparc-rtems5-gcc when it can only be compiled by the
sparc-rtems4.11-gcc at the most.

refs #129490

 Changes to be committed:
	new file:   examples/iop_can/config.xml
	new file:   examples/iop_can/iop.xml
	renamed:    examples/iop_example/iop/iop_config.c -> examples/iop_can/iop/iop_config.c
	renamed:    examples/iop_example/iop/iop_logical_device_0.c -> examples/iop_can/iop/iop_logical_device_0.c
	renamed:    examples/iop_example/iop/iop_physical_device_0.c -> examples/iop_can/iop/iop_physical_device_0.c
	renamed:    examples/iop_example/iop/iop_ports.c -> examples/iop_can/iop/iop_ports.c
	new file:   examples/iop_can/queuing/queuing.c
	new file:   examples/iop_can/sampling/sampling.c
	new file:   libs/libiop/can_support.c
	new file:   libs/libiop/can_tasks.c
	new file:   libs/libiop/drivers/occan/include/grlib.h
	new file:   libs/libiop/drivers/occan/include/iop_occan.h
	new file:   libs/libiop/drivers/occan/include/occan_msg_queue.h
	new file:   libs/libiop/drivers/occan/iop_occan.c
	new file:   libs/libiop/drivers/occan/occan_msg_queue.c
	modified:   libs/libiop/eth_tasks.c
	new file:   libs/libiop/include/can_support.h
	modified:   libs/libiop/include/iop.h
	modified:   libs/libiop/include/iop_headers.h
	modified:   pmk/core/ports.c
	modified:   pos/rtems48i/edilib/Makefile.hc
	modified:   pos/rtems48i/rtems48i/c/src/lib/libbsp/sparc/shared/amba/ambapp.c
	modified:   pos/rtems48i/rtems48i/c/src/lib/libbsp/sparc/shared/include/ambapp.h
	modified:   pos/rtems5/rtems5/c/src/lib/libbsp/sparc/shared/amba/ambapp.c
	modified:   tools/configurator/air/pos/rtems48i/rtems48i_makefile.mako
	modified:   tools/configurator/air/pos/rtems48i/rtems48i_partition_makefile.mako
	modified:   tools/configurator/air/targets/sparc/leon3/config.py
	modified:   tools/configurator/air/targets/sparc/leon4/config.py
	modified:   tools/configurator/parsers/iop/definitions.py
	modified:   tools/configurator/parsers/iop/devices.py
	modified:   tools/configurator/parsers/iop/gaisler_devices.py
	modified:   tools/configurator/parsers/iop/parser.py
	modified:   tools/configurator/parsers/iop/ti_devices.py
	modified:   tools/configurator/templates/air_configuration/air_makefile.mako
	modified:   tools/configurator/templates/app_configuration/iop/include/iop_templates.mako
	modified:   tools/configurator/templates/app_configuration/iop/iop_grspw.mako
	modified:   tools/configurator/templates/app_configuration/iop/iop_logical_device.mako
	new file:   tools/configurator/templates/app_configuration/iop/iop_occan.mako
	modified:   tools/configurator/templates/include/makefile.mako
	modified:   tools/configurator/tools/configure_air.py
	modified:   ../utils/jenkins/aftercommitbuild.sh
parent 32ec4ce8
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ModuleName="iop_example">
<!-- Partition 2 -->
<Partition PartitionIdentifier="2" PartitionName="iop"
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="false">
<Sampling_Port Name="iop_sender"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="iop_receiver"
Direction="DESTINATION" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS" IOP="iop.xml" Cores="1">
<Libs>LIBAIR; LIBIOP; LIBPRINTF</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
</Permissions>
</PartitionConfiguration>
</Partition>
<!-- Partition 1 -->
<Partition PartitionIdentifier="1" PartitionName="partition1"
Criticality="LEVEL_A" EntryPoint="entry_func" SystemPartition="false">
<Sampling_Port Name="partition_receiver"
Direction="DESTINATION" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="partition_sender"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS" Cores="1">
<Libs>LIBAIR; IMASPEX; LIBPRINTF</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
CACHE_CONTROL; GLOBAL_TIME; SET_TOD; SET_PARTITION_MODE;
</Permissions>
</PartitionConfiguration>
</Partition>
<!-- Schedule 1 -->
<Module_Schedule ScheduleIdentifier="1" ScheduleName="schedule"
InitialModuleSchedule="true" MajorFrameSeconds="1.0">
<Partition_Schedule PartitionIdentifier="1" PartitionName="partition1"
PeriodDurationSeconds="0.5" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="1" PartitionPeriodStart="true"
WindowDurationSeconds="0.5" WindowStartSeconds="0.0"/>
</Partition_Schedule>
<Partition_Schedule PartitionIdentifier="2" PartitionName="iop"
PeriodDurationSeconds="0.5" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="3" PartitionPeriodStart="true"
WindowDurationSeconds="0.5" WindowStartSeconds="0.5"/>
</Partition_Schedule>
</Module_Schedule>
<!-- Connection table -->
<Connection_Table>
<Channel ChannelIdentifier="1" ChannelName="MessageIn">
<Source>
<Standard_Partition PartitionIdentifier="1" PartitionName="partition1"
PortName="partition_sender"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="2" PartitionName="iop"
PortName="iop_receiver"/>
</Destination>
</Channel>
<Channel ChannelIdentifier="2" ChannelName="MessageOut">
<Source>
<Standard_Partition PartitionIdentifier="2" PartitionName="iop"
PortName="iop_sender"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="1" PartitionName="partition1"
PortName="partition_receiver"/>
</Destination>
</Channel>
</Connection_Table>
<!-- Module configuration -->
<AIR_Configuration TicksPerSecond="1000" RequiredCores="1"/>
</ARINC_653_Module>
<?xml version="1.0" encoding="UTF-8"?>
<IOPartition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="iop.xsd" version="1.0" date="2017-11-20" name="iop_example" request_number="64" time_to_live="5">
<RemotePorts>
<Port Name="iop_receiver" LogicalDeviceId="1"/>
<Port Name="iop_sender" />
</RemotePorts>
<LogicalDevices>
<Device Id="1" Name="PARSERVER" Extended="1" RTR="0" />
</LogicalDevices>
<PhysicalDevices>
<Device Id="1" Device="CAN0" CanID ="2" Speed="250" TXD="32" RXD="32" InternalQueue="8" SingleMode="true" Code="f:f:f:f" Mask="f:f:f:f">
<PhysicalRoute Id="1" PortId="iop_sender">
<CanHeader Extended="true" RTR="true" CanID="1"/>
</PhysicalRoute>
<LogicalRoute Id="2" LogicalDeviceId="1">
<CanHeader Extended="false" RTR="false" CanID="1"/>
</LogicalRoute>
</Device>
</PhysicalDevices>
<ModuleSchedules>
<Schedule ScheduleIdentifier="1">
<DevicesConfiguration>
<Device DeviceId="1" Device="CAN0" Reads="5"/>
</DevicesConfiguration>
<RoutesConfiguration>
<Route RouteId="1" Active="true"/>
<Route RouteId="2" Active="true"/>
</RoutesConfiguration>
</Schedule>
</ModuleSchedules>
</IOPartition>
......@@ -24,7 +24,7 @@ static iop_physical_device_t *physical_device_list[1] = \
};
/**
* @brief Physical devices list
* @brief Logical devices list
*/
static iop_logical_device_t *logical_device_list[1] = \
{
......@@ -33,10 +33,12 @@ static iop_logical_device_t *logical_device_list[1] = \
static iop_wrapper_t requests_storage[1024];
/**
* @brief IOP buffers
*/
static iop_buffer_t iop_buffers[1024];
static uint8_t iop_buffers_storage[1024 * IOP_BUFFER_SIZE];
/**
* @brief IOP application configurations
*/
......@@ -45,18 +47,18 @@ iop_configuration_t usr_configuration = {
.wrappers = requests_storage,
.iop_buffers = iop_buffers,
.iop_buffers_storage = iop_buffers_storage,
.wrappers_count = 1024,
.wrappers_count = 1024,
.physical_devices = {
.length = 1,
.elements = physical_device_list
},
.logical_devices = {
.length = 1,
.logical_devices = {
.length = 2,
.elements = logical_device_list
},
.remote_ports = {
.length = 2,
.length = 3,
.elements = remote_ports
}
};
......
......@@ -11,40 +11,38 @@ extern iop_physical_device_t physical_device_0;
*/
static iop_header_t route_header[1] = \
{
{
.eth_header = {
.dst_ip = { 192,168,0,3},
.dst_mac = { 0x00,0x50,0xbf,0x50,0x07,0x0d},
.dst_port = HTONS(13000),
.src_port = HTONS(13000)
}
}
{
.can_header = {
.extended = 0,
.rtr = 0,
.sshot = 0,
.id = 2
}
}
};
/**
* @brief Routes Scheduling
*/
static uint32_t route_schedule_0[1] = \
{ 1 };
{ 1 };
/**
* @brief Routes Configuration
*/
static iop_logical_route_t logical_routes[1] = \
{
{
.schedule = route_schedule_0,
.header = &route_header[0],
.device = &physical_device_0
}
{
.schedule = route_schedule_0,
.header = &route_header[0],
.device = &physical_device_0
}
};
/**
* @brief Logical Device configuration
*/
iop_logical_device_t logical_device_0 = \
iop_logical_device_t logical_device_0= \
{
.routes = {
.length = 1,
......
/*
* ============================================================================
* This file was generated by the GMV's Configurator Tool and is part of an I/O
* partition configuration.
* File Purpose: IO Partition user configuration. Contains the configuration
* options for Ethernet's GRETH devices.
* options for CAN devices.
* ============================================================================
*/
#include <iop.h>
#include <iop_greth.h>
#include <eth_support.h>
#include <iop_occan.h>
#include <can_support.h>
/**
* @brief IOP remote ports
*/
extern iop_port_t remote_ports[2];
/**
* @brief IOP buffers
*/
static iop_buffer_t iop_buffers[64];
static uint8_t iop_buffers_storage[64 * IOP_BUFFER_SIZE];
......@@ -26,45 +28,76 @@ static iop_buffer_t *tx_iop_buffer[32];
*/
static iop_buffer_t *rx_iop_buffer[32];
/**
* @brief Allocation of for the internal message queue
* to be used by the occan driver
*/
static CANMsg rx_msg_fifo[32];
static CANMsg tx_msg_fifo[32];
/**
* @brief RX and TX descriptor table
* @warning this should be 2048, but we need 3072 to ensure the 0x400 alignment
*/
static uint8_t descriptor_table[3072];
//static uint8_t descriptor_table[3072];
/** @brief GRETH control structure*/
static greth_softc_t greth_driver = \
static occan_priv occan_driver = \
{
.iop_buffers = iop_buffers,
.speed = 250000, // TODO maybe use a enum in the future
.filter = {
.single_mode = 0,
.code = {0, 0, 0, 0},
.mask = {0, 0, 0, 0},
},
.iop_buffers = iop_buffers,
.iop_buffers_storage = iop_buffers_storage,
.rx_fifo = {
.cnt = 0,
.ovcnt = 0,
.next = 0,
.last = 0,
.max = 32,
.fifo = rx_msg_fifo,
},
.tx_fifo = {
.cnt = 0,
.ovcnt = 0,
.next = 0,
.last = 0,
.max = 32,
.fifo = tx_msg_fifo,
},
/** @note descriptor table address are split and aligned at the runtime */
.txdesc = descriptor_table,
.rxdesc = descriptor_table,
// .txdesc = descriptor_table,
// .rxdesc = descriptor_table,
.tx_iop_buffer = tx_iop_buffer,
.rx_iop_buffer = rx_iop_buffer
};
/** @brief GRETH driver configuration */
static iop_eth_device_t device_configuration = \
static iop_can_device_t device_configuration = \
{
/* device configuration */
.dev = {
.driver = (void *)&greth_driver,
.init = greth_initialize,
.open = greth_open,
.read = greth_read,
.write = greth_write,
.close = greth_close,
.driver = (void *)&occan_driver,
.init = occan_initialize,
.open = occan_open,
.read = occan_read,
.write = occan_write,
.close = occan_close,
},
/* ethernet configuration */
.ip = { 192, 168, 0, 17 },
.mac = { 0x00, 0x50, 0xC2, 0x75, 0xa0, 0x60 },
.rx_count = 32,
.tx_count = 32
.dev_name ="/dev/occan0",
// .count = 0,
// .flags = 0,
// .bytes_moved = 0,
};
/**
......@@ -78,14 +111,14 @@ static uint32_t reads_per_period[] = \
*/
static iop_header_t route_header[1] = \
{
{
.eth_header = {
.dst_ip = { 192,168,0,3},
.dst_mac = { 0x00,0x50,0xbf,0x50,0x07,0x0d},
.dst_port = HTONS(14000),
.src_port = HTONS(14000)
}
}
{
.can_header = {
.extended = 0,
.rtr = 0,
.sshot = 0,
.id = 2,
},
}
};
/**
......@@ -102,8 +135,8 @@ static iop_physical_route_t physical_routes[1] =\
{
.schedule = route_schedule_0,
.header = &route_header[0],
.port = &remote_ports[1]
}
.port = &remote_ports[2]
},
};
/**
......@@ -113,14 +146,14 @@ iop_physical_device_t physical_device_0 =\
{
.driver = (iop_device_driver_t *)&device_configuration,
.routes = {
.length = 1,
.length = 2,
.elements = physical_routes
},
.reads_per_period = reads_per_period,
.reader_task = eth_reader,
.writer_task = eth_writer,
.header_prebuild = eth_prebuild_header,
.header_compare = eth_compare_header,
.header_copy = eth_copy_header,
.reader_task = can_reader,
.writer_task = can_writer,
.header_prebuild = can_prebuild_header,
.header_compare = can_compare_header,
.header_copy = can_copy_header,
};
......@@ -40,7 +40,7 @@ static air_sampling_port_configuration_t sampling_ports[] = {
/**
* @brief IOP remote ports
*/
iop_port_t remote_ports[2] = {
iop_port_t remote_ports[3] = {
{
.type = AIR_SAMPLING_PORT,
.name = "dsampling",
......@@ -49,7 +49,7 @@ iop_port_t remote_ports[2] = {
},
{
.type = AIR_QUEUING_PORT,
.name = "squeuing",
.name = "squeueing",
.configuration = &queuing_ports[0],
.device = NULL
},
......
/* ============================================================================
* Copyright (C) GMVIS Skysoft S.A., 2008-2013
* ============================================================================
* This file is part of the AIR - ARINC 653 Interface in RTEMS - Operating
* system.
* The license and distribution terms for this file may be found in the file
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
* ==========================================================================*/
#include <rtems.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/sem.h>
#include <rtems/rtems/clock.h>
#include <a653.h>
#include <imaspex.h>
#include <pprintf.h>
QUEUING_PORT_ID_TYPE qpid;
/*---------------------------------------------------------
* function: test *
* prints a simple string *
------------------------------------------------------------*/
void test(PARTITION_ID_TYPE self_id) {
unsigned char msg[1024]="empty\0";
RETURN_CODE_TYPE rc;
MESSAGE_SIZE_TYPE len;
while(1) {
RECEIVE_QUEUING_MESSAGE(qpid, INFINITE_TIME_VALUE, msg, &len, &rc );
if (rc == NO_ERROR) {
pprintf ("Partition %d: %s\n", self_id, msg);
}
}
}
int entry_func() {
RETURN_CODE_TYPE rc;
rtems_name name = 2000;
rtems_mode mode = RTEMS_PREEMPT ;
rtems_mode mode_mask = RTEMS_PREEMPT_MASK;
rtems_id id;
PARTITION_ID_TYPE self_id;
CREATE_QUEUING_PORT("dqueuing", 1024, 32, DESTINATION, FIFO, &qpid, &rc );
if(NO_ERROR != rc){
pprintf("CREATE_QUEUING_PORT error %d\n", rc);
}
GET_PARTITION_ID(&self_id, &rc);
if(NO_ERROR != rc){
pprintf("GET_PARTITION_ID error %d\n", rc);
}
pprintf("Initializing partition %d...\n", self_id);
if (RTEMS_SUCCESSFUL == rtems_task_create (name, 15, 4096, mode, mode_mask, &id)) {
rtems_task_start (id, (rtems_task_entry)test, self_id);
}
SET_PARTITION_MODE(NORMAL, &rc);
if (NO_ERROR != rc){
pprintf("SET_PARTITION_MODE error %d\n", rc);
}
return RTEMS_SUCCESSFUL;
}
/* ============================================================================
* Copyright (C) GMVIS Skysoft S.A., 2008-2013
* ============================================================================
* This file is part of the AIR - ARINC 653 Interface in RTEMS - Operating
* system.
* The license and distribution terms for this file may be found in the file
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
* ==========================================================================*/
#include <rtems.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/sem.h>
#include <rtems/rtems/clock.h>
#include <a653.h>
#include <imaspex.h>
#include <pprintf.h>
SAMPLING_PORT_ID_TYPE SEND_PORT;
/*---------------------------------------------------------
* function: test *
* outputs a simple string via a sampling port *
------------------------------------------------------------*/
void error_message(RETURN_CODE_TYPE rc){
switch(rc){
case INVALID_CONFIG:
pprintf("WRITE_SAMPLING_MESSAGE error Invalid Config\n");
break;
case INVALID_PARAM:
pprintf("WRITE_SAMPLING_MESSAGE error Invalid Param\n");
break;
case INVALID_MODE:
pprintf("WRITE_SAMPLING_MESSAGE error Invalid Mode\n");
break;
default:
pprintf("Unknown error\n");
break;
}
}
void test(PARTITION_ID_TYPE self_id) {
int i = 0, offset = 0;;
char sample[3] = "S0 ";
/* get the number of ticks per second */
int tps = 1000000 / air_syscall_get_us_per_tick();
pprintf("TPS %i\n", tps);
RETURN_CODE_TYPE rc = NO_ERROR;
rtems_interval time;
while(1) {
rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &time);
// append_to_message(message, sample, offset);
// append_time_to_message(message, time, 3 + offset);
// append_to_message(message, " ", offset + 3 + 8);
pprintf ("Partition %d at time %d sending: %s\n", self_id, time, sample);
WRITE_SAMPLING_MESSAGE (SEND_PORT, (MESSAGE_ADDR_TYPE )sample, 1024, &rc );
if (NO_ERROR != rc) {
//pprintf("WRITE_SAMPLING_MESSAGE error %d\n", rc);
error_message(rc);
}
offset += 12;
/*identify the string with an integer index*/
i++;
if (i == 10) {
i=0;
}
sample[1] = 0x30 + i;
rtems_task_wake_after(0.7 * tps);
}
}
int entry_func() {
RETURN_CODE_TYPE rc;
rtems_name name = 10000;
rtems_mode mode = RTEMS_PREEMPT ;
rtems_mode mode_mask = RTEMS_PREEMPT_MASK;
rtems_id id;
PARTITION_ID_TYPE self_id;
/*Getting my own partition id*/
GET_PARTITION_ID(&self_id, &rc);
if(NO_ERROR != rc) {
pprintf("GET_PARTITION_ID error %d\n", rc);
}
pprintf("Initializing partition %d...\n", self_id);
/*Creating Source sampling Port*/
SAMPLING_PORT_NAME_TYPE NAME = "ssampling";
MESSAGE_SIZE_TYPE SIZE = 1024;
SYSTEM_TIME_TYPE PERIOD= 1000000000ll;
CREATE_SAMPLING_PORT (NAME, SIZE, SOURCE, PERIOD, &SEND_PORT, &rc);
if (NO_ERROR != rc) {
pprintf("CREATE_SAMPLING_PORT error %d\n", (int) rc);
}
if (RTEMS_SUCCESSFUL == rtems_task_create (name, 15, 4096, mode, mode_mask, &id)) {
rtems_task_start (id, &test, self_id);
}
SET_PARTITION_MODE(NORMAL, &rc);
if (NO_ERROR != rc) {
pprintf("SET_PARTITION_MODE error %d\n", rc);
}
return RTEMS_SUCCESSFUL;
}
/*
* can_support.c
*
* Created on: Sep 7, 2017
* Author: gmvs@gmv.com
*/
#include <can_support.h>
#include <iop.h>
void can_copy_header(
iop_physical_device_t *iop_dev,
iop_wrapper_t *wrapper,
iop_header_t *header) {
}
/* This function compares the ID on the wrapper
* to the ID of a given header. */
uint16_t can_compare_header(
iop_wrapper_t *wrapper,
iop_header_t *header){
can_header_t *can_header = (can_header_t *) header;
int id = *(int *) (wrapper->buffer->v_addr +
wrapper->buffer->header_off +
3*sizeof(int));
if (id == can_header->id){
return 1;
}
return 0;
}
void can_prebuild_header(
can_header_t *header){
}
/*
* can_tasks.c
*
* Created on: Sep 7, 2017
* Author: gmvs@gmv.com
*
* Read and write high level functions for CAN
*/