add_driver_doc_mp.txt 5.99 KB
Newer Older
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
1) edit ocarina_components.aadl and look for this pattern:


  --------------------------------------------------
  -- USB BRICK (STAR DUNDEE) DEVICE FOR SPACEWIRE --
  --------------------------------------------------


2) below this section, add the following to declare the 2 new drivers for two SPW ports:

  ---------------------------------------------------
  -- CUSTOM DRIVER TO SIMULATE SPW PORT A OF GR740 --
  ---------------------------------------------------

  device gr740_spw_a
  features
    link : requires bus access ocarina_buses::spacewire.generic;
  end gr740_spw_a;

  device implementation gr740_spw_a.pohic
  properties
    Deployment::Driver_Name       => "gr740_spw_a";
    Device_Driver                 => classifier (ocarina_drivers_gr740_spw_a::driver.gr740_spw_a);
    Initialize_Entrypoint         => classifier (ocarina_drivers_gr740_spw_a::spw_a_init);
    Provided_Virtual_Bus_Class    => (classifier (ocarina_buses::pohi.c));
  end gr740_spw_a.pohic;

  ---------------------------------------------------
  -- CUSTOM DRIVER TO SIMULATE SPW PORT B OF GR740 --
  ---------------------------------------------------

  device gr740_spw_b
  features
    link : requires bus access ocarina_buses::spacewire.generic;
  end gr740_spw_b;

  device implementation gr740_spw_b.pohic
  properties
    Deployment::Driver_Name       => "gr740_spw_b";
    Device_Driver                 => classifier (ocarina_drivers_gr740_spw_b::driver.gr740_spw_b);
    Initialize_Entrypoint         => classifier (ocarina_drivers_gr740_spw_b::spw_b_init);
    Provided_Virtual_Bus_Class    => (classifier (ocarina_buses::pohi.c));
  end gr740_spw_b.pohic;


!!pay attention to the Driver_Name!!

we have to define the devices in packages named "ocarina_drivers_gr740_spw_a / b"

3) look for that pattern in the file:


  with ocarina_drivers_star_dundee_spacewire_brick;

4) just below, add:

  with ocarina_drivers_gr740_spw_a;
  with ocarina_drivers_gr740_spw_b;

5) look for that pattern:

package ocarina_drivers_star_dundee_spacewire_brick

6) below that patten section, add:

package ocarina_drivers_gr740_spw_a
public

with ocarina_buses;
with Deployment;

subprogram spw_a_poller
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_a_poller";
end spw_a_poller;

subprogram spw_a_sender
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_a_sender";
end spw_a_sender;

subprogram spw_a_init
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_a_init";
end spw_a_init;


thread thr_poller
end thr_poller;

thread implementation thr_poller.i
calls
	mycall : {
	  pspg : subprogram spw_a_poller;
	};
properties
   Period => 1000ms;
   Dispatch_Protocol => Periodic;
end thr_poller.i;

abstract driver
properties
   Deployment::Version  => "0.1beta";
   Deployment::Help     => "Write your ASN.1 configuration here";
   Deployment::Configuration_Type => classifier (ocarina_drivers::configuration_type_spacewire);
end driver;

abstract implementation driver.gr740_spw_a
subcomponents
   receiver_rasta_spacewire : thread thr_poller.i;
   sender                   : subprogram spw_a_sender;
end driver.gr740_spw_a;

end ocarina_drivers_gr740_spw_a;


package ocarina_drivers_gr740_spw_b
public

with ocarina_buses;
with Deployment;

subprogram spw_b_poller
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_b_poller";
end spw_b_poller;

subprogram spw_b_sender
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_b_sender";
end spw_b_sender;

subprogram spw_b_init
properties
	Source_Language => (C);
	Source_Name => "__po_hi_c_driver_gr740_spw_b_init";
end spw_b_init;


thread thr_poller
end thr_poller;

thread implementation thr_poller.i
calls
	mycall : {
	  pspg : subprogram spw_b_poller;
	};
properties
   Period => 1000ms;
   Dispatch_Protocol => Periodic;
end thr_poller.i;

abstract driver
properties
   Deployment::Version  => "0.1beta";
   Deployment::Help     => "Write your ASN.1 configuration here";
   Deployment::Configuration_Type => classifier (ocarina_drivers::configuration_type_spacewire);
end driver;

abstract implementation driver.gr740_spw_b
subcomponents
   receiver_rasta_spacewire : thread thr_poller.i;
   sender                   : subprogram spw_b_sender;
end driver.gr740_spw_b;

end ocarina_drivers_gr740_spw_b;


6) for the moment note this line:

   Deployment::Configuration_Type => classifier (ocarina_drivers::configuration_type_spacewire);

It is defined in the file like this:

   data configuration_type_spacewire
   properties
      Type_Source_Name              => "Spacewire-Conf-T";
      Deployment::ASN1_Module_Name  => "POHICDRIVER-SPACEWIRE";
      Source_Language               => (ASN1);
      Source_Text                   => ("/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/spacewire.asn", "drivers/configuration/spacewire.h");
   end configuration_type_spacewire;

This can be modified to add a custom type for the configuration of our device ...


7) go to ~/tool-src/polyorb-hi-c/src/drivers


Create (or copy from another driver) the C code of the driver
name of the file: po_hi_driver_gr740_spw_a.c

// The following pattern is __PO_HI_NEED_DRIVER_<Driver_Name> 
// the Driver_Name is in the AADL file (Deployment::Driver_Name)
// Then the definition will be done in deployment.h automatically
#ifdef __PO_HI_NEED_DRIVER_GR740_SPW_A


8) go to ~/tool-src/polyorb-hi-c/include/drivers

Create (or copy from another driver) the include file of the driver
name of the file: po_hi_driver_gr740_spw_a.h

9) The drivers must be copied to:
/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/include/drivers/ (.h files)
and 
/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers (.c files)

This is normally done by the Makefile in pohic/src/drivers

the following two files must be completed with the new driver names (.c and .o):

Makefile.common.in in tool-src/polyorb-hi-c/share/make  (add the .o)
Makefile.am  in tool-srtc/polyorb-hi-c/src/drivers   (add the .c)