diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-FD8634B8-E522-4AC4-8129-ED807A7754A2-GENID-1-2-1-9-1-5-1-6-1.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-FD8634B8-E522-4AC4-8129-ED807A7754A2-GENID-1-2-1-9-1-5-1-6-1.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,48 @@ + + + + + +Kernel-side +ImplementationThis document describes kernel-side implementation of requests +to device drivers. +

Requests from the user-side are initially handled by the driver +in the context of the client user-side thread. All requests are passed to +the "gateway" function: DLogicalChannelBase::Request(). +This is defined as pure virtual in DLogicalChannelBase, and +needs to be implemented in a derived class as part of your logical channel +implementation.

+ + Device driver logical channel communication + + + +

There are two options for implementing this:

+
    +
  1. Use the ready-made framework +provided by the DLogicalChannel class, which handles a +request in the context of a single kernel-side thread. This framework uses +the kernel-side messaging mechanism for queuing requests on a DFC that runs +in that single kernel-side thread.

    In practice, this model makes the +writing of device drivers easier because the same kernel thread can be used +to process requests from (potentially multiple) user-side clients and DFCs, +thus in effect serialising access to the device driver, and eliminating thread-related +issues, such as the need to know about mutexes, pre-emption, etc. Several +drivers can use the same request/DFC kernel thread to reduce resource usage.

  2. +
  3. Derive your own logical +channel class from DLogicalChannelBase to handle requests. +This allows you to build your own thread model for running DFCs to handle +requests and to handle request completion. This requires that you manage inter-thread +conflicts. However, your design may give you the chance to do some optimisation +by handling some requests in the context of the user-side thread, minimising +context-switching overhead.

  4. +
+

Option 1 lets you get a new driver up and running quickly. Option 2 gives +you greater flexibility if the requirements of your driver demand it.

+
\ No newline at end of file