|
#1
|
|||
|
|||
Interfacing to GPIO
I don't understand ARM assembler yet, but here is a test of I/O throughput.
C code: loop:; getl(IO_ADDRESS(GPIO_PADR)) = 0x01; getl(IO_ADDRESS(GPIO_PADR)) = 0x00; goto loop; Generated assembler: .L9: mov r2, #1 ldr r3, .L10+8 mov r1, #0 str r2, [r3, #0] str r1, [r3, #0] b .L9 As you can see, reloading the values 0x00 and 0x01 within the loop is stupid, but hey... //loop:; // getl(IO_ADDRESS(GPIO_PADR)) = 0x01; // getl(IO_ADDRESS(GPIO_PADR)) = 0x00; //goto loop; asm("mov r2, #1\n" \ "mov r1, #0\n" \ "ldr r3, .L10+8" \ ".ASDF:\n" \ "str r2, [r3, #0]\n" \ "str r1, [r3, #0]\n" \ "b .ASDF\n"); printk("You might as well remove this module, its done..."); I can fix that...just by what I can guess of the assembler meaning... Now in my test3.S file: mov r1, #0 ldr r3, .L10+8 .ASDF: str r2, [r3, #0] str r1, [r3, #0] b .ASDF But in order to get a good reading, I want a waveform without so much of the jump instruction: mov r1, #0 ldr r3, .L10+8 .ASDF: str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] str r2, [r3, #0] str r1, [r3, #0] b .ASDF And the results are (from a kernel device driver): (Well, don't forget about PADDR... ) 8.35MHz Upon reading the manual, the GPIO is on the lower power / lower speed APB bus. Using the PC104 bus may proove to be faster. Using a few latches on the address/data bus, an AND gate on the IOR/IOW line avery simple and faster I/O port can be made. |
|
|