Skip to content

Commit

Permalink
Fix duplicated code in ok03 mailbox.s
Browse files Browse the repository at this point in the history
  • Loading branch information
mauri870 committed Jun 1, 2019
1 parent 53e7efb commit 4f90fcd
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/ok03/mailbox.s
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,3 @@ mailbox_read:

and r0, r2, #0xfffffff0 @; move the response (top 28 bits of mail) into r0
pop {pc} @; return
push {lr} @; push the address the function should return to
mov r1, r0 @; save the channel in r1
ldr r0, =0x3f00b880 @; load mailbox base address into r0

right_mail$:
wait_read$:
ldr r2, [r0, #0x18] @; get status of mailbox 0 (VC -> ARM)
tst r2, #0x40000000 @; check if the mailbox is empty
bne wait_read$ @; if VC FIFO queue is empty branch to wait_read

ldr r2, [r0] @; load the address of response data

and r3, r2, #0b1111 @; extract the channel, the lowest 4 bits
teq r3, r1 @; check if the response channel is the same we want
bne right_mail$ @; if the channel is wrong branch to wait_read

and r0, r2, #0xfffffff0 @; move the response (top 28 bits of mail) into r0
pop {pc} @; return

0 comments on commit 4f90fcd

Please sign in to comment.