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

📄 _blkdev.h

📁 DOC文件系统驱动源代码
💻 H
📖 第 1 页 / 共 5 页
字号:
/*
 * $Log:   V:/Flite/archives/TrueFFS5/Src/_blkdev.h_V  $
 * 
 *    Rev 1.1   Jul 04 2002 18:03:18   oris
 * Changed some of the comments.
 * 
 *    Rev 1.0   May 14 2002 14:59:00   oris
 * Initial revision.
 */

/***********************************************************************************/
/*                        M-Systems Confidential                                   */
/*           Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001            */
/*                         All Rights Reserved                                     */
/***********************************************************************************/
/*                            NOTICE OF M-SYSTEMS OEM                              */
/*                           SOFTWARE LICENSE AGREEMENT                            */
/*                                                                                 */
/*      THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE                 */
/*      AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT           */
/*      FOR THE SPECIFIC TERMS AND CONDITIONS OF USE,                              */
/*      OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE:                               */
/*      E-MAIL = info@m-sys.com                                                    */
/***********************************************************************************/

#ifndef _BLKDEV_H
#define _BLKDEV_H

/*----------------------------------------------------------------------*/
/*                           b d C a l l                                */
/*                                                                      */
/* Common entry-point to all TrueFFS functions. Macros are to call      */
/* individual function, which are separately described below.           */
/*                                                                      */
/* Parameters:                                                          */
/*        function   : Block device driver function code (listed below) */
/*        ioreq      : IOreq structure                                  */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus   : 0 on success, otherwise failed                   */
/*----------------------------------------------------------------------*/

#if FILES > 0
#ifndef FL_READ_ONLY
/*----------------------------------------------------------------------*/
/*                     f l F l u s h B u f f e r                        */
/*                                                                      */
/* If there is relevant data in the RAM buffer then writes it on        */
/*   the flash memory.                                                  */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle  : Drive number (0, 1, ...)                          */
/*                        bits 7-4 - Partition # (zero based)           */
/*                        bits 3-0 - Socket # (zero based)              */ 
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*----------------------------------------------------------------------*/

#define flFlushBuffer(ioreq)        bdCall(FL_FLUSH_BUFFER,ioreq)

#endif                                  /* READ_ONLY */
/*----------------------------------------------------------------------*/
/*                      f l O p e n F i l e                             */
/*                                                                      */
/* Opens an existing file or creates a new file. Creates a file handle  */
/* for further file processing.                                         */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle        : Drive number (0, 1, ...)                    */
/*                        bits 7-4 - Partition # (zero based)           */
/*                        bits 3-0 - Socket # (zero based)              */ 
/*        irFlags         : Access and action options, defined below    */
/*        irPath          : path of file to open                        */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*        irHandle        : New file handle for open file               */
/*                                                                      */
/*----------------------------------------------------------------------*/

/** Values of irFlags for flOpenFile: */

#define ACCESS_MODE_MASK   3 /* Mask for access mode bits */

/* Individual flags */

#define ACCESS_READ_WRITE  1 /* Allow read and write */
#define ACCESS_CREATE      2 /* Create new file      */

/* Access mode combinations */

#define OPEN_FOR_READ      0 /* open existing file for read-only         */
#define OPEN_FOR_UPDATE    1 /* open existing file for read/write access */
#define OPEN_FOR_WRITE     3 /* create a new file, even if it exists     */


#define flOpenFile(ioreq)        bdCall(FL_OPEN_FILE,ioreq)


/*----------------------------------------------------------------------*/
/*                      f l C l o s e F i l e                           */
/*                                                                      */
/* Closes an open file, records file size and dates in directory and    */
/* releases file handle.                                                */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle        : Handle of file to close.                    */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*----------------------------------------------------------------------*/

#define flCloseFile(ioreq)      bdCall(FL_CLOSE_FILE,ioreq)

#ifndef FL_READ_ONLY
#ifdef SPLIT_JOIN_FILE

/*------------------------------------------------------------------------*/
/*                      f l S p l i t F i l e                             */
/*                                                                        */
/* Splits the file into two files. The original file contains the first   */
/* part, and a new file (which is created for that purpose) contains      */
/* the second part. If the current position is on a cluster               */
/* boundary, the file will be split at the current position. Otherwise,   */
/* the cluster of the current position is duplicated, one copy is the     */
/* first cluster of the new file, and the other is the last cluster of the*/
/* original file, which now ends at the current position.                 */
/*                                                                        */
/* Parameters:                                                            */
/*        file            : file to split.                                */
/*      irPath          : Path name of the new file.                      */
/*                                                                        */
/* Returns:                                                               */
/*        irHandle        : handle of the new file.                       */
/*        FLStatus        : 0 on success, otherwise failed.               */
/*                                                                        */
/*------------------------------------------------------------------------*/

#define flSplitFile(ioreq)     bdCall(FL_SPLIT_FILE,ioreq)


/*------------------------------------------------------------------------*/
/*                      f l J o i n F i l e                               */
/*                                                                        */
/* joins two files. If the end of the first file is on a cluster          */
/* boundary, the files will be joined there. Otherwise, the data in       */
/* the second file from the beginning until the offset that is equal to   */
/* the offset in cluster of the end of the first file will be lost. The   */
/* rest of the second file will be joined to the first file at the end of */
/* the first file. On exit, the first file is the expanded file and the   */
/* second file is deleted.                                                */
/* Note: The second file will be open by this function, it is advised to  */
/*         close it before calling this function in order to avoid        */
/*         inconsistencies.                                               */
/*                                                                        */
/* Parameters:                                                            */
/*        file            : file to join to.                              */
/*        irPath          : Path name of the file to be joined.           */
/*                                                                        */
/* Return:                                                                */
/*        FLStatus        : 0 on success, otherwise failed.               */
/*                                                                        */
/*------------------------------------------------------------------------*/

#define flJoinFile(ioreq)     bdCall(FL_JOIN_FILE,ioreq)

#endif /* SPLIT_JOIN_FILE */
#endif /* FL_READ_ONLY */
/*----------------------------------------------------------------------*/
/*                      f l R e a d F i l e                             */
/*                                                                      */
/* Reads from the current position in the file to the user-buffer.      */
/* Parameters:                                                          */
/*        irHandle     : Handle of file to read.                        */
/*        irData       : Address of user buffer                         */
/*        irLength     : Number of bytes to read. If the read extends   */
/*                       beyond the end-of-file, the read is truncated  */
/*                       at the end-of-file.                            */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus     : 0 on success, otherwise failed                 */
/*        irLength     : Actual number of bytes read                    */
/*----------------------------------------------------------------------*/

#define flReadFile(ioreq)        bdCall(FL_READ_FILE,ioreq)

#ifndef FL_READ_ONLY
/*----------------------------------------------------------------------*/
/*                      f l W r i t e F i l e                           */
/*                                                                      */
/* Writes from the current position in the file from the user-buffer.   */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle        : Handle of file to write.                    */
/*        irData          : Address of user buffer                      */
/*        irLength        : Number of bytes to write.                   */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*        irLength        : Actual number of bytes written              */
/*----------------------------------------------------------------------*/

#define flWriteFile(ioreq)        bdCall(FL_WRITE_FILE,ioreq)

#endif  /* FL_READ_ONLY */
/*----------------------------------------------------------------------*/
/*                      f l S e e k F i l e                             */
/*                                                                      */

⌨️ 快捷键说明

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