mirror of
https://github.com/rvtr/twl_wrapsdk.git
synced 2025-10-31 06:11:10 -04:00
add DSP test program to develop DSP code with JTAG
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@174 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
parent
a2b5acb237
commit
1e0ba50ead
@ -44,14 +44,14 @@ static volatile DSPData *const dspData = (DSPData*)REG_APBP_COM0_ADDR;
|
|||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_PowerOn
|
Name: DSP_PowerOn
|
||||||
|
|
||||||
Description: power DSP block on but DSPR yet.
|
Description: power DSP block on but reset yet.
|
||||||
you should call DSP_ResetOff() to boot DSP.
|
you should call DSP_ResetOff() to boot DSP.
|
||||||
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_PowerOn(void)
|
void DSP_PowerOn(void) // DSP_Init
|
||||||
{
|
{
|
||||||
reg_CFG_DSP_RST &= ~REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット確認
|
reg_CFG_DSP_RST &= ~REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット確認
|
||||||
reg_CFG_CLK |= REG_CFG_CLK_DSP_MASK; // DSPブロックの電源On
|
reg_CFG_CLK |= REG_CFG_CLK_DSP_MASK; // DSPブロックの電源On
|
||||||
@ -68,7 +68,7 @@ void DSP_PowerOn(void)
|
|||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_PowerOff(void)
|
void DSP_PowerOff(void) // DSP_End
|
||||||
{
|
{
|
||||||
reg_CFG_DSP_RST &= ~REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット設定
|
reg_CFG_DSP_RST &= ~REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット設定
|
||||||
reg_CFG_CLK &= ~REG_CFG_CLK_DSP_MASK; // DSPブロックの電源Off
|
reg_CFG_CLK &= ~REG_CFG_CLK_DSP_MASK; // DSPブロックの電源Off
|
||||||
@ -77,7 +77,7 @@ void DSP_PowerOff(void)
|
|||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_ResetOn
|
Name: DSP_ResetOn
|
||||||
|
|
||||||
Description: Reset DSP.
|
Description: Reset DSP unless Reset state.
|
||||||
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
|
|
||||||
@ -85,9 +85,12 @@ void DSP_PowerOff(void)
|
|||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_ResetOn(void)
|
void DSP_ResetOn(void)
|
||||||
{
|
{
|
||||||
reg_DSP_PCFG |= REG_DSP_PCFG_DSPR_MASK;
|
if ((reg_DSP_PCFG & REG_DSP_PCFG_DSPR_MASK) == 0)
|
||||||
while ( reg_DSP_PSTS & REG_DSP_PSTS_PRST_MASK )
|
|
||||||
{
|
{
|
||||||
|
reg_DSP_PCFG |= REG_DSP_PCFG_DSPR_MASK;
|
||||||
|
while ( reg_DSP_PSTS & REG_DSP_PSTS_PRST_MASK )
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
@ -119,13 +122,16 @@ void DSP_ResetOff(void)
|
|||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_ResetInterface(void)
|
void DSP_ResetInterface(void)
|
||||||
{
|
{
|
||||||
u16 dummy;
|
if (reg_DSP_PCFG & REG_DSP_PCFG_DSPR_MASK)
|
||||||
reg_DSP_PCFG &= ~REG_DSP_PCFG_RRIE_MASK;
|
{
|
||||||
reg_DSP_PSEM = 0;
|
u16 dummy;
|
||||||
reg_DSP_PCLEAR = 0xFFFF;
|
reg_DSP_PCFG &= ~REG_DSP_PCFG_RRIE_MASK;
|
||||||
dummy = dspData[0].recv;
|
reg_DSP_PSEM = 0;
|
||||||
dummy = dspData[1].recv;
|
reg_DSP_PCLEAR = 0xFFFF;
|
||||||
dummy = dspData[2].recv;
|
dummy = dspData[0].recv;
|
||||||
|
dummy = dspData[1].recv;
|
||||||
|
dummy = dspData[2].recv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
@ -254,7 +260,7 @@ void DSP_DisableFifoInterrupt(DSPFifoIntr type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_SendFifo
|
Name: DSP_SendFifoEx
|
||||||
|
|
||||||
Description: write data into DSP memory space.
|
Description: write data into DSP memory space.
|
||||||
|
|
||||||
@ -268,7 +274,7 @@ void DSP_DisableFifoInterrupt(DSPFifoIntr type)
|
|||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags)
|
void DSP_SendFifoEx(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags)
|
||||||
{
|
{
|
||||||
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_PCFG_AIM_MASK);
|
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_PCFG_AIM_MASK);
|
||||||
|
|
||||||
@ -299,22 +305,22 @@ void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_RecvFifo
|
Name: DSP_RecvFifoEx
|
||||||
|
|
||||||
Description: read data into DSP memory space.
|
Description: read data into DSP memory space.
|
||||||
|
|
||||||
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
||||||
addr: source address (in half words).
|
dest: data to receive.
|
||||||
|
src: source address (in half words).
|
||||||
if you want to set high address, ask DSP to set
|
if you want to set high address, ask DSP to set
|
||||||
DMA register.
|
DMA register.
|
||||||
bufp: data to receive.
|
|
||||||
size: data length to receive (in half words).
|
size: data length to receive (in half words).
|
||||||
ignore unless continuous mode
|
ignore unless continuous mode
|
||||||
flags: bitOR of DSPFifoFlag to specify special mode
|
flags: bitOR of DSPFifoFlag to specify special mode
|
||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags)
|
void DSP_RecvFifoEx(DSPFifoMemSel memsel, u16* dest, u16 src, int size, u16 flags)
|
||||||
{
|
{
|
||||||
DSPFifoRecvLength len;
|
DSPFifoRecvLength len;
|
||||||
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_PCFG_AIM_MASK);
|
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_PCFG_AIM_MASK);
|
||||||
@ -340,7 +346,7 @@ void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_DSP_PADR = addr;
|
reg_DSP_PADR = src;
|
||||||
reg_DSP_PCFG = (u16)((reg_DSP_PCFG & ~(REG_DSP_PCFG_MEMSEL_MASK|REG_DSP_PCFG_DRS_MASK|REG_DSP_PCFG_AIM_MASK))
|
reg_DSP_PCFG = (u16)((reg_DSP_PCFG & ~(REG_DSP_PCFG_MEMSEL_MASK|REG_DSP_PCFG_DRS_MASK|REG_DSP_PCFG_AIM_MASK))
|
||||||
| memsel | len | incmode | REG_DSP_PCFG_RS_MASK);
|
| memsel | len | incmode | REG_DSP_PCFG_RS_MASK);
|
||||||
|
|
||||||
@ -351,7 +357,7 @@ void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags
|
|||||||
while ((reg_DSP_PSTS & REG_DSP_PSTS_RFNEI_MASK) == 0)
|
while ((reg_DSP_PSTS & REG_DSP_PSTS_RFNEI_MASK) == 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*bufp = reg_DSP_PDATA;
|
*dest = reg_DSP_PDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -361,7 +367,7 @@ void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags
|
|||||||
while ((reg_DSP_PSTS & REG_DSP_PSTS_RFNEI_MASK) == 0)
|
while ((reg_DSP_PSTS & REG_DSP_PSTS_RFNEI_MASK) == 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*bufp++ = reg_DSP_PDATA;
|
*dest++ = reg_DSP_PDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reg_DSP_PCFG &= ~REG_DSP_PCFG_RS_MASK;
|
reg_DSP_PCFG &= ~REG_DSP_PCFG_RS_MASK;
|
||||||
|
|||||||
@ -29,6 +29,7 @@ SUBDIRS += \
|
|||||||
aes \
|
aes \
|
||||||
camera \
|
camera \
|
||||||
fatfs \
|
fatfs \
|
||||||
|
dsp \
|
||||||
|
|
||||||
endif # TWL_PLATFORM != DSTEG
|
endif # TWL_PLATFORM != DSTEG
|
||||||
|
|
||||||
|
|||||||
31
build/tests/dsp/Makefile
Normal file
31
build/tests/dsp/Makefile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlSDK - tests - dsp
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 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.
|
||||||
|
#
|
||||||
|
# $Log: $
|
||||||
|
# $NoKeywords: $
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS = dsp-jtag \
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
44
build/tests/dsp/dsp-jtag/ARM7/Makefile
Normal file
44
build/tests/dsp/dsp-jtag/ARM7/Makefile
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlSDK - tests - dsp-jtag
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 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.
|
||||||
|
#
|
||||||
|
# $Log: $
|
||||||
|
# $NoKeywords: $
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS =
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#TWL_CODEGEN = THUMB
|
||||||
|
TWL_PROC = ARM7
|
||||||
|
|
||||||
|
TARGET_BIN = dsp_jtag7.axf
|
||||||
|
|
||||||
|
SRCS = main.c
|
||||||
|
|
||||||
|
#SRCDIR = # using default
|
||||||
|
#LCFILE = # using default
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
do-build: $(TARGETS)
|
||||||
|
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
166
build/tests/dsp/dsp-jtag/ARM7/src/main.c
Normal file
166
build/tests/dsp/dsp-jtag/ARM7/src/main.c
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlSDK - tests - dsp - jtag
|
||||||
|
File: main.c
|
||||||
|
|
||||||
|
Copyright 2007 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.
|
||||||
|
|
||||||
|
$Log: main.c,v $
|
||||||
|
$NoKeywords: $
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <twl_sp.h>
|
||||||
|
#include <twl/snd/ARM7/i2s.h>
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
定数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
// ===== スレッド優先度 =====
|
||||||
|
|
||||||
|
#define THREAD_PRIO_SPI 2
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
内部関数定義
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static OSHeapHandle InitializeAllocateSystem(void);
|
||||||
|
static void VBlankIntr(void);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: TwlSpMain
|
||||||
|
|
||||||
|
Description: Initialize and do main
|
||||||
|
|
||||||
|
Arguments: None.
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void TwlSpMain(void)
|
||||||
|
{
|
||||||
|
OSHeapHandle heapHandle;
|
||||||
|
|
||||||
|
// OS初期化
|
||||||
|
OS_Init();
|
||||||
|
OS_InitThread();
|
||||||
|
|
||||||
|
// PXI初期化、ARM9と同期
|
||||||
|
PXI_Init();
|
||||||
|
|
||||||
|
// ヒープ領域設定
|
||||||
|
heapHandle = InitializeAllocateSystem();
|
||||||
|
|
||||||
|
// ボタン入力サーチ初期化
|
||||||
|
(void)PAD_InitXYButton();
|
||||||
|
|
||||||
|
// 割込み許可
|
||||||
|
(void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||||
|
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||||
|
(void)GX_VBlankIntr(TRUE);
|
||||||
|
(void)OS_EnableIrq();
|
||||||
|
(void)OS_EnableInterrupts();
|
||||||
|
|
||||||
|
// サウンド初期化
|
||||||
|
SND_I2SEnable();
|
||||||
|
SND_I2SSetMixingRatio(0); // dsp only
|
||||||
|
MICi_Init();
|
||||||
|
|
||||||
|
// SPI初期化
|
||||||
|
SPI_Init(THREAD_PRIO_SPI);
|
||||||
|
|
||||||
|
// DSP JTAG
|
||||||
|
reg_CFG_DSP_JTAG = REG_CFG_DSP_JTAG_E_MASK;
|
||||||
|
if (reg_CFG_DSP_JTAG == 0)
|
||||||
|
{
|
||||||
|
OS_TPanic("DSP JTAG cannot be enabled.\n");
|
||||||
|
}
|
||||||
|
OS_TPrintf("DSP JTAG has enabled.\n");
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
OS_Halt();
|
||||||
|
|
||||||
|
//---- check reset
|
||||||
|
if (OS_IsResetOccurred())
|
||||||
|
{
|
||||||
|
OS_ResetSystem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: InitializeAllocateSystem
|
||||||
|
|
||||||
|
Description: メモリ割当てシステムを初期化する。
|
||||||
|
|
||||||
|
Arguments: None.
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static OSHeapHandle InitializeAllocateSystem(void)
|
||||||
|
{
|
||||||
|
void *tempLo;
|
||||||
|
OSHeapHandle hh;
|
||||||
|
|
||||||
|
OS_TPrintf("OS_GetWramSubPrivArenaLo() = %p\n", OS_GetWramSubPrivArenaLo());
|
||||||
|
OS_TPrintf("OS_GetWramSubPrivArenaHi() = %p\n", OS_GetWramSubPrivArenaHi());
|
||||||
|
OS_TPrintf("OS_GetWramSubArenaLo() = %p\n", OS_GetWramSubArenaLo());
|
||||||
|
OS_TPrintf("OS_GetWramSubArenaHi() = %p\n", OS_GetWramSubArenaHi());
|
||||||
|
OS_TPrintf("OS_GetSubPrivArenaLo() = %p\n", OS_GetSubPrivArenaLo());
|
||||||
|
OS_TPrintf("OS_GetSubPrivArenaHi() = %p\n", OS_GetSubPrivArenaHi());
|
||||||
|
|
||||||
|
OS_TPrintf("call OS_SetWramSubPrivArenaHi(0x0380f980); to fix arena.\n");
|
||||||
|
OS_SetWramSubPrivArenaHi((void*)0x0380f980);
|
||||||
|
|
||||||
|
// メモリ割当て初期化
|
||||||
|
tempLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV,
|
||||||
|
OS_GetWramSubPrivArenaLo(), OS_GetWramSubPrivArenaHi(), 1);
|
||||||
|
|
||||||
|
// アリーナを0クリア
|
||||||
|
MI_CpuClear8(tempLo, (u32)OS_GetWramSubPrivArenaHi() - (u32)tempLo);
|
||||||
|
|
||||||
|
// アリーナ下位アドレスを設定
|
||||||
|
OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, tempLo);
|
||||||
|
|
||||||
|
// ヒープ作成
|
||||||
|
hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV,
|
||||||
|
OS_GetWramSubPrivArenaLo(), OS_GetWramSubPrivArenaHi());
|
||||||
|
|
||||||
|
if (hh < 0)
|
||||||
|
{
|
||||||
|
OS_Panic("ARM7: Fail to create heap.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// カレントヒープに設定
|
||||||
|
(void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh);
|
||||||
|
|
||||||
|
return hh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: VBlankIntr
|
||||||
|
|
||||||
|
Description: VBlank interrupt handler
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
extern BOOL PMi_Initialized;
|
||||||
|
void PM_SelfBlinkProc(void);
|
||||||
|
|
||||||
|
static void VBlankIntr(void)
|
||||||
|
{
|
||||||
|
//---- LED blink system
|
||||||
|
if (PMi_Initialized)
|
||||||
|
{
|
||||||
|
PM_SelfBlinkProc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
End of file
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
43
build/tests/dsp/dsp-jtag/ARM9/Makefile
Normal file
43
build/tests/dsp/dsp-jtag/ARM9/Makefile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlSDK - tests - dsp-jtag
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 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.
|
||||||
|
#
|
||||||
|
# $Log: $
|
||||||
|
# $NoKeywords: $
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS =
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#TWL_CODEGEN = THUMB
|
||||||
|
|
||||||
|
TARGET_BIN = dsp_jtag9.axf
|
||||||
|
|
||||||
|
SRCS = main.c
|
||||||
|
|
||||||
|
#SRCDIR = # using default
|
||||||
|
#LCFILE = # using default
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
do-build: $(TARGETS)
|
||||||
|
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
148
build/tests/dsp/dsp-jtag/ARM9/src/main.c
Normal file
148
build/tests/dsp/dsp-jtag/ARM9/src/main.c
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlSDK - SND - tests - channel
|
||||||
|
File: main.c
|
||||||
|
|
||||||
|
Copyright 2007 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.
|
||||||
|
|
||||||
|
$Log: main.c,v $
|
||||||
|
$NoKeywords: $
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <twl.h>
|
||||||
|
#include <twl/dsp.h>
|
||||||
|
|
||||||
|
void VBlankIntr(void);
|
||||||
|
|
||||||
|
|
||||||
|
#define WRAM_BNK_PACK( master, ofs, enable ) \
|
||||||
|
( \
|
||||||
|
(((enable) != FALSE) * REG_MI_WRAM_A0_E_MASK) \
|
||||||
|
| (ofs) \
|
||||||
|
| (master) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: TwlMain
|
||||||
|
|
||||||
|
Description: main
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
void TwlMain()
|
||||||
|
{
|
||||||
|
u16 Cont = 0xFFFF;
|
||||||
|
|
||||||
|
// 初期化
|
||||||
|
OS_Init();
|
||||||
|
GX_Init();
|
||||||
|
|
||||||
|
// Vブランク割り込み設定
|
||||||
|
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||||
|
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||||
|
(void)OS_EnableIrq();
|
||||||
|
(void)GX_VBlankIntr(TRUE);
|
||||||
|
|
||||||
|
// USAGE
|
||||||
|
OS_TPrintf("\n");
|
||||||
|
OS_TPrintf("===================================\n");
|
||||||
|
OS_TPrintf("START: DSP_ResetOn and DSP_ResetOff\n\n");
|
||||||
|
OS_TPrintf(" A: DSP_ResetOff\n");
|
||||||
|
OS_TPrintf(" B: DSP_ResetOn\n");
|
||||||
|
OS_TPrintf(" X: DSP_ResetInterface\n");
|
||||||
|
OS_TPrintf("===================================\n");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// DSP初期コード(JTAG接続待ち)の書き込み
|
||||||
|
/* DSP_Iの先頭4Bを 0x5e47, 0x0000 (br ##0, ture) にするとか? */
|
||||||
|
/* brr でも良いのか? */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// WRAMメモリマップ変更
|
||||||
|
{
|
||||||
|
reg_MI_WRAM_B0 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_0KB, TRUE);
|
||||||
|
reg_MI_WRAM_B1 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_32KB, TRUE);
|
||||||
|
reg_MI_WRAM_B2 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_64KB, TRUE);
|
||||||
|
reg_MI_WRAM_B3 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_96KB, TRUE);
|
||||||
|
reg_MI_WRAM_B4 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_128KB, TRUE);
|
||||||
|
reg_MI_WRAM_B5 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_160KB, TRUE);
|
||||||
|
reg_MI_WRAM_B6 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_192KB, TRUE);
|
||||||
|
reg_MI_WRAM_B7 = WRAM_BNK_PACK(MI_WRAM_B_DSP_I, MI_WRAM_B_OFS_224KB, TRUE);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
reg_MI_WRAM_C0 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_0KB, TRUE);
|
||||||
|
reg_MI_WRAM_C1 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_32KB, TRUE);
|
||||||
|
reg_MI_WRAM_C2 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_64KB, TRUE);
|
||||||
|
reg_MI_WRAM_C3 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_96KB, TRUE);
|
||||||
|
reg_MI_WRAM_C4 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_128KB, TRUE);
|
||||||
|
reg_MI_WRAM_C5 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_160KB, TRUE);
|
||||||
|
reg_MI_WRAM_C6 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_192KB, TRUE);
|
||||||
|
reg_MI_WRAM_C7 = WRAM_BNK_PACK(MI_WRAM_C_DSP_D, MI_WRAM_C_OFS_224KB, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DSP初期化 & Go
|
||||||
|
OS_TPrintf("DSP_PowerOn...");
|
||||||
|
DSP_PowerOn();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
OS_TPrintf("DSP_ResetOff...");
|
||||||
|
DSP_ResetOff();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
u16 ReadData;
|
||||||
|
u16 Trg;
|
||||||
|
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
|
||||||
|
ReadData = PAD_Read();
|
||||||
|
Trg = (u16)(ReadData & ~Cont);
|
||||||
|
Cont = ReadData;
|
||||||
|
|
||||||
|
if (Trg & PAD_BUTTON_A)
|
||||||
|
{
|
||||||
|
OS_TPrintf("DSP_ResetOff...");
|
||||||
|
DSP_ResetOff();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
}
|
||||||
|
if (Trg & PAD_BUTTON_B)
|
||||||
|
{
|
||||||
|
OS_TPrintf("DSP_ResetOn...");
|
||||||
|
DSP_ResetOn();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
}
|
||||||
|
if (Trg & PAD_BUTTON_X)
|
||||||
|
{
|
||||||
|
OS_TPrintf("DSP_ResetInterface...");
|
||||||
|
DSP_ResetInterface();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Trg & PAD_BUTTON_START)
|
||||||
|
{
|
||||||
|
OS_TPrintf("DSP_ResetOn/DSP_ResetOff...");
|
||||||
|
DSP_ResetOn();
|
||||||
|
#if 0
|
||||||
|
// DSP初期コード(JTAG接続待ち)の再書き込み
|
||||||
|
/* ここでやりたければ、一時的にWRAMメモリマップを変更する必要がある */
|
||||||
|
#endif
|
||||||
|
DSP_ResetOff();
|
||||||
|
OS_TPrintf("Done.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------
|
||||||
|
// Vブランク割り込み処理
|
||||||
|
//
|
||||||
|
void VBlankIntr(void)
|
||||||
|
{
|
||||||
|
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
|
||||||
|
}
|
||||||
32
build/tests/dsp/dsp-jtag/Makefile
Normal file
32
build/tests/dsp/dsp-jtag/Makefile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlSDK - build
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 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.
|
||||||
|
#
|
||||||
|
# $Log: $
|
||||||
|
# $NoKeywords: $
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS = \
|
||||||
|
ARM7 \
|
||||||
|
ARM9 \
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
@ -83,8 +83,8 @@ DSPFifoFlag;
|
|||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_PowerOn
|
Name: DSP_PowerOn
|
||||||
|
|
||||||
Description: power DSP block on but DSPR yet.
|
Description: power DSP block on but reset yet.
|
||||||
you should call DSP_DSPROff() to boot DSP.
|
you should call DSP_ResetOff() to boot DSP.
|
||||||
|
|
||||||
Arguments: None.
|
Arguments: None.
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void DSP_EnableFifoInterrupt(DSPFifoIntr type);
|
|||||||
void DSP_DisableFifoInterrupt(DSPFifoIntr type);
|
void DSP_DisableFifoInterrupt(DSPFifoIntr type);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_SendFifo
|
Name: DSP_SendFifoEx
|
||||||
|
|
||||||
Description: write data into DSP memory space.
|
Description: write data into DSP memory space.
|
||||||
|
|
||||||
@ -238,28 +238,67 @@ void DSP_DisableFifoInterrupt(DSPFifoIntr type);
|
|||||||
src: data to send.
|
src: data to send.
|
||||||
size: data length to send (in half words).
|
size: data length to send (in half words).
|
||||||
flags: bitOR of DSPFifoFlag to specify special mode
|
flags: bitOR of DSPFifoFlag to specify special mode
|
||||||
|
without DSP_FIFO_FLAG_RECV_UNIT_*
|
||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags);
|
void DSP_SendFifoEx(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_RecvFifo
|
Name: DSP_SendFifo
|
||||||
|
|
||||||
Description: read data into DSP memory space.
|
Description: write data into DSP memory space normally.
|
||||||
|
|
||||||
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
Arguments: memsel: one of DSPFifoMemSel
|
||||||
addr: source address (in half words).
|
dest: destination address (in half words).
|
||||||
|
if you want to set high address, ask DSP to set
|
||||||
|
DMA register.
|
||||||
|
src: data to send.
|
||||||
|
size: data length to send (in half words).
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static inline void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size)
|
||||||
|
{
|
||||||
|
DSP_SendFifoEx(memsel, dest, src, size, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: DSP_RecvFifoEx
|
||||||
|
|
||||||
|
Description: read data from DSP memory space.
|
||||||
|
|
||||||
|
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
||||||
|
dest: data to receive.
|
||||||
|
src: source address (in half words).
|
||||||
if you want to set high address, ask DSP to set
|
if you want to set high address, ask DSP to set
|
||||||
DMA register.
|
DMA register.
|
||||||
bufp: data to receive.
|
|
||||||
size: data length to receive (in half words).
|
size: data length to receive (in half words).
|
||||||
ignore unless continuous mode
|
ignore unless continuous mode
|
||||||
flags: bitOR of DSPFifoFlag to specify special mode
|
flags: bitOR of DSPFifoFlag to specify special mode
|
||||||
|
|
||||||
Returns: None.
|
Returns: None.
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags);
|
void DSP_RecvFifoEx(DSPFifoMemSel memsel, u16 *dest, u16 src, int size, u16 flags);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: DSP_RecvFifo
|
||||||
|
|
||||||
|
Description: read data from DSP memory space normally.
|
||||||
|
|
||||||
|
Arguments: memsel: one of DSPFifoMemSel
|
||||||
|
dest: data to receive.
|
||||||
|
src: source address (in half words).
|
||||||
|
if you want to set high address, ask DSP to set
|
||||||
|
DMA register.
|
||||||
|
size: data length to receive (in half words).
|
||||||
|
|
||||||
|
Returns: None.
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static inline void DSP_RecvFifo(DSPFifoMemSel memsel, u16* dest, u16 src, int size)
|
||||||
|
{
|
||||||
|
DSP_RecvFifoEx(memsel, dest, src, size, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: DSP_SetSemaphore
|
Name: DSP_SetSemaphore
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user