Skip to content
Snippets Groups Projects
Commit 8401adb7 authored by Nicholas Pacini's avatar Nicholas Pacini
Browse files

removed org.polarsys.chess.ada.singlenode

parent 7cf2b1d8
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1009 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.polarsys.chess.codegen.ada.singlenode</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name>
<arguments>
<dictionary>
<key>compliance</key>
<value>pragmatic</value>
</dictionary>
<dictionary>
<key>resource.kind</key>
<value>xmi</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Thu Dec 08 10:05:47 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SIngle node Ada infrastructural code generator
Bundle-SymbolicName: org.polarsys.chess.codegen.ada.singlenode;singleton:=true
Bundle-Version: 0.3.0.qualifier
Bundle-Activator: org.polarsys.chess.codegen.ada.singlenode.Activator
Bundle-Vendor: University of Padova
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.uml2.uml,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.eclipse.ocl,
org.eclipse.ocl.ecore,
org.eclipse.acceleo.common,
org.eclipse.acceleo.parser,
org.eclipse.acceleo.model,
org.eclipse.acceleo.profiler,
org.eclipse.acceleo.engine,
org.polarsys.chess.chessmlprofile,
org.eclipse.papyrus.marte.static.profile,
org.polarsys.chess.m2m,
org.polarsys.chess.core,
org.eclipse.core.commands,
org.eclipse.core.resources,
org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.editor,
org.polarsys.chess.validator,
org.eclipse.m2m.qvt.oml.common,
org.eclipse.m2m.qvt.oml.emf.util,
org.eclipse.ui;bundle-version="3.106.0",
org.eclipse.ui.workbench,
org.eclipse.ui.ide;bundle-version="3.10.0",
org.eclipse.papyrus.sysml
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Export-Package: org.polarsys.chess.codegen.ada.singlenode,
org.polarsys.chess.codegen.ada.singlenode.main,
org.polarsys.chess.codegen.ada.singlenode.service
This Eclipse plugin includes contains the Ada infrastructural code generator (v0.3) for the v0.3 of the
code archetypes for the CHESS component model.
**** Change log v0.3 ****
New features:
- Preliminary support for multi-node systems on Linux platform, based on the YAMI middleware
- Improved support for C component implementations
- Support for structs and enumeration passing between Ada and C and viceversa.
- Several minor improvements
- The code generator is released under EPL license
**** Change log v0.2 ****
New features:
- Component implementations written in C or comprising imperative C++ code are now supported;
- Added protected code section in Ada component implementations to define local variables, package body declarations.
and private declaration (in the implementation specification);
Bug fixes:
- Fixed two mistakes in one conditional branch for the generation of OBCS and sporadic operations.
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>November 14, 2008</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
</body>
</html>
\ No newline at end of file
/org/
<!-- ===================================================================== -->
<!-- Custom targets. -->
<!-- Set customBuildCallbacks = build.acceleo in your build.properties. -->
<!-- ===================================================================== -->
<project name="Build Acceleo Module" default="noDefault">
<!-- ================================================================= -->
<!-- Default target -->
<!-- ================================================================= -->
<target name="noDefault">
<echo message="This file must be called with explicit targets" />
</target>
<!-- ================================================================= -->
<!-- This will be called automatically after the compilation of each -->
<!-- Bundle... in dependency order. -->
<!-- ================================================================= -->
<target name="post.compile.@dot">
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
dependencies="${target.folder}/../../org.polarsys.chess.chessmlprofile;${target.folder}/../../org.eclipse.papyrus.marte.static.profile;${target.folder}/../../org.polarsys.chess.editor;${target.folder}/../../org.polarsys.core.chess;${target.folder}/../../org.polarsys.chess.m2m;${target.folder}/../../org.polarsys.chess.m2m.marte2mast;${target.folder}/../../org.polarsys.chess.validator;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
</target>
</project>
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
src-lib/,\
license_/,\
build.properties,\
build.acceleo,\
about.html,\
tasks/
customBuildCallbacks = build.acceleo
src.includes = license_/,\
src-lib/
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<command
categoryId="it.unipd.chess.commands.category"
defaultHandler="org.polarsys.chess.codegen.ada.singlenode.AdaGenUIHandler"
id="org.polarsys.chess.codegen.ada.singlenode.command.id"
name="Ada">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="org.polarsys.chess.mainMenu"
label="CHESS"
mnemonic="E">
<menu
id="it.unipd.chess.codegenerationMenu"
label="Code generation">
<command
commandId="org.polarsys.chess.codegen.ada.singlenode.command.id"
label="Single node Ada infrastructural code generator"
style="push">
<visibleWhen
checkEnabled="false">
<or>
<with
variable="activeEditorId">
<equals
value="org.eclipse.uml2.uml.editor.presentation.UMLEditorID">
</equals>
</with>
<with
variable="activeEditorInput">
<adapt
type="org.eclipse.core.resources.IResource">
<test
property="org.eclipse.core.resources.projectNature"
value="org.polarsys.chess.CHESSNature">
</test>
</adapt>
</with>
</or>
</visibleWhen>
</command>
</menu>
</menu>
</menuContribution>
</extension>
</plugin>
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
package body Container_Protection is
--------------------------
-- Release_Control_OBCS --
--------------------------
protected body Release_Control_OBCS is
entry Enqueue_For_Release(Release_Time : out Ada.Real_Time.Time) when Barrier is
begin
Release_Time := Ada.Real_Time.Clock;
end Enqueue_For_Release;
procedure Set_Release_Flag(New_Flag : in Boolean) is
begin
Barrier := New_Flag;
end Set_Release_Flag;
function Get_Release_Flag return Boolean is
begin
return Barrier;
end Get_Release_Flag;
end Release_Control_OBCS;
--------------------------
-- Simple_Counter_OBCS --
--------------------------
protected body Simple_Counter_OBCS is
procedure Update_Barrier is
begin
Barrier := Barrier_Release_Flag and Request_Pending > 0;
end Update_Barrier;
entry Enqueue_For_Release(Release_Time : out Ada.Real_Time.Time) when Barrier is
begin
Release_Time := Ada.Real_Time.Clock;
Request_Pending := Request_Pending - 1;
Update_Barrier;
end Enqueue_For_Release;
procedure Set_Release_Flag(New_Flag : in Boolean) is
begin
Barrier_Release_Flag := New_Flag;
Update_Barrier;
end Set_Release_Flag;
function Get_Release_Flag return Boolean is
begin
return Barrier;
end Get_Release_Flag;
procedure Put_Request is
begin
if Request_Pending < Max_Pending then
Request_Pending := Request_Pending + 1;
end if;
Update_Barrier;
end Put_Request;
end Simple_Counter_OBCS;
end Container_Protection;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with System;
with Ada.Real_Time;
package Container_Protection is
-- ** Task_Release **
-- Interface for the definition of descriptor-less release entries
type Task_Release is protected interface;
procedure Enqueue_For_Release(Self : in out Task_Release;
Release_Time : out Ada.Real_Time.Time) is abstract;
-- Interface for the definition of subprograms to control the release
-- of tasks
type Release_Control is limited interface;
procedure Set_Release_Flag(Self : in out Release_Control;
New_Flag : in Boolean) is abstract;
function Get_Release_Flag(Self : in Release_Control) return Boolean
is abstract;
-- Simple OBCS used by cyclic tasks.
-- Permits to block the execution of a task by setting
-- the entry's barrier to false.
protected type Release_Control_OBCS(C : System.Any_Priority) is new
Task_Release and Release_Control with
pragma Priority(C);
overriding
entry Enqueue_for_Release(Release_Time : out Ada.Real_Time.Time);
overriding
procedure Set_Release_Flag(New_Flag : in Boolean);
overriding
function Get_Release_Flag return Boolean;
private
Barrier : Boolean := True;
end Release_Control_OBCS;
protected type Simple_Counter_OBCS(C: System.Any_Priority; Size : Natural) is
new Task_Release and Release_Control with
pragma Priority(C);
overriding
entry Enqueue_for_Release(Release_Time : out Ada.Real_Time.Time);
overriding
procedure Set_Release_Flag(New_Flag : in Boolean);
overriding
function Get_Release_Flag return Boolean;
procedure Put_Request;
private
Max_Pending : Natural := Size;
Request_Pending : Natural := 0;
Barrier : Boolean := True;
Barrier_Release_Flag : Boolean := True;
end Simple_Counter_OBCS;
end Container_Protection;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
--with Ada.Text_IO; use Ada.Text_IO;
package body Data_Structure is
---Temp
procedure My_OPCS (Self : in out Param_Type) is
begin
--Ada.Text_IO.Put_Line("Base My_OPCS ... You are not dispatching!");
null;
end My_OPCS;
-------------------------
-- Deactivate_Activity --
-------------------------
procedure Deactivate_Activity (TA_ref : Task_activity_desc_ref; Act_N : Integer)
is
begin
--Put_Line("Deactivating activity");
TA_ref.all(Act_N).is_Active := false;
--Put("Activity ");
--Put(Integer'Image(Act_N));
--Put_Line(" deactivated");
end Deactivate_Activity;
----------------------------------
-- Deactivate_Activity (offset) --
----------------------------------
procedure Deactivate_Activity (TA_ref : Task_activity_desc_ref; Act_N : Integer;
New_offset : Ada.Real_Time.Time_Span)
is
begin
--Put_Line("Deactivating activity");
TA_ref.all(Act_N).is_Active := false;
TA_ref.all(Act_N).offset := New_offset;
--Put("Activity ");
--Put(Integer'Image(Act_N));
--Put_Line(" deactivated");
end Deactivate_Activity;
procedure Print_Activity_Desc (TA_ref : Task_activity_desc_ref)
is
begin
for I in TA_ref.all'Range loop
--Put("Activity ");
--Put(Integer'Image(I));
--Put_Line(Boolean'Image(TA_ref.all(I).is_Active));
null;
end loop;
end Print_Activity_Desc;
-------------------------
-- Activate_Activity --
-------------------------
procedure Activate_Activity (TA_ref : Task_activity_desc_ref; Act_N : Integer)
is
begin
TA_ref.all(Act_N).Is_Active := true;
end Activate_Activity;
--------------------------------
-- Activate_Activity (offset) --
--------------------------------
procedure Activate_Activity (TA_ref : Task_activity_desc_ref; Act_N : Integer;
new_offset : Ada.Real_Time.Time_Span)
is
begin
TA_ref.all(Act_N).Is_Active := true;
TA_ref.all(Act_N).offset := new_offset;
end Activate_Activity;
--- Param_Buffer_T.Increase_Index
procedure Increase_Index(Self : in out Param_Buffer_T) is
begin
Self.Index := Self.Index + 1;
if Self.Index > Self.Buffer'Last then
Self.Index := Self.Buffer'First;
end if;
end Increase_Index;
--- Subprograms for Request_Queue
procedure Initialize (Self : in out Request_Queue) is
begin
Self.Request_Pending := 0;
Self.Insert_Index := Self.Param_Buffer'First;
Self.Extract_Index := Self.Param_Buffer'First;
end Initialize;
procedure Put(Self : in out Request_Queue; P : Param_Type_Ref) is
begin
Self.Param_Buffer (Self.Insert_Index) := P;
Self.Insert_Index := Self.Insert_Index + 1;
if Self.Insert_Index > Self.Param_Buffer'Last then
Self.Insert_Index := Self.Param_Buffer'First;
end if;
--increase the number of pending requests but do not
--overcome the number of buffered ones
if Self.Request_Pending < Self.Param_Buffer'Last then
Self.Request_Pending := Self.Request_Pending + 1;
end if;
end Put;
procedure Get(Self : in out Request_Queue;
R : out Request_Descriptor_T) is
begin
if Self.Request_Pending > 0 then
R := (Params => Self.Param_Buffer(Self.Extract_Index));
Self.Extract_Index := Self.Extract_Index + 1;
if Self.Extract_Index > Self.Param_Buffer'Last then
Self.Extract_Index := Self.Param_Buffer'First;
end if;
Self.Request_Pending := Self.Request_Pending - 1;
end if;
R.Params.all.In_Use := True;
end Get;
-- Generate_Task_ID
function Generate_Task_ID return Task_Gen_ID is
begin
Next_Task_ID_to_assign := Next_Task_ID_to_assign + 1;
return Next_Task_ID_to_assign;
end Generate_Task_ID;
end Data_Structure;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with Ada.Real_Time;
with Ada.Finalization;
package Data_Structure is
-- Not declared in the private part because otherwise it is not a discrete type,
-- hence cannot be passed as discriminant of a Task
type Task_Gen_ID is new Natural;
type Task_activity_desc_elem is
record
activity: access procedure;
offset: Ada.Real_Time.Time_Span;
is_Active : Boolean;
end record;
type Task_activity_desc is array(Natural range <>) of Task_activity_desc_elem;
type Task_activity_desc_ref is access all Task_activity_desc;
procedure Deactivate_Activity(TA_ref : Task_activity_desc_ref; Act_N : Integer);
procedure Activate_Activity(TA_ref : Task_activity_desc_ref; Act_N : Integer);
procedure Print_Activity_Desc(TA_ref : Task_activity_desc_ref);
procedure Activate_Activity(TA_ref : Task_activity_desc_ref; Act_N : Integer;
New_offset : Ada.Real_Time.Time_Span);
procedure Deactivate_Activity(TA_ref : Task_activity_desc_ref; Act_N: Integer;
New_offset : Ada.Real_Time.Time_Span);
function Generate_Task_ID return Task_Gen_ID;
--- Parameter
type Param_Type is abstract tagged record
In_Use : Boolean := False;
end record;
-- Abstract sequential procedure
procedure My_OPCS (Self : in out Param_Type);
type Param_Type_Ref is access all Param_Type'Class;
type Param_Arr is array(Integer range <>) of Param_Type_Ref;
type Param_Arr_Ref is access all Param_Arr;
-- Request descriptor
type Request_Descriptor_T is
record
--Request : Request_T;
Params : Param_Type_Ref;
end record;
--- Param_Buffer: buffer + index --------------------------
type Param_Buffer_T(Size : Natural) is
record
Buffer : aliased Param_Arr(1..Size);
Index : Integer := 1;
end record;
type Param_Buffer_Ref is access all Param_Buffer_T;
procedure Increase_Index(Self : in out Param_Buffer_T);
type Request_Queue(Size : Positive) is new Ada.Finalization.Controlled with
record
Param_Buffer : Param_Arr(1..Size);
Insert_Index : Integer;
Extract_Index : Integer;
Request_Pending : Natural := 0;
end record;
procedure Initialize(Self : in out Request_Queue);
procedure Put(Self : in out Request_Queue;
P : Param_Type_Ref);
procedure Get(Self : in out Request_Queue;
R : out Request_Descriptor_T);
private
Next_Task_ID_to_assign : Task_Gen_ID := 0;
end Data_Structure;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with Ada.Real_Time;
package System_Time is
System_Start_Time : constant
Ada.Real_Time.Time := Ada.Real_Time.Clock;
Task_Activation_Delay : constant
Ada.Real_Time.Time_Span := Ada.Real_Time.Milliseconds (5_000);
end System_Time;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
package body System_Types is
-- Bounded Queue ---------------------------------------------------
procedure Initialize (Self : in out Bounded_Queue) is
begin
Self.Request_Pending := 0;
Self.Insert_Index := Self.Param_Buffer'First;
Self.Extract_Index := Self.Param_Buffer'First;
end Initialize;
procedure Put(Self : in out Bounded_Queue; P : in Param_Type_Ref) is
begin
Self.Param_Buffer (Self.Insert_Index) := P;
Self.Insert_Index := Self.Insert_Index + 1;
if Self.Insert_Index > Self.Param_Buffer'Last then
Self.Insert_Index := Self.Param_Buffer'First;
end if;
--increase the number of pending requests but do not
--overcome the number of buffered ones
if Self.Request_Pending < Self.Param_Buffer'Last then
Self.Request_Pending := Self.Request_Pending + 1;
end if;
end Put;
procedure Get(Self : in out Bounded_Queue; R : out Request_Descriptor_T) is
begin
if Self.Request_Pending > 0 then
R := (Params => Self.Param_Buffer(Self.Extract_Index));
Self.Extract_Index := Self.Extract_Index + 1;
if Self.Extract_Index > Self.Param_Buffer'Last then
Self.Extract_Index := Self.Param_Buffer'First;
end if;
Self.Request_Pending := Self.Request_Pending - 1;
end if;
R.Params.In_Use := True;
end Get;
procedure Increase_Index(Self : in out Param_Buffer_T) is
begin
Self.Index := Self.Index + 1;
if Self.Index > Self.Buffer'Last then
Self.Index := Self.Buffer'First;
end if;
end Increase_Index;
end System_Types;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
--with System; use System;
--with Ada.Real_Time; use Ada.Real_Time;
with Ada.Finalization; use Ada.Finalization;
package System_Types is
-- Abstract Parameter type --------------------------------------------------
type Param_Type is abstract tagged record
In_Use : Boolean := False;
end record;
-- Abstract sequential procedure
procedure My_OPCS (Self : in out Param_Type) is abstract;
type Param_Type_Ref is access all Param_Type'Class;
type Param_Arr is array(Integer range <>) of Param_Type_Ref;
type Param_Arr_Ref is access all Param_Arr;
--+--------------------------------------------------------------------------
-- Request Descriptor -------------------------------------------------------
type Request_Descriptor_T is
record
--Request : Request_T;
Params : Param_Type_Ref;
end record;
--+--------------------------------------------------------------------------
-- Abstract Queue
type Queue_T is abstract new Controlled with null record;
--type Queue_T is abstract tagged null record;
type Queue_T_Ref is access all Queue_T'Class;
procedure Put(Self : in out Queue_T; P : Param_Type_Ref)
is abstract;
procedure Get(Self : in out Queue_T; R : out Request_Descriptor_T)
is abstract;
-- Bounded Queue ---------------------------------------------------------
type Bounded_Queue(Size : Natural) is new Queue_T with
record
Param_Buffer : Param_Arr(1..Size);
Insert_Index : Natural;
Extract_Index : Natural;
Request_Pending : Natural;
end record;
overriding
procedure Put(Self : in out Bounded_Queue; P : in Param_Type_Ref);
overriding
procedure Get(Self : in out Bounded_Queue; R : out Request_Descriptor_T);
overriding
procedure Initialize(Self : in out Bounded_Queue);
--+--------------------------------------------------------------------------
-- Param_Buffer: buffer + index --------------------------
type Param_Buffer_T(Size : Integer) is
record
Buffer : aliased Param_Arr(1..Size);
Index : Integer := 1;
end record;
type Param_Buffer_Ref is access all Param_Buffer_T;
procedure Increase_Index(Self : in out Param_Buffer_T);
end System_Types;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with Ada.Real_Time;
with System;
package Task_Attributes is
-- Task_State
type Task_Attributes_Record is abstract tagged record
Relative_Deadline : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
Execution_Time : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
Prio : System.Any_Priority := System.Priority'First;
end record;
type Task_Attributes_ptr is access all Task_Attributes_Record'Class;
-- Periodic_Task_State
type Periodic_Task_Attributes_Record is new Task_Attributes_Record with record
Period : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
end record;
type Periodic_Task_Attributes_Record_ptr is access all
Periodic_Task_Attributes_Record'Class;
-- Sporadic_Task_State
type Sporadic_Task_Attributes_Record is new Task_Attributes_Record with record
MIAT : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
end record;
type Sporadic_Task_Attributes_Record_ptr is access all
Sporadic_Task_Attributes_Record'Class;
-- Bursty_Task_State
type Bursty_Task_Attributes_Record is new Task_Attributes_Record with record
Burst_Interval : Ada.Real_Time.Time_Span := Ada.Real_Time.Time_Span_Zero;
Max_Activations : Natural := 0;
end record;
type Bursty_Task_Attributes_Record_ptr is access all
Bursty_Task_Attributes_Record'Class;
end Task_Attributes;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with System_Time;
with Ada.Text_IO; use Ada.Text_IO;
package body Cyclic_Task is
use Ada.Real_Time;
task body Thread_T is
Task_Static_Offset : constant Time_Span := Milliseconds(Static_Offset);
Task_Period : constant Time_Span := Milliseconds(Period);
Next_Time : Time := System_Time.System_Start_Time +
System_Time.Task_Activation_Delay + Task_Static_Offset;
Assigned_Task_ID : constant Task_Gen_ID := My_Task_ID;
Release_Time : Time;
begin
-- Suspend the task until first release;
delay until Next_Time;
Put("Task ");
Put(Natural'Image(Natural(Assigned_Task_ID)));
Put_Line(" first activation");
Task_Loop :
loop
-- First action : enqueue for release
Enqueue_for_Release.all (Release_Time);
-- Execute the sequential operation
Operation.all;
-- Calculate new release time and suspend
Next_Time:= Next_Time + Task_Period;
delay until Next_Time;
end loop Task_Loop;
end Thread_T;
-- procedure Initialize is
-- begin
-- null;
-- end Initialize;
end Cyclic_Task;
-----------------------------------------------------------------------
-- Code Archetypes for the CHESS Component Model --
-- --
-- Copyright (C) 2011-2012 --
-- University of Padova, ITALY --
-- --
-- Author: Marco Panunzio panunzio@math.unipd.it --
-- --
-- All rights reserved. This program and the accompanying materials --
-- are made available under the terms of the Eclipse Public License --
-- v1.0 which accompanies this distribution, and is available at --
-- http://www.eclipse.org/legal/epl-v10.html --
-----------------------------------------------------------------------
with System;
with Data_Structure; use Data_Structure;
with Ada.Real_Time;
package Cyclic_Task is
-- Cannot use Time_Span for offset/period in task discriminant => Natural
task type Thread_T
(My_Task_ID : Task_Gen_ID;
Thread_Priority : System.Any_Priority;
Static_Offset : Natural;
Period : Natural;
Enqueue_for_Release : access procedure (Release : out Ada.Real_Time.Time);
Operation : access procedure) is
pragma Priority (Thread_Priority);
end Thread_T;
--procedure Initialize;
end Cyclic_Task;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment