📄 spi.lst
字号:
104 // Send data
105 while ((spi->SPI_SR & AT91C_SPI_TXEMPTY) == 0);
\ SPI_Write:
\ ??SPI_Write_0:
\ 00000000 103090E5 LDR R3,[R0, #+16]
\ 00000004 800F13E3 TST R3,#0x200
\ 00000008 FCFFFF0A BEQ ??SPI_Write_0
106 spi->SPI_TDR = data | SPI_PCS(npcs);
\ 0000000C 0130A0E3 MOV R3,#+1
\ 00000010 1311E0E1 MVN R1,R3, LSL R1
\ 00000014 0F1001E2 AND R1,R1,#0xF
\ 00000018 011882E1 ORR R1,R2,R1, LSL #+16
\ 0000001C 0C1080E5 STR R1,[R0, #+12]
107 while ((spi->SPI_SR & AT91C_SPI_TDRE) == 0);
\ ??SPI_Write_1:
\ 00000020 101090E5 LDR R1,[R0, #+16]
\ 00000024 020011E3 TST R1,#0x2
\ 00000028 FCFFFF0A BEQ ??SPI_Write_1
108 }
\ 0000002C 1EFF2FE1 BX LR ;; return
109
110 //------------------------------------------------------------------------------
111 /// Sends the contents of buffer through a SPI peripheral, using the PDC to
112 /// take care of the transfer.
113 /// \param spi Pointer to an AT91S_SPI instance.
114 /// \param buffer Data buffer to send.
115 /// \param length Length of the data buffer.
116 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
117 unsigned char SPI_WriteBuffer(AT91S_SPI *spi,
118 void *buffer,
119 unsigned int length)
120 {
121 // Check if first bank is free
122 if (spi->SPI_TCR == 0) {
\ SPI_WriteBuffer:
\ 00000000 0C3190E5 LDR R3,[R0, #+268]
\ 00000004 000053E3 CMP R3,#+0
\ 00000008 0500001A BNE ??SPI_WriteBuffer_0
123
124 spi->SPI_TPR = (unsigned int) buffer;
\ 0000000C 081180E5 STR R1,[R0, #+264]
125 spi->SPI_TCR = length;
\ 00000010 0C2180E5 STR R2,[R0, #+268]
126 spi->SPI_PTCR = AT91C_PDC_TXTEN;
\ 00000014 401FA0E3 MOV R1,#+256
\ 00000018 201180E5 STR R1,[R0, #+288]
127 return 1;
\ ??SPI_WriteBuffer_1:
\ 0000001C 0100A0E3 MOV R0,#+1
\ 00000020 1EFF2FE1 BX LR
128 }
129 // Check if second bank is free
130 else if (spi->SPI_TNCR == 0) {
\ ??SPI_WriteBuffer_0:
\ 00000024 1C3190E5 LDR R3,[R0, #+284]
\ 00000028 000053E3 CMP R3,#+0
131
132 spi->SPI_TNPR = (unsigned int) buffer;
\ 0000002C 18118005 STREQ R1,[R0, #+280]
133 spi->SPI_TNCR = length;
\ 00000030 1C218005 STREQ R2,[R0, #+284]
134 return 1;
\ 00000034 F8FFFF0A BEQ ??SPI_WriteBuffer_1
135 }
136
137 // No free banks
138 return 0;
\ 00000038 0000A0E3 MOV R0,#+0
\ ??SPI_WriteBuffer_2:
\ 0000003C 1EFF2FE1 BX LR ;; return
139 }
140
141 //------------------------------------------------------------------------------
142 /// Returns 1 if there is no pending write operation on the SPI; otherwise
143 /// returns 0.
144 /// \param pSpi Pointer to an AT91S_SPI instance.
145 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
146 unsigned char SPI_IsFinished(AT91S_SPI *pSpi)
147 {
148 return ((pSpi->SPI_SR & AT91C_SPI_TXEMPTY) != 0);
\ SPI_IsFinished:
\ 00000000 100090E5 LDR R0,[R0, #+16]
\ 00000004 0008A0E1 LSL R0,R0,#+16
\ 00000008 A00CA0E1 LSR R0,R0,#+25
\ 0000000C 010000E2 AND R0,R0,#0x1
\ 00000010 1EFF2FE1 BX LR ;; return
149 }
150
151 //------------------------------------------------------------------------------
152 /// Reads and returns the last word of data received by a SPI peripheral. This
153 /// method must be called after a successful SPI_Write call.
154 /// \param spi Pointer to an AT91S_SPI instance.
155 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
156 unsigned short SPI_Read(AT91S_SPI *spi)
157 {
158 while ((spi->SPI_SR & AT91C_SPI_RDRF) == 0);
\ SPI_Read:
\ ??SPI_Read_0:
\ 00000000 101090E5 LDR R1,[R0, #+16]
\ 00000004 010011E3 TST R1,#0x1
\ 00000008 FCFFFF0A BEQ ??SPI_Read_0
159 return spi->SPI_RDR & 0xFFFF;
\ 0000000C 080090E5 LDR R0,[R0, #+8]
\ 00000010 0008A0E1 MOV R0,R0, LSL #+16
\ 00000014 2008A0E1 MOV R0,R0, LSR #+16
\ 00000018 1EFF2FE1 BX LR ;; return
160 }
161
162 //------------------------------------------------------------------------------
163 /// Reads data from a SPI peripheral until the provided buffer is filled. This
164 /// method does NOT need to be called after SPI_Write or SPI_WriteBuffer.
165 /// \param spi Pointer to an AT91S_SPI instance.
166 /// \param buffer Data buffer to store incoming bytes.
167 /// \param length Length in bytes of the data buffer.
168 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
169 unsigned char SPI_ReadBuffer(AT91S_SPI *spi,
170 void *buffer,
171 unsigned int length)
172 {
173 // Check if the first bank is free
174 if (spi->SPI_RCR == 0) {
\ SPI_ReadBuffer:
\ 00000000 043190E5 LDR R3,[R0, #+260]
\ 00000004 000053E3 CMP R3,#+0
\ 00000008 0500001A BNE ??SPI_ReadBuffer_0
175
176 spi->SPI_RPR = (unsigned int) buffer;
\ 0000000C 001180E5 STR R1,[R0, #+256]
177 spi->SPI_RCR = length;
\ 00000010 042180E5 STR R2,[R0, #+260]
178 spi->SPI_PTCR = AT91C_PDC_RXTEN;
\ 00000014 0110A0E3 MOV R1,#+1
\ 00000018 201180E5 STR R1,[R0, #+288]
179 return 1;
\ 0000001C 0100A0E3 MOV R0,#+1
\ 00000020 1EFF2FE1 BX LR
180 }
181 // Check if second bank is free
182 else if (spi->SPI_RNCR == 0) {
\ ??SPI_ReadBuffer_0:
\ 00000024 143190E5 LDR R3,[R0, #+276]
\ 00000028 000053E3 CMP R3,#+0
183
184 spi->SPI_RNPR = (unsigned int) buffer;
\ 0000002C 10118005 STREQ R1,[R0, #+272]
185 spi->SPI_RNCR = length;
\ 00000030 14218005 STREQ R2,[R0, #+276]
186 return 1;
\ 00000034 0100A003 MOVEQ R0,#+1
187 }
188
189 // No free bank
190 return 0;
\ 00000038 0000A013 MOVNE R0,#+0
\ ??SPI_ReadBuffer_1:
\ 0000003C 1EFF2FE1 BX LR ;; return
191 }
192
Maximum stack usage in bytes:
Function .cstack
-------- -------
SPI_Configure 0
SPI_ConfigureNPCS 0
SPI_Disable 0
SPI_Enable 0
SPI_IsFinished 0
SPI_Read 0
SPI_ReadBuffer 0
SPI_Write 0
SPI_WriteBuffer 0
Section sizes:
Function/Label Bytes
-------------- -----
SPI_Enable 12
SPI_Disable 12
SPI_Configure 48
SPI_ConfigureNPCS 12
SPI_Write 48
SPI_WriteBuffer 64
SPI_IsFinished 20
SPI_Read 28
SPI_ReadBuffer 64
308 bytes in section .text
308 bytes of CODE memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -