I'm working on an NMI handler for the SamD20 part and it's really time critical to complete the tasks I need to in that routine. The assembly listing from the GCC tools looks pretty good, but I need to make it more compact.
I'm simply needing to get the states of (2) GPIO pins in my routine, both pins are defined as inputs and they are both on portA. the clock is on PA19 and the data on PA21.
In "C" code I can access to the individual pin using
#define MDCVAL ((((Port *)PORT)->Group.IN.reg)&(0x01U << GPIO_PIN(MDC)))
#define PORTA PORT->Group.IN.reg
In my NMI handler, I've tried accessing the pin in assembly and nothing seems to work.
In my asm routing I put in the address of the PORTA, but I can't seem to put in the PORTA but I've seen lots of examples where that can be done. In fact most of the examples I've seen, don't seem to work.
Ideally what I'd like to do in assembly is a set of instructions that does this;
while(!((((Port *)PORT)->Group.IN.reg)&(0x01U << GPIO_PIN(MDC))));
I'm thinking the steps I need to do this are to;
1. Get the 32bit value of the PORT->Group.IN.reg and store it one of the "r" registers
2. Use one of the "r" registers to store 1<<19 or 1<<22 depending on the pin that needs to be tested
3. Do a bit test and repeat or branch depending on the state
I'm hoping someone has done something like this and can assist with what I'm trying to do.