📄 dbgu.lst
字号:
89
90 //------------------------------------------------------------------------------
91 /// Return 1 if a character can be read in DBGU
92 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
93 unsigned int DBGU_IsRxReady()
94 {
95 return (AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_RXRDY);
\ DBGU_IsRxReady:
\ 00000000 EB00E0E3 MVN R0,#+235
\ 00000004 D00EC0E3 BIC R0,R0,#0xD00
\ 00000008 000090E5 LDR R0,[R0, #+0]
\ 0000000C 010000E2 AND R0,R0,#0x1
\ 00000010 1EFF2FE1 BX LR ;; return
96 }
97
98 //------------------------------------------------------------------------------
99 /// Reads and returns a character from the DBGU.
100 /// \note This function is synchronous (i.e. uses polling).
101 /// \return Character received.
102 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
103 unsigned char DBGU_GetChar(void)
104 {
105 while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_RXRDY) == 0);
\ DBGU_GetChar:
\ ??DBGU_GetChar_0:
\ 00000000 EB00E0E3 MVN R0,#+235
\ 00000004 D00EC0E3 BIC R0,R0,#0xD00
\ 00000008 000090E5 LDR R0,[R0, #+0]
\ 0000000C 010010E3 TST R0,#0x1
\ 00000010 FAFFFF0A BEQ ??DBGU_GetChar_0
106 return AT91C_BASE_DBGU->DBGU_RHR;
\ 00000014 E700E0E3 MVN R0,#+231
\ 00000018 D00EC0E3 BIC R0,R0,#0xD00
\ 0000001C 000090E5 LDR R0,[R0, #+0]
\ 00000020 FF0000E2 AND R0,R0,#0xFF
\ 00000024 1EFF2FE1 BX LR ;; return
107 }
108
109 #ifndef NOFPUT
110 #include <stdio.h>
111
112 //------------------------------------------------------------------------------
113 /// \exclude
114 /// Implementation of fputc using the DBGU as the standard output. Required
115 /// for printf().
116 /// \param c Character to write.
117 /// \param pStream Output stream.
118 /// \param The character written if successful, or -1 if the output stream is
119 /// not stdout or stderr.
120 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
121 signed int fputc(signed int c, FILE *pStream)
122 {
\ fputc:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040A0E1 MOV R4,R0
123 if ((pStream == stdout) || (pStream == stderr)) {
\ 00000008 ........ LDR R0,??DataTable1 ;; __iar_Stdout
\ 0000000C 000051E1 CMP R1,R0
\ 00000010 20009F15 LDRNE R0,??fputc_0 ;; __iar_Stderr
\ 00000014 00005111 CMPNE R1,R0
\ 00000018 0300001A BNE ??fputc_1
124
125 DBGU_PutChar(c);
\ 0000001C FF0004E2 AND R0,R4,#0xFF
\ 00000020 ........ BL DBGU_PutChar
126 return c;
\ 00000024 0400A0E1 MOV R0,R4
\ 00000028 000000EA B ??fputc_2
127 }
128 else {
129
130 return EOF;
\ ??fputc_1:
\ 0000002C 0000E0E3 MVN R0,#+0
\ ??fputc_2:
\ 00000030 1040BDE8 POP {R4,LR}
\ 00000034 1EFF2FE1 BX LR ;; return
\ ??fputc_0:
\ 00000038 ........ DC32 __iar_Stderr
131 }
132 }
133
134 //------------------------------------------------------------------------------
135 /// \exclude
136 /// Implementation of fputs using the DBGU as the standard output. Required
137 /// for printf(). Does NOT currently use the PDC.
138 /// \param pStr String to write.
139 /// \param pStream Output stream.
140 /// \return Number of characters written if successful, or -1 if the output
141 /// stream is not stdout or stderr.
142 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
143 signed int fputs(const char *pStr, FILE *pStream)
144 {
\ fputs:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0050A0E1 MOV R5,R0
\ 00000008 0140A0E1 MOV R4,R1
145 signed int num = 0;
\ 0000000C 0060A0E3 MOV R6,#+0
\ 00000010 000000EA B ??fputs_0
146
147 while (*pStr != 0) {
148
149 if (fputc(*pStr, pStream) == -1) {
150
151 return -1;
152 }
153 num++;
\ ??fputs_1:
\ 00000014 016086E2 ADD R6,R6,#+1
154 pStr++;
\ ??fputs_0:
\ 00000018 0000D5E5 LDRB R0,[R5, #+0]
\ 0000001C 000050E3 CMP R0,#+0
\ 00000020 0600000A BEQ ??fputs_2
\ 00000024 0410A0E1 MOV R1,R4
\ 00000028 0100D5E4 LDRB R0,[R5], #+1
\ 0000002C ........ BL fputc
\ 00000030 010070E3 CMN R0,#+1
\ 00000034 F6FFFF1A BNE ??fputs_1
\ 00000038 0000E0E3 MVN R0,#+0
\ 0000003C 000000EA B ??fputs_3
155 }
156
157 return num;
\ ??fputs_2:
\ 00000040 0600A0E1 MOV R0,R6
\ ??fputs_3:
\ 00000044 7040BDE8 POP {R4-R6,LR}
\ 00000048 1EFF2FE1 BX LR ;; return
158 }
159
160 #undef putchar
161
162 //------------------------------------------------------------------------------
163 /// \exclude
164 /// Outputs a character on the DBGU.
165 /// \param c Character to output.
166 /// \return The character that was output.
167 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
168 signed int putchar(signed int c)
169 {
170 return fputc(c, stdout);
\ putchar:
\ 00000000 ........ LDR R1,??DataTable1 ;; __iar_Stdout
\ 00000004 ........ B fputc ;; tailcall
171 }
\ In section .text, align 4, keep-with-next
\ ??DataTable1:
\ 00000000 ........ DC32 __iar_Stdout
172
173 #endif //#ifndef NOFPUT
174
Maximum stack usage in bytes:
Function .cstack
-------- -------
DBGU_Configure 0
DBGU_GetChar 0
DBGU_IsRxReady 0
DBGU_PutChar 0
fputc 0
fputs 0
putchar 0
Section sizes:
Function/Label Bytes
-------------- -----
DBGU_Configure 100
DBGU_PutChar 52
DBGU_IsRxReady 20
DBGU_GetChar 40
fputc 60
fputs 76
putchar 8
??DataTable1 4
360 bytes in section .text
360 bytes of CODE memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -