Path: blob/master/arch/unicore32/kernel/debug-macro.S
10817 views
/*1* linux/arch/unicore32/kernel/debug-macro.S2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*11* Debugging macro include header12*/13#include <generated/asm-offsets.h>14#include <mach/hardware.h>1516.macro put_word_ocd, rd, rx=r16171001: movc \rx, p1.c0, #018cand.a \rx, #219bne 1001b20movc p1.c1, \rd, #121.endm2223#ifdef CONFIG_DEBUG_OCD24/* debug using UniCore On-Chip-Debugger */25.macro addruart, rx26.endm2728.macro senduart, rd, rx29put_word_ocd \rd, \rx30.endm3132.macro busyuart, rd, rx33.endm3435.macro waituart, rd, rx36.endm37#else38#define UART_CLK_DEFAULT 3686400 * 2039/* Uartclk = MCLK/ 2, The MCLK on my board is 3686400 * 40 */40#define BAUD_RATE_DEFAULT 11520041/* The baud rate of the serial port */4243#define UART_DIVISOR_DEFAULT (UART_CLK_DEFAULT \44/ (16 * BAUD_RATE_DEFAULT) - 1)4546.macro addruart,rx47mrc p0, #0, \rx, c1, c048tst \rx, #1 @ MMU enabled?49moveq \rx, #0xee000000 @ physical base address50movne \rx, #0x6e000000 @ virtual address5152@ We probe for the active serial port here53@ However, now we assume UART0 is active: epip4d54@ We assume r1 and r2 can be clobbered.5556movl r2, #UART_DIVISOR_DEFAULT57mov r1, #0x8058str r1, [\rx, #UART_LCR_OFFSET]59and r1, r2, #0xff0060mov r1, r1, lsr #861str r1, [\rx, #UART_DLH_OFFSET]62and r1, r2, #0xff63str r1, [\rx, #UART_DLL_OFFSET]64mov r1, #0x765str r1, [\rx, #UART_FCR_OFFSET]66mov r1, #0x367str r1, [\rx, #UART_LCR_OFFSET]68mov r1, #0x069str r1, [\rx, #UART_IER_OFFSET]70.endm7172.macro senduart,rd,rx73str \rd, [\rx, #UART_THR_OFFSET]74.endm7576.macro waituart,rd,rx771001: ldr \rd, [\rx, #UART_LSR_OFFSET]78tst \rd, #UART_LSR_THRE79beq 1001b80.endm8182.macro busyuart,rd,rx831001: ldr \rd, [\rx, #UART_LSR_OFFSET]84tst \rd, #UART_LSR_TEMT85bne 1001b86.endm87#endif88899091