Project

General

Profile

Entry point

In the directory Static_Plugins, you have three files to modify :
  • static_plugin.ads : defines a type used to list all the known static plugins.
    On line 4, you see an enumeration of all the accepted static plugins.
    The Pragma Pure on line 2 means that this header has no dependancy and can be elaborate easily.
  • static_plugin-management.adb : in the function Load_Static_Plugin, you can create the right object for your plugin.
    On line 15, a first cast is done to check that the device to create is really based on a static plugin. If it's not the case, a Constraint_Error will be raised and is handled on line 22 to 24. In this case we will raise an exception defines in common.exceptions package.
    If the cast is legal, we test all the value possible for the type defined in static_plugin interface. In this case, the only value is DRV_DEBUG. And on line 18, we instantiate the correct object for this kind of plugin.
  • static_plugin-init.adb : add the static driver during the ENX initialization phase.
    The function init is called by the ENX Init function (line 44).
    In this Init function, you need to add all the static plugin you want load during initialization phase.
    NOTA BENE : Static plugins cannot be load during ENX execution, it can only be done during initialization.

Static plugin example

Before adding new entry point in the listed files, you must have developped a static plugin !
You can find a simple example in Driver_Debug directory.

In the header file (ads file), you need to defines:
  • your object (line 7 to 10). It inherits from T_Driver standard parameters like Name, Address, ...
  • methods defines by the object interface (line 12 to 39). It inherits from T_Driver abstract methods.
In the body file (adb file), you need to implement all the methods define in your header. Some functions are really critical :
  • Init / Close : these two method are called when creating / deleting an instance of the object. So you need to insure the initialization of all parameters for initialization and to free the memory for deleting.
  • Write_* : Methors called to write 8, 16 or 32 bits. It's not mandatory to implement all of them. You can raise exception if you don't need 8, 16 or 32 bits access.
  • Read_* : Same than for Write_* methods but for reading puprose.

For more precise information, look the documentation about Plugin creation.