1
0
mirror of https://git.code.sf.net/p/openocd/code synced 2024-11-26 02:16:26 +00:00
openocd/contrib/loaders/flash/at91sam7x/dcc.c
Antonio Borneo 382148e4dd openocd: fix SPDX tag format for files .c
With the old checkpatch we cannot use the correct format for the
SPDX tags in the file .c, in fact the C99 comments are not allowed
and we had to use the block comment.

With the new checkpatch, let's switch to the correct SPDX format.

Change created automatically through the command:
	sed -i \
	's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \
	$(find src/ contrib/ -name \*.c)

Change-Id: I6da16506baa7af718947562505dd49606d124171
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7153
Tested-by: jenkins
2022-09-18 08:22:01 +00:00

39 lines
1.0 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
* Copyright (C) 2007 by Pavel Chromy *
* chromy@asix.cz *
***************************************************************************/
#include "dcc.h"
/* debug channel read (debugger->MCU) */
uint32 dcc_rd(void)
{
volatile uint32 dcc_reg;
do {
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :);
} while ((dcc_reg&1) == 0);
asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) :);
return dcc_reg;
}
/* debug channel write (MCU->debugger) */
int dcc_wr(uint32 data)
{
volatile uint32 dcc_reg;
do {
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :);
/* operation controlled by master, cancel operation
upon reception of data for immediate response */
if (dcc_reg&1) return -1;
} while (dcc_reg&2);
asm volatile ("mcr p14, 0, %0, C1, C0" : : "r" (data));
return 0;
}