Question:
How do I set up interrupts on SHARC?
---------------------------------------------
Answer:
The header file, adi_int.h, provides prototypes of the SSL interrupt handling APIs and macros that define interrupt IDs. The file can be found in the CCES subdirectory “<install_path>/SHARC/include/services/int” and is included in C/C++ source as follows:
#include <services/int/adi_int.h>
The following functions are used to install, enable and uninstall interrupts
ADI_INT_HANDLER_PTR pfHandler, void *pCBParam, bool bEnable);
The interrupt IDs macros are defined as the interrupt name prefixed with “INT_CID_”, for example, ADI_CID_GPTMR0I. For a list of the interrupt IDs that are defined for each platform, see the file <<install_path>/SHARC/include/interrupt.h.
Note that <signal.h> now only provides support for the signal-related functions and macros that are required by the C and C++ standards.
Example
Examples using these functions can be found in the ADSP-21469 Board Support Package. See, for example, the “Core_Timer” example, which uses both high- and low-priority timer interrupts.
Documentation
See the System Run-Time Documentation in the CrossCore Embedded Studio Help for more information on the software support for interrupts
Differences from VisualDSP++
VisualDSP++ supported a number of methods of configuring interrupts, each with their own limitations, which led to many user errors and problems. To simplify interrupt support, and to provide a more consistent approach to programming interrupts across Analog Devices’ DSPs, these methods have been removed. The APIs described above are the only supported way to configure interrupts.
Hi,
project conversion is just stopped by use of obsolete function "interrupt", so i continue this thread.
I have to replace that:
interrupt(SIG_SP1, SportISR);
void SportISR(int sig_int){...};
and that:
interrupt(SIG_P18, SpiTransmitDoneISR);
void SpiTransmitDoneISR(int i){...};
I think a short example here and a crossreference for SIG_SP1 and SIG_P18 to ADI_CID_xxx would help.
Thanks,
Jochen
Hi Jochen,
I believe the conversion will have completed, it is just that your project will not build. The Project Import Wizard does not modify code; only convert your project to a format that CCES can understand.
Regarding using the new Interrupt APIs, the FAQ covers the necessary commands - which are also discussed in more detail in the System Runtime Documentaton. In short, though, here's how the CCES Core Timer example compares to the VisualDSP++ one:
VisualDSP++
int timer_count = 1;
...
void timer_isr (int sig)
{
timer_count++;
}
main()
interrupts (SIG_TMZ, timer_isr);
CrossCore Embedded Studio:
#include <services/int/adi_int.h> /* Interrupt Handler API header. */
static volatile int timer_count = 1;
static void timer_isr(uint32_t iid, void* handlerArg)
volatile int *timer_counter = (int *) handlerArg;
*timer_counter += 1;
adi_int_InstallHandler(ADI_CID_TMZHI, /*iid - high priority core timer */
timer_isr, /*handler*/
(void *)&timer_isr_count1, /*handler parameter*/
true /*do enable*/
);
If you have any further questions on converting your project from VisualDSP++ to CrossCore Embedded Studio - including the use of the new interrupts service, please post in the CrossCore Embedded Studio community (I have updated my previous post to suggest the CrossCore Embedded Studio community, also).
Regards,
Craig.
Hi Craig,
your were right, conversion was ok, build not.
Now build is ok too. Maybe the choosen IDs are not ok, i will see after launch of debug app will start...SIG_SP1 => ADI_CID_SP1I
SIG_P18 => ADI_CID_P18I