From 85dd27858ebc3e1a09eced0036cebb1e38521fa8 Mon Sep 17 00:00:00 2001 From: nakasima Date: Fri, 19 Dec 2008 07:42:36 +0000 Subject: [PATCH] =?UTF-8?q?interrupt=5Fcommon.h=E5=89=8A=E9=99=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@131 b871894f-2f95-9b40-918c-086798483c85 --- .../include/brom/os/ARM11/interrupt_types.h | 1 - .../include/brom/os/ARM9/interrupt_types.h | 1 - .../include/brom/os/common/interrupt.h | 98 +++++++++- .../include/brom/os/common/interrupt_common.h | 170 ------------------ trunk/bootrom/include/brom/os/common/timer.h | 2 - 5 files changed, 91 insertions(+), 181 deletions(-) delete mode 100644 trunk/bootrom/include/brom/os/common/interrupt_common.h diff --git a/trunk/bootrom/include/brom/os/ARM11/interrupt_types.h b/trunk/bootrom/include/brom/os/ARM11/interrupt_types.h index cc60aed..cfbb762 100644 --- a/trunk/bootrom/include/brom/os/ARM11/interrupt_types.h +++ b/trunk/bootrom/include/brom/os/ARM11/interrupt_types.h @@ -17,7 +17,6 @@ #ifndef BROM_OS_INTERRUPT_TYPES_H_ #define BROM_OS_INTERRUPT_TYPES_H_ -#include #include #ifdef __cplusplus diff --git a/trunk/bootrom/include/brom/os/ARM9/interrupt_types.h b/trunk/bootrom/include/brom/os/ARM9/interrupt_types.h index c555c0e..23a7a4c 100644 --- a/trunk/bootrom/include/brom/os/ARM9/interrupt_types.h +++ b/trunk/bootrom/include/brom/os/ARM9/interrupt_types.h @@ -17,7 +17,6 @@ #ifndef BROM_OS_INTERRUPT_TYPES_H_ #define BROM_OS_INTERRUPT_TYPES_H_ -#include #include #include diff --git a/trunk/bootrom/include/brom/os/common/interrupt.h b/trunk/bootrom/include/brom/os/common/interrupt.h index 88b9086..2b9f0e4 100644 --- a/trunk/bootrom/include/brom/os/common/interrupt.h +++ b/trunk/bootrom/include/brom/os/common/interrupt.h @@ -17,22 +17,61 @@ #ifndef BROM_OS_INTERRUPT_H_ #define BROM_OS_INTERRUPT_H_ -#include +#include +#include +#include +#ifdef SDK_ARM11 +#include +#else // SDK_ARM9 +#include +#endif // SDK_ARM9 #ifdef __cplusplus extern "C" { #endif #ifdef SDK_ARM11 - -#define OS_IDR_CPU0_TARGET_ENABLE HW_IDR_CPU0_TARGET_ENABLE #define OS_IDR_INTR_PRIO_DEFAULT 8 // Interrupt priority default (0-15) - -OSIntrID i_osReadHighestPendingInterruptRegister( void ); -OSIntrID i_osReadInterruptAcknowledgeRegister( void ); - #endif // SDK_ARM11 +typedef u32 OSIntrMode; + +typedef enum +{ + OS_IRQ_DISABLE = HW_PSR_IRQ_DISABLE, + OS_IRQ_ENABLE = 0 +} +OSIrqMode; + +typedef enum +{ + OS_FIQ_DISABLE = HW_PSR_FIQ_DISABLE, + OS_FIQ_ENABLE = 0 +} +OSFiqMode; + + +//---- interrupt handler type +//typedef IRQ void (*OSIntrHandler) (void); +typedef void (*OSIntrHandler) (void); +typedef void (*OSIntrFunction) (void); + +//IRQ void osInterruptHandler( void ); +void osInterruptHandler( void ); +void i_osInitInterruptTable( void ); + +OSIntrMode osEnableIrq( void ); +OSIntrMode osDisableIrq( void ); +OSIntrMode osRestoreIrq( OSIntrMode state ); + +OSIntrMode osEnableFiq( void ); +OSIntrMode osDisableFiq( void ); +OSIntrMode osRestoreFiq( OSIntrMode state ); + +OSIntrMode osEnableIrqAndFiq( void ); +OSIntrMode osDisableIrqAndFiq( void ); +OSIntrMode osRestoreIrqAndFiq( OSIntrMode state ); + /*---------------------------------------------------------------------------* Name: osInitInterrupts @@ -45,9 +84,54 @@ OSIntrID i_osReadInterruptAcknowledgeRegister( void ); *---------------------------------------------------------------------------*/ void osInitInterrupt( void ); +/*---------------------------------------------------------------------------* + Name: osSetInterruptHandler + + Description: Set interrupt handler + + Arguments: interrupt ID + interrupt handler + + Returns: None + *---------------------------------------------------------------------------*/ +void osSetInterruptHandler( OSIntrID id, OSIntrFunction handler ); + //================================================================================ // INTERRUPT MASK //================================================================================ +/*---------------------------------------------------------------------------* + Name: osEnableInterrupts + + Description: Set CPSR to enable irq and fiq interrupts + + Arguments: None. + + Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE + *---------------------------------------------------------------------------*/ +OSIntrMode osEnableInterrupts( void ); + +/*---------------------------------------------------------------------------* + Name: osDisableInterrupts + + Description: Set CPSR to disable irq and fiq interrupts + + Arguments: None. + + Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE + *---------------------------------------------------------------------------*/ +OSIntrMode osDisableInterrupts( void ); + +/*---------------------------------------------------------------------------* + Name: osRestoreInterrupts + + Description: Restore CPSR irq and fiq interrupts + + Arguments: state of irq interrupt bit + + Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE + *---------------------------------------------------------------------------*/ +OSIntrMode osRestoreInterrupts( OSIntrMode state ); + /*---------------------------------------------------------------------------* Name: osEnableInterruptID diff --git a/trunk/bootrom/include/brom/os/common/interrupt_common.h b/trunk/bootrom/include/brom/os/common/interrupt_common.h deleted file mode 100644 index 97418fd..0000000 --- a/trunk/bootrom/include/brom/os/common/interrupt_common.h +++ /dev/null @@ -1,170 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: CtrBrom - OS - include - File: interrupt_common.h - - Copyright 2008 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ -#ifndef BROM_OS_INTERRUPT_COMMON_H_ -#define BROM_OS_INTERRUPT_COMMON_H_ - -#include -#include -#include -#ifdef SDK_ARM11 -#include -#else // SDK_ARM9 -#include -#endif // SDK_ARM9 - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef u32 OSIntrMode; - -typedef enum -{ - OS_IRQ_DISABLE = HW_PSR_IRQ_DISABLE, - OS_IRQ_ENABLE = 0 -} -OSIrqMode; - -typedef enum -{ - OS_FIQ_DISABLE = HW_PSR_FIQ_DISABLE, - OS_FIQ_ENABLE = 0 -} -OSFiqMode; - - -//---- interrupt handler type -//typedef IRQ void (*OSIntrHandler) (void); -typedef void (*OSIntrHandler) (void); -typedef void (*OSIntrFunction) (void); - - - -//IRQ void osInterruptHandler( void ); -void osInterruptHandler( void ); -void i_osInitInterruptTable( void ); - -OSIntrMode osEnableIrq( void ); -OSIntrMode osDisableIrq( void ); -OSIntrMode osRestoreIrq( OSIntrMode state ); - -OSIntrMode osEnableFiq( void ); -OSIntrMode osDisableFiq( void ); -OSIntrMode osRestoreFiq( OSIntrMode state ); - -OSIntrMode osEnableIrqAndFiq( void ); -OSIntrMode osDisableIrqAndFiq( void ); -OSIntrMode osRestoreIrqAndFiq( OSIntrMode state ); - - -/*---------------------------------------------------------------------------* - Name: osInitInterrupt - - Description: Initialize Interrupts - - Arguments: None - - Returns: None - *---------------------------------------------------------------------------*/ -void osInitInterrupt( void ); - -/*---------------------------------------------------------------------------* - Name: osSetInterruptHandler - - Description: Set interrupt handler - - Arguments: interrupt ID - interrupt handler - - Returns: None - *---------------------------------------------------------------------------*/ - -void osSetInterruptHandler( OSIntrID id, OSIntrFunction handler ); - - -/*---------------------------------------------------------------------------* - Name: osHalt - - Description: Halt CPU Core until Interrupt - - Arguments: None - - Returns: None - *---------------------------------------------------------------------------*/ - -void osHalt( void ); - -#ifdef SDK_ARM9 -#else // SDK_MPCORE - -/*---------------------------------------------------------------------------* - Name: osHaltUntilEvent - - Description: Halt CPU Core until Event - - Arguments: None - - Returns: None - *---------------------------------------------------------------------------*/ - -void osHaltUntilEvent( void ); - -#endif // SDK_MPCORE - -/*---------------------------------------------------------------------------* - Name: osEnableInterrupts - - Description: Set CPSR to enable irq and fiq interrupts - - Arguments: None. - - Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE - *---------------------------------------------------------------------------*/ - -OSIntrMode osEnableInterrupts( void ); - -/*---------------------------------------------------------------------------* - Name: osDisableInterrupts - - Description: Set CPSR to disable irq and fiq interrupts - - Arguments: None. - - Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE - *---------------------------------------------------------------------------*/ - -OSIntrMode osDisableInterrupts( void ); - -/*---------------------------------------------------------------------------* - Name: osRestoreInterrupts - - Description: Restore CPSR irq and fiq interrupts - - Arguments: state of irq interrupt bit - - Returns: last state of HW_PSR_IRQ_DISABLE & HW_PSR_FIQ_DISABLE - *---------------------------------------------------------------------------*/ - -OSIntrMode osRestoreInterrupts( OSIntrMode state ); - - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // BROM_OS_INTERRUPT_COMMON_H_ diff --git a/trunk/bootrom/include/brom/os/common/timer.h b/trunk/bootrom/include/brom/os/common/timer.h index aeaa8e3..7146db6 100644 --- a/trunk/bootrom/include/brom/os/common/timer.h +++ b/trunk/bootrom/include/brom/os/common/timer.h @@ -25,8 +25,6 @@ extern "C" { #include #include -#include - //---------------------------------------------------------------------- #ifdef SDK_ARM11