www.pudn.com > mizi_vivi.rar > debug.S
/* * debug.S - debugging functions for head.S * * Copyright (C) 2001 MIZI Research, Inc. * * Author: Yong-iL Joh* Date : $Date: 2002/09/03 07:42:44 $ * * $Revision: 1.4 $ * Mon May 23 2002 Yong-iL Joh - initial based on bootldr-sa11x0.S * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #include "config.h" #include "asm-pxa.h" #include "machine.h" .align 5 /* * Useful debugging routines */ .macro adduart, rd ldr \rd, =UART_BASE .endm .macro waituart, rx, rd 1: ldr \rx, [\rd, #UART_LSR] tst \rx, #SIO_LSR_TEMT beq 1b .endm .macro senduart, rx, rd str \rx, [\rd, #UART_THR] .endm .macro printch, rx, ry, rd waituart \ry, \rd mov \ry, \rx senduart \ry, \rd .endm /* ;; ******************************************************************** ;; PrintChar -- prints the character in R0 ;; r0 contains the character ;; r1 contains base of serial port ;; writes r0 with UTSR1, modifies r0,r1,r2 ;;******************************************************************** */ ENTRY(PrintChar) adduart r1 printch r0, r2, r1 mov pc, lr /* ;; ******************************************************************** ;; PrintWord -- prints the 4 characters in R0 ;; r0 contains the binary word ;; r1 contains the base of the serial por ;; writes r0 with RXSTAT, modifies r1,r2,r3,r4 ;; ******************************************************************** */ ENTRY(PrintWord) adduart r1 printch r0, r2, r1 waituart r2, r1 mov r2, r0, lsr #8 senduart r2, r1 waituart r2, r1 mov r2, r0, lsr #16 senduart r2, r1 waituart r2, r1 mov r2, r0, lsr #24 senduart r2, r1 printch #'\r', r2, r1 printch #'\n', r2, r1 mov pc, lr /* ;; ******************************************************************** ;; PrintHexWord -- prints the 4 bytes in R0 as 8 hex ascii characters ;; followed by a newline ;; r0 contains the binary word ;; r1 contains the base of the serial port ;; Writes r0 with RXSTAT, modifies r1,r2,r3,r4 ;; ******************************************************************** */ .macro htoc, rx, ry mov \ry, \ry, ror #28 and \rx, \ry, #0xf cmp \rx, #10 addlt \rx, \rx, #'0' addge \rx, \rx, #'A' - 10 .endm ENTRY(PrintHex) adduart r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 waituart r2, r1 htoc r2, r0 senduart r2, r1 printch #'\r', r2, r1 printch #'\n', r2, r1 mov pc, lr #ifdef CONFIG_GPIO_LED ENTRY(blinkLED) #define LED_WAIT_LOOP 0x00100000 ldr r0, =PXA250_GPIO_BASE ldr r1, [r0, #GPDR_LED] orr r1, r1, #GPIO_LED str r1, [r0, #GPDR_LED] mov r1, #GPIO_LED str r1, [r0, #GPSR_LED] mov r1, #LED_WAIT_LOOP 1: cmp r1, #0 subne r1, r1, #1 bne 1b mov r1, #GPIO_LED str r1, [r0, #GPCR_LED] mov r1, #LED_WAIT_LOOP 1: cmp r1, #0 subne r1, r1, #1 bne 1b mov pc, lr ENTRY(offLED) ldr r0, =PXA250_GPIO_BASE ldr r1, [r0, #GPDR_LED] orr r1, r1, #GPIO_LED str r1, [r0, #GPDR_LED] mov r1, #GPIO_LED str r1, [r0, #GPCR_LED] mov pc, lr #endif /* CONFIG_GPIO_LED */ /* | $Id: debug.S,v 1.4 2002/09/03 07:42:44 tolkien Exp $ | | Local Variables: | mode: asm | mode: font-lock | version-control: t | delete-old-versions: t | End: | | -*- End-Of-File -*- */