Sensing The Value Of A Flag; Installing A Callback Function - Analog Devices VisualDSP++ 5.0 Service Manual

Visualdsp++ 5.0 device drivers and system for blackfin processors
Table of Contents

Advertisement

Operation
The first call sets the value of the flag to a logical high, and the second call
sets the flag to a logical low. The third call toggles the current value of the
flag—if logical low, it changes to a logical high value; if logical high, it
changes to a logical low value.

Sensing the Value of a Flag

The application can sense the value of a flag, regardless of whether the flag
has been configured as an input or an output. The following fragment
illustrates how a flag value is sensed.
u32 Value;
Result = adi_flag_Sense(ADI_FLAG_PF0, &Value);
if (Value == TRUE) {
} else {
The above fragment illustrates how a flag value can be sensed in a polled
type method. Alternatively, a callback function can be used to alert the
application when an event, such as a flag changing value, has occurred.

Installing a Callback Function

To avoid polling and instead invoke a callback function when a pin state
changes, the application should install a callback function. The following
fragment illustrates how to install a callback function and the actual call-
back function.
...
Result = adi_flag_InstallCallback(ADI_FLAG_PF1, ADI_INT_PFA,
...
7-12
// location where flag value is stored
// senses the flag value
// flag is set to logical high
// flag is set to logical low }
ADI_FLAG_TRIGGER_LEVEL_HIGH,
TRUE, (void *)0x12345678, NULL, Callback);
VisualDSP++ 5.0 Device Drivers and System
Services Manual for Blackfin Processors

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VisualDSP++ 5.0 and is the answer not in the manual?

Table of Contents