rtems5_uart.aadl 3.13 KB
Newer Older
Jerome Legrand's avatar
Jerome Legrand committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
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;