asm: fastest way from gpio pin to uart0?
Posted: Fri Jun 05, 2015 2:04 pm
Objective
1. Test a GPIO pin.
2. Branch, accordingly, to either send a '0' or '1' character through UART0 (0x60000000)
Progress
Despite my knowledge of Motorola and AVR assembly, the last few hours have proved fruitless in reaching the objective on this Xtensa platform. At this point, I am extending my hand for tips and hints.
Gathered info
For the sake of an example, let us suppose that GPIO.12 is the pin that needs to be sampled.
Let us also suppose that the pin has been properly configured to act as an input.
We know that the GPIO pin values can be accessed at address 0x60000318.
This is the point where things get fuzzy. Do I need to:
0. Store ascii 0 (0x30) and ascii 1 (0x31) into two registers (say, a1 and a2), using s32i?
1. Load all of 0x60000318 to a register (say, a3), using l32r?
2. Test the a3 register and branch accordingly, using bbsi?
3. Send a character by moving the right register (a1 or a2) to 0x60000000 (UART0), using mov?
Any pointer would be appreciated.
1. Test a GPIO pin.
2. Branch, accordingly, to either send a '0' or '1' character through UART0 (0x60000000)
Progress
Despite my knowledge of Motorola and AVR assembly, the last few hours have proved fruitless in reaching the objective on this Xtensa platform. At this point, I am extending my hand for tips and hints.
Gathered info
For the sake of an example, let us suppose that GPIO.12 is the pin that needs to be sampled.
Let us also suppose that the pin has been properly configured to act as an input.
We know that the GPIO pin values can be accessed at address 0x60000318.
Code: Select all
0x60000318: AA BB CC DD
CC holds values of pin GPIO.15 to pin GPIO.08
DD holds values of pin GPIO.07 to pin GPIO.00
This is the point where things get fuzzy. Do I need to:
0. Store ascii 0 (0x30) and ascii 1 (0x31) into two registers (say, a1 and a2), using s32i?
1. Load all of 0x60000318 to a register (say, a3), using l32r?
2. Test the a3 register and branch accordingly, using bbsi?
3. Send a character by moving the right register (a1 or a2) to 0x60000000 (UART0), using mov?
Any pointer would be appreciated.