HP (Hewlett-Packard) EZ-KIT Switch User Manual


 
Example 7: Source Files
6-8 Getting Started with ADSP-BF548 EZ-KIT Lite
The VDK-style device driver has only one skeleton function requiring
completion—
KeypadDriver_DispatchFunction(). VDK calls
KeypadDriver_DispatchFunction() at specific points in the application,
passing an argument to indicate the reason (text in italics describes the
code added to the function’s skeleton):
At boot time, when VDK is creating the device object.
No additional code for the device driver is required at this point.
When the application opens or closes the device.
Our device driver calls the SSL driver to open and enable (or disable
and close) the physical device driver. Opening the physical driver also
registers our callback function (ISRCallback()) with the SSL.
When the physical device needs attention.
When a key press is detected, the physical device driver calls the call-
back function. The callback function appends the key press details to a
buffer and activates this driver according to the VDK model, causing
an entry to the VDK driver at a later time. All the VDK driver needs
to do is signal when a key press is available by posting the device driver
flag (KeypadFlag).
When the application requests data transfers to or from the device.
In our case, this means that a thread has issued a read on our VDK
driver in order to get details of the next key press. The driver checks the
buffer of key presses; if one is available, the key press is removed from
the buffer and passed back to the calling thread. Otherwise, the driver
pends on KeypadFlag, which blocks the calling thread until a subse-
quent activation entry posts the flag again.