mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-10-31 07:51:08 -04:00
割り込み処理のマージ。
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@128 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
parent
7700a72a36
commit
707f66fe25
@ -1,307 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: CtrBrom - libraries - OS
|
||||
File: os_interrupt.c
|
||||
|
||||
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$
|
||||
*---------------------------------------------------------------------------*/
|
||||
#include <brom/os.h>
|
||||
|
||||
|
||||
asm void i_osIrqVeneer( void );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osInitInterrupt
|
||||
|
||||
Description: Initialize Interrupts
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void osInitInterrupt( void )
|
||||
{
|
||||
static BOOL isInit;
|
||||
|
||||
if ( isInit == FALSE )
|
||||
{
|
||||
isInit = TRUE;
|
||||
|
||||
(void)osDisableIrqAndFiq();
|
||||
|
||||
i_osInitInterruptTable();
|
||||
|
||||
((u32*)HW_INTR_VENEER_BUF)[0] = ((u32*)i_osIrqVeneer)[0];
|
||||
((u32*)HW_INTR_VENEER_BUF)[1] = ((u32*)i_osIrqVeneer)[1];
|
||||
|
||||
{
|
||||
u32 num = OS_INTR_ID_NUM;
|
||||
u32 conf = 0;
|
||||
int i;
|
||||
|
||||
for ( i=0; i<MATH_ROUNDUP(num, 32)/32; i++ )
|
||||
{
|
||||
reg_OS_IDR_CLR_IE[i] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_PND[i] = HW_IDR_WORD_MASK;
|
||||
}
|
||||
|
||||
for ( i=0; i<num; i++ )
|
||||
{
|
||||
reg_OS_IDR_TGT[i] = REG_OS_IDR_TGT0_C0_MASK;
|
||||
reg_OS_IDR_PRIO[i] = OS_IDR_INTR_PRIO_DEFAULT << 4;
|
||||
}
|
||||
for ( i=0; i<32; i+=2 )
|
||||
{
|
||||
conf |= (HW_IDR_INTR_RISE_EDGE | HW_IDR_INTR_1_N_MODEL) << i;
|
||||
}
|
||||
for ( i=0; i<MATH_ROUNDUP(num, 16)/16; i++ )
|
||||
{
|
||||
reg_OS_IDR_CFG[i] = conf;
|
||||
}
|
||||
}
|
||||
reg_OS_IDR_CNT = REG_OS_IDR_CNT_E_MASK;
|
||||
|
||||
reg_OS_CPUI_PRIO = 15 << REG_OS_CPUI_PRIO_THLD_SHIFT;
|
||||
reg_OS_CPUI_BP = HW_CPUIBP_CMP_PRIO_ALL_BITS;
|
||||
reg_OS_CPUI_CNT = REG_OS_CPUI_CNT_E_MASK;
|
||||
|
||||
(void)osEnableInterrupts();
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: i_osIrqVeneer
|
||||
|
||||
Description: Interrupt Vevver
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
#include <brom/code32.h>
|
||||
|
||||
asm void i_osIrqVeneer( void )
|
||||
{
|
||||
INASM_EXTERN( osIrqHandler )
|
||||
|
||||
ldr pc, =osIrqHandler
|
||||
LTORG
|
||||
}
|
||||
|
||||
#include <brom/codereset.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osEnableInterruptID
|
||||
|
||||
Description: set Interrupt Set Enable Register
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: TRUE if last state is enabled
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osEnableInterruptID( OSIntrID id )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_SET_IE[ofs] = 1 << sft;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osDisableInterruptID
|
||||
|
||||
Description: set Interrupt Clear Enable Register
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: TRUE if last state is enabled
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osDisableInterruptID( OSIntrID id )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_CLR_IE[ofs] = 1 << sft;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osRestoreInterruptID
|
||||
|
||||
Description: set Interrupt Clear Enable Register
|
||||
|
||||
Arguments: id : Interrupt Distributor ID
|
||||
state : state whether interrupt is enabled
|
||||
|
||||
Returns: TRUE if last state is enabled
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osRestoreInterruptID( OSIntrID id, BOOL state )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
if ( state == TRUE )
|
||||
{
|
||||
reg_OS_IDR_SET_IE[ofs] = 1 << sft;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_OS_IDR_CLR_IE[ofs] = 1 << sft;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptPendingID
|
||||
|
||||
Description: set Interrupt Set Pending Register
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: TRUE if last state is pending
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osSetInterruptPendingID( OSIntrID id )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_SET_PND[ofs] = 1 << sft;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptPendingID
|
||||
|
||||
Description: set Interrupt Clear Pending Register
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: TRUE if last state is pending
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osClearInterruptPendingID( OSIntrID id )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_CLR_PND[ofs] = 1 << sft;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osRestoreInterruptPendingID
|
||||
|
||||
Description: restore Interrupt Pending
|
||||
|
||||
Arguments: id : Interrupt Distributor ID
|
||||
state : state whether interrupt is enabled
|
||||
|
||||
Returns: TRUE if last state is pending
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osRestoreInterruptPendingID( OSIntrID id, BOOL state )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
if ( state == TRUE )
|
||||
{
|
||||
reg_OS_IDR_SET_PND[ofs] = 1 << sft;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_OS_IDR_CLR_PND[ofs] = 1 << sft;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetEndOfInterruptRegister
|
||||
|
||||
Description: set ID to End of Interrupt Register
|
||||
|
||||
change state to Inactive.
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void osSetEndOfInterruptRegister( OSIntrID id )
|
||||
{
|
||||
reg_OS_CPUI_EOI = id;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: i_osReadHighestPendingInterruptRegister
|
||||
|
||||
Description: read ID from Highest Pending Interrupt Register
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: Interrupt Distributor ID
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
OSIntrID i_osReadHighestPendingInterruptRegister( void )
|
||||
{
|
||||
return (OSIntrID)(reg_OS_CPUI_HI_PND & REG_OS_CPUI_HI_PND_ID_MASK);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: i_osReadInterruptAcknowledgeRegister
|
||||
|
||||
Description: read ID from Interrupt Acknowledge Register
|
||||
|
||||
get interrupt ID and change state to NotPending and Active.
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: Interrupt Distributor ID
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
OSIntrID i_osReadInterruptAcknowledgeRegister( void )
|
||||
{
|
||||
return (OSIntrID)(reg_OS_CPUI_ACK & REG_OS_CPUI_ACK_ID_MASK);
|
||||
}
|
||||
|
||||
@ -19,19 +19,9 @@
|
||||
#define osPanic(...) ((void)0)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//---- timer number alarm uses
|
||||
#define OSi_ALARM_TIMER OS_TIMER_1
|
||||
|
||||
#ifdef SDK_ARM11
|
||||
//---- timer interrupt ID
|
||||
#define OSi_ALARM_IE_TIMER_ID OS_INTR_ID_WATCHDOG
|
||||
|
||||
#else // SDK_ARM9
|
||||
//---- timer interrupt ID
|
||||
#define OSi_ALARM_IE_TIMER_ID OS_INTR_ID_TIMER1
|
||||
|
||||
#ifdef SDK_ARM9
|
||||
//---- timer interrupt mask (must be same number with OSi_ALARM_TIMER)
|
||||
#define OSi_ALARM_IE_TIMER OS_IE_TIMER1
|
||||
#define OSi_ALARM_IE_TIMER (OS_IE_TIMER0 << OSi_ALARM_TIMER)
|
||||
|
||||
//---- timer control setting for alarm
|
||||
#define OSi_ALARM_TIMERCONTROL ( REG_OS_TM0CNT_H_E_MASK | REG_OS_TM0CNT_H_I_MASK | OS_TIMER_PRESCALER_64 )
|
||||
@ -487,11 +477,8 @@ void i_osArrangeTimer(void)
|
||||
//---- let timer be disable
|
||||
osSetTimerControl(OSi_ALARM_TIMER, 0);
|
||||
|
||||
#ifdef SDK_ARM9
|
||||
//---- set check flag timer interrupt
|
||||
// osSetIrqCheckFlag(OSi_ALARM_IE_TIMER);
|
||||
|
||||
#endif // SDK_ARM9
|
||||
osSetInterruptCheckID(OSi_ALARM_IE_TIMER_ID);
|
||||
|
||||
tick = osGetTick();
|
||||
alarm = i_osAlarmQueue.head;
|
||||
|
||||
@ -44,10 +44,44 @@ void osInitInterrupt( void )
|
||||
((u32*)HW_INTR_VENEER_BUF)[0] = ((u32*)i_osIrqVeneer)[0];
|
||||
((u32*)HW_INTR_VENEER_BUF)[1] = ((u32*)i_osIrqVeneer)[1];
|
||||
|
||||
reg_OS_IE = 0;
|
||||
#ifdef SDK_ARM11
|
||||
{
|
||||
u32 num = OS_INTR_ID_NUM;
|
||||
u32 conf = 0;
|
||||
int i;
|
||||
|
||||
for ( i=0; i<MATH_ROUNDUP(num, 32)/32; i++ )
|
||||
{
|
||||
reg_OS_IDR_CLR_IE[i] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_PND[i] = HW_IDR_WORD_MASK;
|
||||
}
|
||||
|
||||
for ( i=0; i<num; i++ )
|
||||
{
|
||||
reg_OS_IDR_TGT[i] = REG_OS_IDR_TGT0_C0_MASK;
|
||||
reg_OS_IDR_PRIO[i] = OS_IDR_INTR_PRIO_DEFAULT << 4;
|
||||
}
|
||||
for ( i=0; i<32; i+=2 )
|
||||
{
|
||||
conf |= (HW_IDR_INTR_RISE_EDGE | HW_IDR_INTR_1_N_MODEL) << i;
|
||||
}
|
||||
for ( i=0; i<MATH_ROUNDUP(num, 16)/16; i++ )
|
||||
{
|
||||
reg_OS_IDR_CFG[i] = conf;
|
||||
}
|
||||
}
|
||||
reg_OS_IDR_CNT = REG_OS_IDR_CNT_E_MASK;
|
||||
|
||||
reg_OS_CPUI_PRIO = 15 << REG_OS_CPUI_PRIO_THLD_SHIFT;
|
||||
reg_OS_CPUI_BP = HW_CPUIBP_CMP_PRIO_ALL_BITS;
|
||||
reg_OS_CPUI_CNT = REG_OS_CPUI_CNT_E_MASK;
|
||||
|
||||
#else // SDK_ARM9
|
||||
reg_OS_IE = 0;
|
||||
reg_OS_IF = 0xffffffff;
|
||||
|
||||
#endif // SDK_ARM9
|
||||
|
||||
(void)osEnableInterrupts();
|
||||
}
|
||||
}
|
||||
@ -88,16 +122,17 @@ asm void i_osIrqVeneer( void )
|
||||
OSIntrMask osSetInterruptMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
#ifdef SDK_ARM11
|
||||
OSIntrMask prep = reg_OS_IDR_SET_IE_ALL;
|
||||
reg_OS_IDR_CLR_IE[0] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_IE[1] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_IE[2] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_IE[3] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_SET_IE_ALL = mask;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
reg_OS_IE = mask;
|
||||
#else // MPCORE
|
||||
OSIntrMask prep = reg_OS_IDR_SET_ENABLE_ST;
|
||||
reg_OS_IDR_CLR_ENABLE_WP[0] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_ENABLE_WP[1] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_CLR_ENABLE_WP[2] = HW_IDR_WORD_MASK;
|
||||
reg_OS_IDR_SET_ENABLE_ST = mask;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return prep;
|
||||
@ -116,13 +151,13 @@ OSIntrMask osSetInterruptMask( OSIntrMask mask )
|
||||
OSIntrMask osEnableInterruptMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
#ifdef SDK_ARM11
|
||||
OSIntrMask prep = reg_OS_IDR_SET_IE_ALL;
|
||||
reg_OS_IDR_SET_IE_ALL = mask;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
reg_OS_IE = prep | mask;
|
||||
#else // MPCORE
|
||||
OSIntrMask prep = reg_OS_IDR_SET_ENABLE_ST;
|
||||
reg_OS_IDR_SET_ENABLE_ST = mask;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return prep;
|
||||
@ -141,13 +176,13 @@ OSIntrMask osEnableInterruptMask( OSIntrMask mask )
|
||||
OSIntrMask osDisableInterruptMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
#ifdef SDK_ARM11
|
||||
OSIntrMask prep = reg_OS_IDR_SET_IE_ALL;
|
||||
reg_OS_IDR_CLR_IE_ALL = mask;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
reg_OS_IE = prep & ~mask;
|
||||
#else // MPCORE
|
||||
OSIntrMask prep = reg_OS_IDR_CLR_ENABLE_ST;
|
||||
reg_OS_IDR_CLR_ENABLE_ST = mask;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return prep;
|
||||
@ -165,21 +200,21 @@ OSIntrMask osDisableInterruptMask( OSIntrMask mask )
|
||||
|
||||
BOOL osEnableInterruptID( OSIntrID id )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
BOOL retval;
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_SET_IE[ofs] = 1 << sft;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
|
||||
retval = TRUE & (BOOL)(prep >> id);
|
||||
reg_OS_IE = prep | (1 << id);
|
||||
#else // MPCORE
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_ENABLE_WP[ofs] >> sft);
|
||||
reg_OS_IDR_SET_ENABLE_WP[ofs] = 1 << sft;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
@ -197,21 +232,21 @@ BOOL osEnableInterruptID( OSIntrID id )
|
||||
|
||||
BOOL osDisableInterruptID( OSIntrID id )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
BOOL retval;
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_CLR_IE[ofs] = 1 << sft;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
|
||||
retval = TRUE & (BOOL)(prep >> id);
|
||||
reg_OS_IE = prep & ~(1 << id);
|
||||
#else // MPCORE
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_ENABLE_WP[ofs] >> sft);
|
||||
reg_OS_IDR_CLR_ENABLE_WP[ofs] = 1 << sft;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
@ -230,10 +265,24 @@ BOOL osDisableInterruptID( OSIntrID id )
|
||||
|
||||
BOOL osRestoreInterruptID( OSIntrID id, BOOL state )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
BOOL retval;
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_IE[ofs] >> sft);
|
||||
|
||||
if ( state == TRUE )
|
||||
{
|
||||
reg_OS_IDR_SET_IE[ofs] = 1 << sft;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_OS_IDR_CLR_IE[ofs] = 1 << sft;
|
||||
}
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IE;
|
||||
|
||||
retval = TRUE & (BOOL)(prep >> id);
|
||||
if ( state == TRUE )
|
||||
@ -244,22 +293,7 @@ BOOL osRestoreInterruptID( OSIntrID id, BOOL state )
|
||||
{
|
||||
reg_OS_IE = prep & ~(state << id);
|
||||
}
|
||||
#else // MPCORE
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_ENABLE_WP[ofs] >> sft);
|
||||
|
||||
if ( state == TRUE )
|
||||
{
|
||||
reg_OS_IDR_SET_ENABLE_WP[ofs] = 1 << sft;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_OS_IDR_CLR_ENABLE_WP[ofs] = 1 << sft;
|
||||
}
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
@ -282,13 +316,13 @@ BOOL osRestoreInterruptID( OSIntrID id, BOOL state )
|
||||
OSIntrMask osClearInterruptPendingMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
#ifdef SDK_ARM11
|
||||
OSIntrMask prep = reg_OS_IDR_SET_PND_ALL;
|
||||
reg_OS_IDR_CLR_PND_ALL = mask;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IF;
|
||||
reg_OS_IF = mask;
|
||||
#else // MPCORE
|
||||
OSIntrMask prep = reg_OS_IDR_SET_PENDING_ST;
|
||||
reg_OS_IDR_CLR_PENDING_ST = mask;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return prep;
|
||||
@ -307,30 +341,139 @@ OSIntrMask osClearInterruptPendingMask( OSIntrMask mask )
|
||||
BOOL osClearInterruptPendingID( OSIntrID id )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IF;
|
||||
BOOL retval;
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_CLR_PND[ofs] = 1 << sft;
|
||||
#else // SDK_ARM9
|
||||
OSIntrMask prep = reg_OS_IF;
|
||||
|
||||
retval = TRUE & (BOOL)(prep >> id);
|
||||
reg_OS_IF = (u32)(1 << id);
|
||||
#else // MPCORE
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PENDING_WP[ofs] >> sft);
|
||||
reg_OS_IDR_CLR_PENDING_WP[ofs] = 1 << sft;
|
||||
#endif // MPCORE
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef SDK_ARM11
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptPendingID
|
||||
|
||||
Description: set Interrupt Set Pending Register
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: TRUE if last state is pending
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osSetInterruptPendingID( OSIntrID id )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
reg_OS_IDR_SET_PND[ofs] = 1 << sft;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osRestoreInterruptPendingID
|
||||
|
||||
Description: restore Interrupt Pending
|
||||
|
||||
Arguments: id : Interrupt Distributor ID
|
||||
state : state whether interrupt is enabled
|
||||
|
||||
Returns: TRUE if last state is pending
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
BOOL osRestoreInterruptPendingID( OSIntrID id, BOOL state )
|
||||
{
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
BOOL retval;
|
||||
|
||||
retval = TRUE & (reg_OS_IDR_SET_PND[ofs] >> sft);
|
||||
|
||||
if ( state == TRUE )
|
||||
{
|
||||
reg_OS_IDR_SET_PND[ofs] = 1 << sft;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_OS_IDR_CLR_PND[ofs] = 1 << sft;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetEndOfInterruptRegister
|
||||
|
||||
Description: set ID to End of Interrupt Register
|
||||
|
||||
change state to Inactive.
|
||||
|
||||
Arguments: Interrupt Distributor ID
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void osSetEndOfInterruptRegister( OSIntrID id )
|
||||
{
|
||||
reg_OS_CPUI_EOI = id;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: i_osReadHighestPendingInterruptRegister
|
||||
|
||||
Description: read ID from Highest Pending Interrupt Register
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: Interrupt Distributor ID
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
OSIntrID i_osReadHighestPendingInterruptRegister( void )
|
||||
{
|
||||
return (OSIntrID)(reg_OS_CPUI_HI_PND & REG_OS_CPUI_HI_PND_ID_MASK);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: i_osReadInterruptAcknowledgeRegister
|
||||
|
||||
Description: read ID from Interrupt Acknowledge Register
|
||||
|
||||
get interrupt ID and change state to NotPending and Active.
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: Interrupt Distributor ID
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
OSIntrID i_osReadInterruptAcknowledgeRegister( void )
|
||||
{
|
||||
return (OSIntrID)(reg_OS_CPUI_ACK & REG_OS_CPUI_ACK_ID_MASK);
|
||||
}
|
||||
|
||||
#endif // SDK_ARM11
|
||||
|
||||
|
||||
//================================================================================
|
||||
// IRQ CHEKE BUFFER
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptCheckFlag
|
||||
Name: osSetInterruptCheckID
|
||||
|
||||
Description: set irq flag to check being called
|
||||
|
||||
@ -338,15 +481,106 @@ BOOL osClearInterruptPendingID( OSIntrID id )
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osSetInterruptCheckFlag( OSIntrMask mask )
|
||||
BOOL osSetInterruptCheckID( OSIntrID id )
|
||||
{
|
||||
BOOL retval;
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
u32 *buf = &((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[ofs];
|
||||
#else // SDK_ARM9
|
||||
u32 sft = id;
|
||||
u32 *buf = (OSIntrMask *)HW_INTR_CHECK_BUF;
|
||||
#endif // SDK_ARM9
|
||||
|
||||
retval = TRUE & (*buf >> sft);
|
||||
*buf |= 1 << sft;
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptCheckID
|
||||
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osClearInterruptCheckID( OSIntrID id )
|
||||
{
|
||||
BOOL retval;
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
u32 *buf = &((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[ofs];
|
||||
#else // SDK_ARM9
|
||||
u32 sft = id;
|
||||
u32 *buf = (OSIntrMask *)HW_INTR_CHECK_BUF;
|
||||
#endif // SDK_ARM9
|
||||
|
||||
retval = TRUE & (*buf >> sft);
|
||||
*buf &= ~(1 << sft);
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckID
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckID( OSIntrID id )
|
||||
{
|
||||
BOOL retval;
|
||||
#ifdef SDK_ARM11
|
||||
u32 ofs = id/32;
|
||||
u32 sft = id%32;
|
||||
u32 *buf = &((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[ofs];
|
||||
#else // SDK_ARM9
|
||||
u32 sft = id;
|
||||
u32 *buf = (OSIntrMask *)HW_INTR_CHECK_BUF;
|
||||
#endif // SDK_ARM9
|
||||
|
||||
retval = TRUE & (*buf >> sft);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptCheckMask
|
||||
|
||||
Description: set irq flag to check being called
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osSetInterruptCheckMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
*(vu32 *)HW_INTR_CHECK_BUF |= (u32)mask;
|
||||
#ifdef SDK_ARM11
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[0] |= mask.w[0];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[1] |= mask.w[1];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[2] |= mask.w[2];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[3] |= mask.w[3];
|
||||
#else // SDK_ARM9
|
||||
*(OSIntrMask *)HW_INTR_CHECK_BUF |= mask;
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptCheckFlag
|
||||
Name: osClearInterruptCheckMask
|
||||
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
@ -354,18 +588,51 @@ void osSetInterruptCheckFlag( OSIntrMask mask )
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osClearInterruptCheckFlag( OSIntrMask mask )
|
||||
void osClearInterruptCheckMask( OSIntrMask mask )
|
||||
{
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
*(vu32 *)HW_INTR_CHECK_BUF &= (u32)~mask;
|
||||
#ifdef SDK_ARM11
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[0] &= ~mask.w[0];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[1] &= ~mask.w[1];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[2] &= ~mask.w[2];
|
||||
((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[3] &= ~mask.w[3];
|
||||
#else // SDK_ARM9
|
||||
*(OSIntrMask *)HW_INTR_CHECK_BUF &= ~mask;
|
||||
#endif // SDK_ARM9
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckMask
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be cleared
|
||||
|
||||
Returns: TRUE if irq flag exists
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckMask( OSIntrMask mask )
|
||||
{
|
||||
u32 tmp;
|
||||
#ifdef SDK_ARM11
|
||||
OSIntrMode enabled = osDisableInterrupts();
|
||||
tmp = ((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[0] & mask.w[0];
|
||||
tmp |= ((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[1] & mask.w[1];
|
||||
tmp |= ((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[2] & mask.w[2];
|
||||
tmp |= ((OSIntrMask *)HW_INTR_CHECK0_BUF)->w[3] & mask.w[3];
|
||||
(void)osRestoreInterrupts( enabled );
|
||||
#else // SDK_ARM9
|
||||
tmp = osGetInterruptCheckMask() & mask;
|
||||
#endif // SDK_ARM9
|
||||
|
||||
return tmp ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// WAIT
|
||||
//============================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterrupt
|
||||
Name: osWaitInterruptID
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
@ -377,23 +644,56 @@ void osClearInterruptCheckFlag( OSIntrMask mask )
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterrupt( BOOL clear, OSIntrMask irqFlags )
|
||||
void osWaitInterruptID( BOOL clear, OSIntrID id )
|
||||
{
|
||||
OSIntrMode cpsrIrq = osDisableInterrupts();
|
||||
|
||||
if (clear)
|
||||
{
|
||||
(void)osClearInterruptCheckFlag( irqFlags );
|
||||
(void)osClearInterruptCheckID( id );
|
||||
}
|
||||
|
||||
while (!(osGetInterruptCheckFlag() & irqFlags))
|
||||
while (! osIsInterruptCheckID(id) )
|
||||
{
|
||||
osHalt();
|
||||
(void)osEnableInterrupts();
|
||||
(void)osDisableInterrupts();
|
||||
}
|
||||
|
||||
(void)osClearInterruptCheckFlag( irqFlags );
|
||||
(void)osClearInterruptCheckID( id );
|
||||
(void)osRestoreInterrupts( cpsrIrq );
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptMask
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
OS_WaitInterrupt wait by using OS_Halt().
|
||||
|
||||
Arguments: clear TRUE if want to clear interrupt flag before wait.
|
||||
FALSE if not.
|
||||
irqFlags bit of interrupts to wait for
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterruptMask( BOOL clear, OSIntrMask irqFlags )
|
||||
{
|
||||
OSIntrMode cpsrIrq = osDisableInterrupts();
|
||||
|
||||
if (clear)
|
||||
{
|
||||
(void)osClearInterruptCheckMask( irqFlags );
|
||||
}
|
||||
|
||||
while (! osIsInterruptCheckMask(irqFlags) )
|
||||
{
|
||||
osHalt();
|
||||
(void)osEnableInterrupts();
|
||||
(void)osDisableInterrupts();
|
||||
}
|
||||
|
||||
(void)osClearInterruptCheckMask( irqFlags );
|
||||
(void)osRestoreInterrupts( cpsrIrq );
|
||||
}
|
||||
|
||||
|
||||
@ -18,19 +18,9 @@
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//---- timer number tick uses
|
||||
#define OSi_TICK_TIMER OS_TIMER_0
|
||||
|
||||
#ifdef SDK_ARM11
|
||||
//---- timer interrupt ID
|
||||
#define OSi_TICK_IE_TIMER_ID OS_INTR_ID_TIMER
|
||||
|
||||
#else // SDK_ARM9
|
||||
//---- timer interrupt ID
|
||||
#define OSi_TICK_IE_TIMER_ID OS_INTR_ID_TIMER0
|
||||
|
||||
#ifdef SDK_ARM9
|
||||
//---- timer interrupt mask (must be same number with OSi_TICK_TIMER)
|
||||
#define OSi_TICK_IE_TIMER REG_OS_IF_T0_MASK
|
||||
#define OSi_TICK_IE_TIMER (OS_IE_TIMER0 << OSi_TICK_TIMER)
|
||||
|
||||
//---- timer control setting for tick
|
||||
#define OSi_TICK_TIMERCONTROL ( REG_OS_TM0CNT_H_E_MASK | REG_OS_TM0CNT_H_I_MASK | OS_TIMER_PRESCALER_64 )
|
||||
|
||||
@ -150,6 +150,86 @@ BOOL osRestoreInterruptPendingID( OSIntrID id, BOOL state );
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osSetEndOfInterruptRegister( OSIntrID id );
|
||||
|
||||
//================================================================================
|
||||
// WAIT FOR INTERRUPT
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptID
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
OS_WaitInterrupt wait by using OS_Halt().
|
||||
|
||||
Arguments: clear TRUE if want to clear interrupt flag before wait.
|
||||
FALSE if not.
|
||||
irqFlags bit of interrupts to wait for
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterruptID( BOOL clear, OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptMask
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
OS_WaitInterrupt wait by using OS_Halt().
|
||||
|
||||
Arguments: clear TRUE if want to clear interrupt flag before wait.
|
||||
FALSE if not.
|
||||
irqFlags bit of interrupts to wait for
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterruptMask( BOOL clear, OSIntrMask irqFlags );
|
||||
|
||||
//================================================================================
|
||||
// INTERRUPT FLAG (INCLUDING TO WAIT FOR INTERRUPT)
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptCheckID
|
||||
|
||||
Description: set irq flag to check being called
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osSetInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptCheckID
|
||||
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osClearInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckID
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckMask
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be cleared
|
||||
|
||||
Returns: TRUE if irq flag exists
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckMask( OSIntrMask mask );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -25,9 +25,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define reg_OS_IDR_SET_IE (( REGType32v *) REG_IDR_SET_IE0_ADDR)
|
||||
#define reg_OS_IDR_SET_IE_ALL (*( REGType128v *) REG_IDR_SET_IE0_ADDR)
|
||||
#define reg_OS_IDR_CLR_IE (( REGType32v *) REG_IDR_CLR_IE0_ADDR)
|
||||
#define reg_OS_IDR_CLR_IE_ALL (*( REGType128v *) REG_IDR_CLR_IE0_ADDR)
|
||||
#define reg_OS_IDR_SET_PND (( REGType32v *) REG_IDR_SET_PND0_ADDR)
|
||||
#define reg_OS_IDR_SET_PND_ALL (*( REGType128v *) REG_IDR_SET_PND0_ADDR)
|
||||
#define reg_OS_IDR_CLR_PND (( REGType32v *) REG_IDR_CLR_PND0_ADDR)
|
||||
#define reg_OS_IDR_CLR_PND_ALL (*( REGType128v *) REG_IDR_CLR_PND0_ADDR)
|
||||
#define reg_OS_IDR_ACT (( REGType32v *) REG_IDR_ACT0_ADDR)
|
||||
#define reg_OS_IDR_TGT (( REGType8v *) REG_IDR_TGT0_ADDR)
|
||||
#define reg_OS_IDR_PRIO (( REGType8v *) REG_IDR_PRIO0_ADDR)
|
||||
@ -50,11 +54,8 @@ extern "C" {
|
||||
#define HW_CPUIBP_CMP_PRIO_7 6 // Only bits [7] of priority are compared for pre-emption
|
||||
#define HW_CPUIBP_NO_PREEMPT 7 // No pre-emption is performed
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 w[6];
|
||||
}
|
||||
OSIntrMask;
|
||||
|
||||
typedef u128 OSIntrMask;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@ -236,7 +236,7 @@ OSIntrFunction osGetInterruptHandler( OSIntrID id );
|
||||
// INTERRUPT CHECK
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptCheckFlag
|
||||
Name: osSetInterruptCheckID
|
||||
|
||||
Description: set irq flag to check being called
|
||||
|
||||
@ -244,10 +244,43 @@ OSIntrFunction osGetInterruptHandler( OSIntrID id );
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osSetInterruptCheckFlag( OSIntrMask intr );
|
||||
BOOL osSetInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptCheckFlag
|
||||
Name: osClearInterruptCheckID
|
||||
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osClearInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckID
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osSetInterruptCheckMask
|
||||
|
||||
Description: set irq flag to check being called
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osSetInterruptCheckMask( OSIntrMask intr );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osClearInterruptCheckMask
|
||||
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
@ -255,10 +288,10 @@ void osSetInterruptCheckFlag( OSIntrMask intr );
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osClearInterruptCheckFlag( OSIntrMask mask );
|
||||
void osClearInterruptCheckMask( OSIntrMask mask );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osGetInterruptCheckFlag
|
||||
Name: osGetInterruptCheckMask
|
||||
|
||||
Description: get irq factors stored in HW_INTR_CHECK_BUF
|
||||
|
||||
@ -266,7 +299,7 @@ void osClearInterruptCheckFlag( OSIntrMask mask );
|
||||
|
||||
Returns: irq flags factors in HW_INTR_CHECK_BUG
|
||||
*---------------------------------------------------------------------------*/
|
||||
static inline OSIntrMask osGetInterruptCheckFlag( void )
|
||||
static inline OSIntrMask osGetInterruptCheckMask( void )
|
||||
{
|
||||
return *(OSIntrMask *)HW_INTR_CHECK_BUF;
|
||||
}
|
||||
@ -275,7 +308,7 @@ static inline OSIntrMask osGetInterruptCheckFlag( void )
|
||||
// WAIT FOR INTERRUPT
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterrupt
|
||||
Name: osWaitInterruptID
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
@ -287,45 +320,69 @@ static inline OSIntrMask osGetInterruptCheckFlag( void )
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterrupt( BOOL clear, OSIntrMask irqFlags );
|
||||
void osWaitInterruptID( BOOL clear, OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptMask
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
OS_WaitInterrupt doesn't switch thread.
|
||||
OS_WaitInterrupt wait by using OS_Halt().
|
||||
|
||||
Arguments: clear TRUE if want to clear interrupt flag before wait.
|
||||
FALSE if not.
|
||||
irqFlags bit of interrupts to wait for
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
void osWaitInterruptMask( BOOL clear, OSIntrMask irqFlags );
|
||||
|
||||
//================================================================================
|
||||
// INTERRUPT FLAG (INCLUDING TO WAIT FOR INTERRUPT)
|
||||
//================================================================================
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osInitIntrFlag
|
||||
Name: osSetInterruptCheckID
|
||||
|
||||
Description: Initialize eventflag and task for interrupts
|
||||
Description: set irq flag to check being called
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: TRUE if success.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osInitIntrFlag( void );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptID
|
||||
|
||||
Description: wait specifiled interrupt.
|
||||
|
||||
Arguments: id interrupt ID to wait
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osWaitInterruptID( int id );
|
||||
BOOL osSetInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osWaitInterruptMask
|
||||
Name: osClearInterruptCheckID
|
||||
|
||||
Description: wait specifiled mask for interrupts.
|
||||
supported only 0-31
|
||||
Description: clear irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: mask interrupt mask to wait
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: received interrupt mask, 0 if failed.
|
||||
NOTE: non-waiting interrupt bits may set
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
OSIntrMask osWaitInterruptMask( OSIntrMask mask );
|
||||
BOOL osClearInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckID
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be set
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckID( OSIntrID id );
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osIsInterruptCheckMask
|
||||
|
||||
Description: check irq flag stored in HW_INTR_CHECK_BUF
|
||||
|
||||
Arguments: irq factors to be cleared
|
||||
|
||||
Returns: TRUE if irq flag exists
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL osIsInterruptCheckMask( OSIntrMask mask );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -26,6 +26,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//---- timer number alarm uses
|
||||
#define OSi_ALARM_TIMER OS_TIMER_1
|
||||
|
||||
//---- timer interrupt ID
|
||||
#ifdef SDK_ARM11
|
||||
#define OSi_ALARM_IE_TIMER_ID ((OSIntrID)(OS_INTR_ID_TIMER + OSi_ALARM_TIMER))
|
||||
#else // SDK_ARM9
|
||||
#define OSi_ALARM_IE_TIMER_ID ((OSIntrID)(OS_INTR_ID_TIMER0 + OSi_ALARM_TIMER))
|
||||
#endif // SDK_ARM9
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
//---- Alarm Handler
|
||||
typedef void (*OSAlarmHandler) (void *);
|
||||
|
||||
@ -162,7 +162,7 @@ void i_osWaitCpuCycles( OSCpuCycle cycle );
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
extern void osTerminate(void);
|
||||
void osTerminate(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osHalt
|
||||
@ -173,7 +173,23 @@ extern void osTerminate(void);
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
extern void osHalt(void);
|
||||
void osHalt(void);
|
||||
|
||||
#ifdef SDK_ARM11
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osHaltUntilEvent
|
||||
|
||||
Description: Halt CPU Core until Event
|
||||
|
||||
Arguments: None
|
||||
|
||||
Returns: None
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
void osHaltUntilEvent( void );
|
||||
|
||||
#endif // SDK_ARM11
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: osExit
|
||||
@ -185,7 +201,7 @@ extern void osHalt(void);
|
||||
|
||||
Returns: -- (Never return)
|
||||
*---------------------------------------------------------------------------*/
|
||||
extern void osExit(int status);
|
||||
void osExit(int status);
|
||||
|
||||
|
||||
#endif /* SDK_ASM */
|
||||
|
||||
@ -38,6 +38,17 @@ extern u64 osGetTick( void );
|
||||
extern void i_osSetTick( u64 );
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//---- timer number tick uses
|
||||
#define OSi_TICK_TIMER OS_TIMER_0
|
||||
|
||||
//---- timer interrupt ID
|
||||
#ifdef SDK_ARM11
|
||||
#define OSi_TICK_IE_TIMER_ID ((OSIntrID)(OS_INTR_ID_TIMER + OSi_TICK_TIMER))
|
||||
#else // SDK_ARM9
|
||||
#define OSi_TICK_IE_TIMER_ID ((OSIntrID)(OS_INTR_ID_TIMER0 + OSi_TICK_TIMER))
|
||||
#endif // SDK_ARM9
|
||||
|
||||
//---- conversion tick count <-> real time count
|
||||
#ifdef SDK_ARM11
|
||||
#define OS_TICK_CLOCK HW_CPU_CLOCK
|
||||
|
||||
@ -36,9 +36,9 @@ extern "C" {
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_UDEF_VENEER 0x18
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_IABT_VENEER 0x20
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_DABT_VENEER 0x28
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_START_VECTOR1 0x54
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK0 0x58
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK1 0x5c
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_START_VECTOR1 0x3c
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK1 0x40
|
||||
#define HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK0 0x50
|
||||
|
||||
//---- system reserved area
|
||||
#define HW_INTR_VENEER_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_INTR_VENEER)
|
||||
@ -48,8 +48,8 @@ extern "C" {
|
||||
#define HW_DABT_VENEER_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_DABT_VENEER)
|
||||
#define HW_UDEF_VENEER_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_UDEF_VENEER)
|
||||
#define HW_START_VECTOR1_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_START_VECTOR1)
|
||||
#define HW_INTR_CHECK0_PTR (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK0)
|
||||
#define HW_INTR_CHECK1_PTR (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK1)
|
||||
#define HW_INTR_CHECK0_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK0)
|
||||
#define HW_INTR_CHECK1_BUF (HW_AXI_WRAM_SYSRV + HW_AXI_WRAM_SYSRV_OFS_INTR_CHECK1)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -67,6 +67,25 @@ typedef volatile s64 vs64;
|
||||
typedef float f32;
|
||||
typedef volatile f32 vf32;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 w[3];
|
||||
}
|
||||
u96;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 w[4];
|
||||
}
|
||||
u128;
|
||||
|
||||
typedef volatile u96 vu96;
|
||||
typedef volatile u128 vu128;
|
||||
|
||||
/*
|
||||
io_register_list_XX.hで使用するマクロと型
|
||||
*/
|
||||
|
||||
/*
|
||||
io_register_list_XX.hで使用するマクロと型
|
||||
*/
|
||||
@ -75,11 +94,15 @@ typedef u8 REGType8;
|
||||
typedef u16 REGType16;
|
||||
typedef u32 REGType32;
|
||||
typedef u64 REGType64;
|
||||
typedef u96 REGType96;
|
||||
typedef u128 REGType128;
|
||||
|
||||
typedef vu8 REGType8v;
|
||||
typedef vu16 REGType16v;
|
||||
typedef vu32 REGType32v;
|
||||
typedef vu64 REGType64v;
|
||||
typedef vu96 REGType96v;
|
||||
typedef vu128 REGType128v;
|
||||
|
||||
|
||||
#ifndef SDK_BOOL_ALREADY_DEFINED_
|
||||
|
||||
Loading…
Reference in New Issue
Block a user