ButterflyMP3

avrfat16.h

Go to the documentation of this file.
00001 
00036 #include "types.h"
00037 #include "uart.h"
00038 
00039 #define PARTITION_START         446     ///< Start address of partition 1 in MBR
00040 
00041 //-----------------------------------------------------------------------------
00042 // FAT32 File Attributes and Types
00043 //-----------------------------------------------------------------------------
00044 #define FILE_ATTR_READ_ONLY     0x01
00045 #define FILE_ATTR_HIDDEN                0x02
00046 #define FILE_ATTR_SYSTEM                0x04
00047 #define FILE_ATTR_SYSHID                0x06
00048 #define FILE_ATTR_VOLUME_ID     0x08
00049 #define FILE_ATTR_DIRECTORY             0x10
00050 #define FILE_ATTR_ARCHIVE               0x20
00051 #define FILE_ATTR_LFN_TEXT              0x0F
00052 #define FILE_ATTR_LFN_MASK              0x3F
00053 #define FILE_HEADER_BLANK               0x00
00054 #define FILE_HEADER_DELETED             0xE5
00055 #define FILE_TYPE_DIR                   0x10
00056 #define FILE_TYPE_FILE                  0x20
00057 #define FILE_TYPE_MP3                   0x55
00058 #define FAT16_LDIR_Ord                  0
00059 #define FAT16_LDIR_Name1                1
00060 #define FAT16_LDIR_Attr                 11
00061 #define FAT16_LDIR_Type                 12
00062 #define FAT16_LDIR_Chksum               13
00063 #define FAT16_LDIR_Name2                14
00064 #define FAT16_LDIR_FstClusLO    26
00065 #define FAT16_LDIR_Name3                28
00066 
00067 // For ID3 tags
00068 #define LFN_TYPE_INDEX        208
00069 #define LFN_TYPE_FILENAME     0x00        ///< No bits set
00070 #define LFN_TYPE_ID3_TITLE    0x01        ///< Bit 0
00071 #define LFN_TYPE_ID3_ARTIST   0x02        ///< Bit 1
00072 #define LFN_BUFFER_LENGTH     208
00073 #define LFN_TITLE_INDEX       0
00074 #define LFN_TITLE_LENGTH      100      ///< Title length including '\0'
00075 #define LFN_ARTIST_INDEX      100
00076 #define LFN_ARTIST_LENGTH     100      ///< Artist length including '\0'
00077 #define LFN_FREE_INDEX        200
00078 #define LFN_FREE_LEN          8        
00079 
00080 
00081 uint32  FAT16_fat_begin_lba;
00082 uint32  FAT16_cluster_begin_lba;
00083 uint8   FAT16_sectors_per_cluster;
00084 uint32  FAT16_dir_first_sector;
00085 uint32  FAT16_root_dir_first_sector;
00086 uint32  FAT16_parent_dir_first_sector;
00087 
00088 uint8   FAT16_filetype;
00089 uint8   FAT16_longfilename[LFN_BUFFER_LENGTH+1]; 
00090 uint8   FAT16_LFNTitleLen;
00091 uint8   FAT16_LFNArtistLen;
00092 uint16  FAT16_entryMAX;         
00093 uint16  FAT16_entryMIN;         
00094 
00095 uint8 *FAT_buffer; 
00096 uint8 *FAT_scratch; 
00097 uint8 (*FAT_read)(uint32 lba); 
00098 uint8 (*FAT_write)(uint32 lba);
00099 
00100 uint8 FAT_initFat16(void); 
00101 uint8 FAT_readCluster(uint32 cluster, uint8 sector_offset); 
00102 //uint8 FAT_get_label(uint8 label[]); 
00103 uint32 FAT_NextCluster(uint32 cluster); //
00104 //uint8 FAT_NextnCluster(uint16 cluster, uint16 fatBuf[], uint8 buffer_size);
00105 //uint8 FAT_getLongFilename(uint32 filenumber);
00106 uint32 FAT_getNextSong(uint32 filenumber,uint32 dir_lba);
00107 uint32 FAT_getPrevSong(uint32 filenumber,uint32 dir_lba);
00108 
00123 uint32 FAT_getNumberedSong(char songNumber,uint32 dir_lba);
00124 
00125 
00138 uint8 FAT_ChkSum(uint8 *pFcbName); 
00139 
00149 //uint8 FAT_readRoot(uint32 filenumber);
00150 
00161 uint8   FAT_readFile(uint32 filenumber, uint32 dir_first_sector);
00162 
00171 uint8 FAT_scanDir(uint32 directory_cluster);
00172 
00181 uint8 FAT_scanDir_lba(uint32 lba_addr);
00182 
00191 uint32 FAT_cluster2lba(uint32 cluster);
00192 
00201 uint32 FAT_lba2cluster(uint32 lba_addr);
00202 
00212 uint32 FAT_getParentDir(uint32 lba_addr);
00213 
00220 void FAT_Scratch2Cluster(void);
 All Files Functions Variables Typedefs Enumerations Enumerator Defines