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

📄 blockdev.h

📁 H3 M-system NAND flash driver in Linux OS, M-DOC driver
💻 H
📖 第 1 页 / 共 5 页
字号:

/*----------------------------------------------------------------------*/
/*                           f l A b s R e a d                          */
/*                                                                      */
/* Reads absolute sectors by sector no.                                 */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle        : Drive number (0, 1, ...)                    */
/*                        bits 7-4 - Partition # (zero based)           */
/*                        bits 3-0 - Socket # (zero based)              */ 
/*        irData          : Address of user buffer to read into         */
/*        irSectorNo      : First sector no. to read (sector 0 is the   */
/*                          DOS boot sector).                           */
/*        irSectorCount   : Number of consecutive sectors to read      */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*        irSectorCount        : Number of sectors actually read        */
/*----------------------------------------------------------------------*/
#define flAbsRead(ioreq)        bdCall(FL_ABS_READ,ioreq)

/*----------------------------------------------------------------------*/
/*                         f l A b s W r i t e                          */
/*                                                                      */
/* Writes absolute sectors by sector no.                                */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle        : Drive number (0, 1, ...)                    */
/*                        bits 7-4 - Partition # (zero based)           */
/*                        bits 3-0 - Socket # (zero based)              */ 
/*        irData          : Address of user buffer to write from        */
/*        irSectorNo      : First sector no. to write                   */
/*        irSectorCount   : Number of consectutive sectors to write     */
/*                                                                      */
/* Returns:                                                             */
/*        FLStatus        : 0 on success, otherwise failed              */
/*        irSectorCount   : Number of sectors actually written          */
/*----------------------------------------------------------------------*/
#define flAbsWrite(ioreq)        bdCall(FL_ABS_WRITE,ioreq)



/*
 * FAT Filter API 
 */
  extern FLStatus     ffCheckBeforeWrite (IOreq FAR2 *ioreq);



/*----------------------------------------------------------------------*/
/*                      f l D e f r a g m e n t V o l u m e             */
/*                                                                      */
/* Performs a general defragmentation and recycling of non-writable     */
/* Flash areas, to achieve optimal write speed.                         */
/*                                                                      */
/* NOTE: The required number of sectors (in irLength) may be changed    */
/* (from another execution thread) while defragmentation is active. In  */
/* particular, the defragmentation may be cut short after it began by   */
/* modifying the irLength field to 0.                                   */
/*                                                                      */
/* Parameters:                                                          */
/*        irHandle  : Drive number (0, 1, ...)                          */
/*                        bits 7-4 - Partition # (zero based)           */
/*                        bits 3-0 - Socket # (zero based)              */ 
/*        irLength  : Minimum number of sectors to make available for   */
/*                    writes.                                           */
/*                                                                      */
/* Returns:                                                             */
/*        irLength  : Actual number of sectors available for writes     */
/*        FLStatus  : 0 on success, otherwise failed                    */
/*----------------------------------------------------------------------*/
#define flDefragmentVolume(ioreq)        bdCall(FL_DEFRAGMENT_VOLUME,ioreq)





 /*-------------------------------------------------------------------
 * bdkReadInit - Init read operations on the DiskOnChip starting
 *       at 'startUnit', with a size of 'areaLen' bytes and 'signature'.
 *
 * Note: Blocks in the DiskOnChip are marked with a 4-character signature
 *       followed by a 4-digit hexadecimal number.
 *
 * Parameters:
 *             'irHandle'      - Drive number (0, 1, ...)
 *                        bits 7-4 - Partition # (zero based)           
 *                        bits 3-0 - Socket # (zero based)               
 *             'irData'         - bdkParams record
 *                startingBlock - unit number of the sub-partition to start reading from
 *                length        - number of bytes to read
 *                oldSign       - signature of the sub-partition
 *                flags         - Should be set to 0
 *
 *  Return :
 *      flOK                - success
 *      flDriveNotAvailable - DiskOnChip ASIC was not found
 *      flUnknownMedia      - failed in Flash chips recognition
 *      flBadFormat         - TL format does not exists
 *      flNoSpaceInVolume   - there are 0 units marked with this signature
 *      flDataError         - MTD read fault.
 *      flHWReadProtect     - HW read protection was triggerd
 *-------------------------------------------------------------------*/
#define bdkReadInit(ioreq) bdCall(FL_BINARY_READ_INIT,ioreq)

