diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-32B82E5C-FD53-48E6-9ABC-88F82ACF71BC.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-32B82E5C-FD53-48E6-9ABC-88F82ACF71BC.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,56 @@ + + + + + +The +LDD Entry Point and FactoryThis document describes how LDDs are created. +

An LDD +must define an entry point function using the macro DECLARE_STANDARD_LDD, +or DECLARE_EXTENSION_LDD in the case of kernel extensions. +This must create an LDD factory object derived from DLogicalDevice:

DECLARE_STANDARD_LDD() + { + return new DerivedLogicalDevice; + }

This factory object is created on the kernel heap. Its +purpose is to create the logical channel, the object through which all client +interaction with the driver will occur.

DLogicalDevice is +derived from DObject, and is, therefore a reference-counting +object. It also means that DLogicalDevice objects are given +a name, as these objects are always subsequently found by name. The user-side +specifies the name of the logical device through the first parameter in the +user-side call to RBusLogicalChannel::DoCreate().

The +file extension of a LDD DLL can be any permitted Symbian Platform name but, +by convention, the LDD DLL has the extension .LDD. Device +driver DLLs are polymorphic interface DLLs. When building LDDs, specify a +target type of ldd in the .mmp file.

An +LDD is loaded by calling User::LoadLogicalDevice(). This +static function:

    +
  • loads the DLL into RAM, +if necessary

  • +
  • calls the exported function +at ordinal 1 to create the factory object, the DLogicalDevice derived +object

  • +
  • places the factory object +into the appropriate object container.

  • +
This only needs to be done once, not every time the driver is +used.

If an LDD needs to perform initialisation at boot time (before +the driver is loaded by User::LoadLogicalDevice()) then +specify the entry point macros DECLARE_STANDARD_EXTENSION and DECLARE_EXTENSION_LDD.

DECLARE_STANDARD_EXTENSION() + { + // initialise code here + } + +DECLARE_EXTENSION_LDD() + { + return new DMyLogicalFactory; + }

In order for the kernel to initialise the LDD extension +at boot time then the .oby file must specify the extension keyword. +Also note that initialisation of the extension will not load +the LDD: this still has to be done through a call to User::LoadLogicalDevice().

+
\ No newline at end of file