DIFFERENCES BETWEEN EKA1 AND EKA2 in VS .NET

Making Denso QR Bar Code in VS .NET DIFFERENCES BETWEEN EKA1 AND EKA2
DIFFERENCES BETWEEN EKA1 AND EKA2
QR Code Scanner In .NET Framework
Using Barcode Control SDK for .NET framework Control to generate, create, read, scan barcode image in .NET framework applications.
EKA1
QR Code 2d Barcode Generator In VS .NET
Using Barcode creator for .NET framework Control to generate, create QR Code image in .NET framework applications.
Client thread RBusLogicalChannel
Read QR Code ISO/IEC18004 In VS .NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
DoSvControl()
Generate Bar Code In VS .NET
Using Barcode printer for Visual Studio .NET Control to generate, create bar code image in VS .NET applications.
DoControl()
Decoding Barcode In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications.
DoRequest()
Paint QR Code In Visual C#.NET
Using Barcode printer for Visual Studio .NET Control to generate, create QR Code image in .NET applications.
DoCancel()
Create Quick Response Code In .NET
Using Barcode generation for ASP.NET Control to generate, create Quick Response Code image in ASP.NET applications.
user kernel
Encode QR Code 2d Barcode In VB.NET
Using Barcode printer for Visual Studio .NET Control to generate, create QR image in .NET applications.
DoControl() DoRequest() DoCancel()
Print Barcode In .NET
Using Barcode generator for .NET Control to generate, create bar code image in .NET applications.
Driver's logical channel class
Draw Code 39 Extended In .NET Framework
Using Barcode generation for .NET framework Control to generate, create ANSI/AIM Code 39 image in .NET framework applications.
EKA2
Encode EAN 13 In Visual Studio .NET
Using Barcode drawer for VS .NET Control to generate, create UPC - 13 image in VS .NET applications.
Client thread RBusLogicalChannel
Identcode Encoder In .NET
Using Barcode generation for VS .NET Control to generate, create Identcode image in VS .NET applications.
DoSvControl()
EAN-13 Reader In .NET Framework
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET framework applications.
DoControl()
EAN / UCC - 13 Creator In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
DoRequest()
Code128 Recognizer In .NET Framework
Using Barcode recognizer for .NET Control to read, scan read, scan image in .NET framework applications.
DoCancel()
Bar Code Generation In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create barcode image in .NET framework applications.
user kernel Request()
GS1-128 Generation In Visual C#
Using Barcode generation for .NET Control to generate, create GS1-128 image in .NET framework applications.
DLogicalChannel
Drawing Barcode In Java
Using Barcode creation for Java Control to generate, create barcode image in Java applications.
Driver's logical channel class HandleMsg() Driver's DFC thread
Generate GS1 - 13 In C#.NET
Using Barcode printer for .NET Control to generate, create EAN13 image in Visual Studio .NET applications.
DoControl()
Paint Bar Code In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create bar code image in ASP.NET applications.
DoRequest()
DoCancel()
Figure 12.11 Comparison of the EKA1 and EKA2 device driver models
DEVICE DRIVERS AND EXTENSIONS
12.5.2 Choice of device driver model
In EKA1, the functions DoControl(), DoRequest() and DoCancel() that you implemented in your logical channel class all ran in the context of the user-side thread. On EKA2, you have the choice of implementing a device driver based on DLogicalChannelBase (in which case requests run in the context of the client thread) or DLogicalChannel (in which case requests run in a DFC in the context of a kernel-side thread as shown in Figure 12.11). When porting a device driver from EKA1 to EKA2, you may nd it easier to use the functionality provided by the DLogicalChannel class, as this helps to avoid synchronization issues by handling all requests in the context of a single thread. If you follow the pattern I described in Section 12.4.7.4, you can simplify migration to the new device driver model by implementing your HandleMsg() to determine the type of request, and then call your existing DoControl(), DoCancel() and DoRequest() functions. Of course, you can now rename these, giving them any name you wish, as the names are no longer mandated by the device driver framework. In EKA1, you could access user memory directly from your kernel-side code. Although this is exceedingly bad practice, it does work. In EKA2, you are unlikely to get away with it as the kernel may (depending on memory model) panic the system with KERN-EXEC 3). You must ensure that you follow the rules set out in Section 12.1.5.
12.5.3 More detailed API changes
In previous sections I have described the fundamental differences between the EKA1 and EKA2 device driver models, but this is in no way a de nitive list. For a more detailed discussion of the changes between EKA1 and EKA2 device driver models, please refer to the DDK (available to Symbian Partners).
Summary
In this chapter I have introduced kernel extensions and device drivers. I have shown how these are managed by the kernel framework and might be implemented by a device driver provider using a simple serial driver as an example. Next I will take a look at the support that Symbian OS provides for peripherals such as MultiMediaCard and USB.
Peripheral Support
by Peter Scobie
The nice thing about standards is that there are so many of them to choose from.
Andrew Tannenbaum
In this chapter, I begin by describing more of the services available to device drivers. Then I go on to describe a number of speci c device driver implementations among them media drivers, the MultiMediaCard driver and the USB driver. The rst service, one that device drivers frequently make use of, is direct memory access, or DMA.
13.1 DMA
13.1.1 DMA hardware
DMA hardware allows data to be transferred between a peripheral and system memory without the intervention of the processor. It is used to ease the burden on the processor of servicing peripherals that produce frequent interrupts. This applies equally to transfers involving data received by the phone (data taken from the peripheral and stored in a buffer) or data transmitted by the phone (data taken from a buffer and pushed to the peripheral). A hardware DMA controller manages a set of DMA channels, each channel providing one direction of communication between the memory and the peripheral (either transmit or receive). Because of this, full duplex communication with a peripheral requires the use of two channels. Many controllers also support DMA transfer directly from one area of system memory to another. Individual DMA transfer requests can be set up on each channel. These requests can involve a considerable amount of data an amount
PERIPHERAL SUPPORT
that would otherwise involve the processor servicing a series of interrupts. But the use of DMA means that only one processor interrupt is generated, at the end of the transfer. For certain types of peripheral data transfer, such as bulk transfer over full-speed USB, the use of DMA becomes essential to avoid the CPU consuming an excessive proportion of its available bandwidth servicing interrupts. Symbian OS phones normally provide one or more DMA channels dedicated to the LCD controller, for the transfer of pixel data between a frame buffer and the LCD interface. The LCD controller typically manages these DMA resources itself and they are not available to the main Symbian OS DMA framework, which I am about to describe. In addition to these LCD channels, most phone platforms provide a limited number of general-purpose DMA channels. Platforms have differing strategies on how these channels are allocated. Some may x the allocation of each DMA channel to a particular peripheral. Others allow dynamic allocation. This second method provides a pool of DMA channels that can be allocated to any peripheral on a rst-come rst-served basis. This could allow the platform to provide DMA services to more peripherals than there are DMA channels assuming that device drivers free up DMA channels when they are not in use. With this scheme, however, there is a risk that a device driver might request a DMA channel but nd that none are free. So the Symbian OS software framework normally xes the allocation of DMA channels to particular devices, even when the hardware does not impose this. Normally, DMA hardware reads and writes directly to physical address space, bypassing the MMU. Let s examine the simplest type of DMA request involving a one-shot transfer to or from a single, physically contiguous memory region. In this case, the DMA channel is supplied with information on the transfer source and destination (each being either a physical memory address or a peripheral identi er), together with the number of bytes to transfer. The request is initiated and the controller interrupts the processor once either the transfer completes successfully, or an error occurs. DMA controllers often provide support for data to be transferred as a continuous stream as well as a one-shot transfer. This requires more than one set of transfer registers for each channel, allowing a double-buffer scheme to be employed. While the controller is transferring data using one set of registers, the software can simultaneously be programming the second set ready for the next transfer. As soon as the rst transfer completes, the controller moves on to process the second one, without interrupting data ow. At the same time the controller signals the end of the rst transfer with an interrupt, which signals the software to begin preparing the third and so on. Some DMA controllers support scatter-gather mode. This allows a DMA channel to transfer data to and from a number of memory locations
that aren t contiguous, all as a single request. The control software has to supply information to the DMA controller, describing the transfer as a linked list of data structures, each specifying part of the transfer. These data structures are known as descriptors. (Not to be confused with the same term widely used in Symbian OS to refer to the family of TDesC derived classes!) The DMA controller acts on each descriptor in turn, and only interrupts the processor at the end of the descriptor chain. Some controllers allow the descriptor chain to be extended while transfer is in progress another way to facilitate uninterrupted data transfer. Figure 13.1 shows a setup for scatter-gather DMA transfer from two disjoint blocks of memory into a peripheral.