📄 sdspi.lst
字号:
###############################################################################
# #
# 25/May/2009 02:53:24 #
# 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\memories\sdmmc\sdspi.c #
# Command line = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91lib\memories\sdmmc\sdspi.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\sdspi.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\sdspi.o #
# #
# #
###############################################################################
F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\at91lib\memories\sdmmc\sdspi.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 "sdspi.h"
35 #include <utility/assert.h>
36 #include <utility/trace.h>
37 #include <board.h>
38 #include <crc7.h>
typedef unsigned int size_t;
^
"F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\external_libs\crc\linuxtypes.h",4 Warning[Pe301]:
typedef name has already been declared (with same type)
39 #include <crc-itu-t.h>
typedef unsigned int size_t;
^
"F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\external_libs\crc\linuxtypes.h",4 Warning[Pe301]:
typedef name has already been declared (with same type)
40 #include <crc16.h>
typedef unsigned int size_t;
^
"F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\external_libs\crc\linuxtypes.h",4 Warning[Pe301]:
typedef name has already been declared (with same type)
41 #include <crc-ccitt.h>
42 #include <string.h>
\ In section .text, align 4
\ __??Code32?? __intrinsic __code __interwork void *memset(void *, int, size_t)
\ memset:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0200A0E1 MOV R0,R2
\ 0000000C 0120A0E1 MOV R2,R1
\ 00000010 0010A0E1 MOV R1,R0
\ 00000014 0400A0E1 MOV R0,R4
\ 00000018 ........ BL __aeabi_memset
\ 0000001C 0400A0E1 MOV R0,R4
\ 00000020 1040BDE8 POP {R4,LR}
\ 00000024 1EFF2FE1 BX LR ;; return
43
44 //------------------------------------------------------------------------------
45 // Macros
46 //------------------------------------------------------------------------------
47
48 /// Transfer is pending.
49 #define SDSPI_STATUS_PENDING 1
50 /// Transfer has been aborted because an error occured.
51 #define SDSPI_STATUS_ERROR 2
52
53 /// SPI driver is currently in use.
54 #define SDSPI_ERROR_LOCK 1
55
56 // Data Tokens
57 #define SDSPI_START_BLOCK_1 0xFE // Single/Multiple read, single write
58 #define SDSPI_START_BLOCK_2 0xFC // Multiple block write
59 #define SDSPI_STOP_TRAN 0xFD // Cmd12
60
61 //------------------------------------------------------------------------------
62 // Exported functions
63 //------------------------------------------------------------------------------
64
65 //------------------------------------------------------------------------------
66 /// Initializes the SD Spi structure and the corresponding SPI hardware.
67 /// \param pSpid Pointer to a Spid instance.
68 /// \param pSpiHw Associated SPI peripheral.
69 /// \param spiId SPI peripheral identifier.
70 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
71 void SDSPI_Configure(SdSpi *pSdSpi,
72 AT91PS_SPI pSpiHw,
73 unsigned char spiId)
74 {
75 // Initialize the SPI structure
76 pSdSpi->pSpiHw = pSpiHw;
\ SDSPI_Configure:
\ 00000000 001080E5 STR R1,[R0, #+0]
77 pSdSpi->spiId = spiId;
\ 00000004 0420C0E5 STRB R2,[R0, #+4]
78 pSdSpi->semaphore = 1;
\ 00000008 0120A0E3 MOV R2,#+1
\ 0000000C 0C20C0E5 STRB R2,[R0, #+12]
79
80 // Enable the SPI clock
81 AT91C_BASE_PMC->PMC_PCER = (1 << pSdSpi->spiId);
\ 00000010 D430D0E1 LDRSB R3,[R0, #+4]
\ 00000014 1223A0E1 LSL R2,R2,R3
\ 00000018 EF30E0E3 MVN R3,#+239
\ 0000001C C03FC3E3 BIC R3,R3,#0x300
\ 00000020 002083E5 STR R2,[R3, #+0]
82
83 // Execute a software reset of the SPI twice
84 pSpiHw->SPI_CR = AT91C_SPI_SWRST;
\ 00000024 8020A0E3 MOV R2,#+128
\ 00000028 002081E5 STR R2,[R1, #+0]
85 pSpiHw->SPI_CR = AT91C_SPI_SWRST;
\ 0000002C 002081E5 STR R2,[R1, #+0]
86
87 // Configure SPI in Master Mode with No CS selected !!!
88 pSpiHw->SPI_MR = AT91C_SPI_MSTR | AT91C_SPI_MODFDIS | AT91C_SPI_PCS;
\ 00000030 1120A0E3 MOV R2,#+17
\ 00000034 F02A82E3 ORR R2,R2,#0xF0000
\ 00000038 042081E5 STR R2,[R1, #+4]
89
90 // Disables the receiver PDC transfer requests
91 // Disables the transmitter PDC transfer requests.
92 pSpiHw->SPI_PTCR = AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS;
\ 0000003C 0220A0E3 MOV R2,#+2
\ 00000040 802F82E3 ORR R2,R2,#0x200
\ 00000044 202181E5 STR R2,[R1, #+288]
93
94 // Enable the SPI
95 pSpiHw->SPI_CR = AT91C_SPI_SPIEN;
\ 00000048 0120A0E3 MOV R2,#+1
\ 0000004C 002081E5 STR R2,[R1, #+0]
96
97 // Disable the SPI clock
98 AT91C_BASE_PMC->PMC_PCDR = (1 << pSdSpi->spiId);
\ 00000050 D400D0E1 LDRSB R0,[R0, #+4]
\ 00000054 1200A0E1 LSL R0,R2,R0
\ 00000058 041083E3 ORR R1,R3,#0x4
\ 0000005C 000081E5 STR R0,[R1, #+0]
99 }
\ 00000060 1EFF2FE1 BX LR ;; return
100
101 //------------------------------------------------------------------------------
102 /// Configures the parameters for the device corresponding to the cs.
103 /// \param pSdSpi Pointer to a SdSpi instance.
104 /// \param cs number corresponding to the SPI chip select.
105 /// \param csr SPI_CSR value to setup.
106 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
107 void SDSPI_ConfigureCS(SdSpi *pSdSpi, unsigned char cs, unsigned int csr)
108 {
\ SDSPI_ConfigureCS:
\ 00000000 00502DE9 PUSH {R12,LR}
109 unsigned int spiMr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -