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

📄 global.h~

📁 avr MP3 的源程序,包含文件系统,适合初学者
💻 H~
字号:
#ifndef _GLOBAL_H_
#define _GLOBAL_H_

#include "type.h"
#include "global_def.h"

byte    intFlag=0;

dword   filePos=0;
word    mp3Pos=0;

word    readPos=0;  //sector bytes offset
byte    sectorPos=0;//sector offset in cluster

dword   totalSectors; //total sectors in drive

byte    playStatus=0; //playing status

word    totalFiles=0; //total played files

struct _sectorBuffer
{
byte data[512];
} sectorBuffer;     //mmc/sd sector buffer

flash byte lcdLineStart[4]={0x80,0x90,0x88,0x98};

flash byte invalidFileChars[47] = 
{ 
    0x00, 0x01, 0x02, 0x03, 0x04, 0x06,
    0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
    0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
    0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
    0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
    0x1F, 0x22, 0x2A, 0x2B, 0x2C, 0x2E, 
    0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
    0x3F, 0x5B, 0x5C, 0x5D, 0x7C 
};


//--------------------------------------------------------------------------
//				FAT Part
//--------------------------------------------------------------------------
dword		FirstDataSector;	//First data sector of the partition
word 		Bytes_Per_Sector;	//Bytes per sector in drive, usually 512 bytes
byte		Sectors_Per_Cluster;//Sectors per cluster
word        Bytes_Per_Cluster;  //bytes of a cluster
dword  		FirstFATSector;		//First sector of the FAT table
dword		FirstRootCluster;   //First cluster of Root Directory
dword   	FirstRootSector;    //First root sector(fat16 or fat12)
word		rootDirSectors;     //Root directory sectors
//dword		DriveSize;          //Drive size (free space in drive, used for identification)
//dword		FirstDirSector;     //First directory sector

		
byte        fileName[FILE_NAME_LENGTH]; //file name, NULL terminated
byte   		fileExtension[4];	//file extension, 4 byte to make it dword
dword		FileSize=0;         //File size of the file just read from dir table
word		currentFileNum; 	//File number from the directory table
dword		currentCluster;		//Current cluster in file chain.
dword		firstCluster;		//First cluster of the file just read from dir table.
byte		subDirLevel=0;		//# of dir level we went down from root directory
byte		dirString[DIR_STRING_LENGTH];//Dir tree string, used for displaying path on LCD
                                        //position 0 (dirString[0]) stores size of the string.
byte		FATtype;            //file system type:FAT32=32,FAT16=16.FAT12=12.
//dword		maxcluster;			//last usable cluster+1
//byte		dirStack[7];		//used RAM for doing stack
dword       tableStartCluster;  //unicode.bin file start cluster
dword       tableFileSize;      //the size of unicode.bin	    
            
typedef struct 
{  //Holds the read offset of each dir entry position in root directiry
    dword   dirLBA;        //sector address of a directory
    word	readPos;       //Offset in sector
    word	fileNum;       //File number
    word    entryCount;    //Root directory Entry count
} ROOT_OFFSET_TYPE;
        
typedef struct
{
    dword   startCluster;
    dword   fileSize;
    byte    fileExtName[3];
    word    fileNumber;
} FILE_INFO_TYPE;

FILE_INFO_TYPE      currentFileInfo;
        
ROOT_OFFSET_TYPE    dirReadOffset;     //file root read offset


#endif

⌨️ 快捷键说明

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