?? spi.lst
字號:
###############################################################################
# #
# 08/Mar/2009 18:04:12 #
# IAR ANSI C/C++ Compiler V5.20.2.21007/W32 EVALUATION for ARM #
# Copyright 1999-2008 IAR Systems AB. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = E:\IAR\at91lib\peripherals\spi\spi.c #
# Command line = E:\IAR\at91lib\peripherals\spi\spi.c -D at91sam9260 -D #
# sdram -lC E:\IAR\at91sam9260-ek\basic-twi-eeprom-project #
# \ewp\at91sam9260_sdram\List\ --remarks --diag_suppress #
# Pe826,Pe1375 -o E:\IAR\at91sam9260-ek\basic-twi-eeprom-p #
# roject\ewp\at91sam9260_sdram\Obj\ --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --endian=little #
# --cpu=ARM926EJ-S -e --fpu=None --dlib_config #
# "D:\Program Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\ -I E:\IAR\at91sam9260-ek\basic-twi-eeprom-p #
# roject\ewp\..\..\..\at91lib\boards\at91sam9260-ek\ -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\peripherals\ -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\components\ -I E:\IAR\at91sam9260-ek\basic-t #
# wi-eeprom-project\ewp\..\..\..\at91lib\usb\ -I #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -On #
# List file = E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\at91s #
# am9260_sdram\List\spi.lst #
# Object file = E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\at91s #
# am9260_sdram\Obj\spi.o #
# #
# #
###############################################################################
E:\IAR\at91lib\peripherals\spi\spi.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 "spi.h"
35 #include <pio/pio.h>
36 #include <aic/aic.h>
37 #include <pdc/pdc.h>
38
39 #define SPI0_INTERRUPT_LEVEL 7 // 定義Spi的中斷優先級為最高優先級
40
\ In section .data, align 1
41 unsigned char r_flag = 1;
\ r_flag:
\ 00000000 01 DC8 1
42
43 //------------------------------------------------------------------------------
44 // Exported functions
45 //------------------------------------------------------------------------------
46 //------------------------------------------------------------------------------
47 /// Enables a SPI peripheral
48 /// \param spi Pointer to an AT91S_SPI instance.
49 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
50 void SPI_Enable(AT91S_SPI *spi)
51 {
52 spi->SPI_CR = AT91C_SPI_SPIEN;
\ SPI_Enable:
\ 00000000 0110A0E3 MOV R1,#+1
\ 00000004 001080E5 STR R1,[R0, #+0]
53 }
\ 00000008 1EFF2FE1 BX LR ;; return
54
55 //------------------------------------------------------------------------------
56 /// Disables a SPI peripheral.
57 /// \param spi Pointer to an AT91S_SPI instance.
58 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
59 void SPI_Disable(AT91S_SPI *spi)
60 {
61 spi->SPI_CR = AT91C_SPI_SPIDIS;
\ SPI_Disable:
\ 00000000 0210A0E3 MOV R1,#+2
\ 00000004 001080E5 STR R1,[R0, #+0]
62 }
\ 00000008 1EFF2FE1 BX LR ;; return
63
64 //------------------------------------------------------------------------------
65 /// Configures a SPI peripheral as specified. The configuration can be computed
66 /// using several macros (see "SPI configuration macros") and the constants
67 /// defined in LibV3 (AT91C_SPI_*).
68 /// \param spi Pointer to an AT91S_SPI instance.
69 /// \param id Peripheral ID of the SPI.
70 /// \param configuration Value of the SPI configuration register.
71 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
72 void SPI_Configure(AT91S_SPI *spi,
73 unsigned int id,
74 unsigned int configuration)
75 {
76 AT91C_BASE_PMC->PMC_PCER = 1 << id; // 配制 SPI 電源時鐘
\ SPI_Configure:
\ 00000000 0130A0E3 MOV R3,#+1
\ 00000004 1331B0E1 LSLS R3,R3,R1
\ 00000008 EFC0E0E3 MVN R12,#+239
\ 0000000C C0CFCCE3 BIC R12,R12,#0x300
\ 00000010 00308CE5 STR R3,[R12, #+0]
77 spi->SPI_CR = AT91C_SPI_SPIDIS | AT91C_SPI_SWRST; // Disable and reset the SPI
\ 00000014 8230A0E3 MOV R3,#+130
\ 00000018 003080E5 STR R3,[R0, #+0]
78 spi->SPI_MR = configuration;
\ 0000001C 042080E5 STR R2,[R0, #+4]
79 }
\ 00000020 1EFF2FE1 BX LR ;; return
80
81
82 //*----------------------------------------------------------------------------
83 //* \fn AT91F_SPI_CfgCs
84 //* \brief Configure SPI chip select register
85 //*----------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
86 void SPI_CfgCs ( AT91PS_SPI pSPI, // pointer to a SPI controller
87 int cs, // SPI cs number (0 to 3)
88 int val) // chip select register
89 {
90 //* Write to the CSR register
91 *(pSPI->SPI_CSR + cs) = val;
\ SPI_CfgCs:
\ 00000000 0430A0E3 MOV R3,#+4
\ 00000004 93012CE0 MLA R12,R3,R1,R0
\ 00000008 30208CE5 STR R2,[R12, #+48]
92 }
\ 0000000C 1EFF2FE1 BX LR ;; return
93
94
95 //------------------------------------------------------------------------------
96 /// Configures a chip select of a SPI peripheral. The chip select configuration
97 /// is computed using the definition provided by the LibV3 (AT91C_SPI_*).
98 /// \param spi Pointer to an AT91S_SPI instance.
99 /// \param npcs Chip select to configure (1, 2, 3 or 4).
100 /// \param configuration Desired chip select configuration.
101 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
102 void SPI_ConfigureNPCS(AT91S_SPI *spi,
103 unsigned int npcs,
104 unsigned int configuration)
105 {
106 spi->SPI_CSR[npcs] = configuration;
\ SPI_ConfigureNPCS:
\ 00000000 0430A0E3 MOV R3,#+4
\ 00000004 93012CE0 MLA R12,R3,R1,R0
\ 00000008 30208CE5 STR R2,[R12, #+48]
107 }
\ 0000000C 1EFF2FE1 BX LR ;; return
108
109
110 //*----------------------------------------------------------------------------
111 //* \fn AT91F_SPI_CfgPCS
113 //*----------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
114 void SPI_CfgPCS (AT91PS_SPI pSPI, // pointer to a SPI controller
115 char PCS_Device) // PCS of the Device
116 {
117 //* Write to the MR register
118 pSPI->SPI_MR &= 0xFFF0FFFF;
\ SPI_CfgPCS:
\ 00000000 042090E5 LDR R2,[R0, #+4]
\ 00000004 F02AD2E3 BICS R2,R2,#0xF0000
\ 00000008 042080E5 STR R2,[R0, #+4]
119 pSPI->SPI_MR |= ( (PCS_Device<<16) & AT91C_SPI_PCS );
\ 0000000C 042090E5 LDR R2,[R0, #+4]
\ 00000010 0130B0E1 MOVS R3,R1
\ 00000014 FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000018 F0CAA0E3 MOV R12,#+983040
\ 0000001C 03381CE0 ANDS R3,R12,R3, LSL #+16
\ 00000020 022093E1 ORRS R2,R3,R2
\ 00000024 042080E5 STR R2,[R0, #+4]
120 }
\ 00000028 1EFF2FE1 BX LR ;; return
121
122
123 //*----------------------------------------------------------------------------
124 //* \fn AT91F_SPI_EnableIt
125 //* \brief Enable SPI interrupt
126 //*----------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
127 void SPI_EnableIt (unsigned int flag) // IT to be enabled
128 {
129 //* Write to the IER register
130 AT91C_BASE_SPI0->SPI_IER = flag;
\ SPI_EnableIt:
\ 00000000 04109FE5 LDR R1,??SPI_EnableIt_0 ;; 0xfffc8014
\ 00000004 000081E5 STR R0,[R1, #+0]
131 }
\ 00000008 1EFF2FE1 BX LR ;; return
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -