Commit 0b280bd6 authored by Laura Alexandra Sequeira Gouveia's avatar Laura Alexandra Sequeira Gouveia

Merge branch 'TASTE' of https://spass-git-ext.gmv.com/AIR/AIR into TASTE

parents 29c0a407 18428182
......@@ -8,28 +8,56 @@
* ==========================================================================*/
#include <air.h>
#include <rtems.h>
#ifdef RTEMS48I
#include <pprintf.h>
#include <pprintf.h>
#else
#include <stdio.h>
#endif
int producer() {
for (;;)
{
long pid;
air_status_code_e rc;
air_partition_status_t status;
int x = 2;
volatile int y = 0;
rc = air_syscall_get_partition_id(NULL, &pid);
if(AIR_NO_ERROR != rc)
{
printf("P0main air_syscall_get_partition_id ERROR: %u\n", rc);
}
rc = air_syscall_get_partition_status(pid, &status);
if(AIR_NO_ERROR != rc)
{
printf("P0main air_syscall_get_partition_status ERROR: %u\n", rc);
}
/*Example on how to act differently if a HM restart action was selected*/
if(status.start_condition != AIR_START_CONDITION_HM_PARTITION_RESTART)
{
/*Force a division by 0*/
x = x/y;
}
uint32_t tps = 1000000 / air_syscall_get_us_per_tick();
for (;;)
{
#ifdef RTEMS48I
pprintf("In partition PO loop t20\n");
pprintf("In partition PO loop\n");
#else
printf("In partition PO loop t20\n");
printf("In partition PO loop\n");
#endif
rtems_task_wake_after(20);
rtems_task_wake_after(tps/2);
#ifdef RTEMS48I
pprintf("P0 : Waking up\n");
pprintf("P0 : Waking up %d\n", x);
#else
printf("P0 : Waking up\n");
printf("P0 : Waking up %d\n", x);
#endif
}
return AIR_SUCCESSFUL;
}
}
return AIR_SUCCESSFUL;
}
......@@ -8,26 +8,44 @@
* ==========================================================================*/
#include <air.h>
#include <rtems.h>
#ifdef RTEMS48I
#include <pprintf.h>
#include <pprintf.h>
#else
#include <stdio.h>
#endif
void partition_HM_callback(air_state_e state_id,air_error_e error_id)
{
printf("ENTERING partition_HM_callback\tSTATE:%d\tERROR:%d\n",state_id,error_id);
/*implement some appropriate handler here*/
}
int receiver() {
for (;;)
{
/*Force a division by 0*/
int x = 2;
volatile int y = 0;
x = x/y;
uint32_t tps = 1000000 / air_syscall_get_us_per_tick();
for (;;)
{
#ifdef RTEMS48I
pprintf("In partition P1 loop t20\n");
pprintf("In partition P1 loop\n");
#else
printf("In partition P1 loop t20\n");
printf("In partition P1 loop\n");
#endif
rtems_task_wake_after(20);
rtems_task_wake_after(tps/2);
#ifdef RTEMS48I
pprintf("P1 : Waking up\n");
pprintf("P1 : Waking up - %d\n", x);
#else
printf("P1 : Waking up\n");
printf("P1 : Waking up - %d\n", x);
#endif
}
return AIR_SUCCESSFUL;
}
return AIR_SUCCESSFUL;
}
......@@ -4,14 +4,14 @@
<!-- Partition 1 -->
<Partition PartitionIdentifier="1" PartitionName="partition1"
Criticality="LEVEL_A" EntryPoint="entry_func" SystemPartition="false">
<Sampling_Port Name="RECV_APP_RT1" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT2" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT3" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT4" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT1" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT2" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT3" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT4" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT1" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT2" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT3" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_APP_RT4" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT1" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT2" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT3" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_APP_RT4" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR; IMASPEX; LIBPRINTF</Libs>
<Devices></Devices>
......@@ -25,22 +25,22 @@
<!-- Partition 2 -->
<Partition PartitionIdentifier="2" PartitionName="iop"
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="false">
<Sampling_Port Name="SEND_IO_RT1" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT2" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT3" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT4" Direction="SOURCE" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT1" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT2" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT3" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT4" Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS5" IOP="iop.xml" Cores="1">
<Libs>LIBAIR; LIBIOP; LIBPRINTF</Libs>
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="true">
<Sampling_Port Name="SEND_IO_RT1" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT2" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT3" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="SEND_IO_RT4" Direction="SOURCE" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT1" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT2" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT3" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="RECV_IO_RT4" Direction="DESTINATION" MaxMessageSize="64" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="Bare" IOP="iop.xml" Cores="1">
<Libs>LIBIOP</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
FPU_CONTROL; CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
SUPERVISOR;
</Permissions>
</PartitionConfiguration>
</Partition>
......@@ -50,9 +50,9 @@
InitialModuleSchedule="true" MajorFrameSeconds="1.0">
<Partition_Schedule PartitionIdentifier="1" PartitionName="partition1"
PeriodDurationSeconds="0.5" PeriodSeconds="1.0">
PeriodDurationSeconds="1.0" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="1" PartitionPeriodStart="true"
WindowDurationSeconds="0.5" WindowStartSeconds="0.5"/>
WindowDurationSeconds="1.0" WindowStartSeconds="0.0"/>
<WindowConfiguration WindowIdentifier="1" Cores="0" />
</Partition_Schedule>
......
......@@ -12,12 +12,12 @@
#include <rtems/rtems/clock.h>
#include <a653.h>
#include <imaspex.h>
#include <string.h>
#include <pprintf.h>
/* inter-partition ports maximum size definitions */
#define MAX_MESSAGE_SIZE 1024 // bytes
#define MAX_MESSAGE_SIZE 64 // bytes
#define IOP_REFRESH_RATE 1000000000 // 1s in ns
#define false 0
......@@ -199,8 +199,8 @@ uint8_t get_iop_data()
memcpy(&aux[j], readFrom, sizeof(uint16_t));
readFrom = readFrom + sizeof (uint16_t);
/*limit data printing */
if (j<16 && i%2)
pprintf("%04x ", aux[j]);
// if (j<16 && i%2)
// pprintf("%04x ", aux[j]);
}
pprintf("\n");
......@@ -223,7 +223,7 @@ uint8_t get_iop_data()
}
void run_partition(rtems_id task_id)
void run_partition(unsigned int task_id)
{
rtems_status_code status = NO_ERROR;
int ticks_per_sec;
......@@ -344,25 +344,19 @@ int entry_func() {
if(NO_ERROR != rc) {
pprintf("GET_PARTITION_ID error %d\n", rc);
}
pprintf("Initializing partition %d...\n", self_id);
// init inter-partition ports
setup_ports();
pprintf( "Time since boot up: %d ticks.\n", air_syscall_get_elapsed_ticks());
// start rtems task
pprintf("Set-up Rtems Task ...\n");
rtems_id task_id;
rtems_name rname = rtems_build_name( 'P', 'A', 'R', '1' );
if (RTEMS_SUCCESSFUL == rtems_task_create(rname, 1, RTEMS_MINIMUM_STACK_SIZE*3, RTEMS_PREEMPT, RTEMS_FLOATING_POINT, &task_id))
if (RTEMS_SUCCESSFUL == rtems_task_create(rname, 1, RTEMS_MINIMUM_STACK_SIZE*3, RTEMS_PREEMPT, RTEMS_LOCAL | RTEMS_FLOATING_POINT, &task_id))
{
rtems_task_start (task_id, run_partition, task_id);
}
pprintf("Rtems Task has been setup.\n");
pprintf( "Time since boot up: %d ticks.\n", air_syscall_get_elapsed_ticks());
SET_PARTITION_MODE(NORMAL, &rc);
if (NO_ERROR != rc)
{
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ModuleName="iop_example">
<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ModuleName="iop_can">
<!-- 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_receiver2"
Direction="DESTINATION" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="partition_sender"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="partition_sender2"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR; IMASPEX; LIBPRINTF</Libs>
<Devices></Devices>
......@@ -18,25 +22,29 @@
</Permissions>
</PartitionConfiguration>
</Partition>
<!-- Partition 2 -->
<Partition PartitionIdentifier="2" PartitionName="iop"
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="false">
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="true">
<Sampling_Port Name="iop_sender"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="iop_sender2"
Direction="SOURCE" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<Sampling_Port Name="iop_receiver"
Direction="DESTINATION" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="RTEMS5" IOP="iop.xml" Cores="1">
<Libs>LIBAIR; LIBIOP; LIBPRINTF</Libs>
<Sampling_Port Name="iop_receiver2"
Direction="DESTINATION" MaxMessageSize="8" RefreshRateSeconds="1.0"/>
<PartitionConfiguration Personality="Bare" IOP="iop.xml" Cores="1">
<Libs>LIBIOP</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
FPU_CONTROL; CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
SUPERVISOR;
</Permissions>
</PartitionConfiguration>
</PartitionConfiguration>
</Partition>
<!-- Schedule 1 -->
<Module_Schedule ScheduleIdentifier="1" ScheduleName="schedule"
InitialModuleSchedule="true" MajorFrameSeconds="1.0">
......@@ -64,19 +72,38 @@
PortName="iop_receiver"/>
</Destination>
</Channel>
<Channel ChannelIdentifier="1" ChannelName="MessageIn2">
<Source>
<Standard_Partition PartitionIdentifier="1" PartitionName="partition1"
PortName="partition_sender2"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="2" PartitionName="iop"
PortName="iop_receiver2"/>
</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>
<Source>
<Standard_Partition PartitionIdentifier="2" PartitionName="iop"
PortName="iop_sender"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="1" PartitionName="partition1"
PortName="partition_receiver"/>
</Destination>
</Channel>
<Channel ChannelIdentifier="3" ChannelName="MessageOut2">
<Source>
<Standard_Partition PartitionIdentifier="2" PartitionName="iop"
PortName="iop_sender2"/>
</Source>
<Destination>
<Standard_Partition PartitionIdentifier="1" PartitionName="partition1"
PortName="partition_receiver2"/>
</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">
<IOPartition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="iop.xsd" version="1.0" date="2017-11-20" name="iop_can" request_number="64" time_to_live="5">
<RemotePorts>
<Port Name="iop_receiver" LogicalDeviceId="1"/>
<Port Name="iop_receiver2" LogicalDeviceId="2"/>
<Port Name="iop_sender" />
<Port Name="iop_sender2" />
</RemotePorts>
<LogicalDevices>
<Device Id="1" Name="PARSERVER" Extended="0" RTR="0" />
<Device Id="1" Name="DESTINATION_DEVICE_NAME"/>
<Device Id="2" Name="DESTINATION_DEVICE_NAME2"/>
</LogicalDevices>
<PhysicalDevices>
<Device Id="1" Device="CAN0" Baud="250" TXD="32" RXD="32" Code="0x00000000" Mask="0x00000000" Selection="0" Enable0="0" Enable1="1">
<Device Id="1" Device="CAN0" Baud="500" Code="0x00000000" Mask="0x00000000" Selection="0" Enable0="0" Enable1="0">
<PhysicalRoute Id="1" PortId="iop_sender">
<CanHeader Extended="true" Sshot="false" RTR="false" CanID="34"/>
</PhysicalRoute>
......@@ -19,16 +22,27 @@
<CanHeader Extended="false" Sshot="false" RTR="false" CanID="5"/>
</LogicalRoute>
</Device>
<Device Id="0" Device="CAN1" Baud="250" Code="0x00000000" Mask="0x00000000" Selection="1" Enable0="0" Enable1="0">
<PhysicalRoute Id="3" PortId="iop_sender2">
<CanHeader Extended="true" Sshot="false" RTR="false" CanID="35"/>
</PhysicalRoute>
<LogicalRoute Id="4" LogicalDeviceId="2">
<CanHeader Extended="false" Sshot="false" RTR="false" CanID="6"/>
</LogicalRoute>
</Device>
</PhysicalDevices>
<ModuleSchedules>
<Schedule ScheduleIdentifier="1">
<DevicesConfiguration>
<Device DeviceId="1" Device="CAN0" Reads="1"/>
<Device DeviceId="0" Device="CAN1" Reads="1"/>
</DevicesConfiguration>
<RoutesConfiguration>
<Route RouteId="1" Active="true"/>
<Route RouteId="2" Active="true"/>
<Route RouteId="3" Active="true"/>
<Route RouteId="4" Active="true"/>
</RoutesConfiguration>
</Schedule>
</ModuleSchedules>
......
......@@ -4,35 +4,26 @@
* Created on: Mar 15, 2018
* Author: gmvs
*
* WARNING: When running this example on GR740, the following have to be configured:
* - CAN pin multiplexing
*
*
*/
#include <rtems.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/sem.h>
#include <rtems/rtems/clock.h>
#include <string.h>
#include <a653.h>
#include <imaspex.h>
#include <pprintf.h>
SAMPLING_PORT_ID_TYPE SEND_PORT;
SAMPLING_PORT_ID_TYPE SEND_PORT, SEND_PORT2;
SAMPLING_PORT_ID_TYPE RECEIVE_PORT;
SAMPLING_PORT_ID_TYPE RECEIVE_PORT, RECEIVE_PORT2;
void grcan_send_msg(PARTITION_ID_TYPE self_id){
pprintf("This is Partition %d - Sender Task\n", self_id);
int i = 0;
char sample1[] = { 0x11, 0x22, 0x33, 0x44, 0x55};
// char sample2[] = "GMVS";
// char sample3[] = "TEST0";
char sample1[] = { 0xDE, 0xAD, 0xBE, 0xEF};
char sample2[] = { 0xBE, 0xEF, 0xDE, 0xAD};
int tps = 1000000 / air_syscall_get_us_per_tick();
int sleep = 1*tps;
......@@ -42,25 +33,19 @@ void grcan_send_msg(PARTITION_ID_TYPE self_id){
rtems_task_wake_after(sleep);
pprintf("Sender task starting\n");
RETURN_CODE_TYPE rc = NO_ERROR;
rtems_interval time;
while(1){
pprintf("Sending message ..%s.. through CAN\n", sample1);
pprintf("Sending %dbytes: 0xDEADBEEF\n", sizeof(sample1));
WRITE_SAMPLING_MESSAGE(SEND_PORT,
(MESSAGE_ADDR_TYPE) sample1,
3,
sizeof(sample1),
&rc);
// pprintf("Sending message ..%s.. through CAN\n", sample2);
// WRITE_SAMPLING_MESSAGE(SEND_PORT, (MESSAGE_ADDR_TYPE) sample2, 4, &rc);
//
// pprintf("Sending message ..%s.. through CAN\n", sample3);
// WRITE_SAMPLING_MESSAGE(SEND_PORT, (MESSAGE_ADDR_TYPE) sample3, 5, &rc);
// i++;
// if(i == 10){
// i = 0;
// }
// sample3[4] = 0x30 + i;
pprintf("Sending %dbytes: 0xBEEFDEAD\n", sizeof(sample2));
WRITE_SAMPLING_MESSAGE(SEND_PORT2,
(MESSAGE_ADDR_TYPE) sample2,
sizeof(sample2),
&rc);
rtems_task_wake_after(1* tps);
}
......@@ -69,33 +54,53 @@ void grcan_send_msg(PARTITION_ID_TYPE self_id){
void grcan_receive_msg(PARTITION_ID_TYPE self_id){
pprintf("This is Partition %d - Receiver Task\n", self_id);
char recv_msg[8];
int tsp = 1000000 / air_syscall_get_us_per_tick();
int sleep = 2*tsp;
int msg_len = 0;
char recv_msg[8] = {0,0,0,0,0,0,0,0};
int tps = 1000000 / air_syscall_get_us_per_tick();
int sleep = 2*tps;
long int msg_len = 0;
VALIDITY_TYPE validity;
pprintf("TSP %i\n", tsp);
pprintf("TPS %i\n", tps);
pprintf("Receiver task: Sleep for %ds so IOP gets ready...\n", sleep/1000);
pprintf("Receiver task: Sleep for %ds so IOP gets ready...\n", sleep/tps);
rtems_task_wake_after(sleep);
pprintf("Receiver task starting\n");
RETURN_CODE_TYPE rc = NO_ERROR;
rtems_interval time;
while(1){
pprintf("Attempting to read from CAN\n");
READ_SAMPLING_MESSAGE(RECEIVE_PORT,
(MESSAGE_ADDR_TYPE) recv_msg,
&msg_len,
&validity,
&rc);
if(msg_len > 0)
{
pprintf("Partition%d received a message with length %d:\n", self_id, msg_len);
for(int i = 0; i < msg_len; i++)
pprintf("%x",recv_msg[i]);
pprintf("\n");
/* Clear buffer for next message */
memset(recv_msg, 0, msg_len);
}
READ_SAMPLING_MESSAGE(RECEIVE_PORT2,
(MESSAGE_ADDR_TYPE) recv_msg,
&msg_len,
&validity,
&rc);
if(msg_len > 0)
pprintf("Partition%d received a message with length %d:\n %s \n", self_id, msg_len, recv_msg);
/* Clean buffer for next message */
memset(recv_msg, '\0', sizeof(char)*8);
{
pprintf("Partition%d received a message with length %d:\n", self_id, msg_len);
for(int i = 0; i < msg_len; i++)
pprintf("%x",recv_msg[i]);
pprintf("\n");
/* Clear buffer for next message */
memset(recv_msg, 0, msg_len);
}
rtems_task_wake_after(1*tsp);
rtems_task_wake_after(1*tps);
}
}
......@@ -123,6 +128,8 @@ int entry_func(){
/*Creating Source sampling Port*/
SAMPLING_PORT_NAME_TYPE RECEIVER_NAME = "partition_receiver";
SAMPLING_PORT_NAME_TYPE SENDER_NAME = "partition_sender";
SAMPLING_PORT_NAME_TYPE RECEIVER_NAME2 = "partition_receiver2";
SAMPLING_PORT_NAME_TYPE SENDER_NAME2 = "partition_sender2";
MESSAGE_SIZE_TYPE SIZE = 8;
SYSTEM_TIME_TYPE PERIOD= 1000000000ll;
......@@ -130,18 +137,25 @@ int entry_func(){
if (NO_ERROR != rc) {
pprintf("CREATE_SAMPLING_PORT %s, error: %d\n",SENDER_NAME, rc);
}
pprintf("CREATE_SAMPLING_PORT %s\n", SENDER_NAME);
CREATE_SAMPLING_PORT (SENDER_NAME2, SIZE, SOURCE, PERIOD, &SEND_PORT2, &rc);
if (NO_ERROR != rc) {
pprintf("CREATE_SAMPLING_PORT %s, error: %d\n",SENDER_NAME, rc);
}
CREATE_SAMPLING_PORT (RECEIVER_NAME, SIZE, DESTINATION, PERIOD, &RECEIVE_PORT, &rc);
if (NO_ERROR != rc) {
pprintf("CREATE_SAMPLING_PORT %s, error: %d\n", RECEIVER_NAME, rc);
}
pprintf("CREATE_SAMPLING_PORT %s\n", RECEIVER_NAME);
CREATE_SAMPLING_PORT (RECEIVER_NAME2, SIZE, DESTINATION, PERIOD, &RECEIVE_PORT2, &rc);
if (NO_ERROR != rc) {
pprintf("CREATE_SAMPLING_PORT %s, error: %d\n", RECEIVER_NAME, rc);
}
if (RTEMS_SUCCESSFUL == rtems_task_create (name_send, 15, 4096, mode, mode_mask, &id)) {
rtems_task_start (id, grcan_send_msg, self_id);
rtems_task_start (id, (rtems_task_entry) grcan_send_msg, self_id);
}
if(RTEMS_SUCCESSFUL == rtems_task_create (name_receive, 25, 4096, mode, mode_mask, &id)){
rtems_task_start(id, grcan_receive_msg, self_id);
rtems_task_start(id, (rtems_task_entry) grcan_receive_msg, self_id);
}
SET_PARTITION_MODE(NORMAL, &rc);
......
......@@ -3,18 +3,18 @@
<!-- Partition 3 -->
<Partition PartitionIdentifier="3" PartitionName="iop"
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="false">
Criticality="LEVEL_A" EntryPoint="empty" SystemPartition="true">
<Sampling_Port Name="dsampling"
Direction="DESTINATION" MaxMessageSize="1024" RefreshRateSeconds="1.0"/>
<Queuing_Port Name="squeuing"
Direction="SOURCE" MaxMessageSize="1024" MaxNbMessages="32" />
<PartitionConfiguration Personality="RTEMS5" IOP="iop.xml" Cores="1">
<Libs>LIBAIR; LIBIOP; LIBPRINTF</Libs>
<PartitionConfiguration Personality="Bare" IOP="iop.xml" Cores="1">
<Libs>LIBIOP</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
FPU_CONTROL; CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
SUPERVISOR;
</Permissions>
</PartitionConfiguration>
</Partition>
......
......@@ -23,23 +23,24 @@ 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";
unsigned char msg[1024]="empty\0";
RETURN_CODE_TYPE rc;
MESSAGE_SIZE_TYPE len;
pprintf ("Ready to receive\n", self_id, msg);
while(1) {
RECEIVE_QUEUING_MESSAGE(qpid, INFINITE_TIME_VALUE, msg, &len, &rc );
if (rc == NO_ERROR) {
if (rc == NO_ERROR)
pprintf ("Partition %d: %s\n", self_id, msg);
}
// pprintf(".");
else
if(rc == INVALID_CONFIG)
pprintf ("Partition %d Overflow: %s\n", self_id, msg);
}
}
......
......@@ -8,66 +8,14 @@
* ==========================================================================*/
#include <rtems.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/sem.h>