Commit ef34ba9d authored by hugues.jerome's avatar hugues.jerome Committed by yoogx

* Move code for all drivers in src/drivers directory



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-ada@1038 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 3ac4191c
......@@ -186,6 +186,7 @@ AC_OUTPUT([
share/Makefile
share/make/Makefile
src/Makefile
src/drivers/Makefile
src/polyorb_hi.gpr
examples/Makefile
examples/aadlv1/Makefile
......
# BEGIN: DO NOT DELETE THIS LINE
ADA_SPECS_WITH_BODY = $(srcdir)/ping.ads $(srcdir)/pinged.ads \
$(srcdir)/tcp_ip.ads $(srcdir)/uart.ads
ADA_SPECS_WITH_BODY = $(srcdir)/ping.ads $(srcdir)/pinged.ads
ADA_SPECS = $(ADA_SPECS_WITH_BODY)
......@@ -8,8 +7,7 @@ ADA_BODIES = $(ADA_SPECS_WITH_BODY:.ads=.adb)
AADL_SOURCES = $(srcdir)/beeper.aadl $(srcdir)/generic_native.aadl \
$(srcdir)/software.aadl $(srcdir)/system_demo.aadl \
$(srcdir)/tcp_protocol.aadl $(srcdir)/scenario.aadl \
$(srcdir)/uart_line.aadl
$(srcdir)/tcp_protocol.aadl $(srcdir)/scenario.aadl
# END: DO NOT DELETE THIS LINE
......
......@@ -5,8 +5,7 @@
system delayed_connections
properties
Ocarina_Config::AADL_Files => ("beeper.aadl", "generic_native.aadl",
"software.aadl", "system_demo.aadl", "tcp_protocol.aadl",
"uart_line.aadl");
"software.aadl", "system_demo.aadl", "tcp_protocol.aadl");
Ocarina_Config::Generator => polyorb_hi_ada;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
......
......@@ -87,32 +87,25 @@ end Pingee.Impl;
process Pinger_Process
features
Out_Port : out event data port Software::Simple_Type;
Out_Port_2 : out event data port Software::Simple_Type;
end Pinger_Process;
process implementation Pinger_Process.Impl
subcomponents
Pinger : thread Software::Pinger.Impl;
Pinger_2 : thread Software::Pinger.Impl;
connections
port Pinger.Data_Source -> Out_Port;
port Pinger_2.Data_Source -> Out_Port_2;
end Pinger_Process.Impl;
process Pingee_Process
features
In_Port : in event data port Software::Simple_Type;
In_Port_2 : in event data port Software::Simple_Type;
end Pingee_Process;
process implementation Pingee_Process.Impl
subcomponents
Ping_Me : thread Software::Pingee.Impl;
Ping_Me_2 : thread Software::Pingee.Impl;
connections
port In_Port-> Ping_Me.Data_Sink;
port In_Port_2 -> Ping_Me_2.Data_Sink;
end Pingee_Process.Impl;
end Software;
......@@ -8,7 +8,6 @@ public
with Generic_Native; -- Generic hardware
with TCP_IP_Protocol; -- TCP/IP protocol stack, as an AADL device
with UART_Line; -- UART device, as an AADL device
with Beeper; -- Beeper device
with Software; -- Software part for this demo
......@@ -27,11 +26,6 @@ public
Bus_TCP : bus Generic_Native::Generic_Bus.impl;
-- DB9 serial line, it is shared by Node_1 and Node_2 to support
-- communication through the serial line.
Bus_DB9 : bus Generic_Native::Generic_Bus.impl;
------------------------------------------------------------------
-- Node #1 hardware components
......@@ -39,15 +33,9 @@ public
Memory_1 : memory Generic_Native::Memory_Segment.impl;
TCP_IP_Cnx_1 : device TCP_IP_Protocol::TCP_IP_Device.impl
{ Deployment::Location => "127.0.0.1";
Deployment::Port_Number => 1234; };
UART_Cnx_1 : device UART_Line::UART_Device.impl
{ Deployment::Location => "127.0.0.1";
Deployment::Port_Number => 12341; };
-- { Deployment::Location => "/dev/ttyS0";
-- Deployment::Port_Number => 0; };
-- Beeper_1 : device Beeper::Beeper_Device.impl;
{ Deployment::Location => "127.0.0.1";
Deployment::Port_Number => 1234; };
-- Beeper_1 : device Beeper::Beeper_Device.impl;
-- Node #1 software components
......@@ -61,11 +49,6 @@ public
TCP_IP_Cnx_2 : device TCP_IP_Protocol::TCP_IP_Device.impl
{ Deployment::Location => "127.0.0.1";
Deployment::Port_Number => 2345; };
UART_Cnx_2 : device UART_Line::UART_Device.impl
{ Deployment::Location => "127.0.0.1";
Deployment::Port_Number => 23451; };
-- { Deployment::Location => "/dev/ttyS1";
-- Deployment::Port_Number => 0; };
-- Node #2 software components
......@@ -84,11 +67,6 @@ public
port Node_1.Out_Port -> Node_2.In_Port
{ Actual_Connection_Binding => (reference (Bus_TCP)); };
bus access Bus_DB9 -> UART_Cnx_1.Serial_Wire;
bus access Bus_DB9 -> UART_Cnx_2.Serial_Wire;
port Node_1.Out_Port_2 -> Node_2.In_Port_2
{ Actual_Connection_Binding => (reference (Bus_DB9)); };
properties
-- By binding the device to the processor, we specify that the
......@@ -98,14 +76,10 @@ public
Actual_Processor_Binding => (reference (Processor_1)) applies to Node_1;
Actual_Processor_Binding => (reference (Processor_1))
applies to TCP_IP_Cnx_1;
Actual_Processor_Binding => (reference (Processor_1))
applies to UART_Cnx_1;
Actual_Processor_Binding => (reference (Processor_2)) applies to Node_2;
Actual_Processor_Binding => (reference (Processor_2))
applies to TCP_IP_Cnx_2;
Actual_Processor_Binding => (reference (Processor_2))
applies to UART_Cnx_2;
end The_Demo.impl;
end System_Demo;
\ No newline at end of file
end System_Demo;
......@@ -60,8 +60,8 @@ public
-- event.
properties
Initialize_Entrypoint
=> classifier (TCP_IP_Protocol::Initialize_Receiver);
-- Initialize_Entrypoint
-- => classifier (TCP_IP_Protocol::Initialize_Receiver);
Dispatch_Protocol => Background;
end Driver_TCP_IP_Protocol_thread_receiver;
......@@ -86,7 +86,7 @@ public
-- variables to configure the stack.
properties
Source_Name => "TCP_IP.Initialize";
Source_Name => "POlyORB_HI_Drivers_Native_TCP_IP.Initialize";
Source_Language => Ada;
end Initialize;
......@@ -97,7 +97,7 @@ public
-- Initialize the receiver thread
properties
Source_Name => "TCP_IP.Initialize_Receiver";
Source_Name => "POlyORB_HI_Drivers_Native_TCP_IP.Initialize_Receiver";
Source_Language => Ada;
end Initialize_Receiver;
......@@ -110,7 +110,7 @@ public
-- defined in the AADL model.
properties
Source_Name => "TCP_IP.Receive";
Source_Name => "POlyORB_HI_Drivers_Native_TCP_IP.Receive";
Source_Language => Ada;
end Receive;
......@@ -123,7 +123,7 @@ public
-- model.
properties
Source_Name => "TCP_IP.Send";
Source_Name => "POlyORB_HI_Drivers_Native_TCP_IP.Send";
Source_Language => Ada;
end Send;
......
This diff is collapsed.
with PolyORB_HI.Errors;
with PolyORB_HI_Generated.Deployment;
with PolyORB_HI.Streams;
with PolyORB_HI.Utils;
package UART is
use PolyORB_HI.Errors;
use PolyORB_HI_Generated.Deployment;
use PolyORB_HI.Streams;
procedure Initialize (Name_Table : PolyORB_HI.Utils.Naming_Table_Type);
procedure Receive;
pragma Warnings (Off);
function Send
(Node : Node_Type;
Message : Stream_Element_Array;
Size : Stream_Element_Offset)
return Error_Kind;
pragma Export (C, Send, "uart_device.impl_send");
pragma Warnings (On);
end UART;
package UART_Line
-- This package models a serial line (UART) based protocol layer for
-- the PolyORB-HI/Ada AADL runtime. It defines the subprograms and
-- threads to be integrated with the runtime low level interface.
public
with Generic_Native;
------------
-- DEVICE --
------------
-- The main entrypoint for this package is this device, it relies
-- on the 'Implement_As' feature that defines its full
-- specification.
device UART_Device
features
Serial_Wire : requires bus access Generic_Native::Generic_Bus.impl;
-- Connection to the remote node
end UART_Device;
device implementation UART_Device.impl
properties
Implemented_As =>
classifier (UART_Line::Driver_UART_Line.impl);
Initialize_Entrypoint => classifier (UART_Line::Initialize);
end UART_Device.impl;
------------
-- DRIVER --
------------
-- In AADLv2, we can model the actual implementation of a driver
-- using an abstract component.
abstract Driver_UART_Line
end Driver_UART_Line;
abstract implementation Driver_UART_Line.impl
subcomponents
receiver : thread Driver_UART_Line_thread_receiver.impl;
end Driver_UART_Line.impl;
-------------
-- THREADS --
-------------
-- This thread handles the execution logic of the protocol
-- stack. It relies on the previous subprograms to receive
-- messages.
thread Driver_UART_Line_thread_receiver
-- This thread is dispatched when an event is detected on the
-- real hardware. It then calls receive to handle the incoming
-- event.
properties
Dispatch_Protocol => Background;
end Driver_UART_Line_thread_receiver;
thread implementation Driver_UART_Line_thread_receiver.impl
calls
call1 : { pspg : subprogram receive; };
end Driver_UART_Line_thread_receiver.impl;
-----------------
-- SUBPROGRAMS --
-----------------
-- These subprograms model the high-level view of the serial line
-- protocol stack. They define an API used by the stack to send and
-- receive data, and perform node's initialisation.
subprogram Initialize
-- Initialize the different internal resources for managing
-- connections on a node. This subprogram has no formal visible
-- parameters, but relies on well-known data structures and
-- variables to configure the stack.
properties
Source_Name => "UART.Initialize";
Source_Language => Ada;
end Initialize;
-------------
subprogram Receive
-- Receive data and dispatch them to the receiving entity. This
-- program and its sibling (send) share a common protocol, not
-- defined in the AADL model.
properties
Source_Name => "UART.Receive";
Source_Language => Ada;
end Receive;
-------------
subprogram Send
-- Send data to a remote node. This program and its sibling
-- (receive) share a common protocol, not defined in the AADL
-- model.
properties
Source_Name => "UART.Send";
Source_Language => Ada;
end Send;
end UART_Line;
......@@ -14,7 +14,8 @@ properties
Ocarina_Config::Generator => polyorb_hi_ada;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment));
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
end ping;
......
# BEGIN: DO NOT DELETE THIS LINE
ADA_SPECS_WITH_BODY = $(srcdir)/grspw.adb $(srcdir)/gruart.adb \
$(srcdir)/native_uart.adb $(srcdir)/ping.adb \
$(srcdir)/pinged.adb $(srcdir)/grspw.ads $(srcdir)/gruart.ads \
$(srcdir)/native_uart.ads $(srcdir)/ping.ads \
$(srcdir)/pinged.ads
ADA_SPECS_WITH_BODY = $(srcdir)/ping.ads \
$(srcdir)/pinged.ads $(srcdir)/gr_rasta_fpga.ads
ADA_SPECS = $(ADA_SPECS_WITH_BODY)
......@@ -12,7 +9,8 @@ ADA_BODIES = $(ADA_SPECS_WITH_BODY:.ads=.adb)
AADL_SOURCES = $(srcdir)/generic_bus.aadl $(srcdir)/grspw.aadl \
$(srcdir)/generic_native.aadl $(srcdir)/gruart.aadl \
$(srcdir)/software.aadl $(srcdir)/gr_cpci_x4cv.aadl \
$(srcdir)/native_uart.aadl $(srcdir)/system_demo.aadl
$(srcdir)/native_uart.aadl $(srcdir)/system_demo.aadl \
$(srcdir)/grrastafpga.aadl
# END: DO NOT DELETE THIS LINE
......
......@@ -87,7 +87,7 @@ public
-- variables to configure the stack.
properties
Source_Name => "GRSPW.Initialize";
Source_Name => "PolyORB_HI_Drivers_GRSPW.Initialize";
Source_Language => Ada;
end Initialize;
......@@ -100,7 +100,7 @@ public
-- defined in the AADL model.
properties
Source_Name => "GRSPW.Receive";
Source_Name => "PolyORB_HI_Drivers_GRSPW.Receive";
Source_Language => Ada;
end Receive;
......@@ -113,7 +113,7 @@ public
-- model.
properties
Source_Name => "GRSPW.Send";
Source_Name => "PolyORB_HI_Drivers_GRSPW.Send";
Source_Language => Ada;
end Send;
......
......@@ -88,7 +88,7 @@ public
-- variables to configure the stack.
properties
Source_Name => "GRUART.Initialize";
Source_Name => "PolyORB_HI_Drivers_GRUART.Initialize";
Source_Language => Ada;
end Initialize;
......@@ -101,7 +101,7 @@ public
-- defined in the AADL model.
properties
Source_Name => "GRUART.Receive";
Source_Name => "PolyORB_HI_Drivers_GRUART.Receive";
Source_Language => Ada;
end Receive;
......@@ -114,7 +114,7 @@ public
-- model.
properties
Source_Name => "GRUART.Send";
Source_Name => "PolyORB_HI_Drivers_GRUART.Send";
Source_Language => Ada;
end Send;
......
......@@ -85,7 +85,7 @@ public
-- variables to configure the stack.
properties
Source_Name => "Native_UART.Initialize";
Source_Name => "PolyORB_HI_Drivers_Native_UART.Initialize";
Source_Language => Ada;
end Initialize;
......@@ -98,7 +98,7 @@ public
-- defined in the AADL model.
properties
Source_Name => "Native_UART.Receive";
Source_Name => "PolyORB_HI_Drivers_Native_UART.Receive";
Source_Language => Ada;
end Receive;
......@@ -111,7 +111,7 @@ public
-- model.
properties
Source_Name => "Native_UART.Send";
Source_Name => "PolyORB_HI_Drivers_Native_UART.Send";
Source_Language => Ada;
end Send;
......
SUBDIRS = drivers
# BEGIN: DO NOT DELETE THIS LINE
ADA_SPECS_WITH_BODY = $(srcdir)/polyorb_hi-aperiodic_task.ads \
$(srcdir)/polyorb_hi-background_task.ads \
......
......@@ -11,7 +11,7 @@ with PolyORB_HI_Generated.Transport;
-- This package provides support for the GRSPW device driver as
-- defined in the GRSPW AADLv2 model.
package body GRSPW is
package body PolyORB_HI_Drivers_GRSPW is
task body Idle_Task is
begin
......@@ -161,4 +161,4 @@ package body GRSPW is
-- Note: we have no way to no there was an error here
end Send;
end GRSPW;
end PolyORB_HI_Drivers_GRSPW;
......@@ -4,7 +4,7 @@ with PolyORB_HI.Streams;
with PolyORB_HI.Utils;
with System;
package GRSPW is
package PolyORB_HI_Drivers_GRSPW is
use PolyORB_HI.Errors;
use PolyORB_HI_Generated.Deployment;
......@@ -33,4 +33,4 @@ package GRSPW is
pragma Priority (System.Priority'First);
end Idle_Task;
end GRSPW;
end PolyORB_HI_Drivers_GRSPW;
......@@ -13,7 +13,7 @@ with PolyORB_HI_Generated.Transport;
-- This package provides support for the GRUART device driver as
-- defined in the GRUART AADLv2 model.
package body GRUART is
package body PolyORB_HI_Drivers_GRUART is
pragma Suppress (Elaboration_Check, PolyORB_HI_Generated.Transport);
-- We do not want a pragma Elaborate_All to be implicitely
......@@ -192,4 +192,4 @@ package body GRUART is
-- Note: we have no way to no there was an error here
end Send;
end GRUART;
end PolyORB_HI_Drivers_GRUART;
......@@ -3,7 +3,7 @@ with PolyORB_HI_Generated.Deployment;
with PolyORB_HI.Streams;
with PolyORB_HI.Utils;
package GRUART is
package PolyORB_HI_Drivers_GRUART is
use PolyORB_HI.Errors;
use PolyORB_HI_Generated.Deployment;
......@@ -22,4 +22,4 @@ package GRUART is
pragma Export (C, Send, "gruart_device.impl_send");
pragma Warnings (On);
end GRUART;
end PolyORB_HI_Drivers_GRUART;
......@@ -14,7 +14,7 @@ with PolyORB_HI_Generated.Transport;
-- This package provides support for the TCP_IP device driver as
-- defined in the tcp_protocol.aadl AADLv2 model.
package body TCP_IP is
package body PolyORB_HI_Drivers_Native_TCP_IP is
pragma Suppress (Elaboration_Check, PolyORB_HI_Generated.Transport);
-- We do not want a pragma Elaborate_All to be implicitely
......@@ -112,7 +112,9 @@ package body TCP_IP is
-- Connect to other nodes and send my node id
for N in Nodes'Range loop
if N /= My_Node and then Nodes (N).Address.Addr /= No_Inet_Addr then
if N /= My_Node
and then Nodes (N).Address.Addr /= No_Inet_Addr
then
loop
Create_Socket (Nodes (N).Socket_Send);
......@@ -144,6 +146,7 @@ package body TCP_IP is
end if;
end loop;
Initialize_Receiver;
pragma Debug (Put_Line (Verbose, "Initialization of socket subsystem"
& " is complete"));
end Initialize;
......@@ -214,6 +217,8 @@ package body TCP_IP is
for N in Node_Type'Range loop
if N /= My_Node then
Set (R_Sockets, Nodes (N).Socket_Receive);
pragma Debug (Put_Line (Verbose, "Will wait on " &
Image (Nodes (N).Address)));
end if;
end loop;
......@@ -317,4 +322,4 @@ package body TCP_IP is
return Error_Kind'(Error_Transport);
end Send;
end TCP_IP;
end PolyORB_HI_Drivers_Native_TCP_IP;
......@@ -3,7 +3,7 @@ with PolyORB_HI_Generated.Deployment;
with PolyORB_HI.Streams;
with PolyORB_HI.Utils;
package TCP_IP is
package PolyORB_HI_Drivers_Native_TCP_IP is
use PolyORB_HI.Errors;
use PolyORB_HI_Generated.Deployment;
......@@ -23,4 +23,4 @@ package TCP_IP is
pragma Export (C, Send, "tcp_ip_device.impl_send");
pragma Warnings (On);
end TCP_IP;
end PolyORB_HI_Drivers_Native_TCP_IP;
......@@ -13,7 +13,7 @@ with PolyORB_HI_Generated.Transport;
-- This package provides support for the Native_UART device driver as
-- defined in the Native_UART AADLv2 model.
package body Native_UART is
package body PolyORB_HI_Drivers_Native_UART is
pragma Suppress (Elaboration_Check, PolyORB_HI_Generated.Transport);
-- We do not want a pragma Elaborate_All to be implicitely
......@@ -197,4 +197,4 @@ package body Native_UART is
end Send;
end Native_UART;
end PolyORB_HI_Drivers_Native_UART;
......@@ -3,7 +3,7 @@ with PolyORB_HI_Generated.Deployment;
with PolyORB_HI.Streams;
with PolyORB_HI.Utils;
package Native_UART is
package PolyORB_HI_Drivers_Native_UART is
use PolyORB_HI.Errors;
use PolyORB_HI_Generated.Deployment;
......@@ -22,4 +22,4 @@ package Native_UART is
pragma Export (C, Send, "native_uart_device.impl_send");
pragma Warnings (On);
end Native_UART;
end PolyORB_HI_Drivers_Native_UART;
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