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

📄 flashos.h

📁 flash 的读写操作,对于目前主流的flash开发都有启发!
💻 H
字号:
/***********************************************************************/
/*  This file is part of the C166 Compiler package                     */
/*  Copyright KEIL ELEKTRONIK GmbH 2002                                */
/***********************************************************************/
/*                                                                     */
/*  FlashOS.H:  Data structures and entries                            */
/*              for Flash Programming Functions                        */
/*                                                                     */
/***********************************************************************/

#define VERS         1         // Interface Version 1.0

#define UNKNOWN      0         // Unknown
#define ONCHIP       1         // On-chip Flash Memory
#define NOMUX8BIT    2         // External Flash device on Non-Multiplex 8-bit Bus
#define NOMUX16BIT   3         // External Flash device on Non-Multiplex 16-bit Bus
#define MUX8BIT      4         // External Flash device on Multiplex 8-bit Bus
#define MUX16BIT     5         // External Flash device on Multiplex 16-bit Bus

struct FlashBlocks  {
  unsigned long   szBlock;     // Size in Bytes
  unsigned long AddrBlock;     // Address of Blocks
};

#define PROGRAM_BLOCK_END  0xFFFFFFFF, 0xFFFFFFFF,
#define ERASE_BLOCK_END    0xFFFFFFFF, 0xFFFFFFFE,

struct FlashDevice  {
  unsigned short     Vers;     // Version Number and Architecture
  char       DevName[128];     // Device Name and Description
  unsigned short  DevType;     // Device Type: ONCHIP, NOMUX8BIT, NOMUX16BIT, ...
  unsigned long    DevAdr;     // Default Device Start Address
  unsigned long     szDev;     // Total Size of Device
  unsigned long       Res;     // Reserved for future Extension
  unsigned short valEmpty;     // Content of Erased memory
#ifdef __C166__
  short (*Init)         (unsigned long adr);                 // Initialize Flash 
  short (*UnInit)       (void);                              // De-Initialize Flash 
  short (*EraseBlock)   (unsigned long adr);                 // Erase Block Function
  short (*ProgramBlock) (unsigned long adr, void near *buf); // Program Block Function
#else
  unsigned short Init;         // Initialize Flash 
  unsigned short UnInit;       // De-Initialize Flash 
  unsigned short ProgramBlock; // Program Block Function
  unsigned short EraseBlock;   // Erase Block Function
#endif
  unsigned long    toProg;     // Time Out of Program Block Function
  unsigned long   toErase;     // Time Out of Erase Block Function

  struct FlashBlocks blocks[128];
};


#ifdef XC16
#define FLASH_DRV_VERS (0x0100+VERS)   // Driver Version, do not modify!
#else
#define FLASH_DRV_VERS (0x0000+VERS)   // Driver Version, do not modify!
#endif

extern void ChkTimeOut (void);

⌨️ 快捷键说明

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