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

📄 buffer.h

📁 MP3 Player Source Code
💻 H
字号:
/** \file buffer.h * Global buffer for file I/O. * Supported data types: Raw buffer, FAT entries. */#ifndef BUFFER_H#define BUFFER_Htypedef unsigned char byte;	/**< 8 bits, unsigned */typedef unsigned int word;	/**< 16 bits (make sure!), unsigned */typedef unsigned long u_32;	/**< 32 bits (make sure!), unsigned *//** FAT/VFAT directory record union */union DirRecordUnion {  /** Standard directory entry */  struct Entry {    byte Name[11];    byte Attr;    byte NTRes;    byte CrtTimeTenth;    word CrtTime;    word CrtDate;    word LstAccDate;    word FstClusHi;    word WrtTime;    word WrtDate;    word FstClusLo;    u_32 FileSize;  } entry;  /** Extended directory entry */  struct LongEntry {    byte Ord;    word Name1[5]; /**< characters 1-5 */    byte Attr;    byte Type; /**< entry type, zero=long name component */    byte Chksum;    word Name2[6]; /**< characters 6-11 */    word FstClusLO; /**< zero for long entry */    word Name3[2]; /**< characters 12-13 */  } longentry;}; /** FAT/VFAT directory record type */typedef union DirRecordUnion dirrecordtype;/** Disk Block type including RAW data and FAT deciphering structures. *//* FAT structure definition from Microsoft's FAT32 File System * Specification, version 1.03. Always use 512 byte disk block. */typedef union DiskBlock {    /** Boot Sector / Bios Parameter Block structure*/  struct Fat {		    byte BS_jmpBoot[3];		/**< x86 Boot Jump Code */    byte BS_OEMName[8];		/**< Formatter's name, usually "MSWIN4.1" */        word BPB_BytsPerSec;	/**< Bytes per sector (512) */    byte BPB_SecPerClus;	/**< Sectors per Cluster (1,2,4,8,..,128) */    word BPB_RsvdSecCnt;	/**< Reserved sectors (1 (32 for FAT32)) */    byte BPB_NumFATs;		/**< Number of FATs (2) */    word BPB_RootEntCnt;	/**< FAT12/16 n of root dir entries */    word BPB_TotSec16;		/**< Old sector count (0 for FAT32) */    byte BPB_Media;		/**< Media Type (eg 0xF8) */    word BPB_FATSz16;		/**< Size of one FAT16 in sectors */    word BPB_SecPerTrk;		/**< Old CHS Sectors Per Track */    word BPB_NumHeads;		/**< Old CSH Number of Heads */    u_32 BPB_HiddSec;		/**< n of sectors before this volume */    u_32 BPB_TotSec32;		/**< New sector count (0 for FAT12/16) */       /** FAT type specific extensions */    union Extensions{	      /** FAT12/16 specific extensions to Bios Parameter Block*/      struct Fat16Specific {		byte BS_DrvNum;		/**< DOS INT13 Drive Number (0x80=HD)*/	byte BS_Reserved1;	/**< For WINNT; Format to 0 */	byte BS_BootSig;	/**< 0x29 if next 3 fields are present */	byte BS_VolID[4];	/**< Volume ID (usually format datetime) */	byte BS_VolLab[11];	/**< Volume Label */	byte BS_FilSysType[8];	/**< Decorative name of fs, eg "FAT16   "*/      } _16;      /** FAT32 specific extensions to Bios Parameter Block*/      struct Fat32Specific {	        u_32 BPB_FATSz32;	/**< Size of one FAT32 in sectors */	word BPB_ExtFlags;	/**< Flags; active FAT number etc */	word BPB_FSVer;		/**< File System Version (0x0000) */	u_32 BPB_RootClus;	/**< Start cluster of Root Dir. (2) */	word BPB_FSInfo;	/**< Start sector of FSINFO in Resvd area */	word BPB_BkBootSec;	/**< Sector in Resvd area for BkBoot (6) */	byte BPB_Reserved[12];	/**< Reserved, Always 0. */	byte BS_DrvNum;      	/**< DOS INT13 Drive Number (0x80=HD) */	byte BS_Reserved1;      /**< For WINNT, Format to 0 */	byte BS_BootSig;	/**< 0x29 if next 3 fields are present */	byte BS_VolID[4];	/**< Volume ID (usually format datetime) */	byte BS_VolLab[11];	/**< Volume Label */	byte BS_FilSysType[8];  /**< Decorative name of fs, eg "FAT32   "*/      } _32;    } ext;  } fat;  /** Raw Data (interpret sector as array of 8-bit chars)*/  struct Raw {    byte buf[512];		/**< Raw Data */  } raw;  /** Interpret sector as directory records */  dirrecordtype dir[16];    /** Interpret sector as array of 16-bit integers */  word Fat16Table[256];  /** Interpret sector as array of 32-bit integers */  u_32 Fat32Table[128];} DiskBlockType;/** 32-bit data type that is also "byte addressable". * \warning Byte order is for LITTLE-ENDIAN ARCHITECTURES, change * byte order for big-endian compilers/architectures! */union Address {  unsigned long l;  struct B {    unsigned char b0;    unsigned char b1;    unsigned char b2;    unsigned char b3;  } b;};/** Address type */typedef union Address addressType;/** Dirty but powerful global variable that is used for * 1) remembering which sector is in the RAM disk buffer diskSect and * 2) possibly other weird and dirty purposes, be very careful with this! */extern addressType sectorAddress;/** File I/O buffer */extern xdata DiskBlockType diskSect;/** Global Data Buffer pointer  * Used mainly for filling the buffer and reading MP3 data to send to * the codec, be very careful with what you do with this global pointer!*/extern xdata unsigned char *dataBufPtr;#endif

⌨️ 快捷键说明

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