Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

IORD_ALTERA_AVALON_PIO_DATA execution speed

Is there a faster way to read a pin than using the IORD_ALTERA_AVALON_PIO_DATA macro?

I'm finding the code below is running quite slow, but by removing the second condition (i.e. reducing the number of IORD_ALTERA_AVALON_PIO_DATA commands) it runs significantly faster, almost an order of magnitude.

Is there any overhead in this macro that I can get around by doing something more direct? Looking through the header files I couldn't see anything, but I thought it was worth asking.

Thanks

Bert

if ((IORD_ALTERA_AVALON_PIO_DATA(PIO_CONTROL_IN_BASE) == 0x02) || (IORD_ALTERA_AVALON_PIO_DATA(PIO_CONTROL_IN_BASE) == 0x03)) {
    sample_array = IORD_ALTERA_AVALON_PIO_DATA(PIO_ADC_DATA_BASE);
    i++;
}

11 Replies