Daniel:
Let's be a little more 'clear':
void clear_burst_done( char * err_message ){
volatile unsigned int status;
volatile unsigned int done;
unsigned int time_out;
unsigned int reg;
// clear the burst done status
reg = ( INTERRUPT_SDRAM_BURST_DONE_SET(1));
time_out = 0;
do {
vmc_regs[MASKED_INT]= reg;
// prevent Metrowerks from optimizing volatiles
reg = dummy(reg);
status = (volatile) vmc_regs[MASKED_INT];
done = INTERRUPT_SDRAM_BURST_DONE(status);
(void) dummy(done+13); // was also thrown in to keep optomizations off
time_out++;
// done goes to zero when cleared
} while((time_out<TIME_OUT_EXP) && done);
if( time_out >= TIME_OUT_EXP ){
serial_puts(err_message, MAX_STR_SIZE);
}
}
vmc_regs[MASKED_INT] is a memory mapped FPGA register in an interrupt controller that follows the common system of "write a '1' to clear it". So, this function clears the interrupt status register, then busy-waits to make sure the hardware actually does it before moving on.
I don't think that the second call to 'dummy' is really necessary, but that's what's in there now so I just copied it.
I'm pretty sure that I can come up with a more minimalist example--something that one could implement with just about any demo board and not need to use external bus mode or assume the existence of string I/O (i.e. accessing PIM registers). If there's somebody who could do something positive about the net result, I would make the effort.
Yes, I have read more than one 1000 page PDF detailing the fine points of #pragma's. (No, I didn't enjoy it. The software guys appreciated me giving them the abridged version.)
Boris