?? main.lst
字號(hào):
###############################################################################
# #
# 24/Apr/2009 16:18:23 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\main.c #
# Command line = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\main.c -D at91sam7se512 -D sram #
# -D TRACE_LEVEL=4 -lC D:\basic-dataflash-project-at91sam7 #
# se-ek\at91sam7se-ek\basic-dataflash-project\ewp\at91sam7 #
# se512_sram\List\ --remarks --diag_suppress Pe826,Pe1375 #
# -o D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-e #
# k\basic-dataflash-project\ewp\at91sam7se512_sram\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 "D:\Program Files\arm\ARM\INC\DLib_Config_ #
# Full.h" -I D:\basic-dataflash-project-at91sam7se-ek\at91 #
# sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/p #
# eripherals\ -I D:\basic-dataflash-project-at91sam7se-ek\ #
# at91sam7se-ek\basic-dataflash-project\ewp\..\..\..\at91l #
# ib\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam7 #
# se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/memor #
# ies\ -I D:\basic-dataflash-project-at91sam7se-ek\at91sam #
# 7se-ek\basic-dataflash-project\ewp\..\..\..\at91lib/boar #
# ds/at91sam7se-ek\ -I "D:\Program Files\arm\ARM\INC\" #
# --interwork --cpu_mode arm -Oh #
# List file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\List\main. #
# lst #
# Object file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\Obj\main.o #
# #
# #
###############################################################################
D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\basic-dataflash-project\main.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 /// \dir "Basic-dataflash-project"
31 ///
32 /// !!!Purpose
33 ///
34 /// The Basic Dataflash project will help new users get familiar with SPI interface
35 /// on Atmel's AT91 family of microcontrollers. This project gives you an AT45
36 /// Dataflash programming code so that can help develop your own SPI devices
37 /// applications with maximum efficiency.
38 ///
39 /// You can find following information depends on your needs:
40 /// - A Spi low level driver performs SPI device Initializes, data transfer and
41 /// receive. It can be used by upper SPI driver such as AT45 %dataflash.
42 /// - A Dataflash driver is based on top of the corresponding Spi driver.
43 /// It allow user to do operations with %dataflash in a unified way.
44 ///
45 /// !See also
46 /// - "spi-flash": Dataflash interface driver.
47 ///
48 /// !!!Requirements
49 ///
50 /// This package can be used with all Atmel evaluation kits that have SPI
51 /// interface and on-board or external Serialflash connected. The package runs at
52 /// SRAM or SDRAM, so SDRAM device is needed if you want to run this package in SDRAM.
53 ///
54 ///
55 /// !!!Description
56 ///
57 /// The demonstration program tests the dataflash present on the evaluation kit by
58 /// erasing and writing each one of its pages.
59 ///
60 /// !!!Usage
61 ///
62 /// -# Build the program and download it inside the evaluation board. Please
63 /// refer to the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6224.pdf">SAM-BA User Guide</a>,
64 /// the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6310.pdf">GNU-Based Software Development</a>
65 /// application note or to the <a href="ftp://ftp.iar.se/WWWfiles/arm/Guides/EWARM_UserGuide.ENU.pdf">IAR EWARM User Guide</a>,
66 /// depending on your chosen solution.
67 /// -# On the computer, open and configure a terminal application
68 /// (e.g. HyperTerminal on Microsoft Windows) with these settings:
69 /// - 115200 bauds
70 /// - 8 bits of data
71 /// - No parity
72 /// - 1 stop bit
73 /// - No flow control
74 /// -# Start the application.
75 /// -# Upon startup, the application will output the following lines on the DBGU.
76 /// \code
77 /// -- Basic Dataflash Project xxx --
78 /// -- AT91xxxxxx-xx
79 /// -- Compiled: xxx xx xxxx xx:xx:xx --
80 /// -I- Initializing the SPI and AT45 drivers
81 /// -I- At45 enabled
82 /// -I- SPI interrupt enabled
83 /// -I- Waiting for a dataflash to be connected ...
84 /// \endcode
85 /// -# As soon as a dataflash is connected, the tests will start. Eventually,
86 /// the test result (pass or fail) will be output on the DBGU.
87 //------------------------------------------------------------------------------
88
89 //------------------------------------------------------------------------------
90 /// \unit
91 ///
92 /// !Purpose
93 ///
94 /// This file contains all the specific code for the basic-dataflash-project.
95 /// It tests the dataflash present on the evaluation kit by erasing and writing
96 /// each one of its pages
97 ///
98 /// !Contents
99 /// The code can be roughly broken down as follows:
100 /// - AT45 Dataflash write data function.
101 /// - AT45 Dataflash read data function.
102 /// - AT45 Dataflash erase function.
103 /// - Other AT45 functions (such as AT45_GetStatus())
104 /// - The main() function, which implements the program behavior.
105 /// - Initializes an AT45 instance and configures SPI chip select pin.
106 /// - Config SPI Interrupt Service Routine.
107 /// - Identifier the AT45 device connected to the evaluation kit.
108 /// - Test the dataflash by erasing and writing each one of its pages.
109 ///
110 /// !See also
111 /// - "spi-flash": Dataflash interface driver.
112 /// Please refer to the list of functions in the #Overview# tab of this unit
113 /// for more detailed information.
114 //------------------------------------------------------------------------------
115 //------------------------------------------------------------------------------
116 // Headers
117 //------------------------------------------------------------------------------
118
119 #include <board.h>
120 #include <pio/pio.h>
121 #include <aic/aic.h>
122 #include <utility/assert.h>
123 #include <utility/trace.h>
124 #include <spi-flash/at45.h>
125 #include <board_memories.h>
126 #include <pit/pit.h>
127 #include <stdlib.h>
128 #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
129 #include <usb/device/usbprinter/USBPrinter.h>
130 //------------------------------------------------------------------------------
131 // Local definitions
132 //------------------------------------------------------------------------------
133
134 /// SPI clock frequency, in Hz.
135 #define SPCK 15000000
136
137 /// If there is no on-board dataflash socket, use SPI0/NPCS0.
138 #ifndef BOARD_AT45_A_SPI_PINS
139 #ifdef AT91C_BASE_SPI0
140 #define BOARD_AT45_A_SPI_BASE AT91C_BASE_SPI0
141 #define BOARD_AT45_A_SPI_ID AT91C_ID_SPI0
142 #define BOARD_AT45_A_SPI_PINS PINS_SPI0
143 #define BOARD_AT45_A_NPCS_PIN PIN_SPI0_NPCS0
144 #else
145 #define BOARD_AT45_A_SPI_BASE AT91C_BASE_SPI
146 #define BOARD_AT45_A_SPI_ID AT91C_ID_SPI
147 #define BOARD_AT45_A_SPI_PINS PINS_SPI
148 #define BOARD_AT45_A_NPCS_PIN PIN_SPI_NPCS0
149 #endif
150 #define BOARD_AT45_A_SPI 0
151 #define BOARD_AT45_A_NPCS 0
152 #endif
153
154 //------------------------------------------------------------------------------
155 // Internal variables
156 //------------------------------------------------------------------------------
157 //My define variable **********************************************************
\ In section .bss, align 4
158 volatile unsigned int timestamp = 0;
\ timestamp:
\ 00000000 DS8 4
\ In section .bss, align 4
159 unsigned char *SdCodeAddr;
\ SdCodeAddr:
\ 00000000 DS8 4
\ In section .bss, align 4
160 unsigned long crc32_table[256];
\ crc32_table:
\ 00000000 DS8 1024
\ In section .data, align 1
161 unsigned char state = 1;
\ state:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -