📄 smt_fat.h
字号:
/********************************************************************************/
/* */
/* Copyright (C) SEIKO EPSON CORP. 2000 */
/* */
/* File name : smt_fat.h */
/* This is smart media FAT file system library header file */
/* */
/* Revision history */
/* 2000.04.25 H.Ogura start */
/* 2001.10.04 A.Saito Add parameters to the function smtInitDev */
/* 2001.12.14 A.Saito Add member bFatType to structure SMT_DEV_INFO */
/* Add define "SMT_FATTYPE_1x" */
/* 2003.02.14 A.Saito Add defind "SMT_BLKTRY_MAX */
/* 2003.03.13 A.Saito Add define "SMT_BLKMV_*" */
/* Modify prototype defines */
/* 2003.06.05 A.Saito Modify Comment */
/* Add prototype declaration of smtBlockCopy() */
/* */
/********************************************************************************/
/********************************************************************************/
/* The tab size of this file is 4 . */
/********************************************************************************/
#ifndef __SMART_MEDIA_FAT_LIBRARY__
#define __SMART_MEDIA_FAT_LIBRARY__
/********************************************************/
/* CONSTANT DEFINE */
/********************************************************/
/*------------------------------------------------------*/
/* MAKER CODE */
/*------------------------------------------------------*/
#define SMT_MC_TOSHIBA 0x98 // TOSHIBA Code
#define SMT_MC_SAMSUNG 0xE5 // SAMSUNG Code
/*------------------------------------------------------*/
/* BLOCK ALLOCATION TABLE SIZE */
/*------------------------------------------------------*/
#define SMT_BLK_ALLOC 1024 // Block Allocation Table Size
#define SMT_BLK_ENTRY 128 // Entry Table Size
#define SMT_BLK_CHECK 128 // Allocation Check Table Size
/*------------------------------------------------------*/
/* DATA OFFSET */
/*------------------------------------------------------*/
#define SMT_CIS_A1 0 // CIS Area-1
#define SMT_CIS_A2 256 // CIS Area-2
#define SMT_DRV_I1 128 // Identify Drive Information Area-1
#define SMT_DRV_I2 384 // Identify Drive Information Area-2
#define SMT_FNC_SEL 0 // Function Select Information Area
#define SMT_DAT_FLG 4 // Invalid Data Flag Area
#define SMT_ECC_A1 13 // ECC Area-1
#define SMT_ECC_A2 8 // ECC Area-2
#define SMT_DAT_A1 6 // Data Address Area-1
#define SMT_DAT_A2 11 // Data Address Area-2
/*------------------------------------------------------*/
/* MAXIMUM */
/*------------------------------------------------------*/
#define SMT_TYP_MAX 3 // Flash Memory / MASK ROM/ NAND /
#define SMT_MDL_MAX 8 // 4 / 8 / 16 / 24/32 / 64 / 128 MB
#define SMT_DAT_MAX 512 // Data Size
#define SMT_PRL_MAX 16 // Prolix Size
#define SMT_ZON_MAX 1024 // Zone Size
#define SMT_LZN_MAX 1000 // Logic Zone Size
#define SMT_BLKTRY_MAX 3 // Page read retry limit
/*------------------------------------------------------*/
/* LOGICAL FORMAT */
/*------------------------------------------------------*/
/*** MASTER BOOT SECTOR ***/
#define SMT_PRTPOS 0x1BE // Partition Offset
#define SMT_SIGPOS 0x1FE // Signature Offset
#define SMT_SIGNAT 0xAA55 // Signature Code
/*** PARTITION BOOT SECTOR ***/
#define SMT_MAKVER 0x003 // Maker & Version Offset
#define SMT_BYTSCT 0x00B // Bytes/Sector Offset
#define SMT_SCTALC 0x00D // Sectors/Alloc Offset
#define SMT_RSVSCT 0x00E // Reserved Sector Offset
#define SMT_FATCNT 0x010 // FAT Count Offset
#define SMT_ROTENT 0x011 // Root Entry Offset
#define SMT_SCTP16 0x013 // Sectors/Partition(16) Offset
#define SMT_DSTBYT 0x015 // Destinction Byte Offset
#define SMT_FATSCT 0x016 // FAT Sector Count Offset
#define SMT_SCTTRK 0x018 // Sectors/Track Offset
#define SMT_HEDCNT 0x01A // Head Count Offset
#define SMT_HIDSCT 0x01C // Hide Sector Count Offset
#define SMT_SCTP32 0x020 // Sectors/Partition(32) Offset
#define SMT_PHYDRV 0x024 // Physical Derive Number
#define SMT_RSVPOS 0x025 // Reserved
#define SMT_EBRSIG 0x026 // Extension Boot Record Signature
#define SMT_VOLUME 0x027 // Volume ID
#define SMT_VOLLBL 0x02B // Volume Label
#define SMT_FILSYS 0x036 // File System Offset
#define SMT_RSVIPL 0x03E // Reserved (IPL Area)
#define SMT_FAT_12 "FAT12 " // FAT-12
#define SMT_FAT_16 "FAT16 " // FAT-16
/*------------------------------------------------------*/
/* COMMON (FAT MODULE) */
/*------------------------------------------------------*/
#define SMT_DRVNUM 0 // Drive Number
#define SMT_SCTINI -1 // Sector Initial
#define SMT_WRTCIS 0 // Write CIS Data
#define SMT_WRTDAT 1 // Write Data
#define SMT_AREA_1 0 // AREA-1
#define SMT_AREA_2 1 // AREA-2
/*------------------------------------------------------*/
/* FAT TYPE FLAG */
/*------------------------------------------------------*/
#define SMT_FATTYPE_12 0x00 // FAT-12
#define SMT_FATTYPE_16 0x01 // FAT-16
/*------------------------------------------------------*/
/* BLOCK MOVE PATTERN FLAG */
/*------------------------------------------------------*/
#define SMT_BLKMV_FIRST 0x01 // Copy first half
#define SMT_BLKMV_LATTER 0x02 // Copy latter half
#define SMT_BLKMV_BOTH 0x03 // Copy first and latter half
#define SMT_BLKMV_RECOVER 0x10 // Copy with target sector
/********************************************************/
/* STRUCTURE */
/********************************************************/
/*------------------------------------------------------*/
/* SECTOR INFORMATION STRUCTURE */
/*------------------------------------------------------*/
struct SMT_SCT_INFO{
unsigned long ulMstBoot; // Master Boot Sector Number
unsigned long ulNotUse[2]; // Not Use Sector Number
unsigned long ulPrtBoot; // Partition Boot Sector Number
unsigned long ulFatArea[2]; // FAT Area Sector Number
unsigned long ulFatCopy[2]; // FAT Copy Area Sector Number
unsigned long ulRootDir[2]; // Root Directory Area Sector Number
unsigned long ulDatArea[2]; // Data Area Sector Number
};
/*------------------------------------------------------*/
/* SMART MEDIA SIZE INFORMATION STRUCTURE */
/*------------------------------------------------------*/
struct SMT_SIZ_INFO{
unsigned short uwNumCyl; // Number of Cylinders
unsigned short uwHdTrk; // Heads/Track
unsigned short uwSctHd; // Sectors/Head
unsigned long ulNumSct; // Number of Sectors
unsigned short uwDatSize; // Data Size
unsigned short uwPrlSize; // Prolix Size
unsigned short uwPageSize; // Page Size
unsigned short uwBlkSize; // Block Size
unsigned long ulNumBlk; // Number of Blocks
unsigned long ulNumPage; // Number of Pages
unsigned short uwErsUnit; // Erase Unit Size
unsigned short uwBadBlk; // Number of Bad Blocks
};
/*------------------------------------------------------*/
/* PARTITION INFORMATION */
/*------------------------------------------------------*/
struct SMT_PRT_STR{
unsigned char bBoot; // Boot Distinction
unsigned char bSHdNum; // Start Head Number
unsigned char bSSctNum; // Start Sector Number
unsigned char bSCylNum; // Start Cylinder Number
unsigned char bSystem; // System Distinction
unsigned char bEHdNum; // End Head Number
unsigned char bESctNum; // End Sector Number
unsigned char bESylNum; // End Cylinder Number
unsigned long ulSLogSct; // Start Logical Sector Number
unsigned long ulPrtSize; // Partition Size
};
/*------------------------------------------------------*/
/* MASTER BOOT SECTOR INFORMATION */
/*------------------------------------------------------*/
struct SMT_MST_INFO{
unsigned char bBoot[446]; // Boot Order (NOT USE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -