mirror of
https://github.com/rvtr/ctr_firmware.git
synced 2025-10-31 07:51:08 -04:00
ARM11へTick追加。
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@100 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
parent
e781b2f723
commit
77f8f44746
@ -28,14 +28,15 @@ BROM_CODEGEN_ALL ?= TRUE
|
|||||||
SRCDIR = . ../common
|
SRCDIR = . ../common
|
||||||
|
|
||||||
SRCS = \
|
SRCS = \
|
||||||
os_thread.c \
|
os_tick.c \
|
||||||
os_context.c \
|
|
||||||
os_init.c \
|
os_init.c \
|
||||||
os_system.c \
|
os_system.c \
|
||||||
os_timer.c \
|
os_timer.c \
|
||||||
os_irqHandler.c \
|
os_irqHandler.c \
|
||||||
os_interrupt.c \
|
os_interrupt.c \
|
||||||
os_interrupt_common.c \
|
os_interrupt_common.c \
|
||||||
|
os_thread.c \
|
||||||
|
os_context.c \
|
||||||
|
|
||||||
TARGET_LIB = libos$(BROM_LIBSUFFIX).a
|
TARGET_LIB = libos$(BROM_LIBSUFFIX).a
|
||||||
|
|
||||||
|
|||||||
@ -31,8 +31,6 @@ BROM_PROC = ARM9
|
|||||||
SRCDIR = . ../common
|
SRCDIR = . ../common
|
||||||
|
|
||||||
SRCS = \
|
SRCS = \
|
||||||
os_thread.c \
|
|
||||||
os_context.c \
|
|
||||||
os_init.c \
|
os_init.c \
|
||||||
os_system.c \
|
os_system.c \
|
||||||
os_timer.c \
|
os_timer.c \
|
||||||
@ -40,6 +38,8 @@ SRCS = \
|
|||||||
os_irqHandler.c \
|
os_irqHandler.c \
|
||||||
os_interrupt.c \
|
os_interrupt.c \
|
||||||
os_interrupt_common.c \
|
os_interrupt_common.c \
|
||||||
|
os_thread.c \
|
||||||
|
os_context.c \
|
||||||
|
|
||||||
TARGET_LIB = libos_sp$(BROM_LIBSUFFIX).a
|
TARGET_LIB = libos_sp$(BROM_LIBSUFFIX).a
|
||||||
|
|
||||||
|
|||||||
@ -31,23 +31,23 @@
|
|||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void osInitBROM(void)
|
void osInitBROM(void)
|
||||||
{
|
{
|
||||||
|
static BOOL isInit;
|
||||||
|
|
||||||
|
if ( isInit == FALSE )
|
||||||
|
{
|
||||||
|
isInit = TRUE;
|
||||||
|
|
||||||
#ifdef SDK_ARM9
|
#ifdef SDK_ARM9
|
||||||
|
|
||||||
#ifdef BROM_DEBUG_ITCM
|
#ifdef BROM_DEBUG_ITCM
|
||||||
MI_CpuFillFast( (void*)HW_ITCM, 0, HW_ITCM_SIZE );
|
MI_CpuFillFast( (void*)HW_ITCM, 0, HW_ITCM_SIZE );
|
||||||
#endif // BROM_DEBUG_ITCM
|
#endif // BROM_DEBUG_ITCM
|
||||||
|
|
||||||
#else // SDK_ARM7
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
//---- Init Exception System
|
|
||||||
// the exception vecter of ARM9 is in the noninitialized main memory.
|
|
||||||
// osInitException();
|
|
||||||
|
|
||||||
#endif // SDK_ARM7
|
|
||||||
|
|
||||||
//---- Init Interrupt
|
|
||||||
osInitInterrupt();
|
|
||||||
|
|
||||||
|
osInitInterrupt();
|
||||||
|
// osInitTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
|
|||||||
@ -18,17 +18,23 @@
|
|||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
//---- timer control setting for tick
|
#ifdef SDK_ARM11
|
||||||
#define OSi_TICK_TIMERCONTROL ( REG_OS_TM0CNT_H_E_MASK | REG_OS_TM0CNT_H_I_MASK | OS_TIMER_PRESCALER_64 )
|
//---- timer interrupt ID
|
||||||
|
#define OSi_TICK_IE_TIMER_ID OS_INTR_ID_TIMER
|
||||||
|
|
||||||
//---- timer number tick uses
|
#else // SDK_ARM9
|
||||||
#define OSi_TICK_TIMER OS_TIMER_3
|
//---- timer interrupt ID
|
||||||
|
#define OSi_TICK_IE_TIMER_ID OS_INTR_ID_TIMER0
|
||||||
|
|
||||||
//---- timer interrupt mask (must be same number with OSi_TICK_TIMER)
|
//---- timer interrupt mask (must be same number with OSi_TICK_TIMER)
|
||||||
#define OSi_TICK_IE_TIMER REG_OS_IF_T3_MASK
|
#define OSi_TICK_IE_TIMER REG_OS_IF_T0_MASK
|
||||||
|
|
||||||
//---- timer interrupt ID
|
//---- timer number tick uses
|
||||||
#define OSi_TICK_IE_TIMER_ID OS_INTR_ID_TIMER3
|
#define OSi_TICK_TIMER OS_TIMER_0
|
||||||
|
|
||||||
|
//---- 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 )
|
||||||
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
//---- flag for initialization tick
|
//---- flag for initialization tick
|
||||||
static u16 i_osUseTick = FALSE;
|
static u16 i_osUseTick = FALSE;
|
||||||
@ -59,6 +65,9 @@ void osInitTick(void)
|
|||||||
{
|
{
|
||||||
i_osUseTick = TRUE;
|
i_osUseTick = TRUE;
|
||||||
|
|
||||||
|
#ifdef SDK_ARM11
|
||||||
|
osStartTimerWithMSec(1, 0);
|
||||||
|
#else // SDK_ARM9
|
||||||
//---- OS reserves OSi_TICK_TIMER timer
|
//---- OS reserves OSi_TICK_TIMER timer
|
||||||
SDK_ASSERT(!i_osIsTimerReserved(OSi_TICK_TIMER));
|
SDK_ASSERT(!i_osIsTimerReserved(OSi_TICK_TIMER));
|
||||||
i_osSetTimerReserved(OSi_TICK_TIMER);
|
i_osSetTimerReserved(OSi_TICK_TIMER);
|
||||||
@ -68,9 +77,10 @@ void osInitTick(void)
|
|||||||
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
||||||
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)0);
|
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)0);
|
||||||
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
||||||
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
//---- set interrupt callback
|
//---- set interrupt callback
|
||||||
osSetInterruptHandler( OS_INTR_ID_TIMER3, i_osCountUpTick );
|
osSetInterruptHandler( OSi_TICK_IE_TIMER_ID, i_osCountUpTick );
|
||||||
|
|
||||||
//---- enable timer interrupt
|
//---- enable timer interrupt
|
||||||
osEnableInterruptID(OSi_TICK_IE_TIMER_ID);
|
osEnableInterruptID(OSi_TICK_IE_TIMER_ID);
|
||||||
@ -111,9 +121,14 @@ static void i_osCountUpTick(void)
|
|||||||
//---- setting for timer
|
//---- setting for timer
|
||||||
if (i_osNeedResetTimer)
|
if (i_osNeedResetTimer)
|
||||||
{
|
{
|
||||||
|
#ifdef SDK_ARM11
|
||||||
|
osStopTimer();
|
||||||
|
osStartTimerWithMSec(1, 0);
|
||||||
|
#else // SDK_ARM9
|
||||||
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
||||||
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)0);
|
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)0);
|
||||||
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
||||||
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
i_osNeedResetTimer = FALSE;
|
i_osNeedResetTimer = FALSE;
|
||||||
}
|
}
|
||||||
@ -134,6 +149,9 @@ static void i_osCountUpTick(void)
|
|||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
u64 osGetTick(void)
|
u64 osGetTick(void)
|
||||||
{
|
{
|
||||||
|
#ifdef SDK_ARM11
|
||||||
|
return (i_osTickCounter << 32) | reg_OS_WD_COUNT;
|
||||||
|
#else // SDK_ARM9
|
||||||
vu16 countL;
|
vu16 countL;
|
||||||
vu64 countH;
|
vu64 countH;
|
||||||
|
|
||||||
@ -152,8 +170,10 @@ u64 osGetTick(void)
|
|||||||
(void)osRestoreInterrupts(prev);
|
(void)osRestoreInterrupts(prev);
|
||||||
|
|
||||||
return (countH << 16) | countL;
|
return (countH << 16) | countL;
|
||||||
|
#endif // SDK_ARM9
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SDK_ARM9
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: osGetTickLo
|
Name: osGetTickLo
|
||||||
|
|
||||||
@ -168,6 +188,7 @@ u16 osGetTickLo(void)
|
|||||||
SDK_ASSERT(OSi_UseTick);
|
SDK_ASSERT(OSi_UseTick);
|
||||||
return *(REGType16 *)((u32)REG_TM0CNT_L_ADDR + OSi_TICK_TIMER * 4);
|
return *(REGType16 *)((u32)REG_TM0CNT_L_ADDR + OSi_TICK_TIMER * 4);
|
||||||
}
|
}
|
||||||
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: osSetTick
|
Name: osSetTick
|
||||||
@ -185,15 +206,24 @@ void osSetTick(u64 count)
|
|||||||
SDK_ASSERT(i_osUseTick);
|
SDK_ASSERT(i_osUseTick);
|
||||||
prev = osDisableInterrupts();
|
prev = osDisableInterrupts();
|
||||||
|
|
||||||
reg_OS_IF = OSi_TICK_IE_TIMER;
|
|
||||||
|
|
||||||
i_osNeedResetTimer = TRUE;
|
i_osNeedResetTimer = TRUE;
|
||||||
|
|
||||||
|
#ifdef SDK_ARM11
|
||||||
|
osClearInterruptPending(OSi_TICK_IE_TIMER_ID);
|
||||||
|
|
||||||
|
i_osTickCounter = (u64)(count >> 32);
|
||||||
|
|
||||||
|
osStopTimer();
|
||||||
|
osStartTimerWithMSec((u32)count, 0);
|
||||||
|
#else // SDK_ARM9
|
||||||
|
reg_OS_IF = OSi_TICK_IE_TIMER;
|
||||||
|
|
||||||
i_osTickCounter = (u64)(count >> 16);
|
i_osTickCounter = (u64)(count >> 16);
|
||||||
|
|
||||||
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
i_osSetTimerControl(OSi_TICK_TIMER, 0);
|
||||||
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)(count & 0xffff));
|
i_osSetTimerCount((OSTimer)OSi_TICK_TIMER, (u16)(count & 0xffff));
|
||||||
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
i_osSetTimerControl(OSi_TICK_TIMER, (u16)OSi_TICK_TIMERCONTROL);
|
||||||
|
#endif // SDK_ARM9
|
||||||
|
|
||||||
(void)osRestoreInterrupts(prev);
|
(void)osRestoreInterrupts(prev);
|
||||||
}
|
}
|
||||||
@ -28,8 +28,13 @@ extern "C" {
|
|||||||
#define HW_CPU_CLOCK_ARM11 (67027964 * 4)
|
#define HW_CPU_CLOCK_ARM11 (67027964 * 4)
|
||||||
#define HW_CPU_CLOCK HW_CPU_CLOCK_ARM11
|
#define HW_CPU_CLOCK HW_CPU_CLOCK_ARM11
|
||||||
|
|
||||||
|
#ifndef SDK_MG20EMU
|
||||||
#define HW_ARM11_IC_SIZE 0x4000 // Inst Cache
|
#define HW_ARM11_IC_SIZE 0x4000 // Inst Cache
|
||||||
#define HW_ARM11_DC_SIZE 0x4000 // Data Cache
|
#define HW_ARM11_DC_SIZE 0x4000 // Data Cache
|
||||||
|
#else // SDK_MG20EMU
|
||||||
|
#define HW_ARM11_IC_SIZE 0x8000 // Inst Cache
|
||||||
|
#define HW_ARM11_DC_SIZE 0x8000 // Data Cache
|
||||||
|
#endif // SDK_MG20EMU
|
||||||
#define HW_ARM11_CACHE_LINE_SIZE 32
|
#define HW_ARM11_CACHE_LINE_SIZE 32
|
||||||
|
|
||||||
#define HW_IC_SIZE HW_ARM11_IC_SIZE
|
#define HW_IC_SIZE HW_ARM11_IC_SIZE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user