📄 d12def.h
字号:
/******* D12 operate function *******/
/// dma parameter
#define D12Dma0 0
#define D12Dma1 1
#define D12Dma2 2
#define D12Dma3 3
#define D12DmaEn 4
#define D12DmaWr 8
#define D12DmaRld 0x10
#define D12SofIntEn 0x20
#define D12Ep4dInt 0x40
#define D12Ep5dInt 0x80
/// mode parameter
#define D12NoLazyClk 2
#define D12ClkRun 4
#define D12AllInt 8
#define D12SoftConnect 0x10
#define D12EpCfgMask 0x3f
#define D12EpCfg0 0x00
#define D12EpCfg1 0x40
#define D12EpCfg2 0x80
#define D12EpCfg3 0xc0
#define D12Pll4M 11
#define D12Pll6M 7
#define D12Pll8M 5
#define D12Pll12M 3
#define D12Pll24M 1
#define D12Pll48M 0
/// interrupt bits
#define D12Ep0Int 1
#define D12Ep1Int 2
#define D12Ep2Int 4
#define D12Ep3Int 8
#define D12Ep4Int 0x10
#define D12Ep5Int 0x20
#define D12BusRst 0x40
#define D12SuspChg 0x80
#define D12DmaEot 1
/// endpoint status
#define D12EpStart 0
#define D12EpStall 1
///
void D12SetEpStat(U8 Ep,U8 Stat);
void D12SetAddr(U8 Addr);
void D12SetEp(U8 Val);
void D12SetDma(U8 Dma);
void D12SetMode(U8 Val1, U8 Val2);
void D12SendResume(void);
void D12AckEp(U8 Ep);
#define D12SelEp(Ep) D12Cmd = Ep
#define D12RdEpStat(Ep) D12Cmd = Ep|0x80
#define D12RdLastTrStat(Ep) D12Cmd = Ep|0x40
U32 D12RdChipId(void);
U8 D12GetDma(void);
U8 D12RdEp(U8 Ep, U8 buf[], U8 cnt);
void D12WrEp(U8 Ep, U8 buf[],U8 cnt);
U8 D12RdInt(void);
///
#define D12Cmd *(volatile U8 *)(0x2000001)
#define D12Dat *(volatile U8 *)(0x2000000)
#define MyD12DmaCfg D12Ep4dInt
#define MyD12EpCfgOff D12EpCfg0|D12AllInt|D12ClkRun|D12NoLazyClk
#define MyD12EpCfgOn MyD12EpCfgOff|D12SoftConnect
/***********************************************************/
U8 UsbInit(void);
void D12Ep0IntProc(void);
void D12Ep1IntProc(void);
void D12Ep2IntProc(void);
void D12Ep3IntProc(void);
void D12Ep4IntProc(void);
void D12Ep5IntProc(void);
void D12BusRstProc(void);
void D12SuspChgProc(void);
#define UsbRdChipId() D12RdChipId()
#define UsbQueryInt() D12RdInt()
#define UsbIntProc(i) \
if(i&D12Ep0Int)\
D12Ep0IntProc();\
if(i&D12Ep1Int)\
D12Ep1IntProc();\
if(i&D12Ep2Int)\
D12Ep2IntProc();\
if(i&D12Ep3Int)\
D12Ep3IntProc();\
if(i&D12Ep4Int)\
D12Ep4IntProc();\
if(i&D12Ep5Int)\
D12Ep5IntProc();\
if(i&D12BusRst)\
D12BusRstProc();\
if(i&D12SuspChg)\
D12SuspChgProc();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -