Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities/STM32_EVAL/STM3210E_EVAL/stm3210e_eval_fsmc_nand.h @ 0:c59513fd84fb
Initial commit of STM32 test code.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 03 Oct 2011 21:19:15 +1030 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c59513fd84fb |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm3210e_eval_fsmc_nand.h | |
4 * @author MCD Application Team | |
5 * @version V4.5.0 | |
6 * @date 07-March-2011 | |
7 * @brief This file contains all the functions prototypes for the | |
8 * stm3210e_eval_fsmc_nand firmware driver. | |
9 ****************************************************************************** | |
10 * @attention | |
11 * | |
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS | |
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE | |
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY | |
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING | |
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE | |
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. | |
18 * | |
19 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> | |
20 ****************************************************************************** | |
21 */ | |
22 | |
23 /* Define to prevent recursive inclusion -------------------------------------*/ | |
24 #ifndef __STM3210E_EVAL_FSMC_NAND_H | |
25 #define __STM3210E_EVAL_FSMC_NAND_H | |
26 | |
27 #ifdef __cplusplus | |
28 extern "C" { | |
29 #endif | |
30 | |
31 /* Includes ------------------------------------------------------------------*/ | |
32 #include "stm32f10x.h" | |
33 | |
34 /** @addtogroup Utilities | |
35 * @{ | |
36 */ | |
37 | |
38 /** @addtogroup STM32_EVAL | |
39 * @{ | |
40 */ | |
41 | |
42 /** @addtogroup STM3210E_EVAL | |
43 * @{ | |
44 */ | |
45 | |
46 /** @addtogroup STM3210E_EVAL_FSMC_NAND | |
47 * @{ | |
48 */ | |
49 | |
50 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Types | |
51 * @{ | |
52 */ | |
53 typedef struct | |
54 { | |
55 uint8_t Maker_ID; | |
56 uint8_t Device_ID; | |
57 uint8_t Third_ID; | |
58 uint8_t Fourth_ID; | |
59 }NAND_IDTypeDef; | |
60 | |
61 typedef struct | |
62 { | |
63 uint16_t Zone; | |
64 uint16_t Block; | |
65 uint16_t Page; | |
66 } NAND_ADDRESS; | |
67 /** | |
68 * @} | |
69 */ | |
70 | |
71 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Constants | |
72 * @{ | |
73 */ | |
74 /** | |
75 * @brief NAND Area definition for STM3210E-EVAL Board RevD | |
76 */ | |
77 #define CMD_AREA (uint32_t)(1<<16) /* A16 = CLE high */ | |
78 #define ADDR_AREA (uint32_t)(1<<17) /* A17 = ALE high */ | |
79 | |
80 #define DATA_AREA ((uint32_t)0x00000000) | |
81 | |
82 /** | |
83 * @brief FSMC NAND memory command | |
84 */ | |
85 #define NAND_CMD_AREA_A ((uint8_t)0x00) | |
86 #define NAND_CMD_AREA_B ((uint8_t)0x01) | |
87 #define NAND_CMD_AREA_C ((uint8_t)0x50) | |
88 | |
89 #define NAND_CMD_WRITE0 ((uint8_t)0x80) | |
90 #define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10) | |
91 | |
92 #define NAND_CMD_ERASE0 ((uint8_t)0x60) | |
93 #define NAND_CMD_ERASE1 ((uint8_t)0xD0) | |
94 | |
95 #define NAND_CMD_READID ((uint8_t)0x90) | |
96 #define NAND_CMD_STATUS ((uint8_t)0x70) | |
97 #define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A) | |
98 #define NAND_CMD_RESET ((uint8_t)0xFF) | |
99 | |
100 /** | |
101 * @brief NAND memory status | |
102 */ | |
103 #define NAND_VALID_ADDRESS ((uint32_t)0x00000100) | |
104 #define NAND_INVALID_ADDRESS ((uint32_t)0x00000200) | |
105 #define NAND_TIMEOUT_ERROR ((uint32_t)0x00000400) | |
106 #define NAND_BUSY ((uint32_t)0x00000000) | |
107 #define NAND_ERROR ((uint32_t)0x00000001) | |
108 #define NAND_READY ((uint32_t)0x00000040) | |
109 | |
110 /** | |
111 * @brief FSMC NAND memory parameters | |
112 */ | |
113 #define NAND_PAGE_SIZE ((uint16_t)0x0200) /* 512 bytes per page w/o Spare Area */ | |
114 #define NAND_BLOCK_SIZE ((uint16_t)0x0020) /* 32x512 bytes pages per block */ | |
115 #define NAND_ZONE_SIZE ((uint16_t)0x0400) /* 1024 Block per zone */ | |
116 #define NAND_SPARE_AREA_SIZE ((uint16_t)0x0010) /* last 16 bytes as spare area */ | |
117 #define NAND_MAX_ZONE ((uint16_t)0x0004) /* 4 zones of 1024 block */ | |
118 | |
119 /** | |
120 * @brief FSMC NAND memory address computation | |
121 */ | |
122 #define ADDR_1st_CYCLE(ADDR) (uint8_t)((ADDR)& 0xFF) /* 1st addressing cycle */ | |
123 #define ADDR_2nd_CYCLE(ADDR) (uint8_t)(((ADDR)& 0xFF00) >> 8) /* 2nd addressing cycle */ | |
124 #define ADDR_3rd_CYCLE(ADDR) (uint8_t)(((ADDR)& 0xFF0000) >> 16) /* 3rd addressing cycle */ | |
125 #define ADDR_4th_CYCLE(ADDR) (uint8_t)(((ADDR)& 0xFF000000) >> 24) /* 4th addressing cycle */ | |
126 /** | |
127 * @} | |
128 */ | |
129 | |
130 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Macros | |
131 * @{ | |
132 */ | |
133 /** | |
134 * @} | |
135 */ | |
136 | |
137 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Functions | |
138 * @{ | |
139 */ | |
140 void NAND_Init(void); | |
141 void NAND_ReadID(NAND_IDTypeDef* NAND_ID); | |
142 uint32_t NAND_WriteSmallPage(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumPageToWrite); | |
143 uint32_t NAND_ReadSmallPage (uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumPageToRead); | |
144 uint32_t NAND_WriteSpareArea(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumSpareAreaTowrite); | |
145 uint32_t NAND_ReadSpareArea(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumSpareAreaToRead); | |
146 uint32_t NAND_EraseBlock(NAND_ADDRESS Address); | |
147 uint32_t NAND_Reset(void); | |
148 uint32_t NAND_GetStatus(void); | |
149 uint32_t NAND_ReadStatus(void); | |
150 uint32_t NAND_AddressIncrement(NAND_ADDRESS* Address); | |
151 | |
152 #ifdef __cplusplus | |
153 } | |
154 #endif | |
155 | |
156 #endif /* __STM3210E_EVAL_FSMC_NAND_H */ | |
157 /** | |
158 * @} | |
159 */ | |
160 | |
161 /** | |
162 * @} | |
163 */ | |
164 | |
165 /** | |
166 * @} | |
167 */ | |
168 | |
169 /** | |
170 * @} | |
171 */ | |
172 | |
173 /** | |
174 * @} | |
175 */ | |
176 | |
177 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |