📄 stm32f10x_spi.lst
字号:
138 /* Initialize the SPI_Direction member */
139 SPI_InitStruct->SPI_Direction = SPI_Direction_2Lines_FullDuplex;
\ SPI_StructInit:
\ 00000000 0021 MOVS R1,#+0
\ 00000002 0180 STRH R1,[R0, #+0]
140
141 /* initialize the SPI_Mode member */
142 SPI_InitStruct->SPI_Mode = SPI_Mode_Slave;
\ 00000004 0021 MOVS R1,#+0
\ 00000006 4180 STRH R1,[R0, #+2]
143
144 /* initialize the SPI_DataSize member */
145 SPI_InitStruct->SPI_DataSize = SPI_DataSize_8b;
\ 00000008 0021 MOVS R1,#+0
\ 0000000A 8180 STRH R1,[R0, #+4]
146
147 /* Initialize the SPI_CPOL member */
148 SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low;
\ 0000000C 0021 MOVS R1,#+0
\ 0000000E C180 STRH R1,[R0, #+6]
149
150 /* Initialize the SPI_CPHA member */
151 SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge;
\ 00000010 0021 MOVS R1,#+0
\ 00000012 0181 STRH R1,[R0, #+8]
152
153 /* Initialize the SPI_NSS member */
154 SPI_InitStruct->SPI_NSS = SPI_NSS_Hard;
\ 00000014 0021 MOVS R1,#+0
\ 00000016 4181 STRH R1,[R0, #+10]
155
156 /* Initialize the SPI_BaudRatePrescaler member */
157 SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
\ 00000018 0021 MOVS R1,#+0
\ 0000001A 8181 STRH R1,[R0, #+12]
158
159 /* Initialize the SPI_FirstBit member */
160 SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB;
\ 0000001C 0021 MOVS R1,#+0
\ 0000001E C181 STRH R1,[R0, #+14]
161
162 /* Initialize the SPI_CRCPolynomial member */
163 SPI_InitStruct->SPI_CRCPolynomial = 7;
\ 00000020 0721 MOVS R1,#+7
\ 00000022 0182 STRH R1,[R0, #+16]
164 }
\ 00000024 7047 BX LR ;; return
165
166 /*******************************************************************************
167 * Function Name : SPI_Cmd
168 * Description : Enables or disables the specified SPI peripheral.
169 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
170 * - NewState: new state of the SPIx peripheral.
171 * This parameter can be: ENABLE or DISABLE.
172 * Output : None
173 * Return : None
174 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
175 void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState)
176 {
177 /* Check the parameters */
178 assert_param(IS_FUNCTIONAL_STATE(NewState));
179
180 if (NewState != DISABLE)
\ SPI_Cmd:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??SPI_Cmd_0
181 {
182 /* Enable the selected SPI peripheral */
183 SPIx->CR1 |= CR1_SPE_Set;
\ 00000006 0288 LDRH R2,[R0, #+0]
\ 00000008 52F04002 ORRS R2,R2,#0x40
\ 0000000C 0280 STRH R2,[R0, #+0]
\ 0000000E 03E0 B.N ??SPI_Cmd_1
184 }
185 else
186 {
187 /* Disable the selected SPI peripheral */
188 SPIx->CR1 &= CR1_SPE_Reset;
\ ??SPI_Cmd_0:
\ 00000010 0288 LDRH R2,[R0, #+0]
\ 00000012 024B LDR.N R3,??SPI_Cmd_2 ;; 0xffbf
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 0380 STRH R3,[R0, #+0]
189 }
190 }
\ ??SPI_Cmd_1:
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??SPI_Cmd_2:
\ 0000001C BFFF0000 DC32 0xffbf
191
192 /*******************************************************************************
193 * Function Name : SPI_ITConfig
194 * Description : Enables or disables the specified SPI interrupts.
195 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
196 * - SPI_IT: specifies the SPI interrupt source to be enabled
197 * or disabled.
198 * This parameter can be one of the following values:
199 * - SPI_IT_TXE: Tx buffer empty interrupt mask
200 * - SPI_IT_RXNE: Rx buffer not empty interrupt mask
201 * - SPI_IT_ERR: Error interrupt mask
202 * - NewState: new state of the specified SPI interrupt.
203 * This parameter can be: ENABLE or DISABLE.
204 * Output : None
205 * Return : None
206 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
207 void SPI_ITConfig(SPI_TypeDef* SPIx, u8 SPI_IT, FunctionalState NewState)
208 {
\ SPI_ITConfig:
\ 00000000 30B4 PUSH {R4,R5}
209 u16 itpos = 0, itmask = 0 ;
\ 00000002 0025 MOVS R5,#+0
\ 00000004 2B00 MOVS R3,R5
\ 00000006 0025 MOVS R5,#+0
\ 00000008 2C00 MOVS R4,R5
210
211 /* Check the parameters */
212 assert_param(IS_FUNCTIONAL_STATE(NewState));
213 assert_param(IS_SPI_CONFIG_IT(SPI_IT));
214
215 /* Get the SPI IT index */
216 itpos = SPI_IT >> 4;
\ 0000000A C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 0000000C 0D09 LSRS R5,R1,#+4
\ 0000000E EDB2 UXTB R5,R5 ;; ZeroExtS R5,R5,#+24,#+24
\ 00000010 2B00 MOVS R3,R5
217 /* Set the IT mask */
218 itmask = (u16)((u16)1 << itpos);
\ 00000012 0125 MOVS R5,#+1
\ 00000014 9D40 LSLS R5,R5,R3
\ 00000016 2C00 MOVS R4,R5
219
220 if (NewState != DISABLE)
\ 00000018 D2B2 UXTB R2,R2 ;; ZeroExtS R2,R2,#+24,#+24
\ 0000001A 002A CMP R2,#+0
\ 0000001C 03D0 BEQ.N ??SPI_ITConfig_0
221 {
222 /* Enable the selected SPI interrupt */
223 SPIx->CR2 |= itmask;
\ 0000001E 8588 LDRH R5,[R0, #+4]
\ 00000020 2543 ORRS R5,R5,R4
\ 00000022 8580 STRH R5,[R0, #+4]
\ 00000024 02E0 B.N ??SPI_ITConfig_1
224 }
225 else
226 {
227 /* Disable the selected SPI interrupt */
228 SPIx->CR2 &= (u16)~itmask;
\ ??SPI_ITConfig_0:
\ 00000026 8588 LDRH R5,[R0, #+4]
\ 00000028 A543 BICS R5,R5,R4
\ 0000002A 8580 STRH R5,[R0, #+4]
229 }
230 }
\ ??SPI_ITConfig_1:
\ 0000002C 30BC POP {R4,R5}
\ 0000002E 7047 BX LR ;; return
231
232 /*******************************************************************************
233 * Function Name : SPI_DMACmd
234 * Description : Enables or disables the SPIx抯 DMA interface.
235 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
236 * - SPI_DMAReq: specifies the SPI DMA transfer request to be
237 * enabled or disabled.
238 * This parameter can be any combination of the following values:
239 * - SPI_DMAReq_Tx: Tx buffer DMA transfer request
240 * - SPI_DMAReq_Rx: Rx buffer DMA transfer request
241 * - NewState: new state of the selected SPI DMA transfer request.
242 * This parameter can be: ENABLE or DISABLE.
243 * Output : None
244 * Return : None
245 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
246 void SPI_DMACmd(SPI_TypeDef* SPIx, u16 SPI_DMAReq, FunctionalState NewState)
247 {
248 /* Check the parameters */
249 assert_param(IS_FUNCTIONAL_STATE(NewState));
250 assert_param(IS_SPI_DMA_REQ(SPI_DMAReq));
251
252 if (NewState != DISABLE)
\ SPI_DMACmd:
\ 00000000 D2B2 UXTB R2,R2 ;; ZeroExtS R2,R2,#+24,#+24
\ 00000002 002A CMP R2,#+0
\ 00000004 03D0 BEQ.N ??SPI_DMACmd_0
253 {
254 /* Enable the selected SPI DMA requests */
255 SPIx->CR2 |= SPI_DMAReq;
\ 00000006 8388 LDRH R3,[R0, #+4]
\ 00000008 0B43 ORRS R3,R3,R1
\ 0000000A 8380 STRH R3,[R0, #+4]
\ 0000000C 02E0 B.N ??SPI_DMACmd_1
256 }
257 else
258 {
259 /* Disable the selected SPI DMA requests */
260 SPIx->CR2 &= (u16)~SPI_DMAReq;
\ ??SPI_DMACmd_0:
\ 0000000E 8388 LDRH R3,[R0, #+4]
\ 00000010 8B43 BICS R3,R3,R1
\ 00000012 8380 STRH R3,[R0, #+4]
261 }
262 }
\ ??SPI_DMACmd_1:
\ 00000014 7047 BX LR ;; return
263
264 /*******************************************************************************
265 * Function Name : SPI_SendData
266 * Description : Transmits a Data through the SPIx peripheral.
267 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
268 * - Data : Data to be transmitted..
269 * Output : None
270 * Return : None
271 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
272 void SPI_SendData(SPI_TypeDef* SPIx, u16 Data)
273 {
274 /* Write in the DR register the data to be sent */
275 SPIx->DR = Data;
\ SPI_SendData:
\ 00000000 8181 STRH R1,[R0, #+12]
276 }
\ 00000002 7047 BX LR ;; return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -