Hi,

so trying to get my things up and running, I wrote a program for the PRU in 
asm to toggle 2 pins and read 4.

In C, I manage to manipulate them because I'm using GPIO.
But in asm... I try to interact with r30 and r31, and nothing really 
happens...

I"m with kernel 3.15.

Could someone guide me ? 
I think I have to add a dts to declare pins and pinmux, but I feel a bit 
lost on this point.

In case, this is my asm source

#include "pru.h"
#include "pru_macros.hp"

.origin 0
.entrypoint MAIN


MAIN:

 /* enable ocp wide accesses */

 LBCO r0, CONST_PRUCFG, 4, 4
 CLR r0, r0, 4
 SBCO r0, CONST_PRUCFG, 4, 4

 /* prepared pru to host shared memory */

 MOV r0, 0x000000120
 MOV r1, CTPPR_0
 ST32 r0, r1

 MOV r0, 0x00100000
 MOV r1, CTPPR_1
 ST32 r0, r1


 MOV r10, 0
 MOV r11, 0
 MOV r12, 0
 /* main */
LOOP1:
SET r30.t15  /* CLK high */ 
MOV r10, r31.b0 /* Read in the data */ 

QBBC CHKSENSOR2, r10.b0.t0 /* if r10.0, set r11.0 */
SET r11, 0  
CHKSENSOR2:
QBBC CHKSENSOR3, r10.b0.t1 /* if r10.1, set r11.15 */
SET r11, 15
CHKSENSOR3:
QBBC CHKSENSOR4, r10.b0.t2 /* if r10.2, set r12.0 */
SET r12, 0
CHKSENSOR4:
QBBC ENDCHECK, r10.b0.t3 /* if r10.3, set r12.15 */
SET r12, 15

ENDCHECK:
CLR r30.t15 /* CLK low  */     
LSL r11, r11, 1
LSL r12, r12, 1
ADD r0, r0, 1
JMP LOOP1
 /* store results from r10,r11 into host memory */

 SBCO r10, CONST_PRUSHAREDRAM, 0, 8

 /* signal cpu we are done (never reached) */

 MOV r31.b0, PRU0_ARM_INTERRUPT + 16
 HALT


Thanks,

Cedric

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to