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

📄 sysflashmem.h

📁 vxworks MPC8541 BSP
💻 H
字号:
/* sysFlashMem.h - Flash memory library header */

/* Copyright 2003-2004 ZTE, Inc. */

/*
modification history
--------------------
01a,17jun03,lzq  created.
*/

/*
DESCRIPTION
This file contains header information for Flash memory devices.
*/

#ifndef __INCsysFlashMemh
#define __INCsysFlashMemh

#ifdef __cplusplus
extern "C" {
#endif

#include "semLib.h"

/* defines */

typedef struct flash_id {
    UINT64 vendorID;
    UINT64 deviceID;
    UINT64 subdevID1;
    UINT64 subdevID2;
} FLASH_ID;

typedef struct flash_part {
    UINT32 blockSize;
    UINT32 blockCount;
} FLASH_PART;

typedef struct flash_phy {
    int isAmdType;
    FLASH_ID *flashID;
    FLASH_PART *flashPart;
    UINT32 partCount;
    int writeBufMod;
} FLASH_PHY;

typedef struct flash_unit {
    int unitNo;

    UINT32 unitAddr;
    UINT32 unitSize;
    UINT32 devCount;

    FLASH_PHY *phy;

    SEM_ID unitSem;

    int inited;
} FLASH_UNIT;

typedef struct flash_dev {
    int unitNo;

    UINT32 devAddr;
    UINT32 devSize;
    UINT32 bankCount;
    UINT32 portSize;

    int writeBufMod;

    UINT32 partCount;
    FLASH_PART *devPart;

    void (*get) (struct flash_dev *dev, UINT32 pos, char *buf);
    void (*set) (struct flash_dev *dev, UINT32 pos, char *buf);
    STATUS (*write) (struct flash_dev *dev, UINT32 pos, char *buf);
    STATUS (*erase) (struct flash_dev *dev, UINT32 pos);

    SEM_ID devSem;

    FLASH_UNIT *unit;

    int inited;
} FLASH_DEV;

typedef struct fs_sect_tbl {
    int sect;
    FLASH_DEV *dev;
    char *sectLabel;
    char **subDirs;
    BOOL inited;
} FS_SECT_TBL;

#define FLASH_UNIT_NUM		3
#define FLASH_BANK_MAX		4
#define FLASH_PORT_MAX		8
#define WRITE_BUF_SIZE		32

/*
 * Delay defines
 */

#define FLASH_WRITE_TIMEOUT		1000000
#define FLASH_ERASE_TIMEOUT		(10 * sysClkRateGet())

/*
 * Check option defines
 */

#define FLASH_POLL_RESERVE1		0x00
#define FLASH_POLL_ERASE		0x01
#define FLASH_POLL_WRITE		0x02
#define FLASH_POLL_UNLOCK		0x03
#define FLASH_POLL_LOCKUP		0x04
#define FLASH_POLL_LOCKDOWN		0x05
#define FLASH_POLL_RESERVE2		0x80

/*
 * Flash driver interface
 */

STATUS flashInit(void);
STATUS flashRead(FLASH_DEV *dev, UINT32 pos, char *buf, UINT32 len);
STATUS flashWrite(FLASH_DEV *dev, UINT32 pos, char *buf, UINT32 len);
STATUS flashProgram(FLASH_DEV *dev, UINT32 pos, char *buf, UINT32 len);
STATUS flashErase(FLASH_DEV *dev, UINT32 pos, UINT32 len);
STATUS flashEraseAll(FLASH_DEV *dev);
STATUS flashWritable(FLASH_DEV *dev, UINT32 pos, UINT32 len);

/*lint -save -e762*/
STATUS sysNvRamGet(char *string, int strLen, int offset);
STATUS sysNvRamSet(char *string, int strLen, int offset);
/*lint -restore*/

STATUS flashTest(FLASH_DEV *dev);
STATUS flashTestAll(void);

#include "configFlashApp.h"

#ifdef __cplusplus
}
#endif

#endif /* __INCsysFlashMemh */

⌨️ 快捷键说明

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