diff --git a/examples/aadlv2/rasta/Makefile.am b/examples/aadlv2/rasta/Makefile.am index 014b0e08a4165feaf93d5463bfc42cf98a0453bb..12fb9ae12e3f4b0f3c719e4596e73eb5e2628c25 100644 --- a/examples/aadlv2/rasta/Makefile.am +++ b/examples/aadlv2/rasta/Makefile.am @@ -26,6 +26,7 @@ if HAS_GNATMAKE_FOR_LEON SCENARIO_FILES+= $(srcdir)/scenario_spw.aadl \ $(srcdir)/scenario.aadl $(srcdir)/scenario_uart.aadl \ $(srcdir)/scenario_uart_2.aadl \ + $(srcdir)/scenario_uart_native.aadl \ $(srcdir)/scenario_no_cnx_leon.aadl \ $(srcdir)/scenario_no_cnx_native.aadl endif diff --git a/examples/aadlv2/rasta/native_uart.adb b/examples/aadlv2/rasta/native_uart.adb index 9b0952a3401bb6f0c94d819a8fb15096d8bb1ec4..30805a8b98289e740024aabeb003b92cdaa510dc 100644 --- a/examples/aadlv2/rasta/native_uart.adb +++ b/examples/aadlv2/rasta/native_uart.adb @@ -26,15 +26,12 @@ package body Native_UART is use PolyORB_HI.Output; type Node_Record is record - -- SpaceWire is a simple protocol, we use one core to send, - -- another to receive. + -- UART is a simple protocol, we use one port to send, another + -- to receive. UART_Port_Send : GNAT.Serial_Communications.Serial_Port; --- UART_Device_Send : Uart.Core.UART_Device; UART_Port_Receive : GNAT.Serial_Communications.Serial_Port; --- UART_Device_Receive : Uart.Core.UART_Device; - end record; Nodes : array (Node_Type) of Node_Record; @@ -60,30 +57,31 @@ package body Native_UART is procedure Initialize (Name_Table : PolyORB_HI.Utils.Naming_Table_Type) is begin - Put_Line ("coin"); begin GNAT.Serial_Communications.Open (Port => Nodes (My_Node).UART_Port_Send, Name => "/dev/ttyS0"); exception - when others => - Put_Line ("ttyS0"); + when E : others => + Put_Line (Ada.Exceptions.Exception_Information (E)); end; begin GNAT.Serial_Communications.Open (Port => Nodes (My_Node).UART_Port_Receive, - Name => "/dev/ttyUSB1"); + Name => "/dev/ttyUSB0"); exception - when others => - Put_Line ("ttyUSB1"); + when E : others => + Put_Line (Ada.Exceptions.Exception_Information (E)); end; GNAT.Serial_Communications.Set (Port => Nodes (My_Node).UART_Port_Send, + Parity => GNAT.Serial_Communications.Even, Rate => GNAT.Serial_Communications.B19200); GNAT.Serial_Communications.Set (Port => Nodes (My_Node).UART_Port_Receive, + Parity => GNAT.Serial_Communications.Even, Rate => GNAT.Serial_Communications.B19200, Block => True); @@ -111,8 +109,6 @@ package body Native_UART is Main_Loop : loop Put_Line ("Using user-provided Native_UART stack to receive"); --- Put_Line ("Waiting on UART #" --- & Nodes (My_Node).UART_Device_Receive'Img); -- UART is a character-oriented protocol @@ -123,18 +119,20 @@ package body Native_UART is Packet_Size := Ada.Streams.Stream_Element_Offset (To_Length (To_PO_HI_Message_Length_Stream (SEL))); + SEO := Packet_Size; + SEA (1 .. Message_Length_Size) := SEL; Data_Received_Index := Message_Length_Size + 1; - while Data_Received_Index < Packet_Size loop + while Data_Received_Index <= Packet_Size + Message_Length_Size loop -- We must loop to make sure we receive all data GNAT.Serial_Communications.Read (Nodes (My_Node).UART_Port_Receive, SEA (Data_Received_Index .. SEO + 1), SEO); - Data_Received_Index := 1 + SEO; + Data_Received_Index := 1 + SEO + 1; end loop; -- 2/ Receive full message @@ -142,9 +140,7 @@ package body Native_UART is if SEO /= SEA'First - 1 then Put_Line (Normal, - "UART #" --- & Nodes (My_Node).UART_Device_Receive'Img - & " received" + "UART received" & Ada.Streams.Stream_Element_Offset'Image (SEO) & " bytes"); @@ -159,7 +155,6 @@ package body Native_UART is exception when E : others => Put_Line (Ada.Exceptions.Exception_Information (E)); - Put_Line ("arghl"); end; else Put_Line ("Got error"); @@ -191,7 +186,6 @@ package body Native_UART is begin Put_Line ("Using user-provided UART stack to send"); Put_Line ("Sending through UART #" --- & Nodes (Node).UART_Device_Send'Img & Size'Img & " bytes"); GNAT.Serial_Communications.Write @@ -200,6 +194,7 @@ package body Native_UART is return Error_Kind'(Error_None); -- Note: we have no way to no there was an error here + end Send; end Native_UART; diff --git a/examples/aadlv2/rasta/scenario_uart_native.aadl b/examples/aadlv2/rasta/scenario_uart_native.aadl new file mode 100644 index 0000000000000000000000000000000000000000..9b5087aab4281d32214b3641d1f1748ede564d79 --- /dev/null +++ b/examples/aadlv2/rasta/scenario_uart_native.aadl @@ -0,0 +1,20 @@ +-- This is a scenario file describing the devide driver integration demo + +-- $Id: scenario_local.aadl 6713 2009-06-20 20:58:28Z lanarre $ + +system delayed_connections +properties + Ocarina_Config::AADL_Files => ("grspw.aadl", "gr_cpci_x4cv.aadl", + "generic_bus.aadl", "native_uart.aadl", "generic_native.aadl", + "gruart.aadl", "software.aadl", "system_demo.aadl"); + Ocarina_Config::Generator => polyorb_hi_ada; + Ocarina_Config::Needed_Property_Sets => + (value (Ocarina_Config::Data_Model), + value (Ocarina_Config::Deployment)); + Ocarina_Config::AADL_Version => AADLv2; + Ocarina_Config::Root_System_Name => "the_demo.uart_native"; +end delayed_connections; + +system implementation delayed_connections.Impl +end delayed_connections.Impl; + diff --git a/examples/aadlv2/rasta/software.aadl b/examples/aadlv2/rasta/software.aadl index 6c637daa2725b533b59e12301af8a3ae6122e5eb..49bc6809830eccbbddf7d25902412b682e7f2920 100644 --- a/examples/aadlv2/rasta/software.aadl +++ b/examples/aadlv2/rasta/software.aadl @@ -57,7 +57,7 @@ connections properties Source_Stack_Size => 512 KByte; Dispatch_Protocol => Periodic; - Period => 10 sec; + Period => 3 sec; Priority => 2; end Pinger.Impl; diff --git a/examples/aadlv2/rasta/system_demo.aadl b/examples/aadlv2/rasta/system_demo.aadl index 9fd2961553c05c30d7c361d659d1376ed2a84f6a..88b69bc6f5879dc86ce23caf8e8569211517fe5d 100644 --- a/examples/aadlv2/rasta/system_demo.aadl +++ b/examples/aadlv2/rasta/system_demo.aadl @@ -213,6 +213,46 @@ public --------------------------------------------------------------------------- + system implementation The_Demo.UART_Native + + -- XXX + + subcomponents + + Bus_UART : bus Generic_Bus::Generic_Bus.impl; + + -- Node #1 hardware components + + Processor_1 : processor Generic_Native::Generic_Processor.impl; + + Memory_1 : memory Generic_Native::Memory_Segment.impl; + + + UART_Cnx_1 : device Native_UART_Protocol::Native_UART_Device.impl + { Deployment::Location => "1:2"; + -- Configure UART port #1 to send, #2 to receive + }; + + -- Node #1 software components + + Node_1 : process Process_Simple.Impl; + + connections + + bus access Bus_UART -> UART_Cnx_1.DB9_Wire; + port Node_1.Out_Port -> Node_1.In_Port + { Actual_Connection_Binding => (reference (Bus_UART)); }; + + properties + + Actual_Processor_Binding => (reference (Processor_1)) applies to Node_1; + Actual_Processor_Binding => (reference (Processor_1)) + applies to UART_Cnx_1; + + end The_Demo.UART_Native; + + --------------------------------------------------------------------------- + system implementation The_Demo.UART_2 -- Note: this setting assumes one RASTA board and a Native