/*-------------------------------------------------------------------
 * bdkReadBlock - Read to 'buffer' from the DiskOnChip BDK Image area.
 *
 * Note: Before the first use of this function 'bdkCopyBootAreaInit'
 *       must be called
 *
 * Parameters:
 *             'irHandle'      - Drive number (0, 1, ...)
 *                    bits 7-4 - Partition # (zero based)           
 *                    bits 3-0 - Socket # (zero based)               
 *             'irData'         - bdkParams record
 *                length        - number of bytes to read
 *                bdkBuffer     - buffer to read into
 *
 *  Return :
 *      flOK                - success
 *      flDriveNotAvailable - DiskOnChip ASIC was not found
 *      flUnknownMedia      - failed in Flash chips recognition
 *      flBadFormat         - TL format does not exists
 *      flNoSpaceInVolume   - there are 0 units marked with this signature
 *      flDataError         - MTD read fault.
 *      flHWReadProtect     - HW read protection was triggerd
 *-------------------------------------------------------------------*/
#define bdkReadBlock(ioreq) bdCall(FL_BINARY_READ_BLOCK,ioreq)

/*-------------------------------------------------------------------
 * bdkWriteInit - Init update operations on the DiskOnChip starting
 *       at 'startUnit', with a size of 'areaLen' bytes and 'signature'.
 *
 * Note: Blocks in the DiskOnChip are marked with a 4-character signature
 *       followed by a 4-digit hexadecimal number.
 *
 * Parameters:
 *             'irHandle'       - Drive number (0, 1, ...)
 *                     bits 7-4 - Partition # (zero based)           
 *                     bits 3-0 - Socket # (zero based)               
 *             'irData'         - bdkParams record
 *                startingBlock - unit number of the sub-partition to start writting to
 *                length        - number of bytes to write
 *                oldSign       - signature of the sub-partition
 *                flags         - BDK_COMPLETE_IMAGE_UPDATE
 *
 * Return:     flOK              - success
 *             flGeneralFailure  - DiskOnChip ASIC was not found
 *             flUnknownMedia    - fail in Flash chips recognition
 *             flNoSpaceInVolume - 'areaLen' is bigger than BootImage length
 *-------------------------------------------------------------------*/
#define bdkWriteInit(ioreq) bdCall(FL_BINARY_WRITE_INIT,ioreq)

/*-------------------------------------------------------------------
 * bdkWriteBlock - Write 'buffer' to the DiskOnChip BDK Image area.
 *
 * Note: Before the first use of this function 'bdkUpdateBootAreaInit'
 *       must be called
 *
 * Parameters:
 *             'irHandle'       - Drive number (0, 1, ...)
 *                     bits 7-4 - Partition # (zero based)           
 *                     bits 3-0 - Socket # (zero based)               
 *             'irData'         - bdkParams record
 *                length        - number of bytes to write
 *                bdkBuffer     - buffer to write from
 *                flags         - ERASE_BEFORE_WRITE
 *
 * Return:     flOK              - success
 *             flBadLength       - buffer length > Erasable Block Size
 *             flWriteFault      - fail in buffer writing
 *             flNoSpaceInVolume - end of media was prematurely reached
 *-------------------------------------------------------------------*/
#define bdkWriteBlock(ioreq) bdCall(FL_BINARY_WRITE_BLOCK,ioreq)


/*-------------------------------------------------------------------
 * bdkErase - erase given number of blockdsin the BDK area.
 *
 *  Erase given number of blockds in the binary sub partition.
 *
 * Parameters: ioreq
 *             'irHandle'       - Drive number (0, 1, ...)
 *                     bits 7-4 - Partition # (zero based)           
 *                     bits 3-0 - Socket # (zero based)               
 *             'irData'         - bdkParams record
 *                startingBlock - unit number of the sub-partition to start erasing from
 *                length        - number of blocks to erase
 *                oldSign       - signature of the sub-partition
 *
 * Return:     flOK              - success
 *             flBadLength       - buffer length > Erasable Block Size
 *             flWriteFault      - fail in buffer writing
 *             flNoSpaceInVolume - end of media was prematurely reached
 *-------------------------------------------------------------------*/
#define bdkErase(ioreq) bdCall(FL_BINARY_ERASE,ioreq)



/*-------------------------------------------------------------------
 * bdkCreate - create new BDK partition .
 *
 *  Init create operations on the DiskOnChip starting at 'startUnit', with
 *  a # of 'units' and 'signature'.
 *
 *  Note : Blocks in the DiskOnChip are marked with a 4-character signature
 *         followed by a 4-digit hexadecimal number.
 *
 * Parameters: ioreq
 *             'irHandle'       - Drive number (0, 1, ...)

⌨️ 快捷键说明

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