📄 dbgu.lst
字号:
###############################################################################
# #
# 18/Jul/2008 11:38:00 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91lib\peripherals\dbgu\dbgu.c #
# Command line = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91lib\peripherals\dbgu\dbgu.c #
# -D at91sam7se512 -lC D:\rock\atarm\at91sam7se\software\ #
# usb-device-core-project-1.3-iar5-at91sam7se-ek\at91sam7s #
# e-ek\usb-device-core-project\ewp\at91sam7se512_sdram\Lis #
# t\ --remarks -o D:\rock\atarm\at91sam7se\software\usb-de #
# vice-core-project-1.3-iar5-at91sam7se-ek\at91sam7se-ek\u #
# sb-device-core-project\ewp\at91sam7se512_sdram\Obj\ #
# --no_cse --no_unroll --no_inline --no_code_motion #
# --no_tbaa --no_clustering --no_scheduling --debug #
# --endian little --cpu ARM7TDMI -e --fpu None #
# --dlib_config "D:\Program Files\IAR Systems\Embedded #
# Workbench 5.0 Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\boards\at91sam7se-ek\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\peripherals\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\components\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\usb\ -I "D:\Program #
# Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -On #
# List file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\at91sam7se512_sdram\List\dbgu.lst #
# Object file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\at91sam7se512_sdram\Obj\dbgu.o #
# #
# #
###############################################################################
D:\rock\atarm\at91sam7se\software\usb-device-core-project-1.3-iar5-at91sam7se-ek\at91lib\peripherals\dbgu\dbgu.c
1 /* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support - ROUSSET -
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2006, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaiimer below.
13 *
14 * - Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the disclaimer below in the documentation and/or
16 * other materials provided with the distribution.
17 *
18 * Atmel's name may not be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
24 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
27 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * ----------------------------------------------------------------------------
32 */
33
34 //------------------------------------------------------------------------------
35 // Headers
36 //------------------------------------------------------------------------------
37
38 #include "dbgu.h"
39 #include <stdarg.h>
40 #include <board.h>
41
42 //------------------------------------------------------------------------------
43 // Exported functions
44 //------------------------------------------------------------------------------
45 //------------------------------------------------------------------------------
46 /// Initializes the DBGU with the given parameters, and enables both the
47 /// transmitter and the receiver.
48 /// \param mode Operating mode to configure (see <Modes>).
49 /// \param baudrate Desired baudrate.
50 /// \param mck Frequency of the system master clock.
51 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
52 void DBGU_Configure(unsigned int mode,
53 unsigned int baudrate,
54 unsigned int mck)
55 {
\ DBGU_Configure:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0260B0E1 MOVS R6,R2
56 // Reset & disable receiver and transmitter, disable interrupts
57 AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;
\ 00000010 FF00E0E3 MVN R0,#+255
\ 00000014 D00EC0E3 BIC R0,R0,#0xD00
\ 00000018 0C10A0E3 MOV R1,#+12
\ 0000001C 001080E5 STR R1,[R0, #+0]
58 AT91C_BASE_DBGU->DBGU_IDR = 0xFFFFFFFF;
\ 00000020 F300E0E3 MVN R0,#+243
\ 00000024 D00EC0E3 BIC R0,R0,#0xD00
\ 00000028 0010E0E3 MVN R1,#+0
\ 0000002C 001080E5 STR R1,[R0, #+0]
59
60 // Configure baud rate
61 AT91C_BASE_DBGU->DBGU_BRGR = mck / (baudrate * 16);
\ 00000030 0600B0E1 MOVS R0,R6
\ 00000034 1020A0E3 MOV R2,#+16
\ 00000038 920511E0 MULS R1,R2,R5
\ 0000003C ........ BL __aeabi_uidivmod
\ 00000040 DF10E0E3 MVN R1,#+223
\ 00000044 D01EC1E3 BIC R1,R1,#0xD00
\ 00000048 000081E5 STR R0,[R1, #+0]
62
63 // Configure mode register
64 AT91C_BASE_DBGU->DBGU_MR = mode;
\ 0000004C FB00E0E3 MVN R0,#+251
\ 00000050 D00EC0E3 BIC R0,R0,#0xD00
\ 00000054 004080E5 STR R4,[R0, #+0]
65
66 // Disable DMA channel
67 AT91C_BASE_DBGU->DBGU_PTCR = AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS;
\ 00000058 DF00E0E3 MVN R0,#+223
\ 0000005C C00EC0E3 BIC R0,R0,#0xC00
\ 00000060 0210A0E3 MOV R1,#+2
\ 00000064 801F81E3 ORR R1,R1,#0x200
\ 00000068 001080E5 STR R1,[R0, #+0]
68
69 // Enable receiver and transmitter
70 AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RXEN | AT91C_US_TXEN;
\ 0000006C FF00E0E3 MVN R0,#+255
\ 00000070 D00EC0E3 BIC R0,R0,#0xD00
\ 00000074 5010A0E3 MOV R1,#+80
\ 00000078 001080E5 STR R1,[R0, #+0]
71 }
\ 0000007C 7040BDE8 POP {R4-R6,LR}
\ 00000080 1EFF2FE1 BX LR ;; return
72
73 //------------------------------------------------------------------------------
74 /// Outputs a character on the DBGU line.
75 /// \param c Character to send.
76 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
77 static void DBGU_PutChar(unsigned char c)
78 {
79 // Wait for the transmitter to be ready
80 while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXEMPTY) == 0);
\ DBGU_PutChar:
\ ??DBGU_PutChar_0:
\ 00000000 EB10E0E3 MVN R1,#+235
\ 00000004 D01EC1E3 BIC R1,R1,#0xD00
\ 00000008 001091E5 LDR R1,[R1, #+0]
\ 0000000C 800F11E3 TST R1,#0x200
\ 00000010 FAFFFF0A BEQ ??DBGU_PutChar_0
81
82 // Send character
83 AT91C_BASE_DBGU->DBGU_THR = c;
\ 00000014 E310E0E3 MVN R1,#+227
\ 00000018 D01EC1E3 BIC R1,R1,#0xD00
\ 0000001C 0020B0E1 MOVS R2,R0
\ 00000020 FF2012E2 ANDS R2,R2,#0xFF ;; Zero extend
\ 00000024 002081E5 STR R2,[R1, #+0]
84
85 // Wait for the transfer to complete
86 while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXEMPTY) == 0);
\ ??DBGU_PutChar_1:
\ 00000028 EB10E0E3 MVN R1,#+235
\ 0000002C D01EC1E3 BIC R1,R1,#0xD00
\ 00000030 001091E5 LDR R1,[R1, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -