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

📄 common_bak.h.h

📁 51环境下的FAT及FAT32文件系统源码
💻 H
字号:
#include "reg51.h"

//#define DEBUG_LIGHT
//#define COMPILE_LIGHT
//#define FAT32OR16_LIGHT
//#define FAT32_ACCESS

#define NULL		0
#define TRUE   		1
#define FALSE  		0

#define SECT_LEN	512
					   
// Disable all interrupts
#define DISABLE_INTERRUPTS		EA = 0
// Enable all interrupts
#define ENABLE_INTERRUPTS		EA = 1
#define BUFFER_LENGTH	512

typedef unsigned char       UINT8;
typedef unsigned short      UINT16;
typedef unsigned long       UINT32;

typedef union {
    struct 
    {
        UINT8    Type;
        UINT8    Index;
    } Descriptor;

    struct 
    {
        UINT8 tx0;  // MSB for 8051 Keil C
        UINT8 tx1;   
        UINT8 endp;   
        UINT8 c0;   // LSB for 8051 Keil C
    } chars;
 
    struct 
    {
        UINT8 c3;  // MSB for 8051 Keil C
        UINT8 c2;   
        UINT8 c1;   
        UINT8 c0;   // LSB for 8051 Keil C
    } chars0;

    struct
    {
        UINT16 i1;    // MSW for 8051 keil C
        UINT16 i0;    // LSW for 8051 Keil C
    } ints;

    UINT32 u0;

} FLEXI_INT32;

typedef union  {
    struct 
    {
        UINT8 c1;   // MSB for 8051 Keil C
        UINT8 c0;   // LSB for 8051 Keil C
    } chars;

    UINT16 i0;
} FLEXI_INT16, *pFLEXI_INT16;

typedef struct _XXG_FLAGS
{
	unsigned char bTimer        :1;
	unsigned char bIN_ISR		:1;
	unsigned char bCOM_ERR		:1;
	unsigned char bTimeout		:1;
	unsigned char bData1		:1;
	unsigned char bUartInDone	:1;
	unsigned char bMassDevice	:1;
	unsigned char bToggle       :1;

	unsigned char SLAVE_IS_ATTACHED	:1;
	unsigned char SLAVE_REMOVED	:1;
	unsigned char SLAVE_FOUND	:1;	// Slave USB device found
	unsigned char SLAVE_ENUMERATED	:1;	// slave USB device enumeration done
	unsigned char SLAVE_ONLINE	:1;
	unsigned char SLAVE_STALLED     :1;
	unsigned char TIMEOUT_ERR	:1; 	// timeout error during data endpoint transfer
	unsigned char DATA_STOP		:1;	// device unplugged during data transfer
} XXGFLAGS;

typedef struct
{
	unsigned int sector;
	unsigned char offset;
} DIR_IDX, *pDIR_IDX;

#ifndef COMPILE_LIGHT
#ifdef DEBUG_LIGHT
void light (  char partten1, char  partten2, UINT16 trans, UINT16  time);
#endif

#ifndef DEBUG_LIGHT
#ifdef FAT32OR16_LIGHT
void light (  char partten1, char  partten2, UINT16 trans, UINT16  time);
#endif
#endif

#endif //COMPILE_LIGHT

#ifdef COMPILE_LIGHT
void light (  char partten1, char  partten2, UINT16 trans, UINT16  time);
#endif

void DelayMs(unsigned int nFactor);

⌨️ 快捷键说明

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