- //***********************************************************************
- // *
- // 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;
- UC timecouter=0;
- //***********************************************************************
- //* *
- //* Routine Definition *
- //* *
- //***********************************************************************
- void Int_2(void) interrupt 2 using 0
- {
- }
- void Int_3(void) interrupt 3 using 0
- {
- TH1=60;
- TL1=80;
- timecouter++;
- }
- 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;
- //读取ISP1581中断寄存器
- USB_Int_Flag.VALUE |= D14_Cntrl_Reg.D14_INT.VALUE;
- //回写ISP1581中断寄存器
- D14_Cntrl_Reg.D14_INT.VALUE = USB_Int_Flag.VALUE;
- // if (USB_Int_Flag.BITS.EP1RX)
- // USB_Int_Flag.BITS.EP1RX = 0;
- //总线复位处理
- if(USB_Int_Flag.BITS.RESET)
- {
- //清除总线复位中断位
- USB_Int_Flag.BITS.RESET = 0;
- //设置总线复位标志
- Kernel_Flag.BITS.Bus_Reset = 1;
- PIO_Count = 64;
- //切换到全速模式
- HS_FS_LED = FULL_SPEED_LED;
- Kernel_Flag.BITS.HS_FS_State = FULL_SPEED;
- //初始化ISP1581
- Init_D14();
- //设置softconnect
- D14_Cntrl_Reg.D14_MODE.BITS.SOFTCT = 1;
- }
- }