2 * Copyright (c) 2013-2020 ARM Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * $Date: 24. January 2020
21 * Project: NAND Flash Driver definitions
26 * Removed volatile from ARM_NAND_STATUS
28 * Extended ARM_NAND_ECC_INFO structure
30 * ARM_NAND_STATUS made volatile
32 * Updated ARM_NAND_ECC_INFO structure and ARM_NAND_ECC_xxx definitions
34 * New simplified driver:
35 * complexity moved to upper layer (command agnostic)
37 * NV-DDR & NV-DDR2 Interface (ONFI specification)
38 * VCC, VCCQ and VPP Power Supply Control
39 * WP (Write Protect) Control
41 * Changed prefix ARM_DRV -> ARM_DRIVER
43 * Namespace prefix ARM_ added
48 #ifndef DRIVER_NAND_H_
49 #define DRIVER_NAND_H_
56 #include "Driver_Common.h"
58 #define ARM_NAND_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2,4) /* API version */
61 /****** NAND Device Power *****/
62 #define ARM_NAND_POWER_VCC_Pos 0
63 #define ARM_NAND_POWER_VCC_Msk (0x07UL << ARM_NAND_POWER_VCC_Pos)
64 #define ARM_NAND_POWER_VCC_OFF (0x01UL << ARM_NAND_POWER_VCC_Pos) ///< VCC Power off
65 #define ARM_NAND_POWER_VCC_3V3 (0x02UL << ARM_NAND_POWER_VCC_Pos) ///< VCC = 3.3V
66 #define ARM_NAND_POWER_VCC_1V8 (0x03UL << ARM_NAND_POWER_VCC_Pos) ///< VCC = 1.8V
67 #define ARM_NAND_POWER_VCCQ_Pos 3
68 #define ARM_NAND_POWER_VCCQ_Msk (0x07UL << ARM_NAND_POWER_VCCQ_Pos)
69 #define ARM_NAND_POWER_VCCQ_OFF (0x01UL << ARM_NAND_POWER_VCCQ_Pos) ///< VCCQ I/O Power off
70 #define ARM_NAND_POWER_VCCQ_3V3 (0x02UL << ARM_NAND_POWER_VCCQ_Pos) ///< VCCQ = 3.3V
71 #define ARM_NAND_POWER_VCCQ_1V8 (0x03UL << ARM_NAND_POWER_VCCQ_Pos) ///< VCCQ = 1.8V
72 #define ARM_NAND_POWER_VPP_OFF (1UL << 6) ///< VPP off
73 #define ARM_NAND_POWER_VPP_ON (1UL << 7) ///< VPP on
76 /****** NAND Control Codes *****/
77 #define ARM_NAND_BUS_MODE (0x01UL) ///< Set Bus Mode as specified with arg
78 #define ARM_NAND_BUS_DATA_WIDTH (0x02UL) ///< Set Bus Data Width as specified with arg
79 #define ARM_NAND_DRIVER_STRENGTH (0x03UL) ///< Set Driver Strength as specified with arg
80 #define ARM_NAND_DEVICE_READY_EVENT (0x04UL) ///< Generate \ref ARM_NAND_EVENT_DEVICE_READY; arg: 0=disabled (default), 1=enabled
81 #define ARM_NAND_DRIVER_READY_EVENT (0x05UL) ///< Generate \ref ARM_NAND_EVENT_DRIVER_READY; arg: 0=disabled (default), 1=enabled
83 /*----- NAND Bus Mode (ONFI - Open NAND Flash Interface) -----*/
84 #define ARM_NAND_BUS_INTERFACE_Pos 4
85 #define ARM_NAND_BUS_INTERFACE_Msk (0x03UL << ARM_NAND_BUS_INTERFACE_Pos)
86 #define ARM_NAND_BUS_SDR (0x00UL << ARM_NAND_BUS_INTERFACE_Pos) ///< Data Interface: SDR (Single Data Rate) - Traditional interface (default)
87 #define ARM_NAND_BUS_DDR (0x01UL << ARM_NAND_BUS_INTERFACE_Pos) ///< Data Interface: NV-DDR (Double Data Rate)
88 #define ARM_NAND_BUS_DDR2 (0x02UL << ARM_NAND_BUS_INTERFACE_Pos) ///< Data Interface: NV-DDR2 (Double Data Rate)
89 #define ARM_NAND_BUS_TIMING_MODE_Pos 0
90 #define ARM_NAND_BUS_TIMING_MODE_Msk (0x0FUL << ARM_NAND_BUS_TIMING_MODE_Pos)
91 #define ARM_NAND_BUS_TIMING_MODE_0 (0x00UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 0 (default)
92 #define ARM_NAND_BUS_TIMING_MODE_1 (0x01UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 1
93 #define ARM_NAND_BUS_TIMING_MODE_2 (0x02UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 2
94 #define ARM_NAND_BUS_TIMING_MODE_3 (0x03UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 3
95 #define ARM_NAND_BUS_TIMING_MODE_4 (0x04UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 4 (SDR EDO capable)
96 #define ARM_NAND_BUS_TIMING_MODE_5 (0x05UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 5 (SDR EDO capable)
97 #define ARM_NAND_BUS_TIMING_MODE_6 (0x06UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 6 (NV-DDR2 only)
98 #define ARM_NAND_BUS_TIMING_MODE_7 (0x07UL << ARM_NAND_BUS_TIMING_MODE_Pos) ///< Timing Mode 7 (NV-DDR2 only)
99 #define ARM_NAND_BUS_DDR2_DO_WCYC_Pos 8
100 #define ARM_NAND_BUS_DDR2_DO_WCYC_Msk (0x0FUL << ARM_NAND_BUS_DDR2_DO_WCYC_Pos)
101 #define ARM_NAND_BUS_DDR2_DO_WCYC_0 (0x00UL << ARM_NAND_BUS_DDR2_DO_WCYC_Pos) ///< DDR2 Data Output Warm-up cycles: 0 (default)
102 #define ARM_NAND_BUS_DDR2_DO_WCYC_1 (0x01UL << ARM_NAND_BUS_DDR2_DO_WCYC_Pos) ///< DDR2 Data Output Warm-up cycles: 1
103 #define ARM_NAND_BUS_DDR2_DO_WCYC_2 (0x02UL << ARM_NAND_BUS_DDR2_DO_WCYC_Pos) ///< DDR2 Data Output Warm-up cycles: 2
104 #define ARM_NAND_BUS_DDR2_DO_WCYC_4 (0x03UL << ARM_NAND_BUS_DDR2_DO_WCYC_Pos) ///< DDR2 Data Output Warm-up cycles: 4
105 #define ARM_NAND_BUS_DDR2_DI_WCYC_Pos 12
106 #define ARM_NAND_BUS_DDR2_DI_WCYC_Msk (0x0FUL << ARM_NAND_BUS_DDR2_DI_WCYC_Pos)
107 #define ARM_NAND_BUS_DDR2_DI_WCYC_0 (0x00UL << ARM_NAND_BUS_DDR2_DI_WCYC_Pos) ///< DDR2 Data Input Warm-up cycles: 0 (default)
108 #define ARM_NAND_BUS_DDR2_DI_WCYC_1 (0x01UL << ARM_NAND_BUS_DDR2_DI_WCYC_Pos) ///< DDR2 Data Input Warm-up cycles: 1
109 #define ARM_NAND_BUS_DDR2_DI_WCYC_2 (0x02UL << ARM_NAND_BUS_DDR2_DI_WCYC_Pos) ///< DDR2 Data Input Warm-up cycles: 2
110 #define ARM_NAND_BUS_DDR2_DI_WCYC_4 (0x03UL << ARM_NAND_BUS_DDR2_DI_WCYC_Pos) ///< DDR2 Data Input Warm-up cycles: 4
111 #define ARM_NAND_BUS_DDR2_VEN (1UL << 16) ///< DDR2 Enable external VREFQ as reference
112 #define ARM_NAND_BUS_DDR2_CMPD (1UL << 17) ///< DDR2 Enable complementary DQS (DQS_c) signal
113 #define ARM_NAND_BUS_DDR2_CMPR (1UL << 18) ///< DDR2 Enable complementary RE_n (RE_c) signal
115 /*----- NAND Data Bus Width -----*/
116 #define ARM_NAND_BUS_DATA_WIDTH_8 (0x00UL) ///< Bus Data Width: 8 bit (default)
117 #define ARM_NAND_BUS_DATA_WIDTH_16 (0x01UL) ///< Bus Data Width: 16 bit
119 /*----- NAND Driver Strength (ONFI - Open NAND Flash Interface) -----*/
120 #define ARM_NAND_DRIVER_STRENGTH_18 (0x00UL) ///< Driver Strength 2.0x = 18 Ohms
121 #define ARM_NAND_DRIVER_STRENGTH_25 (0x01UL) ///< Driver Strength 1.4x = 25 Ohms
122 #define ARM_NAND_DRIVER_STRENGTH_35 (0x02UL) ///< Driver Strength 1.0x = 35 Ohms (default)
123 #define ARM_NAND_DRIVER_STRENGTH_50 (0x03UL) ///< Driver Strength 0.7x = 50 Ohms
126 /****** NAND ECC for Read/Write Data Mode and Sequence Execution Code *****/
127 #define ARM_NAND_ECC_INDEX_Pos 0
128 #define ARM_NAND_ECC_INDEX_Msk (0xFFUL << ARM_NAND_ECC_INDEX_Pos)
129 #define ARM_NAND_ECC(n) ((n) & ARM_NAND_ECC_INDEX_Msk) ///< Select ECC
130 #define ARM_NAND_ECC0 (1UL << 8) ///< Use ECC0 of selected ECC
131 #define ARM_NAND_ECC1 (1UL << 9) ///< Use ECC1 of selected ECC
133 /****** NAND Flag for Read/Write Data Mode and Sequence Execution Code *****/
134 #define ARM_NAND_DRIVER_DONE_EVENT (1UL << 16) ///< Generate \ref ARM_NAND_EVENT_DRIVER_DONE
136 /****** NAND Sequence Execution Code *****/
137 #define ARM_NAND_CODE_SEND_CMD1 (1UL << 17) ///< Send Command 1
138 #define ARM_NAND_CODE_SEND_ADDR_COL1 (1UL << 18) ///< Send Column Address 1
139 #define ARM_NAND_CODE_SEND_ADDR_COL2 (1UL << 19) ///< Send Column Address 2
140 #define ARM_NAND_CODE_SEND_ADDR_ROW1 (1UL << 20) ///< Send Row Address 1
141 #define ARM_NAND_CODE_SEND_ADDR_ROW2 (1UL << 21) ///< Send Row Address 2
142 #define ARM_NAND_CODE_SEND_ADDR_ROW3 (1UL << 22) ///< Send Row Address 3
143 #define ARM_NAND_CODE_INC_ADDR_ROW (1UL << 23) ///< Auto-increment Row Address
144 #define ARM_NAND_CODE_WRITE_DATA (1UL << 24) ///< Write Data
145 #define ARM_NAND_CODE_SEND_CMD2 (1UL << 25) ///< Send Command 2
146 #define ARM_NAND_CODE_WAIT_BUSY (1UL << 26) ///< Wait while R/Bn busy
147 #define ARM_NAND_CODE_READ_DATA (1UL << 27) ///< Read Data
148 #define ARM_NAND_CODE_SEND_CMD3 (1UL << 28) ///< Send Command 3
149 #define ARM_NAND_CODE_READ_STATUS (1UL << 29) ///< Read Status byte and check FAIL bit (bit 0)
151 /*----- NAND Sequence Execution Code: Command -----*/
152 #define ARM_NAND_CODE_CMD1_Pos 0
153 #define ARM_NAND_CODE_CMD1_Msk (0xFFUL << ARM_NAND_CODE_CMD1_Pos)
154 #define ARM_NAND_CODE_CMD2_Pos 8
155 #define ARM_NAND_CODE_CMD2_Msk (0xFFUL << ARM_NAND_CODE_CMD2_Pos)
156 #define ARM_NAND_CODE_CMD3_Pos 16
157 #define ARM_NAND_CODE_CMD3_Msk (0xFFUL << ARM_NAND_CODE_CMD3_Pos)
159 /*----- NAND Sequence Execution Code: Column Address -----*/
160 #define ARM_NAND_CODE_ADDR_COL1_Pos 0
161 #define ARM_NAND_CODE_ADDR_COL1_Msk (0xFFUL << ARM_NAND_CODE_ADDR_COL1_Pos)
162 #define ARM_NAND_CODE_ADDR_COL2_Pos 8
163 #define ARM_NAND_CODE_ADDR_COL2_Msk (0xFFUL << ARM_NAND_CODE_ADDR_COL2_Pos)
165 /*----- NAND Sequence Execution Code: Row Address -----*/
166 #define ARM_NAND_CODE_ADDR_ROW1_Pos 0
167 #define ARM_NAND_CODE_ADDR_ROW1_Msk (0xFFUL << ARM_NAND_CODE_ADDR_ROW1_Pos)
168 #define ARM_NAND_CODE_ADDR_ROW2_Pos 8
169 #define ARM_NAND_CODE_ADDR_ROW2_Msk (0xFFUL << ARM_NAND_CODE_ADDR_ROW2_Pos)
170 #define ARM_NAND_CODE_ADDR_ROW3_Pos 16
171 #define ARM_NAND_CODE_ADDR_ROW3_Msk (0xFFUL << ARM_NAND_CODE_ADDR_ROW3_Pos)
174 /****** NAND specific error codes *****/
175 #define ARM_NAND_ERROR_ECC (ARM_DRIVER_ERROR_SPECIFIC - 1) ///< ECC generation/correction failed
179 \brief NAND ECC (Error Correction Code) Information
181 typedef struct _ARM_NAND_ECC_INFO {
182 uint32_t type : 2; ///< Type: 1=ECC0 over Main, 2=ECC0 over Main+Spare, 3=ECC0 over Main and ECC1 over Spare
183 uint32_t page_layout : 1; ///< Page layout: 0=|Main0|Spare0|...|MainN-1|SpareN-1|, 1=|Main0|...|MainN-1|Spare0|...|SpareN-1|
184 uint32_t page_count : 3; ///< Number of virtual pages: N = 2 ^ page_count
185 uint32_t page_size : 4; ///< Virtual Page size (Main+Spare): 0=512+16, 1=1k+32, 2=2k+64, 3=4k+128, 4=8k+256, 8=512+28, 9=1k+56, 10=2k+112, 11=4k+224, 12=8k+448, 15=Not used (extended description)
186 uint32_t reserved : 14; ///< Reserved (must be zero)
187 uint32_t correctable_bits : 8; ///< Number of correctable bits (based on 512 byte codeword size)
188 uint16_t codeword_size [2]; ///< Number of bytes over which ECC is calculated
189 uint16_t ecc_size [2]; ///< ECC size in bytes (rounded up)
190 uint16_t ecc_offset [2]; ///< ECC offset in bytes (where ECC starts in Spare)
191 /* Extended description */
192 uint16_t virtual_page_size [2]; ///< Virtual Page size in bytes (Main/Spare)
193 uint16_t codeword_offset [2]; ///< Codeword offset in bytes (where ECC protected data starts in Main/Spare)
194 uint16_t codeword_gap [2]; ///< Codeword gap in bytes till next protected data
195 uint16_t ecc_gap [2]; ///< ECC gap in bytes till next generated ECC
202 typedef struct _ARM_NAND_STATUS {
203 uint32_t busy : 1; ///< Driver busy flag
204 uint32_t ecc_error : 1; ///< ECC error detected (cleared on next Read/WriteData or ExecuteSequence)
205 uint32_t reserved : 30;
209 /****** NAND Event *****/
210 #define ARM_NAND_EVENT_DEVICE_READY (1UL << 0) ///< Device Ready: R/Bn rising edge
211 #define ARM_NAND_EVENT_DRIVER_READY (1UL << 1) ///< Driver Ready
212 #define ARM_NAND_EVENT_DRIVER_DONE (1UL << 2) ///< Driver operation done
213 #define ARM_NAND_EVENT_ECC_ERROR (1UL << 3) ///< ECC could not correct data
216 // Function documentation
218 \fn ARM_DRIVER_VERSION ARM_NAND_GetVersion (void)
219 \brief Get driver version.
220 \return \ref ARM_DRIVER_VERSION
223 \fn ARM_NAND_CAPABILITIES ARM_NAND_GetCapabilities (void)
224 \brief Get driver capabilities.
225 \return \ref ARM_NAND_CAPABILITIES
228 \fn int32_t ARM_NAND_Initialize (ARM_NAND_SignalEvent_t cb_event)
229 \brief Initialize the NAND Interface.
230 \param[in] cb_event Pointer to \ref ARM_NAND_SignalEvent
231 \return \ref execution_status
234 \fn int32_t ARM_NAND_Uninitialize (void)
235 \brief De-initialize the NAND Interface.
236 \return \ref execution_status
239 \fn int32_t ARM_NAND_PowerControl (ARM_POWER_STATE state)
240 \brief Control the NAND interface power.
241 \param[in] state Power state
242 \return \ref execution_status
245 \fn int32_t ARM_NAND_DevicePower (uint32_t voltage)
246 \brief Set device power supply voltage.
247 \param[in] voltage NAND Device supply voltage
248 \return \ref execution_status
251 \fn int32_t ARM_NAND_WriteProtect (uint32_t dev_num, bool enable)
252 \brief Control WPn (Write Protect).
253 \param[in] dev_num Device number
255 - \b false Write Protect off
256 - \b true Write Protect on
257 \return \ref execution_status
260 \fn int32_t ARM_NAND_ChipEnable (uint32_t dev_num, bool enable)
261 \brief Control CEn (Chip Enable).
262 \param[in] dev_num Device number
264 - \b false Chip Enable off
265 - \b true Chip Enable on
266 \return \ref execution_status
269 \fn int32_t ARM_NAND_GetDeviceBusy (uint32_t dev_num)
270 \brief Get Device Busy pin state.
271 \param[in] dev_num Device number
272 \return 1=busy, 0=not busy, or error
275 \fn int32_t ARM_NAND_SendCommand (uint32_t dev_num, uint8_t cmd)
276 \brief Send command to NAND device.
277 \param[in] dev_num Device number
278 \param[in] cmd Command
279 \return \ref execution_status
282 \fn int32_t ARM_NAND_SendAddress (uint32_t dev_num, uint8_t addr)
283 \brief Send address to NAND device.
284 \param[in] dev_num Device number
285 \param[in] addr Address
286 \return \ref execution_status
289 \fn int32_t ARM_NAND_ReadData (uint32_t dev_num, void *data, uint32_t cnt, uint32_t mode)
290 \brief Read data from NAND device.
291 \param[in] dev_num Device number
292 \param[out] data Pointer to buffer for data to read from NAND device
293 \param[in] cnt Number of data items to read
294 \param[in] mode Operation mode
295 \return number of data items read or \ref execution_status
298 \fn int32_t ARM_NAND_WriteData (uint32_t dev_num, const void *data, uint32_t cnt, uint32_t mode)
299 \brief Write data to NAND device.
300 \param[in] dev_num Device number
301 \param[out] data Pointer to buffer with data to write to NAND device
302 \param[in] cnt Number of data items to write
303 \param[in] mode Operation mode
304 \return number of data items written or \ref execution_status
307 \fn int32_t ARM_NAND_ExecuteSequence (uint32_t dev_num, uint32_t code, uint32_t cmd,
308 uint32_t addr_col, uint32_t addr_row,
309 void *data, uint32_t data_cnt,
310 uint8_t *status, uint32_t *count)
311 \brief Execute sequence of operations.
312 \param[in] dev_num Device number
313 \param[in] code Sequence code
314 \param[in] cmd Command(s)
315 \param[in] addr_col Column address
316 \param[in] addr_row Row address
317 \param[in,out] data Pointer to data to be written or read
318 \param[in] data_cnt Number of data items in one iteration
319 \param[out] status Pointer to status read
320 \param[in,out] count Number of iterations
321 \return \ref execution_status
324 \fn int32_t ARM_NAND_AbortSequence (uint32_t dev_num)
325 \brief Abort sequence execution.
326 \param[in] dev_num Device number
327 \return \ref execution_status
330 \fn int32_t ARM_NAND_Control (uint32_t dev_num, uint32_t control, uint32_t arg)
331 \brief Control NAND Interface.
332 \param[in] dev_num Device number
333 \param[in] control Operation
334 \param[in] arg Argument of operation
335 \return \ref execution_status
338 \fn ARM_NAND_STATUS ARM_NAND_GetStatus (uint32_t dev_num)
339 \brief Get NAND status.
340 \param[in] dev_num Device number
341 \return NAND status \ref ARM_NAND_STATUS
344 \fn int32_t ARM_NAND_InquireECC (int32_t index, ARM_NAND_ECC_INFO *info)
345 \brief Inquire about available ECC.
346 \param[in] index Inquire ECC index
347 \param[out] info Pointer to ECC information \ref ARM_NAND_ECC_INFO retrieved
348 \return \ref execution_status
352 \fn void ARM_NAND_SignalEvent (uint32_t dev_num, uint32_t event)
353 \brief Signal NAND event.
354 \param[in] dev_num Device number
355 \param[in] event Event notification mask
359 typedef void (*ARM_NAND_SignalEvent_t) (uint32_t dev_num, uint32_t event); ///< Pointer to \ref ARM_NAND_SignalEvent : Signal NAND Event.
363 \brief NAND Driver Capabilities.
365 typedef struct _ARM_NAND_CAPABILITIES {
366 uint32_t event_device_ready : 1; ///< Signal Device Ready event (R/Bn rising edge)
367 uint32_t reentrant_operation : 1; ///< Supports re-entrant operation (SendCommand/Address, Read/WriteData)
368 uint32_t sequence_operation : 1; ///< Supports Sequence operation (ExecuteSequence, AbortSequence)
369 uint32_t vcc : 1; ///< Supports VCC Power Supply Control
370 uint32_t vcc_1v8 : 1; ///< Supports 1.8 VCC Power Supply
371 uint32_t vccq : 1; ///< Supports VCCQ I/O Power Supply Control
372 uint32_t vccq_1v8 : 1; ///< Supports 1.8 VCCQ I/O Power Supply
373 uint32_t vpp : 1; ///< Supports VPP High Voltage Power Supply Control
374 uint32_t wp : 1; ///< Supports WPn (Write Protect) Control
375 uint32_t ce_lines : 4; ///< Number of CEn (Chip Enable) lines: ce_lines + 1
376 uint32_t ce_manual : 1; ///< Supports manual CEn (Chip Enable) Control
377 uint32_t rb_monitor : 1; ///< Supports R/Bn (Ready/Busy) Monitoring
378 uint32_t data_width_16 : 1; ///< Supports 16-bit data
379 uint32_t ddr : 1; ///< Supports NV-DDR Data Interface (ONFI)
380 uint32_t ddr2 : 1; ///< Supports NV-DDR2 Data Interface (ONFI)
381 uint32_t sdr_timing_mode : 3; ///< Fastest (highest) SDR Timing Mode supported (ONFI)
382 uint32_t ddr_timing_mode : 3; ///< Fastest (highest) NV_DDR Timing Mode supported (ONFI)
383 uint32_t ddr2_timing_mode : 3; ///< Fastest (highest) NV_DDR2 Timing Mode supported (ONFI)
384 uint32_t driver_strength_18 : 1; ///< Supports Driver Strength 2.0x = 18 Ohms
385 uint32_t driver_strength_25 : 1; ///< Supports Driver Strength 1.4x = 25 Ohms
386 uint32_t driver_strength_50 : 1; ///< Supports Driver Strength 0.7x = 50 Ohms
387 uint32_t reserved : 2; ///< Reserved (must be zero)
388 } ARM_NAND_CAPABILITIES;
392 \brief Access structure of the NAND Driver.
394 typedef struct _ARM_DRIVER_NAND {
395 ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_NAND_GetVersion : Get driver version.
396 ARM_NAND_CAPABILITIES (*GetCapabilities)(void); ///< Pointer to \ref ARM_NAND_GetCapabilities : Get driver capabilities.
397 int32_t (*Initialize) (ARM_NAND_SignalEvent_t cb_event); ///< Pointer to \ref ARM_NAND_Initialize : Initialize NAND Interface.
398 int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_NAND_Uninitialize : De-initialize NAND Interface.
399 int32_t (*PowerControl) (ARM_POWER_STATE state); ///< Pointer to \ref ARM_NAND_PowerControl : Control NAND Interface Power.
400 int32_t (*DevicePower) (uint32_t voltage); ///< Pointer to \ref ARM_NAND_DevicePower : Set device power supply voltage.
401 int32_t (*WriteProtect) (uint32_t dev_num, bool enable); ///< Pointer to \ref ARM_NAND_WriteProtect : Control WPn (Write Protect).
402 int32_t (*ChipEnable) (uint32_t dev_num, bool enable); ///< Pointer to \ref ARM_NAND_ChipEnable : Control CEn (Chip Enable).
403 int32_t (*GetDeviceBusy) (uint32_t dev_num); ///< Pointer to \ref ARM_NAND_GetDeviceBusy : Get Device Busy pin state.
404 int32_t (*SendCommand) (uint32_t dev_num, uint8_t cmd); ///< Pointer to \ref ARM_NAND_SendCommand : Send command to NAND device.
405 int32_t (*SendAddress) (uint32_t dev_num, uint8_t addr); ///< Pointer to \ref ARM_NAND_SendAddress : Send address to NAND device.
406 int32_t (*ReadData) (uint32_t dev_num, void *data, uint32_t cnt, uint32_t mode); ///< Pointer to \ref ARM_NAND_ReadData : Read data from NAND device.
407 int32_t (*WriteData) (uint32_t dev_num, const void *data, uint32_t cnt, uint32_t mode); ///< Pointer to \ref ARM_NAND_WriteData : Write data to NAND device.
408 int32_t (*ExecuteSequence)(uint32_t dev_num, uint32_t code, uint32_t cmd,
409 uint32_t addr_col, uint32_t addr_row,
410 void *data, uint32_t data_cnt,
411 uint8_t *status, uint32_t *count); ///< Pointer to \ref ARM_NAND_ExecuteSequence : Execute sequence of operations.
412 int32_t (*AbortSequence) (uint32_t dev_num); ///< Pointer to \ref ARM_NAND_AbortSequence : Abort sequence execution.
413 int32_t (*Control) (uint32_t dev_num, uint32_t control, uint32_t arg); ///< Pointer to \ref ARM_NAND_Control : Control NAND Interface.
414 ARM_NAND_STATUS (*GetStatus) (uint32_t dev_num); ///< Pointer to \ref ARM_NAND_GetStatus : Get NAND status.
415 int32_t (*InquireECC) ( int32_t index, ARM_NAND_ECC_INFO *info); ///< Pointer to \ref ARM_NAND_InquireECC : Inquire about available ECC.
416 } const ARM_DRIVER_NAND;
422 #endif /* DRIVER_NAND_H_ */