mirror of
https://git.code.sf.net/p/openocd/code
synced 2024-11-22 16:36:25 +00:00
a126229dff
Replace the GPLv2-or-later boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: I380d552940f1c405309a3346454251c0e80b5a45 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7159 Tested-by: jenkins
59 lines
1.3 KiB
ArmAsm
59 lines
1.3 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/***************************************************************************
|
|
* Copyright (C) 2014 Angus Gratton *
|
|
* gus@projectgus.com *
|
|
***************************************************************************/
|
|
|
|
.text
|
|
.syntax unified
|
|
.cpu cortex-m0
|
|
.thumb
|
|
|
|
/*
|
|
* Params :
|
|
* r0 = byte count
|
|
* r1 = buffer start
|
|
* r2 = buffer end
|
|
* r3 = target address
|
|
* r6 = watchdog refresh value
|
|
* r7 = watchdog refresh register address
|
|
*/
|
|
|
|
.thumb_func
|
|
.global _start
|
|
_start:
|
|
wait_fifo:
|
|
// Kick the watchdog
|
|
str r6, [r7, #0]
|
|
// Load write pointer
|
|
ldr r5, [r1, #0]
|
|
// Abort if it is NULL
|
|
cmp r5, #0
|
|
beq.n exit
|
|
// Load read pointer
|
|
ldr r4, [r1, #4]
|
|
// Continue waiting if it equals the write pointer
|
|
cmp r4, r5
|
|
beq.n wait_fifo
|
|
// Copy one word from buffer to target, and increment pointers
|
|
ldmia r4!, {r5}
|
|
stmia r3!, {r5}
|
|
// If at end of buffer, wrap back to buffer start
|
|
cmp r4, r2
|
|
bcc.n no_wrap
|
|
mov r4, r1
|
|
adds r4, #8
|
|
no_wrap:
|
|
// Update read pointer inside the buffer
|
|
str r4, [r1, #4]
|
|
// Deduce the word transferred from the byte count
|
|
subs r0, #4
|
|
// Start again
|
|
bne.n wait_fifo
|
|
exit:
|
|
// Wait for OpenOCD
|
|
bkpt #0x00
|
|
|
|
.pool
|