Commit f3bb1da4 authored by Guilherme Sanches's avatar Guilherme Sanches

Various changes made to the can example and on both the can driver and

the libiop.
parent eb1c1b8c
<?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 3 -->
<Partition PartitionIdentifier="3" PartitionName="iop"
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="false">
<Sampling_Port Name="dsampling"
Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS" IOP="iop.xml" Cores="1">
<Libs>LIBXKY; 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="sampling"
Criticality="LEVEL_A" EntryPoint="entry_func" SystemPartition="false">
<Sampling_Port Name="ssampling"
Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS" Cores="1">
<Libs>LIBXKY; 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>
<!-- Partition 2
<Partition PartitionIdentifier="2" PartitionName="queuing"
Criticality="LEVEL_A" EntryPoint="entry_func" SystemPartition="false">
<PartitionConfiguration Personality="RTEMS" Cores="1">
<Libs>LIBXKY; 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="sampling"
PeriodDurationSeconds="0.2" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="1" PartitionPeriodStart="true"
WindowDurationSeconds="0.2" WindowStartSeconds="0.0"/>
</Partition_Schedule>
<Partition_Schedule PartitionIdentifier="3" PartitionName="iop"
PeriodDurationSeconds="0.6" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="3" PartitionPeriodStart="true"
WindowDurationSeconds="0.6" WindowStartSeconds="0.4"/>
</Partition_Schedule>
</Module_Schedule>
<!-- Connection table -->
<Connection_Table>
<Channel ChannelIdentifier="1" ChannelName="sampling">
<Source>
<Standard_Partition PartitionIdentifier="1" PartitionName="sampling"
PortName="ssampling"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="3" PartitionName="iop"
PortName="dsampling"/>
</Destination>
</Channel>
</Connection_Table>
<!-- Module configuration -->
<XKY_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="2013-06-05" name="iop_example" request_number="64" time_to_live="5">
<RemotePorts>
<Port Name="dsampling" LogicalDeviceId="1"/>
</RemotePorts>
<LogicalDevices>
<Device Id="1" Name="PARSERVER" />
</LogicalDevices>
<PhysicalDevices>
<!--<Device Id="0" Device="ETH0" Ip="192.168.0.17" MAC="d0:39:72:74:d8:1f" TXD="32" RXD="32">-->
<Device Id="0" Device="ETH0" Ip="192.168.0.17" MAC="00:50:C2:75:a0:60" TXD="32" RXD="32">
<LogicalRoute Id="1" LogicalDeviceId="1">
<EthHeader Ip="192.168.0.3" MAC="00:50:bf:50:07:0d" Port="13000"/>
</LogicalRoute>
</Device>
</PhysicalDevices>
<ModuleSchedules>
<Schedule ScheduleIdentifier="1">
<DevicesConfiguration>
<Device DeviceId="0" Device="ETH0" Reads="5"/>
</DevicesConfiguration>
<RoutesConfiguration>
<Route RouteId="1" Active="true"/>
<Route RouteId="2" Active="true"/>
</RoutesConfiguration>
</Schedule>
</ModuleSchedules>
</IOPartition>
......@@ -3,7 +3,7 @@
/**
* @brief IOP remote ports
*/
extern iop_port_t remote_ports[3];
extern iop_port_t remote_ports[2];
/**
* @brief Logical devices
......@@ -26,7 +26,7 @@ static iop_physical_device_t *physical_device_list[1] = \
/**
* @brief Logical devices list
*/
static iop_logical_device_t *logical_device_list[2] = \
static iop_logical_device_t *logical_device_list[1] = \
{
&logical_device_0,
};
......@@ -39,7 +39,6 @@ static iop_wrapper_t requests_storage[1024];
static iop_buffer_t iop_buffers[1024];
static uint8_t iop_buffers_storage[1024 * IOP_BUFFER_SIZE];
/**
* @brief IOP application configurations
*/
......
......@@ -9,13 +9,15 @@ extern iop_physical_device_t physical_device_0;
/**
* @brief Routes Headers
*/
static iop_header_t route_header[0] = \
static iop_header_t route_header[1] = \
{
.can_header = {
.extended = 0,
.rtr = 0,
.sshot = 0,
.id = 2
{
.can_header = {
.extended = 0,
.rtr = 0,
.sshot = 0,
.id = 2
}
}
};
......@@ -25,15 +27,16 @@ static iop_header_t route_header[0] = \
static uint32_t route_schedule_0[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
}
};
/**
......
......@@ -13,7 +13,7 @@
/**
* @brief IOP remote ports
*/
extern iop_port_t remote_ports[3];
extern iop_port_t remote_ports[2];
/**
* @brief IOP buffers
......@@ -34,21 +34,21 @@ static iop_buffer_t *rx_iop_buffer[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 occan_priv occan_driver = \
{
.speed = 250000, // TODO maybe use a enum in the future
.acode = {0, 0, 0, 0},
.amask = {0, 0, 0, 0},
.code = {0, 0, 0, 0},
.mask = {0, 0, 0, 0},
.iop_buffers = iop_buffers,
.iop_buffers_storage = iop_buffers_storage,
/** @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
......@@ -87,7 +87,7 @@ static iop_header_t route_header[1] = \
{
.can_header = {
.extended = 0,
.rtre = 0,
.rtr = 0,
.sshot = 0,
.id = 2,
},
......
......@@ -24,12 +24,6 @@ static xky_queuing_port_configuration_t queuing_ports[] = {
.port_direction = XKY_SOURCE_PORT,
.port_discipline = 0
},
{
.max_message_size = 1024,
.max_nb_message = 32,
.port_direction = XKY_SOURCE_PORT,
.port_discipline = 0
},
};
/**
......@@ -55,15 +49,9 @@ iop_port_t remote_ports[3] = {
},
{
.type = XKY_QUEUING_PORT,
.name = "sevennumbers",
.name = "squeueing",
.configuration = &queuing_ports[0],
.device = NULL
},
{
.type = XKY_QUEUING_PORT,
.name = "soddnumbers",
.configuration = &queuing_ports[1],
.device = NULL
},
};
......@@ -21,13 +21,11 @@
QUEUING_PORT_ID_TYPE qpid;
/*---------------------------------------------------------
* function: test *
* prints a simple string *
/*---------------------------------------------------------
* function: test *
* prints a simple string *
------------------------------------------------------------*/
void test(PARTITION_ID_TYPE self_id) {
char msg[1024]="empty\0";
RETURN_CODE_TYPE rc;
......@@ -42,10 +40,8 @@ void test(PARTITION_ID_TYPE self_id) {
}
}
int entry_func() {
RETURN_CODE_TYPE rc;
rtems_name name = 2000;
......
......@@ -3,69 +3,26 @@
* ============================================================================
* 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.
* 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>
/*
* gmvs
* Garbage due to lazyness
*
* */
void append_to_message(uint8_t *msg_ptr_, char * to_append, int offset){
int i;
//strlen
for( i = 0; to_append[i] != '\0'; i++);
int length = i;
for(i = 0; i < length; i++){
msg_ptr_[offset+i] = to_append[i];
}
msg_ptr_[offset + length] = '\0';
}
void append_time_to_message(uint8_t *msg_ptr_, rtems_interval time, int offset){
int i, length = 8;
char time_tag[] = "00000000";
for(i = length-1; time > 0 && i > 0; i--){
int digit = time%10;
time_tag[i] = digit + '0';
time /= 10;
}
for(i = 0; i < length; i++){
msg_ptr_[offset+i] = time_tag[i];
}
msg_ptr_[offset + length] = '\0';
}
#include <rtems.h>
/*
* end of garbage
* */
#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 *
* outputs a simple string via a sampling port *
------------------------------------------------------------*/
void error_message(RETURN_CODE_TYPE rc){
......@@ -116,7 +73,7 @@ void test(PARTITION_ID_TYPE self_id) {
i=0;
}
sample[1] = 0x30 + i;
rtems_task_wake_after(0.7 * tps);
}
}
......@@ -129,38 +86,35 @@ int entry_func() {
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", 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;
}
......@@ -12,10 +12,6 @@ void can_copy_header() {
}
void can_compared_header(){
}
void can_compare_header(){
}
......
......@@ -167,16 +167,6 @@ typedef struct {
} pelican_regs;
#endif
/* fifo interface */
typedef struct {
int cnt;
int ovcnt; /* overwrite count */
int full; /* 1 = base contain cnt CANMsgs, tail==head */
CANMsg *tail, *head;
CANMsg *base;
char fifoarea[1024];
} occan_fifo;
#define MAX_TSEG2 7
#define MAX_TSEG1 15
......@@ -263,20 +253,18 @@ typedef struct {
unsigned int status;
occan_stats stats;
/* rx&tx fifos */
/* Probably this should be changed
* for the tx and rx _iop_buffer */
occan_fifo *rxfifo;
occan_fifo *txfifo;
/* Config */
unsigned int speed; /* speed in HZ */
unsigned char acode[4];
unsigned char amask[4];
unsigned char code[4];
unsigned char mask[4];
/* IOP descriptors */
unsigned int tx_ptr;
unsigned int rx_ptr;
/* IOP standard buffers */
iop_buffer_t *iop_buffers;
uint8_t *iop_duffers_storage;
uint8_t *iop_buffers_storage;
iop_buffer_t **tx_iop_buffer;
iop_buffer_t **rx_iop_buffer;
......
This diff is collapsed.
......@@ -34,8 +34,10 @@ typedef struct {
/* Not used right now TODO take it or leave it*/
void can_copy_header();
void can_compared_header();
void can_compare_header();
void can_prebuild_header();
void can_write(iop_physical_device_t *pdev);
void can_reader(iop_physical_device_t *pdev);
#endif
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