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

Result = adi_tmr_WatchdogControl
Result = adi_tmr_GPGroupEnable

Installing a Callback Function

While applications can install hardware interrupt service routines (ISRs)
directly to process interrupts from timers (see
timer service provides a simple, easy-to-use callback mechanism that
provides equivalent functionality.
The following code fragment illustrates how to install a callback function.
Different callback functions can be used for each timer, or a single call-
back function can be used for any number of timers. The fragment shows
installation of a single callback function for two general-purpose timers,
the core timer, and a watchdog timer. The switch statement within the
callback function identifies which timer generated the callback.
...
Result = adi_tmr_InstallCallback
(ADI_TMR_GP_TIMER_0, TRUE, (void *)0x00000000, NULL, Callback);
Result = adi_tmr_InstallCallback
(ADI_TMR_GP_TIMER_1, TRUE, (void *)0x11111111, NULL, Callback);
Result = adi_tmr_InstallCallback
(ADI_TMR_CORE_TIMER, TRUE, (void *)0x22222222, NULL, Callback);
Result = adi_tmr_InstallCallback
(ADI_TMR_WDOG_TIMER, TRUE, (void *)0x33333333, NULL, Callback);
...
void Callback(void *ClientHandle, u32 Event, void *pArg) {
// Event = ADI_TMR_EVENT_TIMER_EXPIRED
switch ((u32)pArg) {
case ADI_TMR_GP_TIMER_0:
VisualDSP++ 5.0 Device Drivers and System
Services Manual for Blackfin Processors
(ADI_TMR_WDOG_CMD_ENABLE_TIMER, (void *)FALSE);
(ADI_TMR_GP_TIMER_0 | ADI_TMR_GP_TIMER_1, FALSE);
// do processing when gp timer 0 expires
Timer Service
"Interrupt
Manager"), the
8-13

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