📄 at45.lst
字号:
###############################################################################
# #
# 24/Apr/2009 16:18:21 #
# 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\at91lib\memorie #
# s\spi-flash\at45.c #
# Command line = D:\basic-dataflash-project-at91sam7se-ek\at91lib\memorie #
# s\spi-flash\at45.c -D at91sam7se512 -D sram -D #
# TRACE_LEVEL=4 -lC D:\basic-dataflash-project-at91sam7se- #
# ek\at91sam7se-ek\basic-dataflash-project\ewp\at91sam7se5 #
# 12_sram\List\ --remarks --diag_suppress Pe826,Pe1375 -o #
# D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-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\at45. #
# lst #
# Object file = D:\basic-dataflash-project-at91sam7se-ek\at91sam7se-ek\b #
# asic-dataflash-project\ewp\at91sam7se512_sram\Obj\at45.o #
# #
# #
###############################################################################
D:\basic-dataflash-project-at91sam7se-ek\at91lib\memories\spi-flash\at45.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 "at45.h"
35 #include <board.h>
36 #include <utility/assert.h>
37
38 #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
39
40 //------------------------------------------------------------------------------
41 // Internal definitions
42 //------------------------------------------------------------------------------
43
44 /// Number of dataflash which can be recognized.
45 #define NUMDATAFLASH (sizeof(at45Devices) / sizeof(At45Desc))
46
47 //------------------------------------------------------------------------------
48 // Local variables
49 //------------------------------------------------------------------------------
50
51 /// indicate if the device is configured as binary page or not.
\ In section .bss, align 1
52 static unsigned char configuredBinaryPage;
\ configuredBinaryPage:
\ 00000000 DS8 1
53
54 //------------------------------------------------------------------------------
55 // Internal variables
56 //------------------------------------------------------------------------------
57
\ In section .rodata, align 4
58 static const At45Desc at45Devices[] = {
\ at45Devices:
\ 00000000 000200000100 DC32 512, 1, 264, 9
\ 000008010000
\ 09000000
\ 00000010 0C000000 DC8 12, 0, 0, 0
\ 00000014 ........0004 DC32 `?<Constant "AT45DB011D">`, 1024, 1, 264, 9
\ 000001000000
\ 080100000900
\ 0000
\ 00000028 14000000 DC8 20, 0, 0, 0
\ 0000002C ........0008 DC32 `?<Constant "AT45DB021D">`, 2048, 1, 264, 9
\ 000001000000
\ 080100000900
\ 0000
\ 00000040 1C000000 DC8 28, 0, 0, 0
\ 00000044 ........0010 DC32 `?<Constant "AT45DB041D">`, 4096, 1, 264, 9
\ 000001000000
\ 080100000900
\ 0000
\ 00000058 24000000 DC8 36, 0, 0, 0
\ 0000005C ........0010 DC32 `?<Constant "AT45DB081D">`, 4096, 1, 528, 10
\ 000001000000
\ 100200000A00
\ 0000
\ 00000070 2C000000 DC8 44, 0, 0, 0
\ 00000074 ........0020 DC32 `?<Constant "AT45DB161D">`, 8192, 1, 528, 10
\ 000001000000
\ 100200000A00
\ 0000
\ 00000088 34000000 DC8 52, 0, 0, 0
\ 0000008C ........0020 DC32 `?<Constant "AT45DB321D">`, 8192, 1, 1056, 11
\ 000001000000
\ 200400000B00
\ 0000
\ 000000A0 3C000000 DC8 60, 0, 0, 0
\ 000000A4 ........0040 DC32 `?<Constant "AT45DB642D">`, 16384, 1, 1056, 11
\ 000001000000
\ 200400000B00
\ 0000
\ 000000B8 10000000 DC8 16, 0, 0, 0
\ 000000BC ........0040 DC32 `?<Constant "AT45DB1282">`, 16384, 1, 2112, 12
\ 000001000000
\ 400800000C00
\ 0000
\ 000000D0 18000000 DC8 24, 0, 0, 0
\ 000000D4 ........0080 DC32 `?<Constant "AT45DB2562">`, 32768, 1, 2112, 12
\ 000001000000
\ 400800000C00
\ 0000
\ 000000E8 20000000 DC8 32, 0, 0, 0
\ 000000EC ........ DC32 `?<Constant "AT45DB5122">`
59 { 512, 1, 264, 9, 0x0C, "AT45DB011D"},
60 { 1024, 1, 264, 9, 0x14, "AT45DB021D"},
61 { 2048, 1, 264, 9, 0x1C, "AT45DB041D"},
62 { 4096, 1, 264, 9, 0x24, "AT45DB081D"},
63 { 4096, 1, 528, 10, 0x2C, "AT45DB161D"},
64 { 8192, 1, 528, 10, 0x34, "AT45DB321D"},
65 { 8192, 1, 1056, 11, 0x3C, "AT45DB642D"},
66 {16384, 1, 1056, 11, 0x10, "AT45DB1282"},
67 {16384, 1, 2112, 12, 0x18, "AT45DB2562"},
68 {32768, 1, 2112, 12, 0x20, "AT45DB5122"}
69 };
70
71 //------------------------------------------------------------------------------
72 // Exported functions
73 //------------------------------------------------------------------------------
74
75 //------------------------------------------------------------------------------
76 /// Initializes an AT45 instance and configures SPI chip select register.
77 /// Always returns 0.
78 /// \param pAt45 Pointer to the At45 instance to initialize.
79 /// \param pSpid Pointer to the underlying SPI driver.
80 /// \param spiCs Chip select value to connect to the At45.
81 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
82 unsigned char AT45_Configure(At45 *pAt45, Spid *pSpid, unsigned char spiCs)
83 {
\ AT45_Configure:
\ 00000000 31402DE9 PUSH {R0,R4,R5,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0250A0E1 MOV R5,R2
84 SpidCmd *pCommand;
85
86 // Sanity checks
87 ASSERT(pSpid, "AT45_Configure: pSpid is 0.\n\r");
\ 0000000C 000051E3 CMP R1,#+0
\ 00000010 0400001A BNE ??AT45_Configure_0
\ 00000014 ........ LDR R0,??DataTable4 ;; `?<Constant "-F- ASSERT: ">`
\ 00000018 ........ BL printf
\ 0000001C 64009FE5 LDR R0,??AT45_Configure_1 ;; `?<Constant "AT45_Configure: pSpid...">`
\ 00000020 ........ BL printf
\ ??AT45_Configure_2:
\ 00000024 FEFFFFEA B ??AT45_Configure_2
88 ASSERT(pAt45, "AT45_Configure: pAt45 is 0.\n\r");
\ ??AT45_Configure_0:
\ 00000028 000054E3 CMP R4,#+0
\ 0000002C 0400001A BNE ??AT45_Configure_3
\ 00000030 ........ LDR R0,??DataTable4 ;; `?<Constant "-F- ASSERT: ">`
\ 00000034 ........ BL printf
\ 00000038 4C009FE5 LDR R0,??AT45_Configure_1+0x4 ;; `?<Constant "AT45_Configure: pAt45...">`
\ 0000003C ........ BL printf
\ ??AT45_Configure_4:
\ 00000040 FEFFFFEA B ??AT45_Configure_4
89
90 // Initialize the At45 instance
91 pAt45->pSpid = pSpid;
\ ??AT45_Configure_3:
\ 00000044 001084E5 STR R1,[R4, #+0]
92 pAt45->pDesc = 0;
\ 00000048 0000A0E3 MOV R0,#+0
\ 0000004C 1C0084E5 STR R0,[R4, #+28]
93 memset(pAt45->pCmdBuffer, 0, 8);
\ 00000050 0820A0E3 MOV R2,#+8
\ 00000054 0010A0E3 MOV R1,#+0
\ 00000058 200084E2 ADD R0,R4,#+32
\ 0000005C ........ BL memset
94
95 // Initialize the spidCmd structure
96 pCommand = &(pAt45->command);
\ 00000060 040084E2 ADD R0,R4,#+4
97 pCommand->pCmd = pAt45->pCmdBuffer;
\ 00000064 201084E2 ADD R1,R4,#+32
\ 00000068 001080E5 STR R1,[R0, #+0]
98 pCommand->callback = 0;
\ 0000006C 0010A0E3 MOV R1,#+0
\ 00000070 101080E5 STR R1,[R0, #+16]
99 pCommand->pArgument = 0;
\ 00000074 141080E5 STR R1,[R0, #+20]
100 pCommand->spiCs = spiCs;
\ 00000078 0E50C0E5 STRB R5,[R0, #+14]
101
102 return 0;
\ 0000007C 0100A0E1 MOV R0,R1
\ 00000080 3840BDE8 POP {R3-R5,LR}
\ 00000084 1EFF2FE1 BX LR ;; return
\ ??AT45_Configure_1:
\ 00000088 ........ DC32 `?<Constant "AT45_Configure: pSpid...">`
\ 0000008C ........ DC32 `?<Constant "AT45_Configure: pAt45...">`
103 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -