?? usb_isr.#3
字號:
#include "c8051F320.h"
#include "stdio.h"
#include "intrins.h"
/////////////////////////////
#include "Usb_FunDec.h"
#include "Usb_Parameter.h"
#include "Usb_Register.h"
#include "Usb_Request.h"
extern unsigned char Ep_Status[3];
extern unsigned char USB_State;
extern unsigned char Bulk_Status;
void Usb_Isr() interrupt 8
{
unsigned char bCommon, bIn, bOut;
URead_Byte(CMINT, bCommon); //讀中斷寄存器
URead_Byte(IN1INT, bIn);
URead_Byte(OUT1INT, bOut);
///////////////////////////////////////////////////////////////////////////////////////
if (bCommon & rbRSUINT) // 處理恢復中斷
{
// printf("This is a Resume Interrupt\n");
Usb_Resume();
} if (bCommon & rbRSTINT) // 處理復位中斷t
{
// printf("Reset Interrupt\n");
Usb_Reset();
}
if (bCommon & rbSUSINT) // 處理掛起中斷
{
// printf("This is a Susint Interrupt\n");
Usb_Suspend();
}
/////////////////////////////////////////////////////////////////////////////////////// if (bIn & rbEP0) // 如果是端點0中斷
{
// printf("This is a EP0 Interrupt\n");
Handle_Setup(); // 調用端點0中斷處理函數
}
/////////////////////////////////////////////////////////////////////////////////////// if (bIn & rbIN1) // 如果是端點1中斷
{
// printf("This is a EdPoint1 Interrupt\n");
Handle_In1(); // 調用端點1中斷處理函數
}
/////////////////////////////////////////////////////////////////////////////////////// if (bOut & rbOUT2) // 如果是端點2中斷
{
// printf("This is a EdPoint2 Interrupt\n");
Handle_Out2(); // 調用端點2中斷處理函數
}
}
void Usb_Reset()
{
USB_State = DEV_DEFAULT; // 設備到默認狀態
UWrite_Byte(POWER, 0x00);
Ep_Status[0] = EP_IDLE; // 端點到空閑狀態
Ep_Status[1] = EP_HALT;
Ep_Status[2] = EP_HALT;
Bulk_Status = BULK_IDLE; // 批量傳輸端點狀態到空閑狀態
}
void Usb_Suspend()
{
// 此開發中沒涉及到相關的操作
}
void Usb_Resume()
{
// 此開發中沒涉及到相關的操作
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -