📄 dbgu.lst
字号:
###############################################################################
# #
# 25/May/2009 02:53:23 #
# IAR ANSI C/C++ Compiler V5.20.0.20892/W32 EVALUATION for ARM #
# Copyright 1999-2008 IAR Systems AB. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91lib\peripherals\dbgu\dbgu.c #
# Command line = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91lib\peripherals\dbgu\dbgu.c -D #
# at91sam7x256 -D flash -D TRACE_LEVEL=4 -lC #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\List\ --remarks --diag_suppress #
# Pe826,Pe1375 -o F:\Diplomovka\IARprojects\Diplomovka\25. #
# 4.2009\getting-started-project-at91sam7x-ek-iar\getting- #
# started-project-at91sam7x-ek\at91sam7x-ek\getting-starte #
# d-project\ewp\at91sam7x256_flash\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 "C:\Program #
# Files (x86)\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/peripherals\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib\ -I F:\Diplomovka\IARprojects\Diplomovka\ #
# 25.4.2009\getting-started-project-at91sam7x-ek-iar\getti #
# ng-started-project-at91sam7x-ek\at91sam7x-ek\getting-sta #
# rted-project\ewp\..\..\..\at91lib\memories\sdmmc\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/components\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/boards/at91sam7x-ek\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\external_libs/crc\ -I "C:\Program Files #
# (x86)\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -Oh #
# List file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\List\dbgu.lst #
# Object file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\Obj\dbgu.o #
# #
# #
###############################################################################
F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\at91lib\peripherals\dbgu\dbgu.c
1 /* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2008, 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 disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29
30 //------------------------------------------------------------------------------
31 // Headers
32 //------------------------------------------------------------------------------
33
34 #include "dbgu.h"
35 #include <stdarg.h>
36 #include <board.h>
37
38 //------------------------------------------------------------------------------
39 // Global functions
40 //------------------------------------------------------------------------------
41 //------------------------------------------------------------------------------
42 /// Initializes the DBGU with the given parameters, and enables both the
43 /// transmitter and the receiver. The mode parameter contains the value of the
44 /// DBGU_MR register.
45 /// Value DBGU_STANDARD can be used for mode to get the most common configuration
46 /// (i.e. aysnchronous, 8bits, no parity, 1 stop bit, no flow control).
47 /// \param mode Operating mode to configure.
48 /// \param baudrate Desired baudrate (e.g. 115200).
49 /// \param mck Frequency of the system master clock in Hz.
50 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
51 void DBGU_Configure(
52 unsigned int mode,
53 unsigned int baudrate,
54 unsigned int mck)
55 {
\ DBGU_Configure:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0200A0E1 MOV R0,R2
56 // Reset & disable receiver and transmitter, disable interrupts
57 AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;
\ 0000000C FF20E0E3 MVN R2,#+255
\ 00000010 D02EC2E3 BIC R2,R2,#0xD00
\ 00000014 0C30A0E3 MOV R3,#+12
\ 00000018 003082E5 STR R3,[R2, #+0]
58 AT91C_BASE_DBGU->DBGU_IDR = 0xFFFFFFFF;
\ 0000001C 0C2082E3 ORR R2,R2,#0xC
\ 00000020 0030E0E3 MVN R3,#+0
\ 00000024 003082E5 STR R3,[R2, #+0]
59
60 // Configure baud rate
61 AT91C_BASE_DBGU->DBGU_BRGR = mck / (baudrate * 16);
\ 00000028 0112A0E1 LSL R1,R1,#+4
\ 0000002C ........ BL __aeabi_uidivmod
\ 00000030 DF10E0E3 MVN R1,#+223
\ 00000034 D01EC1E3 BIC R1,R1,#0xD00
\ 00000038 000081E5 STR R0,[R1, #+0]
62
63 // Configure mode register
64 AT91C_BASE_DBGU->DBGU_MR = mode;
\ 0000003C 1C0041E2 SUB R0,R1,#+28
\ 00000040 1C4180E4 STR R4,[R0], #+284
65
66 // Disable DMA channel
67 AT91C_BASE_DBGU->DBGU_PTCR = AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS;
\ 00000044 0210A0E3 MOV R1,#+2
\ 00000048 801F81E3 ORR R1,R1,#0x200
\ 0000004C 001080E5 STR R1,[R0, #+0]
68
69 // Enable receiver and transmitter
70 AT91C_BASE_DBGU->DBGU_CR = AT91C_US_RXEN | AT91C_US_TXEN;
\ 00000050 480FC0E3 BIC R0,R0,#0x120
\ 00000054 5010A0E3 MOV R1,#+80
\ 00000058 001080E5 STR R1,[R0, #+0]
71 }
\ 0000005C 1040BDE8 POP {R4,LR}
\ 00000060 1EFF2FE1 BX LR ;; return
72
73 //------------------------------------------------------------------------------
74 /// Outputs a character on the DBGU line.
75 /// \note This function is synchronous (i.e. uses polling).
76 /// \param c Character to send.
77 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
78 void DBGU_PutChar(unsigned char c)
79 {
80 // Wait for the transmitter to be ready
81 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
82
83 // Send character
84 AT91C_BASE_DBGU->DBGU_THR = c;
\ 00000014 E310E0E3 MVN R1,#+227
\ 00000018 D01EC1E3 BIC R1,R1,#0xD00
\ 0000001C 000081E5 STR R0,[R1, #+0]
85
86 // Wait for the transfer to complete
87 while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_TXEMPTY) == 0);
\ ??DBGU_PutChar_1:
\ 00000020 0800C1E3 BIC R0,R1,#0x8
\ 00000024 000090E5 LDR R0,[R0, #+0]
\ 00000028 800F10E3 TST R0,#0x200
\ 0000002C FBFFFF0A BEQ ??DBGU_PutChar_1
88 }
\ 00000030 1EFF2FE1 BX LR ;; return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -