📄 isr.c
字号:
/*
** WASABI-Hot! version 1.2c
**
**
** -- copyright (c) 2001-2004 by Philips Japan, Ltd. -- All rights reserved --
**
**
** ** This code has been made to check/learn **
** ** the ISP1362/ISP1363 functionalities **
** ** Release 06-Aug-2004 **
**
** OKANO, Akifumi
**
** Application Laboratory, Mobile and Connectivity
** Semiconductors Div, Philips Japan Ltd.
** akifumi.okano@philips.com
** +81-3-3740-4668
*/
// 08-Nov-2001 No static call for SOF service routine
// 27-Feb-2002 Platform dependent part moved to "_hc_hw/hw_acces.c"
/****************************************************************************/
/* includes */
/****************************************************************************/
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include "_hc_core/atl_mix.h"
#include "_hc_core/isr.h"
#include "_hc_hw/hc_comm.h"
#include "_hc_hw/hw_acces.h"
#include "class_dr/audio/sing.h"
#include "_dc/dc_isr.h"
#include "_dc/dc_main.h"
#include "ui.h"
/****************************************************************************/
/* constants */
/****************************************************************************/
unsigned long gp_sof_counter = 0;
unsigned long g_sof_counter_prev = 0;
unsigned short gp_isr_flag;
unsigned short gp_rhsc_event_counter = 0;
unsigned short gp_event_counter = 0;
interrupt_service_func_ptr g_SOF_service_routine = NULL;
interrupt_service_func_ptr g_ISTL_service_routine = NULL;
interrupt_service_func_ptr g_INTL_IRQ_service_routine = NULL;
interrupt_service_func_ptr g_ATL_IRQ_service_routine = NULL;
interrupt_service_func_ptr g_OTG_IRQ_service_routine = NULL;
interrupt_service_func_ptr g_ClkReady_service_routine = NULL;
interrupt_service_func_ptr g_RH_event_service_routine = NULL;
unsigned short gp_hardware_configuration_setting;
unsigned short level = 0; // ebnable/disable control
/****************************************************************************/
/* function prototypes */
/****************************************************************************/
void interrupt_handler_USB_Hc( unsigned short intr );
void clear_HcuPInterrupt_bit( unsigned short flag );
void HcuInterrupt_OPR_Reg_handler( unsigned long intr_stat );
void atl_buff_handler( void );
void clear_HcInterruptStatus_bit( unsigned long flag );
/****************************************************************************/
/* function definitions */
/****************************************************************************/
void interrupt isr_isr_USB_Hc( void ) // ISR entry for 1362 (HC and DC)
{
unsigned short intr;
unsigned short inter_en;
disable_INT(); // ## version1.2c
if ( gp_shared_IRQ ) // If HC and DC sharing one INT line...
disable_Dc(); // disable DC interrupt
inter_en = isr_disable_Hc(); // Disable HC interrupt
if ( gp_shared_IRQ ) // If HC and DC sharing one INT line...
usb_Dc_isr(); // call DC-ISR
intr = read_register16( Com16_HcuPInterrupt ); // Read HC interrupt cause
clear_HcuPInterrupt_bit( intr ); // Clear all HC interrupt here
interrupt_handler_USB_Hc( intr & inter_en ); // Process HC interrupt
hwacces_clear_interrupt_controller();
if ( gp_shared_IRQ ) // If HC and DC sharing one INT line...
enable_Dc(); // enable DC interrupt
isr_enable_Hc(); // Enable HC interrupt
enable_INT(); // ## version1.2c
}
// ## version1.2c (from here)
unsigned short inter_en;
unsigned short isr_disable_Hc( void ) // Disable HC interrupt by masking enable bits
{
unsigned short en;
if ( 0 != (en = read_register16( Com16_HcuPInterruptEnable )) )
{
write_register16( Com16_HcuPInterruptEnable, 0x0000 );
inter_en = en;
}
return ( inter_en );
}
void isr_enable_Hc( void ) // Enabling HC interrupt by restoring mask
{
write_register16( Com16_HcuPInterruptEnable, inter_en );
}
// ## version1.2c (to here)
void interrupt_handler_USB_Hc( unsigned short intr ) // HC interrupt process
{
static unsigned int key_polling_timer = False;
int i;
if ( intr & HcuInterrupt_SOFISTLInt )
{
if ( !(key_polling_timer++ & GENERAL_KEY_POLLING_RATE) )
gp_key_polling_flag = True;
if ( g_SOF_service_routine )
(*g_SOF_service_routine)( 0 );
gp_sof_counter = (gp_sof_counter & 0xFFFF0000) | (read_register32( Com32_HcFmNumber ) & 0x0000FFFF);
}
if ( intr & ( HcuInterrupt_ISTL_0_Int | HcuInterrupt_ISTL_1_Int ) )
if ( g_ISTL_service_routine )
(*g_ISTL_service_routine)( (intr & HcuInterrupt_ISTL_0_Int) ? 0 : 1 );
if ( intr & HcuInterrupt_ATL_IRQ )
if ( g_ATL_IRQ_service_routine )
(*g_ATL_IRQ_service_routine)( 0 );
if ( intr & HcuInterrupt_INTL_IRQ )
if ( g_INTL_IRQ_service_routine )
(*g_INTL_IRQ_service_routine)( 1 );
if ( intr & HcuInterrupt_AllEOTInterrupt )
;
if ( intr & HcuInterrupt_HCSuspend )
;
if ( intr & HcuInterrupt_ClkReady )
if ( g_ClkReady_service_routine )
(*g_ClkReady_service_routine)( 0 );
if ( intr & HcuInterrupt_OPR_Reg )
{
unsigned short intr32;
intr32 = read_register32( Com32_HcInterruptStatus );
clear_HcInterruptStatus_bit( intr32 );
HcuInterrupt_OPR_Reg_handler( intr32 );
}
if ( intr & HcuInterrupt_OTG_IRQ )
if ( g_OTG_IRQ_service_routine )
(*g_OTG_IRQ_service_routine)( 0 );
g_sof_counter_prev = gp_sof_counter;
}
void clear_HcuPInterrupt_bit( unsigned short flag )
{
write_register16( Com16_HcuPInterrupt, flag );
gp_isr_flag |= flag;
}
void HcuInterrupt_OPR_Reg_handler( unsigned long cause )
{
unsigned long intr_stat;
intr_stat = cause & read_register32( Com32_HcInterruptEnable );
if ( intr_stat & HcInterruptStatus_SO )
;
if ( intr_stat & HcInterruptStatus_SF )
;
if ( intr_stat & HcInterruptStatus_RD )
;
if ( intr_stat & HcInterruptStatus_UE )
;
if ( intr_stat & HcInterruptStatus_FNO )
gp_sof_counter += (gp_sof_counter & 0x00008000) ? 0 : (1L << 16);
if ( intr_stat & HcInterruptStatus_RHSC )
{
if ( g_RH_event_service_routine )
(*g_RH_event_service_routine)( 1 );
gp_rhsc_event_counter++;
}
}
void clear_HcInterruptStatus_bit( unsigned long flag )
{
write_register32( Com32_HcInterruptStatus, flag );
gp_isr_flag |= ((flag & 0x01) << 10) | ((flag & 0x7C) << 9);
}
/* ********** ********** ********** ********** ********** ********** **********
ISR process routine installers
********** ********** ********** ********** ********** ********** ********** */
funcPtr isr_install_SOF_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_SOF_service_routine;
g_SOF_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_ISTL_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_ISTL_service_routine;
g_ISTL_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_INTL_IRQ_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_INTL_IRQ_service_routine;
g_INTL_IRQ_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_ATL_IRQ_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_ATL_IRQ_service_routine;
g_ATL_IRQ_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_OTG_IRQ_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_OTG_IRQ_service_routine;
g_OTG_IRQ_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_ClkReady_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_ClkReady_service_routine;
g_ClkReady_service_routine = function_ptr;
return ( tmp );
}
funcPtr isr_install_RH_event_service_routine( funcPtr function_ptr )
{
funcPtr tmp;
tmp = g_RH_event_service_routine;
g_RH_event_service_routine = function_ptr;
return ( tmp );
}
/* ********** ********** ********** ********** ********** ********** **********
Frame count access function
********** ********** ********** ********** ********** ********** ********** */
unsigned long isr_get_frame_number( void )
{
return ( (gp_sof_counter & 0xFFFF0000) | (read_register32( Com32_HcFmNumber ) & 0x0000FFFF) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -