debugutils.h
资源名称:ixp425BSP.rar [点击查看]
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:
VxWorks
开发平台:
C/C++
- /* debugutils.h - IXP425 Eval board configuration header */
- /* Copyright 2002 Wind River Systems, Inc. */
- /*
- modification history
- --------------------
- 01a,05jun02,jb initial version...
- */
- /*
- * This module contains Debug Macros for use in romInit.s
- * - Allow basic serial output - polled only.
- * Provide interface to 7 Seg display.
- */
- /***** UART ****/
- #define DEBUG_UART (1) /* Enable Debug uart output */
- #define UART_REG_SPREAD (2)
- #define UART_DMABodgeDelay 10
- #define UARTLCR_DivisorLatchAccess (1<<7)
- #define UART_LineControl (0x03 << UART_REG_SPREAD)
- #define BaudRateDivisor_115200 1
- #define BaudRateDivisor_9600 0x60
- #define UART_DivisorLatchLSB ( 0x00 << UART_REG_SPREAD )
- #define UART_DivisorLatchMSB ( 0x01 << UART_REG_SPREAD )
- #define UARTLCR_CharLength8 (3<<0)
- #define UARTLCR_StopBits1 (0<<2)
- #define UART_InterruptEnable 0x01
- #define UARTFCR_Enable (1<<0)
- #define UART_FIFOControl (0x02 << UART_REG_SPREAD )
- #define UARTFCR_RXReset (1<<1)
- #define ARTFCR_TXReset (1<<2)
- #define UARTFCR_Mode0RXRDYTXRDY (0<<3)
- #define UARTFCR_RXTrigger1 (0<<6)
- #define UARTMCR_DTRActive (1<<0)
- #define UART_ModemControl (4 << UART_REG_SPREAD )
- #define UART_LineStatus (5 << UART_REG_SPREAD )
- #define UART_Transmit (0 << UART_REG_SPREAD )
- #define UARTLSR_TXHoldingEmpty (1<<5)
- #ifdef _ASMLANGUAGE
- /* For Loop - count down. */
- .MACRO DELAY cycles, reg0
- ldr reg0, =cycles
- subs reg0, reg0, #1
- subne pc, pc, #0xc
- .ENDM
- .MACRO MEMDUMP uart, addr, size, value, temp1, temp2
- 0:
- UARTHexOut uart, addr, temp1, temp2
- mov temp1, #0x3a
- UARTTx uart, temp1, temp2
- ldr value, [addr]
- UARTHexOut uart, value, temp1, temp2
- mov temp1, #13
- UARTTx uart, temp1, temp2
- mov temp1, #10
- UARTTx uart, temp1, temp2
- add addr, addr, #4
- subs size, size, #4
- bne 0b
- .ENDM
- .MACRO UARTHexOut uart, hex, dig, temp
- MOV dig, hex, LSR #28
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #24
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #20
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #16
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #12
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #8
- UARTHexDig uart, dig, temp
- MOV dig, hex, LSR #4
- UARTHexDig uart, dig, temp
- MOV dig, hex
- UARTHexDig uart, dig, temp
- .ENDM
- .MACRO UARTHexDig uart, dig, temp
- and dig, dig, #0xf
- cmp dig, #0xa
- addcc dig, dig, #0x30
- addcs dig, dig, #0x41-0xa
- UARTTx uart, dig, temp
- .ENDM
- .MACRO UARTTextOut uart, char, temp
- and char, char, #0xff
- UARTTx uart, char, temp
- .ENDM
- .MACRO UARTTx uart, char, temp
- 10:
- /* Modified, dont even check if there is room in the transfer fifio, just put it it.. TODO : remove later, on real card*/
- /* ldr uart, =IXP425_UART1_BASE
- ldr temp, [uart, #UART_LineStatus]
- TST temp, #UARTLSR_TXHoldingEmpty
- BEQ 10b
- */
- str char, [uart, #UART_Transmit] /*strb */
- .ENDM
- /*******************************************
- * 7 Seg Display output
- *******************************************/
- .MACRO DebugOutInit
- ldr r0,L$CS2_REG
- ldr r1,L$CS2_VAL
- str r1,[r0]
- .ENDM
- .MACRO DebugOutInitLiteral
- L$CS2_REG: .long 0xc4000008
- L$CS2_VAL: .long 0xBFFF0002
- L$LED_DISPLAY: .long 0x52000000
- .ENDM
- .MACRO DebugOutVal value
- mov r0, #value
- bl FUNC(SevenSegDisplay)
- .ENDM
- /* Assume R0 already has the output code */
- .MACRO DebugOut
- bl FUNC(SevenSegDisplay)
- .ENDM
- #endif /* _ASMLANGUAGE */
- #define DEBUG_OUT_INIT
- #define DEBUG_OUT_VAL(x)
- /* Error Code Fatal */
- /* Error code will add 0xFF also */
- #define ERROR_UNDEF_INSTR 0x00F1
- #define ERROR_SW_INT 0x00F2
- #define ERROR_PREFETCH_ABORT 0x00F3
- #define ERROR_DATA_ABORT 0x00F4
- #define ERROR_UNKNOWN_VEC 0x00F5
- #define ERROR_VEC_IRQ 0x00F6
- #define ERROR_VEC_FIQ 0x00F7
- /* Informational codes - progress indicators */
- #define INFO_CODE_1 (0x0001)
- #define INFO_CODE_2 (0x0002)
- #define INFO_CODE_3 (0x0003)
- #define INFO_CODE_4 (0x0004)
- #define INFO_CODE_5 (0x0005)
- #define INFO_CODE_6 (0x0006)
- #define INFO_CODE_7 (0x0007)
- #define INFO_CODE_8 (0x0008)
- #define INFO_CODE_9 (0x0009)
- #define INFO_CODE_A (0x000A)
- #define INFO_CODE_B (0x000B)
- #define INFO_CODE_C (0x000C)
- #define INFO_CODE_D (0x000D)
- #define INFO_CODE_E (0x000E)
- #define INFO_CODE_F (0x000F)
- #define INFO_CODE_10 (0x0010)
- #define INFO_CODE_11 (0x0011)
- #define INFO_CODE_12 (0x0012)
- #define INFO_CODE_13 (0x0013)
- #define INFO_CODE_14 (0x0014)
- #define INFO_CODE_15 (0x0015)
- #define INFO_CODE_16 (0x0016)
- #define INFO_CODE_17 (0x0017)
- #define INFO_CODE_18 (0x0018)
- #define INFO_CODE_19 (0x0019)
- #define INFO_CODE_1A (0x001A)
- #define INFO_CODE_1B (0x001B)
- #define INFO_CODE_1C (0x001C)
- #define INFO_CODE_1D (0x001D)
- #define INFO_CODE_1E (0x001E)
- #define INFO_CODE_1F (0x001F)
- #define INFO_CODE_20 (0x0020)
- #define INFO_CODE_21 (0x0021)
- #define INFO_CODE_22 (0x0022)
- #define INFO_CODE_23 (0x0023)
- #define INFO_CODE_24 (0x0024)
- #define INFO_CODE_25 (0x0025)
- #define INFO_CODE_26 (0x0026)
- #define INFO_CODE_27 (0x0027)