diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-B97BAC2E-04E3-4979-BACE-9C46BADE912E.dita
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Adaptation/GUID-B97BAC2E-04E3-4979-BACE-9C46BADE912E.dita Fri Oct 15 14:32:18 2010 +0100
@@ -0,0 +1,106 @@
+
+
+
+
+
+ Asynchronous request processing is normally
+done in a Deferred Function Call (DFC). The second stage of interrupt
+handling is deferred to run as a DFC, which runs in a non-critical
+context. Different asynchronous requests can be handled using
+a single or multiple DFCs. The number of DFCs to be created must be
+decided when the driver is designed. For example, a driver that handles
+at the same time an asynchronous receive request and a transmit request
+would create two DFCs, one each for receive and transmit. There
+are two main types of deferred function call: standard Deferred Function Call (DFC) Immediate Deferred Function Call (IDFC).
+
A DFC is a kernel object that specifies a function to +be run in a thread, which is processing a DFC queue. A DFC is added +to a DFC queue that is associated with a given thread, where it is +cooperatively scheduled with other DFCs on that queue. Queued DFCs +are run in order of their priority, followed by the order they where +queued. When the DFC gets to run, the function is run kernel side, +and no other DFC in this queue will get to run until it completes. +A DFC can be queued from any context.
An IDFC is run as soon +as the scheduler is next run, which is:
Unlike a DFC, the IDFC is not run from a thread context, +and its execution time must be much smaller. For these reasons, IDFCs +are rarely used directly, but are used for implementation of the kernel +and RTOS personality layers. An important use of IDFCs is in the +implementation of queuing DFCs from an ISR context. IDFCs are run +with interrupts enabled but the kernel locked.
+DFCs are created using
The DFC is initialized with a DFC callback function, a pointer to +an object to be passed to the callback function, and a priority. It +can also provide the DFC queue to be used by this DFC at the time +of construction.
To initiate the process of DFC functionality, the DFC object +must be queued to the DFC queue associated with the Kernel thread.
Before adding the DFC to a DFC queue of the thread, it must be
+associated with the queue (
The DFC callback function is a static function +called when a DFC is executed. A pointer to this function is provided +at the time of DFC object creation. This function implements the deferred +functionality of an asynchronous request, such as reading or writing +data from or to an I/O peripheral. It would then either complete the +request or start another operation.
A DFC function must be cancelled while cleaning up resources,
+for example, when closing the channel. The function