|
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-812DEBEB-84D0-5BD4-A5BB-5AF6B8384CCF" xml:lang="en"><title>Entry |
|
13 Point Implementation</title><shortdesc>Describes how to implement the entry point function.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The DMA Framework implements its entry point function in the platform-specific |
|
15 layer. </p> |
|
16 <p>The entry point for a kernel extension is declared by a </p> |
|
17 <codeblock id="GUID-92670D2D-AB81-5BEA-8008-5BA7B0D23EF6" xml:space="preserve">DECLARE_STANDARD_EXTENSION()</codeblock> |
|
18 <p>statement, followed by the block of code that runs on entry to the DLL. |
|
19 The following code is typical for a port of the DMA Framework , and is taken |
|
20 from the port for the template reference platform: </p> |
|
21 <codeblock id="GUID-ED426309-D8FC-512C-B320-C29B37C74140" xml:space="preserve">DECLARE_STANDARD_EXTENSION() |
|
22 // |
|
23 // Creates and initializes a new DMA controller object on the kernel heap. |
|
24 // |
|
25 { |
|
26 __KTRACE_OPT2(KBOOT, KDMA, Kern::Printf("Starting DMA Extension")); |
|
27 |
|
28 return Controller.Create(); |
|
29 } |
|
30 </codeblock> |
|
31 <p>where <codeph>Controller</codeph> is declared as writable static data: </p> |
|
32 <codeblock id="GUID-DA2508CF-BB22-5A48-B549-63D973E9EDB7" xml:space="preserve">static TTemplateDmac Controller;</codeblock> |
|
33 <p>Create() is a second-phase constructor defined in, and implemented by, |
|
34 the concrete class derived from <xref href="GUID-25398075-927B-36E4-B953-16785EC4086C.dita"><apiname>TDmac</apiname></xref>. DMA channels are |
|
35 attributes of this concrete class because only the platform specific layer |
|
36 knows what kind of channel to use. This platform specific layer second phase |
|
37 constructor must call the platform independent layer second phase constructor, <xref href="GUID-25398075-927B-36E4-B953-16785EC4086C.dita#GUID-25398075-927B-36E4-B953-16785EC4086C/GUID-9B0C8C35-F149-3358-90B8-B4670CFE888F"><apiname>TDmac::Create()</apiname></xref>, |
|
38 before doing anything else. </p> |
|
39 <p> <xref href="GUID-25398075-927B-36E4-B953-16785EC4086C.dita#GUID-25398075-927B-36E4-B953-16785EC4086C/GUID-9B0C8C35-F149-3358-90B8-B4670CFE888F"><apiname>TDmac::Create()</apiname></xref> allocates the arrays containing the |
|
40 descriptors and descriptor headers using the information passed to it by the |
|
41 platform specific layer in the <xref href="GUID-4057074E-2543-3F01-B24A-7FF8A19F79AF.dita"><apiname>SCreateInfo</apiname></xref> struct. This |
|
42 includes information such as the number of descriptors to be allocated, whether |
|
43 hardware descriptors are supported and their size etc. </p> |
|
44 <p>Note that if hardware-specific descriptors are used, they are allocated |
|
45 in a hardware chunk. If pseudo-descriptors are used, they are allocated on |
|
46 the kernel heap. </p> |
|
47 </conbody></concept> |