User`s guide

Inline Assembly Language and Intrinsics
Intrinsic Functions
185Targeting MC56F83xx/DSP5685x Controllers
Listing 7.12 Modulo Buffer Example 2
/* Set up a static location to save error codes */
if ( ! __mod_error(&err_codes)) {
printf (“__mod_error set up failed\n”);
}
/* Initialize a modulo buffer pointer, pointing to an array of 10 ints.
*/
__mod_initint16(M0, &int_buf[9], 10);
/* Check for success of previous call */
if ( err_code ) { printf (
“__mod_initint16 failed\n” ) };
__mod_start();
/* Write modulo buffer with the result of the expression “i”.
Decrement the buffer pointer for each execution of the loop.
The modulo buffer wraps from index 0 to 9 through the entire execution
of the loop. */
for ( i=100; i>0; i-- ) {
__mod_setint16(M0, i, -1);
}
__mod_stop();
Points to Remember
As you use modulo buffer intrinsic functions, keep these points in mind:
1. You must align modulo buffers properly, per the constraints that the M56800E
User’s Manual explains. There is no run-time validation of alignment. Using the
modulo buffer API on unaligned buffers will cause erratic, unpredictable
behavior during data accesses.
2. Calling __mod_start() to write to the modulo control register effectively
changes the hardware’s global-address-generation state. This change of state