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

📄 usbdemo.c

📁 usb1.1开发代码usb1.1开发代码usb1.1开发代码
💻 C
字号:
#include "..\inc\datatype.h"
#include "..\inc\console.h"
#include "..\inc\ctrl_set.h"
#include "..\D12_op\D12Def.h"

//extern U32 MCLK;

//TIME_STRUC SysTime;
//U16	SERIAL_BAUD = 57600;
//char table_begin[] = "/***************************************************************/\n";
/*
void ShowSysClock(int argc, char *argv[])
{
	printf("System is running @%dHz\n", MCLK);	
}
*/
void UsbIntProc(int i)
{		
	
	
	if(i&D12Ep0Int){
				printf("\n D12Ep0IntProc(%x)",i);
				D12Ep0IntProc();
				}
		if(i&D12Ep1Int){
			
			D12Ep1IntProc();printf("\n D12Ep1IntProc(%x)",i);
			}
		if(i&D12Ep2Int){
			printf("\n D12Ep2IntProc(%x)",i);
			D12Ep2IntProc();
			}
		if(i&D12Ep3Int){
			printf("\n D12Ep3IntProc(%x)",i);
			D12Ep3IntProc();
			}
		if(i&D12Ep4Int){
			printf("\n D12Ep4IntProc(%x)",i);
			D12Ep4IntProc();
			}
		if(i&D12Ep5Int){
			printf("\n D12Ep5IntProc(%x)",i);
			D12Ep5IntProc();
			}
		if(i&D12BusRst){
			printf("\n D12BusRstProc(%x)",i);
			D12BusRstProc();
			}
		if(i&D12SuspChg){
			printf("\n D12SuspChgProc(%x)",i);
			D12SuspChgProc();
			}
}

int main(void)
//#pragma import(__use_no_semihosting_swi)
{
	int i;
		
	ChangePllValue(24, 6, 1);	//修改系统主频为2倍频
	PortInit();
	console_init(115200);	
	
//	puts(table_begin);
//	next_line();
//	puts(table_begin);	
//	puts("begin usb test\n");
//	ShowSysClock(0, NULL);	
//	printf("Serial Baud rate is %d\n", SERIAL_BAUD);
//	puts("Build date:");
//	puts(__DATE__);
//	putch('-');
//	puts(__TIME__);
//	next_line();
//	puts(table_begin);
/*	 
	SysTime.year    = 3;
	SysTime.month   = 7;
	SysTime.day     = 2;
	SysTime.weekday = 3;
	SysTime.hour    = 0x17;
	SysTime.min     = 0x09;
	SysTime.sec     = 0;
	
	RtcSetDay(&SysTime);
	RtcSetTime(&SysTime);			
*/	
	
//	puts("System Initialized.\n");		
	
	if(UsbRdChipId()==0x1210)
	{

		UsbInit();
		 
		while(1)
		{
			i = UsbQueryInt();
			UsbIntProc(i);			
		}
	}
}

U32 pIrqStart, pIrqFinish, pIrqHandler;

⌨️ 快捷键说明

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