Project Name: PeriodicStopwatchBF537; OneShotStopwatchBF537 Project Type: ADSP-BF533 [ ] ADSP-BF537 [X] ADSP-BF538 [ ] ADSP-BF561 [ ] Hardware Used: ADSP-BF537 EZ-Kit System Services Components Used: DMA Manager [ ] Deferred Callback Manager [ ] Interrupt Manager [X] Timer Module [ ] Power Management Module [X] Flag Module [ ] External Bus Interface Unit Module [ ] Port Module [ ] RealTime Clock Service [X] Example Overview: There are two examples in this folder: PeriodicStopwatch and OneShotStopwatch. PeriodicStopwatch ----------------- "PeriodicStopwatchBF537.dpj" "./PeriodicStopwatch.c" "./adi_ssl_Init.c" "./adi_ssl_Init.h" "../../../../../include/services/rtc/adi_rtc.h" The PeriodicStopwatch example demonstrates the use of the functions 'adi_rtc_ InstallCallback' and 'adi_rtc_RemoveCallback' for setting up a stopwatch event interrupt and servicing it with a callback. It also demonstrates the use of the 'adi_rtc_ResetStopwatch' function, to re-enable a stopwatch event, and the use of the 'ClientHandle' to extend upon the stopwatch timeout functionality. This example shows how the application can define a structure that is passed as the ‘ClientHandle’ argument to the 'adi_rtc_InstallCallback' function. The application can then provide a‘RTCCallback’ function that interprets the ‘ClientHandle’ argument to creatively control event handling so that a stopwatch event occurs repeatedly every 5 seconds for twenty seconds. The application provides a callback function to handle all RTC events. The data structure, called ‘pCountdownStruct’ has three fields. The first field of the data structure indicates that this event should be periodic. The second field, SecondsCounter, indicates the number of seconds that the callback function should use to re-enable the stopwatch event. The ‘NumRepetitions’ field tells the callback to re-enable the stopwatch event three times. (This field could be set to 0 if the event should recur continuously.) The ClientHandle argument is used to pass the data structure to the ‘adi_rtc_InstallCallback’ function. The ‘pNumSeconds’ variable is set to 5. The "Value" argument is used to pass the pNumSeconds variable that is written to the RTC_SWCNT register when the callback is installed. It is also set to 5, in this case. The stopwatch event occurs after 5 seconds and then repeats 3 times, each time after 5 seconds until ‘NumRepetitions’ equals zero. So, it takes 20 seconds total. Running the example in VisualDSP: 1) Load Project file "PeriodicStopwatchBF537.dpj" 2) Build Project by selecting "Project->Rebuild Project". 3) Select "Debug->Run". 4) Wait about 21 seconds. 5) Select "Debug->Halt" to stop the program. 6) The program should be at the end, in the while loop, having executed the callbacks that were installed, and the "FinalResult" variable should be equal to zero. OneShotStopwatch ---------------- System Services Components Used: DMA Manager [ ] Deferred Callback Manager [ ] Interrupt Manager [X] Timer Module [ ] Power Management Module [X] Flag Module [ ] External Bus Interface Unit Module [ ] Port Module [ ] RealTime Clock Service [X] Source Files: "./OneShotStopwatchBF537.dpj" "../OneShotStopwatch.c" "../adi_ssl_Init.c" "../adi_ssl_Init.h" "../../../../include/services/rtc/adi_rtc.h" The OneShotStopwatch example simply demonstrates the use of the functions 'adi_rtc_InstallCallback' and 'adi_rtc_RemoveCallback' for setting up a stopwatch event interrupt, servicing it with a callback, and removing the callback. Running the example in VisualDSP: 1) Load Project file "OneShotStopwatchBF537.dpj" 2) Build Project by selecting "Project->Rebuild Project". 3) Select "Debug->Run". 4) Wait about 6 seconds. 5) Select "Debug->Halt" to stop the program. 6) The program should be at the end, in the while loop, having executed the callbacks that were installed, and the "FinalResult" variable should be equal to zero.