Skip to content

Instantly share code, notes, and snippets.

@nilhoel1
Created May 17, 2019 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilhoel1/1cbaf8a2e583317c2bfa669a1970d4b7 to your computer and use it in GitHub Desktop.
Save nilhoel1/1cbaf8a2e583317c2bfa669a1970d4b7 to your computer and use it in GitHub Desktop.
; Run a simple delay loop on the PRU
; Original source https://jumpnowtek.com/beaglebone/Working-with-the-BeagleBone-PRUs.html
.setcallreg r29.w0
.origin 0
.entrypoint start
#define PRU0_ARM_INTERRUPT 19
#define DELAY_COUNT 50000000
#define LOOP_ITERATIONS 20
start:
mov r1, LOOP_ITERATIONS
main:
call delay
sub r1, r1, 1
qbne main, r1, 0
mov r31.b0, PRU0_ARM_INTERRUPT + 16 ; notify ARM we are done
halt
delay:
mov r0, DELAY_COUNT
delay_loop:
sub r0, r0, 1
qbne delay_loop, r0, 0
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment