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


 
Example 4: Audio.c File
3-16 Getting Started with ADSP-BF548 EZ-KIT Lite
AD1980Callback()
Callback functions have the following arguments.
The first argument identifies which driver instance has invoked the
callback. This value was supplied as the fourth argument to
adi_dev_Open() (see on page 3-8) when the driver instance was
created.
The second argument identifies the reason for the callback. It is an
integer value: similar to the values of the control commands, the
value is either a common event value defined by SSL’s device man-
ager or a value specific to the device driver raising the event. The
event identifier indicates a successful event, such as completion of a
data transfer, or an unsuccessful event, such as a hardware error.
Either way, at this point it is up to the application to take some
appropriate action.
The final argument identifies the buffer descriptor (if any) that
triggered the event. The application can process, reuse, or discard
the buffer descriptor and the application data buffer it describes, as
required.
Listing 3-5 shows the callback function from example 4. The event
descriptor
ADI_DEV_EVENT_BUFFER_PROCESSED is one of the device man-
ager’s standard events, while ADI_AC97_EVENT_REGISTER_ACCESS_COMPLETE
is specific to the audio codec driver.
Listing 3-5. Callback Function
static void AD1980Callback(
void *AppHandle,
u32 Event,
void *pArg)
{
ADI_DEV_1D_BUFFER* pdesc;
volatile bool* pflag;
switch (Event)