Commit d8a8ef62 authored by yoogx's avatar yoogx

* Add RTEMS5_UART driver, from Ocarina

        For openaadl/ocarina#178
parent b010795f
......@@ -2,12 +2,17 @@
AADL_SOURCES = ${shell find $(srcdir) -name '*.aadl'}
OCARINA_FLAGS=-I$(top_srcdir)/src/aadl -I$(top_srcdir)/src/aadl/buses \
-I$(top_srcdir)/src/aadl/devices -I$(top_srcdir)/src/aadl/drivers \
-I$(top_srcdir)/src/aadl/drivers/uart \
-I$(top_srcdir)/src/property_set
debug:
@echo $(AADL_SOURCES)
check-local:
for FILE in ${AADL_SOURCES}; do \
ocarina -y -aadlv2 -I$(top_srcdir)/src/aadl -I$(top_srcdir)/src/property_set $${FILE};\
ocarina -y -aadlv2 $(OCARINA_FLAGS) $${FILE};\
done
clean-local:
......
......@@ -6,6 +6,7 @@ public
with Processors::SPARC, Memories, Data_Sheet;
with Buses::Ethernet, Buses::UART;
with Deployment;
with RTEMS5_UART;
------------------
-- GR_XC3S_1500 --
......@@ -21,9 +22,6 @@ public
Eth_Bus_0 : requires bus access Buses::Ethernet::Ethernet.impl;
properties
Data_Sheet::UUID => "http://www.gaisler.com/cms/index.php?option=com_content&task=view&id=187&Itemid=118";
end GR_XC3S_1500;
system implementation GR_XC3S_1500.impl
......@@ -33,17 +31,21 @@ public
Eth_0 : device Buses::Ethernet::Generic_Ethernet;
UART_1 : device Buses::UART::Generic_UART;
UART_2 : device Buses::UART::Generic_UART;
connections
C1 : bus access UART_Bus_0 -> UART_1.UART;
C2 : bus access UART_Bus_1 -> UART_2.UART;
C3 : bus access Eth_Bus_0 -> Eth_0.Eth;
end GR_XC3S_1500.impl;
system implementation GR_XC3S_1500.rtems extends GR_XC3S_1500.impl
subcomponents
LEON_Core : refined to processor
{ Deployment::Execution_Platform => LEON_RTEMS;};
connections
C1 : bus access UART_Bus_0 -> UART_1.UART;
C2 : bus access UART_Bus_1 -> UART_2.UART;
C3 : bus access Eth_Bus_0 -> Eth_0.Eth;
UART_1 : refined to device RTEMS5_UART::RTEMS5_APBUART.impl;
UART_2 : refined to device RTEMS5_UART::RTEMS5_APBUART.impl;
end GR_XC3S_1500.rtems;
end Boards::GR_XC3S_1500;
package ASN1_Configuration
public
with Deployment;
------------------------
-- Configuration Type --
------------------------
data configuration_type_ip
properties
Type_Source_Name => "IP-Conf-T";
Deployment::ASN1_Module_Name => "POHICDRIVER-IP";
Source_Language => (ASN1);
Source_Text => ("OCARINA_INCLUDE_PATH/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" , "drivers/configuration/ip.h");
end configuration_type_ip;
data configuration_type_serial
properties
Type_Source_Name => "Serial-Conf-T";
Deployment::ASN1_Module_Name => "POHICDRIVER-UART";
Source_Language => (ASN1);
Source_Text => ("OCARINA_INCLUDE_PATH/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/serial.asn", "drivers/configuration/serial.h");
end configuration_type_serial;
data configuration_type_spacewire
properties
Type_Source_Name => "Spacewire-Conf-T";
Deployment::ASN1_Module_Name => "POHICDRIVER-SPACEWIRE";
Source_Language => (ASN1);
Source_Text => ("OCARINA_INCLUDE_PATH/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/spacewire.asn", "drivers/configuration/spacewire.h");
end configuration_type_spacewire;
end ASN1_Configuration;
\ No newline at end of file
package RTEMS5_UART
public
with Deployment;
with ASN1_Configuration;
with Buses::UART;
-- This driver works for RTEMS 5 (presumably RTEMS 4.11) based on
-- drvmgr driver subsystem, using APBUART driver.
--
-- See Chapter 33 of RCC 1.3 manual
device RTEMS5_APBUART extends Buses::UART::Generic_UART
end RTEMS5_APBUART;
device implementation RTEMS5_APBUART.impl
properties
Deployment::Driver_Name => "RTEMS5_APBUART";
Device_Driver => classifier (serial_driver.impl);
Initialize_Entrypoint => classifier (spg_serial_init);
end RTEMS5_APBUART.impl;
------------
-- DRIVER --
------------
abstract serial_driver
properties
Deployment::Configuration_Type =>
classifier (ASN1_Configuration::configuration_type_serial);
Deployment::Version => "0.1beta";
Deployment::Help => "Write your ASN.1 configuration here";
end serial_driver;
abstract implementation serial_driver.impl
subcomponents
receiver_apbuart_serial : thread serial_poller.impl;
sender : subprogram spg_serial_sender;
end serial_driver.impl;
-------------
-- THREADS --
-------------
-- This thread handles the execution logic of the protocol stack.
thread serial_poller
end serial_poller;
thread implementation serial_poller.impl
calls
mycall : {
pspg : subprogram spg_serial_poller;
};
properties
Period => 1ms;
Dispatch_Protocol => Background;
end serial_poller.impl;
-----------------
-- SUBPROGRAMS --
-----------------
-- These subprograms model the high-level view of the UART protocol
-- stack. They define an API used by the stack to send and receive
-- data, and perform node's initialisation.
subprogram spg_serial_poller
-- 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_Language => (C);
Source_Name => "__po_hi_c_driver_rtems_drvmgr_serial_poller";
Source_Text => ("po_hi_driver_drvmgr_common.c",
"po_hi_driver_rtems_drvmgr_serial.c");
end spg_serial_poller;
subprogram spg_serial_sender
-- Send data to a remote node. This program and its sibling
-- (receive) share a common protocol, not defined in the AADL
-- model.
properties
Source_Language => (C);
Source_Name => "__po_hi_c_driver_rtems_drvmgr_serial_sender";
Source_Text => ("po_hi_driver_drvmgr_common.c",
"po_hi_driver_rtems_drvmgr_serial.c");
end spg_serial_sender;
subprogram spg_serial_init
-- 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_Language => (C);
Source_Name => "__po_hi_c_driver_rtems_drvmgr_serial_init";
Source_Text => ("po_hi_driver_drvmgr_common.c",
"po_hi_driver_rtems_drvmgr_serial.c");
end spg_serial_init;
end RTEMS5_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