|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-22CCA5B5-D4AB-4ABC-94C6-CD85EC470238" xml:lang="en"><title>System |
|
13 Information</title><shortdesc>This topic describes various system information related to the |
|
14 device drivers.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section id="GUID-8968BABB-32E5-4998-8E69-C8389D1E6B63"> <title>Presence |
|
16 of PDD</title> <p>Some drivers may only require an LDD, and not provide |
|
17 a PDD. However, if the driver has a PDD, then the driver must inform the framework |
|
18 of this. The LDD should set the <xref href="GUID-7616AA05-83E6-3989-AB9D-11AE01245BEB.dita#GUID-7616AA05-83E6-3989-AB9D-11AE01245BEB/GUID-EB891156-94D9-323A-AB23-7B5994CD95E3"><apiname>DLogicalDevice::iParseMask</apiname></xref> bitmask |
|
19 with the <xref href="GUID-DD3574F6-5EA7-3E2E-B906-E1E320DE10CD.dita"><apiname>KDeviceAllowPhysicalDevice</apiname></xref> flag. If this flag |
|
20 is not set, then the Kernel assumes that the driver does not have a PDD. </p> <codeblock id="GUID-F4A44E78-EA90-5D75-BC1F-48EF684F7F58" xml:space="preserve">// Logical Channel Second stage constructor |
|
21 DExDriverLogicalDevice:: DExDriverLogicalDevice () |
|
22 { |
|
23 iParseMask = KDeviceAllowPhysicalDevice | KDeviceAllowUnit; |
|
24 ... |
|
25 }</codeblock> </section> |
|
26 <section id="GUID-EFC4AE5D-6506-4B1F-A4E4-DBA31B456593"/> |
|
27 <section id="GUID-E983D7DF-52C4-46FC-B633-BF08519D949D"><title>Capabilities</title> <p>The |
|
28 device driver framework provides a method to set and provide general information |
|
29 to the user on the capabilities of the device driver. Typically, implementations |
|
30 simply return the version number of the LDD. The device driver framework allows |
|
31 both the LDD and PDD to set the device capabilities. </p> <p>The user typically |
|
32 calls the <xref href="GUID-92BAC78E-8ACF-3952-8E77-CCF93ED3BDC9.dita#GUID-92BAC78E-8ACF-3952-8E77-CCF93ED3BDC9/GUID-9C38652A-0135-360D-A54F-A9542C45E608"><apiname>RDevice::GetCaps()</apiname></xref> function to retrieve the device |
|
33 capabilities. </p> <codeblock id="GUID-6801C06D-EEA1-505B-968A-8EF354961183" xml:space="preserve">RDevice device; |
|
34 r = device.Open(KDriverName); |
|
35 if (r==KErrNone) |
|
36 { |
|
37 TPckgBuf<RExDriver::TUartCaps> caps; |
|
38 device.GetCaps(caps); |
|
39 ... |
|
40 device.Close(); |
|
41 }</codeblock> <p> <i>Note:</i> The device capabilities in this context |
|
42 refer to the services that the driver can offer. Do not confuse this with |
|
43 the idea of platform security capabilities, which are completely different. </p></section> |
|
44 <section id="GUID-73AD1B0E-2A31-4D44-A19C-E64A78281C27"><title> HAL handlers</title> <p>Symbian |
|
45 platform provides a Hardware Abstraction Layer (HAL) interface that can be |
|
46 used by device drivers and kernel extensions to provide information on device |
|
47 specific attributes to user code. It comprises set and get interfaces used |
|
48 by the Kernel and by user code. The attributes are divided into groups of |
|
49 similar functionality, each of which is managed by a function called a HAL |
|
50 handler. </p> <p>Drivers must register any HAL handlers they provide, and |
|
51 de-register them when unloading. Kernel extensions do not remove their HAL |
|
52 handlers. </p> <codeblock id="GUID-EE9D2192-92F1-5C9D-9E9C-4CFD5D2C6304" xml:space="preserve">// Adds a HAL entry handling function for the specified group of |
|
53 // HAL entries. |
|
54 Kern::AddHalEntry(EHalGroupDisplay, &handler, this, 1); |
|
55 |
|
56 // Removes the HAL handler |
|
57 TInt Kern::RemoveHalEntry(EHalGroupDisplay);</codeblock> <p>The arguments |
|
58 to <codeph>AddHalEntry()</codeph> are the ID of a HAL group, a pointer to |
|
59 the handler function and a pointer to a data structure that will be passed |
|
60 to the handler function. The HAL handler function prototype is defined by <xref href="GUID-A65A16CA-488D-3A16-A034-F01C9C0B9D15.dita"><apiname>THalFunc</apiname></xref>. </p> <codeblock id="GUID-B3B4A844-FA9B-54CC-A02C-90BB2388AFC8" xml:space="preserve">// Implementation of the kernel extension's exported function |
|
61 EXPORT_C void TExClientInterface::MyExAPI() |
|
62 { |
|
63 … |
|
64 ExController->MyExAPI(); |
|
65 … |
|
66 } |
|
67 |
|
68 LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, |
|
69 TAny* a2) |
|
70 { |
|
71 DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr; |
|
72 return pH->HalFunction(aFunction,a1,a2); |
|
73 } |
|
74 |
|
75 TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, |
|
76 TAny* a2) |
|
77 { |
|
78 ... |
|
79 switch(aFunction) |
|
80 { |
|
81 ... |
|
82 } |
|
83 }</codeblock> <p>When the user calls <xref href="GUID-BD00E7FC-C234-3111-87A5-10F79EB0F2B8.dita#GUID-BD00E7FC-C234-3111-87A5-10F79EB0F2B8/GUID-9454F1B2-D525-3D6D-A872-C6457CACD4FC"><apiname>HAL::Set()</apiname></xref> or <xref href="GUID-BD00E7FC-C234-3111-87A5-10F79EB0F2B8.dita#GUID-BD00E7FC-C234-3111-87A5-10F79EB0F2B8/GUID-573C49D6-7763-37AE-B2B2-4C8FB1327E21"><apiname>HAL::Get()</apiname></xref>, |
|
84 it invokes the corresponding <codeph>halFunction()</codeph> of the HAL function |
|
85 group. </p></section> |
|
86 </conbody></concept> |