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

📄 doc_api.h

📁 DiskOnChip for 8051 MCU 的 API 源代码和文档
💻 H
字号:
/*
* 文件名称:DOC_API.H
* 内容摘要:在 51 MCU 上对 DOC 进行读、写、擦除操作的 API 的用户头文件
* 
* 当前版本:1.0
* 作    者:庄渭峰
* 完成日期:2003年2月6日
*
* 原 作 者:M-Systems 公司
* 版    本:BDK 1.25
*/

#ifndef _DOC_API_H_
#define _DOC_API_H_

/*---------------------------------------------------------------------
 * Definitions Area
 *---------------------------------------------------------------------*/
typedef unsigned char   byte;
typedef unsigned short  word;
typedef unsigned long   dword;

/*------------ Modes definitions for read and write DOC -------------*/
#define EDC_FLAG  0x02   /* Enable EDC when read and write DOC */

/*----- Error Codes -------------------------------------------------*/
typedef enum /* Status code for operation. A zero value indicates success */
{
    flOK = 0,        /* 成功,无错误      */
    flDOCNotFound,   /* DOC 未找到        */
    flDOCNotReady,   /* DOC 未准备好      */
    flDataError,     /* 数据错误          */
    flUnknownMedia,  /* 未知存储介质      */
    flOutOfMedia,    /* 超出 DOC 容量范围 */
    flWriteFault     /* 写或擦除 DOC 出错 */
} FLStatus;

/*------------------ Main DOC data structure -----------------------*/
typedef struct
{
    byte   flags,
           noOfChips;
    word   pageSize,                /* 页大小,应为 512             */
           erasableBlockSize,       /* 块大小,通常为 8192 或 16384 */
           erasableBlockBits,       /* 通常为 13 或 14              */
           pagesPerBlock;           /* 每块页数,通常为 16 或 32    */
    dword  chipSize,
           noOfBlocks,              /* DOC 块的总数                 */
           noOfPages,               /* DOC 页的总数                 */
           floorSize;
} DOCInfo;
extern DOCInfo docInfo;

/*---------------- API Function Definitions -------------------------*/
/* Note: API detail function documentation in DOC_API.C              */
/*-------------------------------------------------------------------*/

/* DOC_Init - Initialize DOC variables */
FLStatus  DOC_Init( word docWindow );
FLStatus  DOC_ReadOnePage( dword pageNum, byte *buf, word len, byte modes );
FLStatus  DOC_WriteOnePage( dword pageNum, byte *buf, word len, byte modes );
FLStatus  DOC_Erase( dword blockNo, word blocksToErase );

#endif /* _DOC_API_H_ */

⌨️ 快捷键说明

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