⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi.lst

📁 Tried to make CAN logger on AT91sam7X-ek, but have no idea how to implement FATFs... -( I m just a
💻 LST
📖 第 1 页 / 共 2 页
字号:
###############################################################################
#                                                                             #
#                                                       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\peripherals\spi\spi.c               #
#    Command line =  F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
#                    tarted-project-at91sam7x-ek-iar\getting-started-project- #
#                    at91sam7x-ek\at91lib\peripherals\spi\spi.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\spi.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\spi.o                               #
#                                                                             #
#                                                                             #
###############################################################################

F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\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          
     36          //------------------------------------------------------------------------------
     37          //         Exported functions
     38          //------------------------------------------------------------------------------
     39          //------------------------------------------------------------------------------
     40          /// Enables a SPI peripheral
     41          /// \param spi  Pointer to an AT91S_SPI instance.
     42          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
     43          void SPI_Enable(AT91S_SPI *spi)
     44          {
     45              spi->SPI_CR = AT91C_SPI_SPIEN;
   \                     SPI_Enable:
   \   00000000   0110A0E3           MOV      R1,#+1
   \   00000004   001080E5           STR      R1,[R0, #+0]
     46          }
   \   00000008   1EFF2FE1           BX       LR               ;; return
     47          
     48          //------------------------------------------------------------------------------
     49          /// Disables a SPI peripheral.
     50          /// \param spi  Pointer to an AT91S_SPI instance.
     51          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
     52          void SPI_Disable(AT91S_SPI *spi)
     53          {
     54              spi->SPI_CR = AT91C_SPI_SPIDIS;
   \                     SPI_Disable:
   \   00000000   0210A0E3           MOV      R1,#+2
   \   00000004   001080E5           STR      R1,[R0, #+0]
     55          }
   \   00000008   1EFF2FE1           BX       LR               ;; return
     56          
     57          //------------------------------------------------------------------------------
     58          /// Configures a SPI peripheral as specified. The configuration can be computed
     59          /// using several macros (see "SPI configuration macros") and the constants
     60          /// defined in LibV3 (AT91C_SPI_*).
     61          /// \param spi  Pointer to an AT91S_SPI instance.
     62          /// \param id  Peripheral ID of the SPI.
     63          /// \param configuration  Value of the SPI configuration register.
     64          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
     65          void SPI_Configure(AT91S_SPI *spi,
     66                                    unsigned int id,
     67                                    unsigned int configuration)
     68          {
     69              AT91C_BASE_PMC->PMC_PCER = 1 << id;
   \                     SPI_Configure:
   \   00000000   0130A0E3           MOV      R3,#+1
   \   00000004   1311A0E1           LSL      R1,R3,R1
   \   00000008   EF30E0E3           MVN      R3,#+239
   \   0000000C   C03FC3E3           BIC      R3,R3,#0x300
   \   00000010   001083E5           STR      R1,[R3, #+0]
     70              spi->SPI_CR = AT91C_SPI_SPIDIS;
   \   00000014   0210A0E3           MOV      R1,#+2
   \   00000018   001080E5           STR      R1,[R0, #+0]
     71              // Execute a software reset of the SPI twice
     72              spi->SPI_CR = AT91C_SPI_SWRST;
   \   0000001C   8010A0E3           MOV      R1,#+128
   \   00000020   001080E5           STR      R1,[R0, #+0]
     73              spi->SPI_CR = AT91C_SPI_SWRST;
   \   00000024   001080E5           STR      R1,[R0, #+0]
     74              spi->SPI_MR = configuration;
   \   00000028   042080E5           STR      R2,[R0, #+4]
     75          }
   \   0000002C   1EFF2FE1           BX       LR               ;; return
     76          
     77          //------------------------------------------------------------------------------
     78          /// Configures a chip select of a SPI peripheral. The chip select configuration
     79          /// is computed using the definition provided by the LibV3 (AT91C_SPI_*).
     80          /// \param spi  Pointer to an AT91S_SPI instance.
     81          /// \param npcs  Chip select to configure (1, 2, 3 or 4).
     82          /// \param configuration  Desired chip select configuration.
     83          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
     84          void SPI_ConfigureNPCS(AT91S_SPI *spi,
     85                                        unsigned int npcs,
     86                                        unsigned int configuration)
     87          {
     88              spi->SPI_CSR[npcs] = configuration;
   \                     SPI_ConfigureNPCS:
   \   00000000   010180E0           ADD      R0,R0,R1, LSL #+2
   \   00000004   302080E5           STR      R2,[R0, #+48]
     89          }
   \   00000008   1EFF2FE1           BX       LR               ;; return
     90          
     91          //------------------------------------------------------------------------------
     92          /// Sends data through a SPI peripheral. If the SPI is configured to use a fixed
     93          /// peripheral select, the npcs value is meaningless. Otherwise, it identifies
     94          /// the component which shall be addressed.
     95          /// \param spi  Pointer to an AT91S_SPI instance.
     96          /// \param npcs  Chip select of the component to address (1, 2, 3 or 4).
     97          /// \param data  Word of data to send.
     98          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
     99          void SPI_Write(AT91S_SPI *spi, unsigned int npcs, unsigned short data)
    100          {
    101              // Discard contents of RDR register
    102              //volatile unsigned int discard = spi->SPI_RDR;
    103          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -