This 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.
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().
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.