📄 stm32f10x_spi.lst
字号:
152 /* Initialize the SPI_CPOL member */
153 SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low;
\ 00000008 C180 STRH R1,[R0, #+6]
154
155 /* Initialize the SPI_CPHA member */
156 SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge;
\ 0000000A 0181 STRH R1,[R0, #+8]
157
158 /* Initialize the SPI_NSS member */
159 SPI_InitStruct->SPI_NSS = SPI_NSS_Hard;
\ 0000000C 4181 STRH R1,[R0, #+10]
160
161 /* Initialize the SPI_BaudRatePrescaler member */
162 SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
\ 0000000E 8181 STRH R1,[R0, #+12]
163
164 /* Initialize the SPI_FirstBit member */
165 SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB;
\ 00000010 C181 STRH R1,[R0, #+14]
166
167 /* Initialize the SPI_CRCPolynomial member */
168 SPI_InitStruct->SPI_CRCPolynomial = 7;
\ 00000012 0721 MOVS R1,#+7
\ 00000014 0182 STRH R1,[R0, #+16]
169 }
\ 00000016 7047 BX LR ;; return
170
171 /*******************************************************************************
172 * Function Name : SPI_Cmd
173 * Description : Enables or disables the specified SPI peripheral.
174 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
175 * - NewState: new state of the SPIx peripheral.
176 * This parameter can be: ENABLE or DISABLE.
177 * Output : None
178 * Return : None
179 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
180 void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState)
181 {
182 /* Check the parameters */
183 assert(IS_FUNCTIONAL_STATE(NewState));
184
185 if (NewState != DISABLE)
\ SPI_Cmd:
\ 00000000 0029 CMP R1,#+0
\ 00000002 0188 LDRH R1,[R0, #+0]
\ 00000004 03D0 BEQ.N ??SPI_Cmd_0
186 {
187 /* Enable the selected SPI peripheral */
188 SPIx->CR1 |= CR1_SPE_Set;
\ 00000006 51F04001 ORRS R1,R1,#0x40
\ 0000000A 0180 STRH R1,[R0, #+0]
\ 0000000C 7047 BX LR
189 }
190 else
191 {
192 /* Disable the selected SPI peripheral */
193 SPIx->CR1 &= CR1_SPE_Reset;
\ ??SPI_Cmd_0:
\ 0000000E 024A LDR.N R2,??SPI_Cmd_1 ;; 0xffbf
\ 00000010 0A40 ANDS R2,R2,R1
\ 00000012 0280 STRH R2,[R0, #+0]
194 }
195 }
\ 00000014 7047 BX LR ;; return
\ 00000016 00BF Nop
\ ??SPI_Cmd_1:
\ 00000018 BFFF0000 DC32 0xffbf
196
197 /*******************************************************************************
198 * Function Name : SPI_ITConfig
199 * Description : Enables or disables the specified SPI interrupts.
200 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
201 * - SPI_IT: specifies the SPI interrupt source to be enabled
202 * or disabled.
203 * This parameter can be one of the following values:
204 * - SPI_IT_TXE: Tx buffer empty interrupt mask
205 * - SPI_IT_RXNE: Rx buffer not empty interrupt mask
206 * - SPI_IT_ERR: Error interrupt mask
207 * - NewState: new state of the specified SPI interrupt.
208 * This parameter can be: ENABLE or DISABLE.
209 * Output : None
210 * Return : None
211 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
212 void SPI_ITConfig(SPI_TypeDef* SPIx, u8 SPI_IT, FunctionalState NewState)
213 {
214 u16 itpos = 0, itmask = 0 ;
215
216 /* Check the parameters */
217 assert(IS_FUNCTIONAL_STATE(NewState));
218 assert(IS_SPI_CONFIG_IT(SPI_IT));
219
220 /* Get the SPI IT index */
221 itpos = SPI_IT >> 4;
222 /* Set the IT mask */
223 itmask = (u16)((u16)1 << itpos);
\ SPI_ITConfig:
\ 00000000 0123 MOVS R3,#+1
\ 00000002 0909 LSRS R1,R1,#+4
\ 00000004 8B40 LSLS R3,R3,R1
\ 00000006 9BB2 UXTH R3,R3
224
225 if (NewState != DISABLE)
\ 00000008 002A CMP R2,#+0
\ 0000000A 8188 LDRH R1,[R0, #+4]
\ 0000000C 02D0 BEQ.N ??SPI_ITConfig_0
226 {
227 /* Enable the selected SPI interrupt */
228 SPIx->CR2 |= itmask;
\ 0000000E 0B43 ORRS R3,R3,R1
\ 00000010 8380 STRH R3,[R0, #+4]
\ 00000012 7047 BX LR
229 }
230 else
231 {
232 /* Disable the selected SPI interrupt */
233 SPIx->CR2 &= (u16)~itmask;
\ ??SPI_ITConfig_0:
\ 00000014 9943 BICS R1,R1,R3
\ 00000016 8180 STRH R1,[R0, #+4]
234 }
235 }
\ 00000018 7047 BX LR ;; return
236
237 /*******************************************************************************
238 * Function Name : SPI_DMACmd
239 * Description : Enables or disables the SPIx抯 DMA interface.
240 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
241 * - SPI_DMAReq: specifies the SPI DMA transfer request to be
242 * enabled or disabled.
243 * This parameter can be any combination of the following values:
244 * - SPI_DMAReq_Tx: Tx buffer DMA transfer request
245 * - SPI_DMAReq_Rx: Rx buffer DMA transfer request
246 * - NewState: new state of the selected SPI DMA transfer request.
247 * This parameter can be: ENABLE or DISABLE.
248 * Output : None
249 * Return : None
250 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
251 void SPI_DMACmd(SPI_TypeDef* SPIx, u16 SPI_DMAReq, FunctionalState NewState)
252 {
253 /* Check the parameters */
254 assert(IS_FUNCTIONAL_STATE(NewState));
255 assert(IS_SPI_DMA_REQ(SPI_DMAReq));
256
257 if (NewState != DISABLE)
\ SPI_DMACmd:
\ 00000000 002A CMP R2,#+0
\ 00000002 8288 LDRH R2,[R0, #+4]
\ 00000004 02D0 BEQ.N ??SPI_DMACmd_0
258 {
259 /* Enable the selected SPI DMA requests */
260 SPIx->CR2 |= SPI_DMAReq;
\ 00000006 1143 ORRS R1,R1,R2
\ 00000008 8180 STRH R1,[R0, #+4]
\ 0000000A 7047 BX LR
261 }
262 else
263 {
264 /* Disable the selected SPI DMA requests */
265 SPIx->CR2 &= (u16)~SPI_DMAReq;
\ ??SPI_DMACmd_0:
\ 0000000C 8A43 BICS R2,R2,R1
\ 0000000E 8280 STRH R2,[R0, #+4]
266 }
267 }
\ 00000010 7047 BX LR ;; return
268
269 /*******************************************************************************
270 * Function Name : SPI_SendData
271 * Description : Transmits a Data through the SPIx peripheral.
272 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
273 * - Data : Data to be transmitted..
274 * Output : None
275 * Return : None
276 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
277 void SPI_SendData(SPI_TypeDef* SPIx, u16 Data)
278 {
279 /* Write in the DR register the data to be sent */
280 SPIx->DR = Data;
\ SPI_SendData:
\ 00000000 8181 STRH R1,[R0, #+12]
281 }
\ 00000002 7047 BX LR ;; return
282
283 /*******************************************************************************
284 * Function Name : SPI_ReceiveData
285 * Description : Returns the most recent received data by the SPIx peripheral.
286 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
287 * Output : None
288 * Return : The value of the received data.
289 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
290 u16 SPI_ReceiveData(SPI_TypeDef* SPIx)
291 {
292 /* Return the data in the DR register */
293 return SPIx->DR;
\ SPI_ReceiveData:
\ 00000000 8089 LDRH R0,[R0, #+12]
\ 00000002 7047 BX LR ;; return
294 }
295
296 /*******************************************************************************
297 * Function Name : SPI_NSSInternalSoftwareConfig
298 * Description : Configures internally by software the NSS pin for the selected
299 * SPI.
300 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
301 * - SPI_NSSInternalSoft: specifies the SPI NSS internal state.
302 * This parameter can be one of the following values:
303 * - SPI_NSSInternalSoft_Set: Set NSS pin internally
304 * - SPI_NSSInternalSoft_Reset: Reset NSS pin internally
305 * Output : None
306 * Return : None
307 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
308 void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, u16 SPI_NSSInternalSoft)
309 {
310 /* Check the parameters */
311 assert(IS_SPI_NSS_INTERNAL(SPI_NSSInternalSoft));
312
313 if (SPI_NSSInternalSoft != SPI_NSSInternalSoft_Reset)
\ SPI_NSSInternalSoftwareConfig:
\ 00000000 054A LDR.N R2,??SPI_NSSInternalSoftwareConfig_0 ;; 0xfeff
\ 00000002 9142 CMP R1,R2
\ 00000004 0188 LDRH R1,[R0, #+0]
\ 00000006 03D0 BEQ.N ??SPI_NSSInternalSoftwareConfig_1
314 {
315 /* Set NSS pin internally by software */
316 SPIx->CR1 |= SPI_NSSInternalSoft_Set;
\ 00000008 51F48071 ORRS R1,R1,#0x100
\ 0000000C 0180 STRH R1,[R0, #+0]
\ 0000000E 7047 BX LR
317 }
318 else
319 {
320 /* Reset NSS pin internally by software */
321 SPIx->CR1 &= SPI_NSSInternalSoft_Reset;
\ ??SPI_NSSInternalSoftwareConfig_1:
\ 00000010 0A40 ANDS R2,R2,R1
\ 00000012 0280 STRH R2,[R0, #+0]
322 }
323 }
\ 00000014 7047 BX LR ;; return
\ 00000016 00BF Nop
\ ??SPI_NSSInternalSoftwareConfig_0:
\ 00000018 FFFE0000 DC32 0xfeff
324
325 /*******************************************************************************
326 * Function Name : SPI_SSOutputCmd
327 * Description : Enables or disables the SS output for the selected SPI.
328 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
329 * - NewState: new state of the SPIx SS output.
330 * This parameter can be: ENABLE or DISABLE.
331 * Output : None
332 * Return : None
333 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
334 void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState)
335 {
336 /* Check the parameters */
337 assert(IS_FUNCTIONAL_STATE(NewState));
338
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -