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

📄 intrpt.c

📁 基于USB2.0芯片 ISP1581 的扫描仪固件源码,USB驱动模块
💻 C
字号:
//***********************************************************************
//									     								                  *
//                P H I L I P S   P R O P R I E T A R Y          		   *  
//                                                                      *
//          COPYRIGHT (c)   1999 BY PHILIPS SINGAPORE (APIC).    		   *
//                    --  ALL RIGHTS RESERVED  --                 		*	
//                                                                      *
// 	File Name	:       Kernel.c                                      *
// 	Author		:       Albert Goh					 					      *
// 	Created		:      	3 March 2000                               	*
//                  	                                                   *
//***********************************************************************
//***********************************************************************
//                                                                      *
// Kernel.c is the control centre for this evaluation firmware. It will *
// control where should the firmware branch through via the selection 	*
// of the UART port of the 8051. if not via the UART, it will be from 	*
// the selection of the code defintion                                  *
//                                                                      *
//***********************************************************************
//***********************************************************************
//                                                                      *
//  Module History														            *
//  **************														            *
//																		                  *
//  Date   	Version			Author				Changes					      *  
//  ====	=======			======				=======					         *
//  030300	  0.1 			Albert				Created    				      *  
//                                                                      *
//                                                                      *
//***********************************************************************
//***********************************************************************
//*																		               *
//*	                     Include Files Definition						   *
//*																		               *
//***********************************************************************

#include "standard.h"
#include "Kernel.h"
#include "D14.h"

extern KERNEL Kernel_Flag;
extern D14_CNTRL_REG xdata *D14_Cntrl_Ptr;
extern volatile D14_CNTRL_REG	xdata	D14_Cntrl_Reg;

extern DMA_INT_FLAG DMA_Int_Flag;
extern USB_INT_FLAG USB_Int_Flag;
extern void Init_D14(void);
extern UC ATAPI_State;
extern DRIVE_CONFIG	Drive_Setup;
extern void Set_USB(void);
extern ULI bytecount;
extern UI PIO_Count;

//***********************************************************************
//*																		               *
//*	                     Variable Definition 							      *
//*																		               *
//***********************************************************************


UI	idata	Data;
ULI USB_Interrupt;
UI DMA_Interrupt;


//***********************************************************************
//*																		               *
//*	                     Routine Definition								   *
//*																		               *
//***********************************************************************

void Int_2(void) interrupt 2 using 0
{
}

void Int_3(void) interrupt 3 using 0
{
}

void Int_4(void) interrupt 4 using 0
{
}

void Int_5(void) interrupt 5 using 0
{
}

//***********************************************************************
//*										    							               *
//*	Routine 	: Int_Timer0                                      		   *
//*	Input		: Timer 0 overflow  									            *
//*	Output		: Set time up flag                    					   *
//*	Function	: To set the time up flag                   			      *
//*																		               *
//***********************************************************************

void Int_Timer0(void) interrupt 1 using 0
{

	Kernel_Flag.BITS.Timer_Expired = 1;
}

//***********************************************************************
//*										    							               *
//*	Routine 	:  Int Ext 0                                       		*
//*	Input		:  External Interrupt from ISP1581                       *
//*	Output	:  None                                 					   *
//*	Function	:  To read and keep a copy of the interrupt source of    *
//*				   ISP1581														      *
//***********************************************************************

void Int_Ext_0(void) interrupt 0 using 1
{

         //read in USB interrupt register and keep a copy
//         USB_Interrupt = D14_Cntrl_Reg.D14_INT.VALUE;
//         USB_Int_Flag.VALUE |= USB_Interrupt;

         USB_Int_Flag.VALUE |= D14_Cntrl_Reg.D14_INT.VALUE;

         //read in DMA interrupt register and keep a copy
//         DMA_Interrupt = D14_Cntrl_Reg.D14_DMA_INT.VALUE;
//         DMA_Int_Flag.VALUE |= DMA_Interrupt;

         DMA_Int_Flag.VALUE |= D14_Cntrl_Reg.D14_DMA_INT.VALUE;

//         D14_Cntrl_Reg.D14_DMA_INT.VALUE = DMA_Interrupt;
//         D14_Cntrl_Reg.D14_INT.VALUE = USB_Interrupt;


         D14_Cntrl_Reg.D14_DMA_INT.VALUE = DMA_Int_Flag.VALUE;
         D14_Cntrl_Reg.D14_INT.VALUE = USB_Int_Flag.VALUE;


         //check for DMA interrupt      
	      if(USB_Int_Flag.BITS.DMA)
		      USB_Int_Flag.BITS.DMA = 0;

         if(USB_Int_Flag.BITS.RESET)
	      {
   
            //check if the IDe device is in read or write phase
            //if bus reset occur during that phase,error has occur
            //this is used for error recovery
            USB_Int_Flag.BITS.RESET = 0;
            Kernel_Flag.BITS.Bus_Reset = 1;
            PIO_Count = 64;

            //turn off high speed LED                           
		      HS_FS_LED = FULL_SPEED_LED;

            //reset device to full speed state
		      Kernel_Flag.BITS.HS_FS_State = FULL_SPEED;
		      Kernel_Flag.BITS.Register_Test = 0;

            //initialize ISP1581
		      Init_D14();

            //enable device and reset the device address
	         D14_Cntrl_Reg.D14_MODE.BITS.SOFTCT = 1;		

         }
         
}

⌨️ 快捷键说明

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