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

📄 kw_fat32.h

📁 linux下数据下载器的设计与实现
💻 H
字号:
/*H**************************************************************************
* NAME:         KW_fat32.h         
*----------------------------------------------------------------------------

*----------------------------------------------------------------------------
* RELEASE:      snd1c-refd-nf-4_0_3      
* REVISION:     1.2     
*----------------------------------------------------------------------------
* PURPOSE:
* FAT32 file-system basic functions definition
*****************************************************************************/

#ifndef _FAT_H_
#define _FAT_H_

/*_____ I N C L U D E S ____________________________________________________*/


/*_____ M A C R O S ________________________________________________________*/

/*----- FAT Configuration -----*/
#define FAT_PARTITIONNED  TRUE              /* TRUE: format with 1 partition, 
                                               FALSE: without partition */


#define READ              ((bit)0)
#define WRITE             ((bit)1)

#define FREE_CLUSTER      ((WORD)0x0000)  /* free cluster value in FAT */
#define LAST_CLUSTER12    ((WORD)0x0FFF)  /* last file cluster in FAT 12 */
#define BAD_CLUSTER12     ((WORD)0x0FF7)  /* bad cluster value in FAT 12 */
#define LAST_CLUSTER16    ((WORD)0xFFFF)  /* last file cluster in FAT 16 */
#define BAD_CLUSTER16     ((WORD)0xFFF7)  /* bad cluster value in FAT 16  */

#define MBR_ADDRESS       ((DWORD)0)       /* Master Boot Record address */
#define ATTR_FILE         ((BYTE)0x00)      /* Normal File Attribute */
#define ATTR_READ_ONLY    ((BYTE)0x01)      /* Read Only File Attribute */
#define ATTR_HIDDEN       ((BYTE)0x02)      /* Hidden File Attribute */
#define ATTR_SYSTEM       ((BYTE)0x04)      /* System File Attribute */
#define ATTR_DIRECTORY    ((BYTE)0x10)      /* Directory Attribute */
#define ATTR_ARCHIVE      ((BYTE)0x20)      /* Archive Attribute */
#define ATTR_LFN_ENTRY    ((BYTE)0x0F)      /* LFN entry attribute */
#define ATTR_ROOT_DIR     ((BYTE)0x90)      /* internal use only */

#define PARTITION_ACTIVE  ((BYTE)0x80)      /* the active partition state */

#define FILE_NOT_EXIST    ((char)0x00)      /* current file does not exist */
#define FILE_DELETED      ((char)0xE5)      /* current file is deleted */

#define LFN_SEQ_MASK      ((BYTE)0x3F)      /* LFN sequence number mask */

#define ODD_EVEN_MASK     ((BYTE)0x01)      /* the odd / even test mask */

#define FAT12             ((BYTE)0x01)      /* FAT12 type */
#define FAT16_INF32M      ((BYTE)0x04)      /* FAT16 type < 32 Mbytes */
#define FAT16_SUP32M      ((BYTE)0x06)      /* FAT16 type > 32 Mbytes */
#define FAT32             ((BYTE)0x0B)      /* FAT32 type not supported */
#define MAX_CLUSTERS12    ((WORD)4084)    /* FAT12 if < FAT16 else */
#define MAX_CLUSTERS16    ((WORD)65524)   /* FAT16 if < FAT32 else */
#define LAST_CLUSTER_32   ((DWORD)0x0FFFFFFF)


/* Format Info */
#define SECTOR_SIZE       ((WORD)512)     /* supported sector size */
#define DIR_SIZE          ((BYTE)32)        /* directory entry size */
#define NB_ROOT_ENTRY_32  ((WORD)0)
#define NB_ROOT_ENTRY     ((WORD)512)
#define NB_RESERVED       ((BYTE)32)        /* number of reserved sectors */
#define NB_FATS           ((BYTE)2)
#define HARD_DISK         ((BYTE)0xF8)      /* hard disk device */
#define FAT_DRIVE_NUMBER  ((BYTE)0x81)
#define FAT_EXT_SIGN      ((BYTE)0x29)
#define BR_SIGNATURE      ((WORD)0xAA55)  /* boot record signature */
#define MBR_ADDRESS       ((DWORD)0)       /* master boot record address */

typedef struct
{
	BYTE FileName[8];
	BYTE ExtName[3];
	BYTE attribute;
	BYTE reserved[10];
	BYTE time[2];
	BYTE date[2];
	BYTE StartClus[2];
	BYTE FileLength[4];
}	Dir_tag;

#endif  /* _FAT_H_ */

⌨️ 快捷键说明

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