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

📄 devio.h

📁 QNX ADS BSP code for i.MX27 chips
💻 H
字号:
/* * $QNXLicenseC:  * Copyright 2007, QNX Software Systems.   *   * Licensed under the Apache License, Version 2.0 (the "License"). You   * may not reproduce, modify or distribute this software except in   * compliance with the License. You may obtain a copy of the License   * at: http://www.apache.org/licenses/LICENSE-2.0   *   * Unless required by applicable law or agreed to in writing, software   * distributed under the License is distributed on an "AS IS" basis,   * WITHOUT WARRANTIES OF ANY KIND, either express or implied.  *  * This file may contain contributions from others, either as   * contributors under the License or as licensors under other terms.    * Please review this entire file for other proprietary rights or license   * notices, as well as the QNX Development Suite License Guide at   * http://licensing.qnx.com/license-guide/ for other information.  * $ */#include <stdint.h>//// The spare area used for the NAND. It is 16 bytes in size. We combine// two pages to give us a 1K cluster and a 32 byte effective spare area.//struct spare1 {	uint32_t	unused1;			// 	uint8_t		erasesig;			// Erase signature	uint8_t		status;				// Factory set - FF means good. Must be offset 6!!!	uint8_t		ecc[5];				// Reserved for hardware ECC	uint8_t		nclusters;			// Number of clusters	uint32_t	cluster;			// Cluster};#define ERASESIG	0xA0struct spare2 {	uint32_t	sequence;			// Sequence number	uint8_t		unused1;			// 	uint8_t		status;				// Factory set - FF means good. Must be offset 6!!!	uint8_t		ecc[5];				// Reserved for hardware ECC	uint8_t		unused2;			// 	uint16_t	fid;				// File id	uint16_t	crctrans;			// Crc for readtrans()};// This struct is included in the chipio structure defined in the low level board driverstruct _chipio {	unsigned	addrcycles;	unsigned	lastcmd;	unsigned	lastpage;	unsigned	inspare;};#ifndef CHIPIO#define CHIPIO struct _chipio#endif//// Nand device specific data structures//#define NANDCMD_READ			0x00	// read the first 256 bytes of a page#define NANDCMD_SPAREREAD		0x50#define NANDCMD_PROGRAM			0x80#define NANDCMD_PROGRAMCONFIRM	0x10#define NANDCMD_ERASE			0x60#define NANDCMD_ERASECONFIRM	0xD0#define NANDCMD_IDREAD			0x90#define NANDCMD_STATUSREAD		0x70#define NANDCMD_RESET			0xFF#define	MX21_NAND_PRESET		0x10000000#define DATASIZE		512#define SPARESIZE		16#define PAGESIZE	(DATASIZE + SPARESIZE)#define PAGES2BLK		32#define PAGES2CLUSTER	2#define AREA0	0#define AREA1	1#define SPARE	2// These timeouts are very generous.#define MAX_RESET_USEC	600		// 600us#define MAX_READ_USEC	50      //  50us#define MAX_POST_USEC	2000    //   2ms#define MAX_ERASE_USEC	10000	//  10ms// Prototypes for chip interfaceint  nand_init(struct etfs_devio *dev);int  nand_wait_busy(CHIPIO *cio, uint32_t usec);void nand_write_pageaddr(CHIPIO *cio, unsigned page, int addr_cycles);void nand_write_blkaddr(CHIPIO *cio, unsigned blk, int addr_cycles);void nand_write_cmd(CHIPIO *cio, int command);void nand_write_data(CHIPIO *cio, uint8_t *databuffer, uint8_t *sparebuffer);void nand_read_data(CHIPIO *cio, uint8_t *databuffer, int data_cycles);uint16_t nand_read_status(CHIPIO *cio);

⌨️ 快捷键说明

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