?? defs.h.bak
字號:
/*
* 描述:C語言類型和常量定義頭文件(ARM處理器)。
* 作者:余康華
* 日期:2005-11-4 14:39
*
* COPYRIGHT (C) 2005 HUIYUAN ELECTRONIC CORP. LTD.
*/
#ifndef __DEFS_H__
#define __DEFS_H__
#include <stdarg.h>
#include <avt.h>
#include <avtcpu.h>
#undef NULL
#define NULL 0
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned int UINT;
typedef unsigned long ULONG;
typedef char BOOL;
#define min(a,b) ((a) > (b) ? (b) : (a))
#define max(a,b) ((a) < (b) ? (b) : (a))
#define MKWORD(a,b) ((USHORT)(a) | ((USHORT)(b) << 8))
// Cluster number
typedef unsigned int CLNO;
struct tm {
int tm_sec; /* seconds after the minute, 0 to 60
(0 - 60 allows for the occasional leap second) */
int tm_min; /* minutes after the hour, 0 to 59 */
int tm_hour; /* hours since midnight, 0 to 23 */
int tm_mday; /* day of the month, 1 to 31 */
int tm_mon; /* months since January, 0 to 11 */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday, 0 to 6 */
int tm_yday; /* days since January 1, 0 to 365 */
int tm_isdst; /* Daylight Savings Time flag */
};
#define FILE_BEGIN 0
#define FILE_CUR 1
#define FILE_END 2
#define DRIVE_MOUNT 1
#define MAX_FILE_SIZE 0x180000
struct _DRIVE;
typedef int (*CALLBACK)(struct _DRIVE *, ULONG, UCHAR *);
// 驅(qū)動器結(jié)構(gòu)體
typedef struct _DRIVE {
struct _MASS_STOR *ms;
CALLBACK ReadSector;
CALLBACK WriteSector;
void (*Sync)(struct _DRIVE *);
void (*Sync2)(struct _DRIVE *, UINT st);
// FAT文件系統(tǒng)變量
UINT Sectors;
CLNO FatStart;
CLNO RootStart;
CLNO DataStart;
USHORT Flags;
UINT RootEntries;
ULONG Fat1;
ULONG Fat2;
ULONG FatEnd;
UINT ClusterSizeShift;
UINT ClusterSize;
ULONG NumClusters;
ULONG NumSectors;
UINT FatLength;
UINT SectorsPerCluster;
UINT SectorsPerClusterShift;
UINT BytesPerSectorShift;
UINT BytesPerSector;
UINT Ref;
UINT sm;
int Fat32;
UINT Connected;
UINT fatst;
UINT fatgoal;
UCHAR tmpbuf[512];
UCHAR fatbuf[512];
} DRIVE;
#define MENU_MAIN 0
#define MENU_QUERY 1
#define MENU_REPORT 2
#define MENU_SAVE 3
#define TRB_MAX 512
typedef struct _TRB {
struct _TRB *Next;
ULONG Number;
UCHAR RcvCnt;
UCHAR Year;
UCHAR Month;
UCHAR Day;
UCHAR Hour;
UCHAR Min;
UCHAR Sec;
UCHAR Code;
UCHAR SubCode;
UCHAR Saved;
} TRB;
#define ZC (const char *)1
#define PX (const char *)2
#define BH (const char *)3
#define ZD (const char *)4
#define DZG (const char *)5
#define FZ (const char *)6
#define QY (const char *)7
#define SB (const char *)8
#define GK (const char *)9
// LCD 顯示數(shù)據(jù)
typedef struct _LCD_TRBS {
UINT JC[17];
UCHAR ZouChe;
UCHAR FuZhu;
UCHAR QianYin;
UCHAR PiXian;
UCHAR BaoHu;
UCHAR DianZiGui;
UCHAR GongKuang; // 25 I, 26 II
UCHAR ShouBing; // 16 *-10, 17 7-10, 41 0
UCHAR QianHou; // 18 前, 19 后
UCHAR ZhiQian; // 20 制, 21 牽
} LCD_TRBS;
#define KEY_ENTER 2
#define KEY_ESC 64
#define KEY_PG 16
#define KEY_UP 8
#define KEY_DOWN 1
#define KEY_LEFT 32
#define KEY_RIGHT 4
extern DRIVE UsbDsk;
extern DRIVE NfDsk;
extern UCHAR CurMenu;
extern LCD_TRBS LcdTrbs;
extern struct tm theTime;
ULONG GetTm(void);
void getTm(char *str, ULONG tm);
ULONG FileTime(int fd);
ULONG GetFileTime(DRIVE *drv, const char *fn);
int FindFile(DRIVE *drv, const char *fn);
int DeleteFile(DRIVE *drv, const char *fn);
int CreateFile(DRIVE *drv, const char *fn, ULONG sz);
UINT FileLength(int fd);
int OpenFile(DRIVE *drv, const char *fn);
void CloseFile(int fd);
ULONG ReadFile(int fd, void *buf, ULONG sz);
ULONG WriteFile(int fd, void *buf, ULONG sz);
ULONG SeekFile(int fd, long offst, int orig);
ULONG FileTell(int fd);
int FatFormat(DRIVE *drv);
int FatUnmount(DRIVE *d);
int FatMount(DRIVE *d, const char *);
void *kmalloc(UINT sz);
void kfree(void *ptr);
char *strcpy(char *, const char *);
int memcmp(const void *, const void *, unsigned int);
void *memset(void *, int, unsigned int);
void *memcpy(void *, const void *, unsigned int);
void GetTime(struct tm *);
void SetTime(struct tm *);
void UsbSync(void);
void NfSync(void);
ULONG mktime(USHORT, USHORT, USHORT, USHORT, USHORT, USHORT);
void Lcd_Clr(void);
void Lcd_FillRect(UINT X0, UINT Y0,UINT w , UINT h, UCHAR color);
void Lcd_NotRect(UINT X0, UINT Y0,UINT w , UINT h);
void Lcd_Clrxy(UINT X0, UINT Y0,UINT X , UINT Y,UCHAR color);
void SetPixel(UINT x, UINT y, UCHAR cr);
int GetPixel(UINT x, UINT y);
void DrawHorzLine(UINT x1, UINT x2, UINT y, UCHAR c);
void DrawVertLine(UINT x, UINT y1, UINT y2, UCHAR c);
void DrawLine(UINT x1, UINT y1, UINT x2, UINT y2, UCHAR color);
void FillRect(UINT x1, UINT y1, UINT x2, UINT y2, UCHAR c);
void DrawRect(UINT x1, UINT y1, UINT x2, UINT y2, UCHAR c);
void DrawBitmap(UINT x, UINT y, UCHAR *bmp);
void drawbmp(UINT x, UINT y, UCHAR *bmp, UINT sz);
UCHAR *gunzip(void *pData, ULONG len, ULONG *outlen);
void ShowLedDigit(UINT x, UINT y, UINT n);
void ShowLedNumber(UINT x, UINT y, UINT val, UINT w);
void OutHz(UINT x, UINT y, const char *hz);
void OutAscii(UINT x, UINT y, char ch);
void OutString(UINT x, UINT y, const char *str);
void OutString2(UINT x, UINT y, const char *str);
void getTm(char *str, ULONG tm);
int SetTextColor(int);
int SetBgColor(int);
int mysprintf(char *, const char *, ...);
int myvsprintf(char *, const char *, va_list);
void IntConnect(UINT iva, UINT isa);
void DbgOut(const char *fmt, ...);
void __assert(const char *f, int l, const char *expr);
void bsp_puts(const char *);
int ReadByte(void);
void internal_fatal(const char *msg);
void LockDrive(DRIVE *d);
void UnlockDrive(DRIVE *d);
void clrwtd(void);
void NfReadFile(int fd, ULONG pos, void *buf, UINT sz);
void NfWriteFile(void *buf, UINT sz);
UINT NfGetFileTime(int fd);
#if 0
#define DBG DbgOut
#define DBG1 DbgOut
#define DBG2 DbgOut
#define DBG3 DbgOut
#define DBG4 DbgOut
#define DBG5 DbgOut
void *Memset(void *ptr, int c, int sz);
void *Memcpy(void *dest, const void *src, int sz);
#else
#define DBG(x)
#define DBG1(a,b)
#define DBG2(a,b,c)
#define DBG3(a,b,c,d)
//#define ASSERT(p) ((void)0)
//#define CHECK_PTR(p) ((void)0)
#define Memset memset
#define Memcpy memcpy
#endif
#endif /* __DEFS_H__ */
/* EOF */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -