📄 filesystem.h
字号:
#define ID_MPEG1 0x03
#define NO_LAYER 0x00
#define LAYERIII 0x01
#define LAYERII 0x02
#define LAYERI 0x03
#define DIR_ATTTR 0x10
#define LFN_DIR 0x0F
#define FALSE_ATTR 0xFF
////////////////////////////////////////////////////////////////////////////
// //
// Structures //
// //
////////////////////////////////////////////////////////////////////////////
typedef struct {
// File Infomation
UNIONULONG Size;
uword Cluster;
char Attr;
char Name[MAX_FILE_LEN];
char Ext[3]; // FILE_EXTENSION
uword Time;
uword Date;
uword Start_Sector;
//#ifdef OLD_MICOM
ubyte Type; // MP3 or MP2 or WMA
//#endif
// Header Infomation
ubyte MPEG_Version;
ubyte Layer;
uword Bit_Rate;
uword Sampling_Freq;
unsigned long Frame_Header;
// ID Tag3 Information
ubyte IDTAG_Flag;
char Title[30];
char Artist[30];
char Album[30];
char Year[4];
char Comment[30];
char Genre;
} TypeFileInfo;
typedef struct {
uword CpV; // Cylinder per Volume
uword HpC; // Head per Cylinder
uword SpH; // Sector per Head
uword allSl; // All Sector
uword allSh;
uword szS; // Sector Size
uword PBpV; // Physical Block per Volume
uword LBpV; // Logical Block per Volume
uword SpB; // Sector per Block
uword PpB; // Page per Block
uword szP; // Size per Page
} sDEV_INFO;
typedef struct __tagDriveInfoBox {
// System Info
uword TotalFileNum; // Total File Number
int TotalAudioFileNum; // Total Available Audio File Number
uword TotalBlockNum; // Total Logical Block Num
uword UseBlockNum; // Total Logical Used Block Num
uword TotalPBlockNum; // Total Physical Block Num
uword TotalBADBlockNum; // Total Bad Block Num
// uword InitBADBlockNum; // Total Bad Block num Below 400
BOOLEAN FAT_flag; // Whether read FAT correctly
BOOLEAN IO_flag; // Whether read device ID correctly
uword Media_type; // Whether SMC or MMC
uword Boot_Offset; // Boot Offset for MMC
uword udFAT1StartSector; // Start Sector for FAT1
uword udFAT1Sectors; // Sector number of FAT1
uword udRootStartSector; // Sector number of Root Entry
uword Init_Block[Init_LBlocks]; // Initial LP Table Blocks
ubyte Device; // Device type => 32MB~256MB
//PBR Info
uword BpSector; // Bytes per Sector
ubyte SpCluster; // Sector per Sector
ubyte CpBlock; // Cluster per Block
uword Root_Entry; // Total Root Entry
ubyte Root_End; // End sector of Root Entry
ubyte FAT_Type; // FAT Type
//#ifdef DIR_INCLUDE
uword Curr_Dir;
//#endif
} TypeDriveInfoBox;
// LCD Display Function
typedef void (*TCC73_LCD_Display_Handler)(ubyte);
////////////////////////////////////////////////////////////////////////////
// //
// Functions //
// //
////////////////////////////////////////////////////////////////////////////
// SMC_IO_Asm.s
///////////////////////////////////////////////////
extern ubyte smpFlashWritePage (uword drive,uword addr,ubyte* p_buf,uword write_size);
extern ubyte smpFlashReadPage (uword drive,uword addr,ubyte* p_buf,uword read_size);
//extern ubyte smpFlashReadID_Number(uword drive,uword addr,ubyte* p_buf,uword read_size);
#ifdef SECURITY_INCLUDE
extern ubyte smpFlashWritePage1 (uword drive,uword addr,ubyte* p_buf,uword write_size);
extern ubyte smpFlashReadPage1 (uword drive,uword addr,ubyte* p_buf,uword read_size);
#endif
extern ubyte smpFlashReadSpare (uword drive,uword addr,ubyte* p_buf,uword read_size);
extern ubyte smpFlashEraseBlock(uword drive,uword addr);
extern ubyte smpFlashReadID (uword drive,ubyte* p_buf,uword read_size);
extern void copymem(ubyte *,ubyte*, int);
extern ubyte cmpmem(ubyte *,ubyte*, int);
extern void CopyMem2String(ubyte *,ubyte *);
extern void setmem( ubyte *dest, ubyte c, uword count );
extern void setmemword( ubyte *dest, uword c, uword count );
extern uword cmpbyte(ubyte *dest,ubyte c, uword count);
// SMC_File_System.c
///////////////////////////////////////////////////
extern ubyte DosReadFile (ubyte *buf, uword len);
extern ubyte DosRemoveFile (uword drive);
extern uword TCC730_FS_RenameFile(uword drive,uword index,ubyte *filename,uword size);
extern ubyte TCC730_DosReplaceFile(uword drive,uword index,uword order);
//extern void fmInit(void);
extern ubyte Get_File_Info(uword drive, uword index,TypeFileInfo *fileinfo);
extern ubyte Get_File_Num(uword drive, uword *nfile);
extern ubyte TCC730_DosCreateFile(uword drive);
extern ubyte TCC730_Read_DiskInfo(uword drive);
extern void TCC730_SetFileSystemMode(ubyte Security_EnableMode);
extern void TCC730_SetChipEnable(ubyte ChipEn_mode);
extern void TCC730_InitialDriveInfo(uword drive);
extern void TCC730_ClearLPTBlockAddress(void);
extern void TCC730_StrUpperCase(char *str,uword size);
extern ubyte FORMAT_SMC_CARD(uword drive,ubyte mode,TCC73_LCD_Display_Handler);
extern ubyte Set_Drive(uword drive);
extern ubyte Update_UsedBlockNum( uword drive );
extern ubyte File_Close(void);
extern ubyte File_Open(void);
extern void TCC730_SaveLBlocksChain(void);
extern ubyte CopyFAT2toFAT1(uword drive);
extern ubyte Erase_UnusedBlock(uword);
extern ubyte Remove_file(uword drive, uword f_index);
extern ubyte TCC730_EncodeFileNum (uword drive,uword *nEncodeFile);
extern uword TCC730_FS_GetEmptyEntryNum(uword drive,uword *nempty_entry,ubyte *str);
extern ubyte TCC730_SaveParameter(ubyte page);
extern ubyte TCC730_ReadParameter(ubyte page);
// 2002.04.29
extern ubyte TCC730_ReadIDTag3(uword drive,uword file_index);
extern uword TCC730_FOpen(uword drive,uword File_Num,ubyte *Attr,TypeFileInfo *file_info);
extern uword TCC730_FRead(uword drive,uword length,ubyte size_of);
extern uword TCC730_FSeek(uword drive,long Offset,char mode,ubyte Position);
extern uword TCC730_FClose(void);
extern uword TCC730_FS_RecoverLostFile(uword drive,ubyte mode);
extern void TCC730_FS_ReadWPFlag(uword drive);
extern uword TCC730_FS_Dir_Change(uword drive,uword dir);
extern uword TCC730_FS_Dir_Make(uword drive,ubyte *file_info,uword size);
extern uword TCC730_FS_GetLFNInfo(uword drive, uword index,ubyte *str,uword *size);
extern uword TCC730_FS_GetLFNEntry(uword drive, uword index,ubyte *str,uword *size);
//extern uword TCC730_FS_GetEntry(uword drive, uword index,ubyte *str,uword *size);
extern uword TCC730_FS_Get_Entry_Count(uword drive);
// SMC_IO_System.c
///////////////////////////////////////////////////
extern uword TCC730_FormatVol (uword drive,ubyte *p_label,uword mode);
extern uword TCC730_EraseBlocksForFormat(uword drive,uword Mode);
extern ubyte TCC730_ReadDeviceID (uword drive);
extern ubyte TCC730_WriteCISBlock (uword drive, uword pblock_no);
extern ubyte TCC730_LPTableInit (uword drive );
extern ubyte TCC730_FATInit (uword drive);
extern ubyte TCC730_GetNewOnePBlock(uword drive,uword pblock_no, uword psector_no, uword *new_pblock);
extern ubyte TCC730_GetUsedBlock (uword drive,uword *clu_no);
extern ubyte TCC730_Find_InitLPTBLOCK(uword drive,uword* lblock_chain);
extern uword TCC730_EncodeLBA (uword lblock_no);
extern ubyte TCC730_SetSpare (uword drive, uword lblock, uword *Pblock_Num, uword *addr, ubyte *Buf);
extern void TCC730_MakeSpareArea (uword drive,uword c_a, uword p_a, uword *addr, ubyte *Tbuf);
extern uword TCC730_Read_RootEntry(uword drive,uword index,ubyte *str);
extern uword TCC730_Write_RootEntry(uword drive,uword start_index,uword end_index,ubyte *buff);
extern ubyte TCC730_GetFileBlocks (uword drive,TypeFileInfo *fileinfo);
extern ubyte TCC730_GetFileCluster(uword drive,uword s_cluster);
extern ubyte TCC730_GetFilePBlock (uword drive,TypeFileInfo *fileinfo);
extern ubyte TCC730_GetNewCluster (uword drive,uword c_size);
extern ubyte TCC730_GetNewOneCluster(uword drive,uword *lblock);
extern ubyte TCC730_GetNewPBlock (uword drive);
extern uword TCC730_GetPBlock(uword drive,uword lblock_num,uword *pbloc_num);
extern uword TCC730_SMC_UpdateRootEntry(uword drive,ubyte* f_info,uword size, uword Type,uword file_index,uword order,uword orderfile_size);
extern uword TCC730_SMC_UpdateFAT(uword drive,uword Type);
extern uword TCC730_DecodeLBA(uword converted_lba);
extern void TCC730_SMC_ReadBlockChain(uword Block_Addr,uword sec_num,ubyte *buff);
extern void TCC730_SMC_WriteBlockChain(uword Block_Addr,uword sec_num,ubyte *buff);
extern void TCC730_SMC_IO(uword drive,uword Block_Addr,ubyte sec_num,ubyte *buff,uword Mode);
extern ubyte cmpcode(ubyte *,CODE ubyte*, int);
extern void copycode(ubyte *,CODE ubyte*, uword);
// SMC_MP3Coder_System.c
////////////////////////////////////////////////////
extern ubyte TCC730_FILE_SYSTEM_Init(uword Current_Driver);
extern ubyte TCC730_Decoder_Init(uword drive,uword File_Num,ubyte mode,long buffer_start);
extern ubyte TCC730_Encoder_Init(uword,long enbuffer_start);
extern ubyte Encoder_to_SMC(uword drive,int n,uword Silence_Flag);
extern ubyte TCC730_ADD_File(uword drive);
extern ubyte SMC_to_Decoder(uword drive,long n, ubyte mode ,long buffer_start,long buffer_end,ubyte end_file,volatile unsigned long *writing_ptr,volatile uword *read_count_addr);
extern void TCC730_SMC_Read_One_Page(uword drive, ubyte *buff_ptr);
// for UNICODE
/////////////////////////////////////////////////////
#ifdef UNICODE_INCLUDE
extern uword TCC730_FS_CheckFontFileExist(void);
extern uword TCC730_FS_OpenUnicodeFontBitMapFile(void);
extern uword TCC730_FS_GetUnicodeFontBitMap(long New_Unicode,ubyte *str,uword size);
extern uword TCC730_FS_CloseUnicodeFontBitMapFile(void);
#endif
////////////////////////////////////////////////////////////////////////////
// //
// Global Variables //
// //
////////////////////////////////////////////////////////////////////////////
#pragma memory=data_seg(TCC730_INTERNAL)
FILE_EXT ubyte eSmErr;
FILE_EXT uword DRV_NO;
FILE_EXT ubyte drv_no;
FILE_EXT ubyte noFreeSpace; // 2001.11.07
FILE_EXT ubyte *Ring_Buff ;//0x204d04 - 0x2054d3
FILE_EXT uword LPTB_Index;
FILE_EXT uword offset;
FILE_EXT ubyte sec_no;
FILE_EXT uword addr;
FILE_EXT uword nValidData;
FILE_EXT uword SpBlock; // 2001.11.07 ;
FILE_EXT uword Para_Addr;
FILE_EXT uword FLASH1_MAXBAND;
FILE_EXT uword FLASH2_MAXBAND;
FILE_EXT int pFcluster;
FILE_EXT int block_addr;
FILE_EXT long current_size;
FILE_EXT long Disk_Free_Size;
FILE_EXT ubyte FileDown_Num;
//FILE_EXT uword Drv_FileOpen;
// File Info Structur
FILE_EXT TypeFileInfo FileInfo;
// Drive Info Structur
FILE_EXT TypeDriveInfoBox DrvInfo[MAX_DRIVE];
// Temporary Buffer
FILE_EXT ubyte gTempBuf[P_SECTOR_SIZE];
// SSFDC LPT Table Buffer
FILE_EXT ubyte LBlocks[P_SECTOR_SIZE];
FILE_EXT ubyte PBlocks[P_SECTOR_SIZE];
FILE_EXT uword LBAddress[LPT_BLOCK_SIZE];
FILE_EXT uword PBAddress[LPT_BLOCK_SIZE];
// LCD Display Function
FILE_EXT TCC73_LCD_Display_Handler Display_Percent;
// Internal 2 Flash
FILE_EXT ubyte IntFlash1porth;
FILE_EXT ubyte IntFlash1portg;
FILE_EXT ubyte IntFlash2porth;
FILE_EXT ubyte IntFlash2portg;
FILE_EXT ubyte ExtFlashporth;
FILE_EXT ubyte ExtFlashportg;
#ifdef WP_INCLUDE
// External drive WP_ONOFF
FILE_EXT ubyte EXT_WP_Flag;
#endif
#ifdef SECURITY_INCLUDE
FILE_EXT ubyte SecurEn;
FILE_EXT ubyte Serial[11];
#endif
#ifdef UNICODE_INCLUDE
FILE_EXT uword FontBlock_Addr;
FILE_EXT uword FontBlock_Num;
#endif
#pragma memory=default
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -