在IAR环境中:
#define uint8 unsigned char
#define uint16 unsigned int
#define uint32 unsigned long int
unsigned char BUFFER[512]; //存放数据
typedef struct //这里一共是512个字节
{
uint8 BS_jmpBoot[3];
uint8 BS_OEMName[8];
uint16 BPB_BytesPerSec;
uint8 BPB_SecPerClus;
uint16 BPB_RsvdSecCnt;
uint8 BPB_NumFATs;
uint16 BPB_RootEntCnt;
uint16 BPB_TotSec16;
uint8 BPB_Media;
uint16 BPB_FATSz16;
uint16 BPB_SecPerTrk;
uint16 BPB_NumHeads;
uint32 BPB_HiddSec;
uint32 BPB_TotSec32;
uint8 BS_DrvNum;
uint8 BS_Reservedl;
uint8 BS_BootSig;
uint32 BS_VolID;
uint8 BS_VolLab[11];
uint8 BS_FilSysType[8];
uint8 ExecutableCode[448];
uint8 ExecutableMarker[2];
} FAT_BPB;
FAT_BPB* BPB;
当我读出了512字节存放到BUFFER中后 BPB = (FAT_BPB*)BUFFER; 查看BPB中的数据发现
uint8 BS_jmpBoot[3];
uint8 BS_OEMName[8]; 这11个数据正常,
BUFFER[11]=0x00;
BUFFER[12]=0x02;
BUFFER[13]=0x40;
转换过去 BPB_BytesPerSec=0x4002 我感觉应该是0x0200才对啊,编译器怎么会把BUFFER[11]给漏掉了呢?请教了 谢谢 |