wiki:ArincExamples
close Warning: Can't synchronize with repository "(default)" (Couldn't open Subversion repository /var/repositories/svn/aadl: SubversionException: ("Failed to load module for FS type 'fsfs'", 160033)). Look in the Trac log for more information.

Simple producer/consumer

The model is very simple. We have two partitions on the same module. One partition sends data to another with queuing ports facilities. On this example, we detail how we can automatically generate ARINC653 deployment files, as well as ARINC653-compliant application code.

Graphical representation

ARINC653 XML deployment file generation

We can automatically generate the corresponding ARINC653 deployment file. There is an example of what could be generated. It maps the AADL model to XML files.

<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=".\A653_Part1_rev1.xsd" ModuleName="ppc_impl">
 <System_HM_Table/>
 <Module_HM_Table/>
 <Partition PartitionName="pr2" PartitionIdentifier="1" EntryPoint="main" SystemPartition="true">
   <Sampling_Port Direction="DESTINATION" Name="pdatain" RefreshRateSeconds=" 0.0250" MaxMessageSize="1"/>
 </Partition>
 <Partition PartitionName="pr1" PartitionIdentifier="2" EntryPoint="main" SystemPartition="true">
   <Sampling_Port Direction="SOURCE" Name="pdataout" RefreshRateSeconds=" 0.0150" MaxMessageSize="1"/>
 </Partition>
 <Partition_Memory PartitionName="pr2" PartitionIdentifier="1">
   <Memory_Requirements SizeBytes="80000" Type="DATA" Access="WRITE"/>
 </Partition_Memory>
 <Partition_Memory PartitionName="pr1" PartitionIdentifier="2">
   <Memory_Requirements SizeBytes="80000" Type="CODE" Access="READ"/>
 </Partition_Memory>
 <Module_Schedule MajorFrameSeconds=" 1.0000">
   <Partition_Schedule PartitionName="pr2" PartitionIdentifier="1" PeriodSeconds=" 1.0000" PeriodDurationSeconds=" 0.5000">
     <Window_Schedule WindowStartSeconds=" 0.0000" WindowIdentifier="0" WindowDurationSeconds=" 0.5000"/>
   </Partition_Schedule>
   <Partition_Schedule PartitionName="pr1" PartitionIdentifier="2" PeriodSeconds=" 1.0000" PeriodDurationSeconds=" 0.5000">
     <Window_Schedule WindowStartSeconds=" 0.5000" WindowIdentifier="1" WindowDurationSeconds=" 0.5000"/>
   </Partition_Schedule>
 </Module_Schedule>
 <Connection_Table>
   <Channel ChannelIdentifier="1">
     <Source>
       <Standard_Partition PortName="pdataout" PartitionName="pr1" PartitionIdentifier="2"/>
     </Source>
     <Destination>
       <Standard_Partition PortName="pdatain" PartitionName="pr2" PartitionIdentifier="1"/>
     </Destination>
   </Channel>
 </Connection_Table>
 <Partition_HM_Table/>
 <Partition_HM_Table/>
</ARINC_653_Module>

Application code generation (sample)

We can also generate the application code that corresponds to this model. The following code gives an example of the generated code for the producer thread.

extern QUEUING_PORT_ID_TYPE pr1_pdataout_id;

/*************/
/* thr_job   */ 
/*************/

void* thr_job ()
{
  pingpong__integer pr1_pdataout_data;

  RETURN_CODE_TYPE ret;
  while (1)
  {
    /*  Call implementation*/
    pingpong__hello_part1 (&(pr1_pdataout_data));
    /*  Send the OUT ports*/
    SEND_QUEUING_MESSAGE (pr1_pdataout_id, &(pr1_pdataout_data), sizeof (int), 10, &(ret));
    PERIODIC_WAIT (&(ret));
  }
}

And the following code generates the initialization of the first partition :

int main ()
{

  PROCESS_ATTRIBUTE_TYPE tattr;
  RETURN_CODE_TYPE ret;
  CREATE_QUEUING_PORT ("pr1_pdataout", sizeof (int), 2, SOURCE, FIFO, &(pr1_pdataout_id), &(ret));
  /*  This queueing port was mapped from an out event data port contained in */
  /*  the process. Itis used for inter-partition communication.*/
  tattr.ENTRY_POINT = thr_job;
  tattr.DEADLINE = 1000;
  tattr.PERIOD = 1000;
  tattr.TIME_CAPACITY = 1;
  CREATE_PROCESS (&(tattr), &(arinc_threads[1]), &(ret));
  /*  This thread was mapped from a thread component containedin this */
  /*  process. The function it executes is also generatedin the file */
  /*  activity.c.*/
  SET_PARTITION_MODE (NORMAL, &(ret));
  /*  Now, we created all resources of the process. Consequently,this thread */
  /*  will not be used any more and it will be keptin a dormant state. By */
  /*  doing that, we also allow one morethread in this partition*/
  return (0);
}

Test it !

The ARINC653 code generator and deployment file generator is included in Ocarina 2.0. The AADL/ARINC653 runtime (POK), is available on the POK website (http://pok.gunnm.org).

More information ?

See the POK project on http://pok.gunnm.org or contact Julien Delange (delange AT telecom-paristech DOT fr).

Last modified 8 years ago Last modified on 12/22/09 08:27:12

Attachments (1)

Download all attachments as: .zip