📄 drives.h
字号:
//drives.h include board.h, utils.h and Rtc.h in 44B0_p2 source
/*==========================================================*/
// Board
/*==========================================================*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "\inc\define.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void __ENTRY(void);
//useful functions exported by reset.s START
void DisableInt(void);
void EnableInt(void);
void EnterCritical(U32 *);
void ExitCritical(U32 *);
void outportb(U8, U32);
void outportw(U16, U32);
void outportl(U32, U32);
U8 inportb(U32);
U16 inportw(U32);
U32 inportl(U32);
//useful functions exported by reset.s END
void DftEnvInit(void);
void CacheDisable(void);
void CacheEnable(void);
void CacheFlush(void);
#define min(x1,x2) ((x1<x2)? x1:x2)
#define max(x1,x2) ((x1>x2)? x1:x2)
void PortInit(void);
void SystemClockInit(void);
U32 GetSysClock(SysClock *);
void SetSysClockPara(void *);
void GetSysClockPara(void *);
int SetSysClock(void);
U32 GetCpuClock(void);
U32 GetMasterClock(void);
void SerialTxChar(char);
void SerialTxString(char *);
void SerialTxEmpty(void);
int SerialRxReady(void);
char SerialRxKey(void);
char SerialRxChar(void);
int SerialRxToBuf(char *);
void SerialChgBaud(U32);
U16 SerialSwitch(U16);
#define kbhit SerialRxReady
#define getkey SerialRxKey
#define getch SerialRxChar
#define putch SerialTxChar
//#define putchar putch
#define puts SerialTxString
#define DebugOut printf
#define ERROR printf
//led,key,buzzer,etc...
void Beep(U32 freq, U32 time); //
void LedSet(U32 LedStatus); //
void LedDisp(void); //
U16 GetKeyStatus(void);
#define KEY1_DOWN() (!(GetKeyStatus()&1))
#define KEY2_DOWN() (!(GetKeyStatus()&2))
#define KEY3_DOWN() (!(GetKeyStatus()&4))
#define KEY4_DOWN() (!(GetKeyStatus()&8))
//Timer
void TimerInit(U32);
void Delay(U32 time);
int WaitEventWithTimeout(int (*event)(void), int cond, U32 ms);
//RTC timer
void RtcSetDay(TIME_STRUC *time);
void RtcSetWeek(TIME_STRUC *time);
void RtcSetTime(TIME_STRUC *time);
void RtcGetTime(TIME_STRUC *time);
void RtcAlarm(TIME_STRUC *time);
void NandFlashInit(void);
void NandFlashStatusRep(void);
//
int LoadEnv(void);
//Nand Flash operation
int WrFileToNF(U32, U32);
int RdFileFrNF(U32, U32);
int EraseNandPart(void);
//
int XModemReceive(char *bufBase, int bufLen);
//
int BoardUsbDownload(U32);
//
int eth_init(void);
int arp_init(void);
void tftp_main(U32 addr, U32 dummy);
//
void EnableIrq(int);
void DisableIrq(int);
void AckAndClrIrq(int);
//
void MemCfgInit(void);
//
void BoardInitStart(void);
void BoardInitEnd(void);
void BoardPrepareRun(void);
//Show boot information
void ShowBootInfo(void);
//IDE
void IdeHardReset(void);
//Shell
void ShellIn(void);
#ifdef __cplusplus
}
#endif
#endif /*__BOARD_H__*/
/*================================================================*/
// RTC
/*================================================================*/
#ifndef __RTC_H__
#define __RTC_H__
int Test_Rtc_Alarm(void);
void Test_Rtc_Tick(void);
void Display_Rtc(void);
void Rtc_Init(void);
#define TESTYEAR (0x99)
#define TESTMONTH (0x12)
#define TESTDAY (0x31)
#define TESTDATE (0x06) // SUN:1 MON:2 TUE:3 WED:4 THU:5 FRI:6 SAT:7
#define TESTHOUR (0x23)
#define TESTMIN (0x59)
#define TESTSEC (0x30)
#define TESTYEAR2 (0x00)
#define TESTMONTH2 (0x01)
#define TESTDAY2 (0x01)
#define TESTDATE2 (0x07) // SUN:1 MON:2 TUE:3 WED:4 THU:5 FRI:6 SAT:7
#define TESTHOUR2 (0x00)
#define TESTMIN2 (0x00)
#define TESTSEC2 (0x00)
#endif //__RTC_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -