mirror of
https://github.com/rvtr/twl_wrapsdk.git
synced 2025-10-31 06:11:10 -04:00
add dsp interface library but it is not checked
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@118 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
parent
86f29eb63e
commit
e9f54f6df6
@ -446,23 +446,38 @@
|
||||
0x1032,,DB_BG3PB,16,w,G2S,volatile,S,15,1,INTEGER_DMX,8,7,DECIMAL_DMX,0,8
|
||||
0x1034,,DB_BG3PC,16,w,G2S,volatile,S,15,1,INTEGER_DY,8,7,DECIMAL_DY,0,8
|
||||
0x1036,,DB_BG3PD,16,w,G2S,volatile,S,15,1,INTEGER_DMY,8,7,DECIMAL_DMY,0,8
|
||||
0x1038,,DB_BG3X,32,w,G2S,volatile,S,27,1,INTEGER_SX,8,19,DECIMAL_SX,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x103c,,DB_BG3Y,32,w,G2S,volatile,S,27,1,INTEGER_SY,8,19,DECIMAL_SY,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1040,,DB_WIN0H,16,w,G2S,volatile,LEFTX,8,8,RIGHTX,0,8,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1042,,DB_WIN1H,16,w,G2S,volatile,LEFTX,8,8,RIGHTX,0,8,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1044,,DB_WIN0V,16,w,G2S,volatile,UPY,8,8,DOWNY,0,8,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1046,,DB_WIN1V,16,w,G2S,volatile,UPY,8,8,DOWNY,0,8,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1048,,DB_WININ,16,rw,G2S,volatile,WIN1IN,8,6,WIN0IN,0,6,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x104a,,DB_WINOUT,16,rw,G2S,volatile,OBJWININ,8,6,WINOUT,0,6,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x104c,,DB_MOSAIC,16,w,G2S,volatile,OBJVSIZE,12,4,OBJHSIZE,8,4,BGVSIZE,4,4,BGHSIZE,0,4,,,,,,,,,,,,,,,,,,
|
||||
0x1050,,DB_BLDCNT,16,rw,G2S,volatile,PLANE2,8,6,EFFECT,6,2,PLANE1,0,6,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1052,,DB_BLDALPHA,16,rw,G2S,volatile,EVB,8,5,EVA,0,5,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1054,,DB_BLDY,16,rw,G2S,volatile,EVY,0,5,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
#twl p79 <20>` 84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4200,,CAM_MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,,,,
|
||||
0x1038,,DB_BG3X,32,w,G2S,volatile,S,27,1,INTEGER_SX,8,19,DECIMAL_SX,0,8,,,,,,,,,,,,,,,,,,
|
||||
0x103c,,DB_BG3Y,32,w,G2S,volatile,S,27,1,INTEGER_SY,8,19,DECIMAL_SY,0,8,,,,,,,,,,,,,,,,,,
|
||||
0x1040,,DB_WIN0H,16,w,G2S,volatile,LEFTX,8,8,RIGHTX,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1042,,DB_WIN1H,16,w,G2S,volatile,LEFTX,8,8,RIGHTX,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1044,,DB_WIN0V,16,w,G2S,volatile,UPY,8,8,DOWNY,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1046,,DB_WIN1V,16,w,G2S,volatile,UPY,8,8,DOWNY,0,8,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1048,,DB_WININ,16,rw,G2S,volatile,WIN1IN,8,6,WIN0IN,0,6,,,,,,,,,,,,,,,,,,,,,
|
||||
0x104a,,DB_WINOUT,16,rw,G2S,volatile,OBJWININ,8,6,WINOUT,0,6,,,,,,,,,,,,,,,,,,,,,
|
||||
0x104c,,DB_MOSAIC,16,w,G2S,volatile,OBJVSIZE,12,4,OBJHSIZE,8,4,BGVSIZE,4,4,BGHSIZE,0,4,,,,,,,,,,,,,,,
|
||||
0x1050,,DB_BLDCNT,16,rw,G2S,volatile,PLANE2,8,6,EFFECT,6,2,PLANE1,0,6,,,,,,,,,,,,,,,,,,
|
||||
0x1052,,DB_BLDALPHA,16,rw,G2S,volatile,EVB,8,5,EVA,0,5,,,,,,,,,,,,,,,,,,,,,
|
||||
0x1054,,DB_BLDY,16,rw,G2S,volatile,EVY,0,5,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
#twl p79 <20>` 84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4200,,CAM_MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,
|
||||
0x4202,,CAM_CNT,16,rw,CAM,volatile,E,15,1,T,14,1,F,13,1,IREQ_I,11,1,IREQ_BE,10,1,IREQ_VS,8,2,CL,5,1,ERR,4,1,TL,0,4
|
||||
0x4204,,CAM_DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4210,,SOFS_H,16,rw,CAM,volatile,OFFSET,0,10
|
||||
0x4212,,SOFS_V,16,rw,CAM,volatile,OFFSET,0,9
|
||||
0x4214,,EOFS_H,16,rw,CAM,volatile,OFFSET,0,10
|
||||
0x4216,,EOFS_V,16,rw,CAM,volatile,OFFSET,0,9
|
||||
0x4204,,CAM_DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4210,,SOFS_H,16,rw,CAM,volatile,OFFSET,0,10,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4212,,SOFS_V,16,rw,CAM,volatile,OFFSET,0,9,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4214,,EOFS_H,16,rw,CAM,volatile,OFFSET,0,10,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4216,,EOFS_V,16,rw,CAM,volatile,OFFSET,0,9,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
#twl p109<30>`114,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4300,,DSP_FIFO_DATA,16,rw,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4304,,DSP_FIFO_ADDR,16,w,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4308,,DSP_CONFIG,16,rw,DSP,volatile,FIFO_MEMSEL,12,4,RECV_DATA_IE,9,3,FIFO_IE,5,4,FIFO_RECV_E,4,1,FIFO_RECV_LEN,2,2,FIFO_INC_MODE,1,1,RESET,0,1,,,,,,,,,
|
||||
0x430c,,DSP_STATUS,16,r,DSP,volatile,SEND_DATA_FULL,13,3,RECV_DATA_EMP,10,3,SEM_RECV_IF,9,1,FIFO_SEND_FULL,8,1,FIFO_SEND_EMP,7,1,FIFO_RECV_NEMP,6,1,FIFO_RECV_FULL,5,1,RESET_BUSY,2,1,FIFO_SEND_BUSY,1,1,FIFO_RECV_BUSY,0,1
|
||||
0x4310,,DSP_SEM_SEND_DATA,16,rw,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4314,,DSP_SEM_RECV_MASK,16,rw,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4318,,DSP_SEM_RECV_CLEAR,16,w,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x431c,,DSP_SEM_RECV_DATA,16,r,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4320,,DSP_SEND_DATA_0,16,rw,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4324,,DSP_RECV_DATA_0,16,r,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x4328,,DSP_SEND_DATA_1,16,rw,DSP,volatile,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
0x432c,,DSP_RECV_DATA_1,16,r,DSP,volatile
|
||||
0x4330,,DSP_SEND_DATA_2,16,rw,DSP,volatile
|
||||
0x4330,,DSP_RECV_DATA_2,16,r,DSP,volatile
|
||||
|
||||
|
Can't render this file because it has a wrong number of fields in line 17.
|
@ -170,6 +170,7 @@ TWL_LIBS_BASE ?= \
|
||||
libctrdg \
|
||||
libaes \
|
||||
libcamera \
|
||||
libdsp \
|
||||
|
||||
ifdef TWL_PROFILE_TYPE
|
||||
TWL_LIBS_BASE += libos.$(TWL_PROFILE_TYPE)
|
||||
|
||||
@ -35,6 +35,7 @@ SUBDIRS = \
|
||||
camera \
|
||||
fatfs \
|
||||
devices \
|
||||
dsp \
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
export NITRO_BLXCHECKED = yes
|
||||
|
||||
46
build/libraries/dsp/ARM9/Makefile
Normal file
46
build/libraries/dsp/ARM9/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - libraries - 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: $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# build ARM & THUMB libraries
|
||||
TWL_CODEGEN_ALL ?= True
|
||||
|
||||
TWL_PROC = ARM9
|
||||
|
||||
SRCS = dsp_if.c
|
||||
|
||||
TARGET_LIB = libdsp$(TWL_LIBSUFFIX).a
|
||||
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||
|
||||
INSTALL_TARGETS = $(TARGETS)
|
||||
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
do-build: $(TARGETS)
|
||||
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
417
build/libraries/dsp/ARM9/dsp_if.c
Normal file
417
build/libraries/dsp/ARM9/dsp_if.c
Normal file
@ -0,0 +1,417 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - library - dsp
|
||||
File: dsp_if.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: $
|
||||
$NoKeywords: $
|
||||
*---------------------------------------------------------------------------*/
|
||||
#include <twl/dsp.h>
|
||||
#include <nitro/hw/ARM9/ioreg_CFG.h>
|
||||
#include <nitro/misc.h>
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
定数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
型定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct DSPData
|
||||
{
|
||||
u16 send;
|
||||
u16 recv;
|
||||
}
|
||||
DSPData;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
静的変数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
static volatile DSPData *const dspData = (DSPData*)REG_DSP_SEND_DATA_0_ADDR;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
内部関数定義
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_PowerOn
|
||||
|
||||
Description: power DSP block on but reset yet.
|
||||
you should call DSP_ResetOff() to boot DSP.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_PowerOn(void)
|
||||
{
|
||||
reg_CFG_CLK |= REG_CFG_CLK_DSP_MASK;
|
||||
reg_CFG_DSP_RST |= REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット解除
|
||||
DSP_ResetOn(); // DSPコアのリセット設定
|
||||
}
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_PowerOff
|
||||
|
||||
Description: power DSP block off
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_PowerOff(void)
|
||||
{
|
||||
reg_CFG_DSP_RST &= ~REG_CFG_DSP_RST_OFF_MASK; // DSPブロックのリセット設定
|
||||
reg_CFG_CLK &= ~REG_CFG_CLK_DSP_MASK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ResetOn
|
||||
|
||||
Description: reset DSP.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ResetOn(void)
|
||||
{
|
||||
reg_DSP_DSP_CONFIG |= REG_DSP_DSP_CONFIG_RESET_MASK;
|
||||
while ( reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_RESET_BUSY_MASK )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ResetOff
|
||||
|
||||
Description: boot DSP if in reset state.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ResetOff(void)
|
||||
{
|
||||
while ( reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_RESET_BUSY_MASK )
|
||||
{
|
||||
}
|
||||
reg_DSP_DSP_CONFIG &= ~REG_DSP_DSP_CONFIG_RESET_MASK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_EnableRecvDataInterrupt
|
||||
|
||||
Description: enable interrupt for receive data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_EnableRecvDataInterrupt(u32 dataNo)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
reg_DSP_DSP_CONFIG |= (1 << dataNo) << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_DisableRecvDataInterrupt
|
||||
|
||||
Description: disable interrupt for receive data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_DisableRecvDataInterrupt(u32 dataNo)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
reg_DSP_DSP_CONFIG &= ~((1 << dataNo) << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendDataIsEmpty
|
||||
|
||||
Description: whether DSP is received sending data.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_SendDataIsEmpty(u32 dataNo)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
return (reg_DSP_DSP_STATUS & ((1 << dataNo) << REG_DSP_DSP_STATUS_SEND_DATA_FULL_SHIFT)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvDataIsReady
|
||||
|
||||
Description: whether there is sent data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_RecvDataIsReady(u32 dataNo)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
return (reg_DSP_DSP_STATUS & ((1 << dataNo) << REG_DSP_DSP_STATUS_RECV_DATA_EMP_SHIFT)) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendData
|
||||
|
||||
Description: send data to DSP
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
data: data to send
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SendData(u32 dataNo, u16 data)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
while (DSP_SendDataIsEmpty(dataNo) == FALSE)
|
||||
{
|
||||
}
|
||||
dspData[dataNo].send = data;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvData
|
||||
|
||||
Description: receive data from DSP
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: receiving data
|
||||
*---------------------------------------------------------------------------*/
|
||||
u16 DSP_RecvData(u32 dataNo)
|
||||
{
|
||||
SDK_ASSERT(dataNo >= 0 && dataNo <= 2);
|
||||
while (DSP_RecvDataIsReady(dataNo) == FALSE)
|
||||
{
|
||||
}
|
||||
return dspData[dataNo].recv;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_EnableFifoInterrupt
|
||||
|
||||
Description: enable interrupt for FIFO.
|
||||
|
||||
Arguments: type: one of DSPFifoIntr
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_EnableFifoInterrupt(DSPFifoIntr type)
|
||||
{
|
||||
reg_DSP_DSP_CONFIG |= type;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_DisableFifoInterrupt
|
||||
|
||||
Description: disable interrupt for FIFO.
|
||||
|
||||
Arguments: type: one of DSPFifoIntr
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_DisableFifoInterrupt(DSPFifoIntr type)
|
||||
{
|
||||
reg_DSP_DSP_CONFIG &= ~type;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendFifo
|
||||
|
||||
Description: write data into DSP memory space.
|
||||
|
||||
Arguments: memsel: one of DSPFifoMemSel
|
||||
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).
|
||||
flags: bitOR of DSPFifoFlag to specify special mode
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags)
|
||||
{
|
||||
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_DSP_CONFIG_FIFO_INC_MODE_MASK);
|
||||
|
||||
reg_DSP_DSP_FIFO_ADDR = dest;
|
||||
reg_DSP_DSP_CONFIG = (u16)((reg_DSP_DSP_CONFIG & ~(REG_DSP_DSP_CONFIG_FIFO_MEMSEL_MASK|REG_DSP_DSP_CONFIG_FIFO_INC_MODE_MASK))
|
||||
| memsel | incmode);
|
||||
|
||||
if (flags & DSP_FIFO_FLAG_SRC_FIX)
|
||||
{
|
||||
while (size-- > 0)
|
||||
{
|
||||
while (reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_FIFO_SEND_FULL_MASK)
|
||||
{
|
||||
}
|
||||
reg_DSP_DSP_FIFO_DATA = *src;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (size-- > 0)
|
||||
{
|
||||
while (reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_FIFO_SEND_FULL_MASK)
|
||||
{
|
||||
}
|
||||
reg_DSP_DSP_FIFO_DATA = *src++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvFifo
|
||||
|
||||
Description: read data into DSP memory space.
|
||||
|
||||
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
||||
addr: source address (in half words).
|
||||
if you want to set high address, ask DSP to set
|
||||
DMA register.
|
||||
bufp: data to receive.
|
||||
size: data length to receive (in half words).
|
||||
ignore unless continuous mode
|
||||
flags: bitOR of DSPFifoFlag to specify special mode
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags)
|
||||
{
|
||||
DSPFifoRecvLength len;
|
||||
u16 incmode = (u16)((flags & DSP_FIFO_FLAG_SRC_FIX) ? 0 : REG_DSP_DSP_CONFIG_FIFO_INC_MODE_MASK);
|
||||
|
||||
SDK_ASSERT(memsel != DSP_FIFO_MEMSEL_PROGRAM);
|
||||
|
||||
switch (flags & DSP_FIFO_FLAG_RECV_MASK)
|
||||
{
|
||||
case DSP_FIFO_FLAG_RECV_UNIT_2B:
|
||||
len = DSP_FIFO_RECV_LEN_2B;
|
||||
size = 1;
|
||||
break;
|
||||
case DSP_FIFO_FLAG_RECV_UNIT_16B:
|
||||
len = DSP_FIFO_RECV_LEN_16B;
|
||||
size = 8;
|
||||
break;
|
||||
case DSP_FIFO_FLAG_RECV_UNIT_32B:
|
||||
len = DSP_FIFO_RECV_LEN_32B;
|
||||
size = 16;
|
||||
break;
|
||||
default:
|
||||
len = DSP_FIFO_RECV_LEN_CONTINUOUS;
|
||||
break;
|
||||
}
|
||||
|
||||
reg_DSP_DSP_FIFO_ADDR = addr;
|
||||
reg_DSP_DSP_CONFIG = (u16)((reg_DSP_DSP_CONFIG & ~(REG_DSP_DSP_CONFIG_FIFO_MEMSEL_MASK|REG_DSP_DSP_CONFIG_FIFO_RECV_LEN_MASK|REG_DSP_DSP_CONFIG_FIFO_INC_MODE_MASK))
|
||||
| memsel | len | incmode | REG_DSP_DSP_CONFIG_FIFO_RECV_E_MASK);
|
||||
|
||||
if (flags & DSP_FIFO_FLAG_DEST_FIX)
|
||||
{
|
||||
while (size-- > 0)
|
||||
{
|
||||
while ((reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_FIFO_RECV_NEMP_MASK) == 0)
|
||||
{
|
||||
}
|
||||
*bufp = reg_DSP_DSP_FIFO_DATA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (size-- > 0)
|
||||
{
|
||||
while ((reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_FIFO_RECV_NEMP_MASK) == 0)
|
||||
{
|
||||
}
|
||||
*bufp++ = reg_DSP_DSP_FIFO_DATA;
|
||||
}
|
||||
}
|
||||
reg_DSP_DSP_CONFIG &= ~REG_DSP_DSP_CONFIG_FIFO_RECV_E_MASK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SetSemaphore
|
||||
|
||||
Description: set semaphore to signal to DSP.
|
||||
NOTE: received semaphore is individual register
|
||||
|
||||
Arguments: mask: bit mask to set
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SetSemaphore(u16 mask)
|
||||
{
|
||||
reg_DSP_DSP_SEM_SEND_DATA |= mask;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_GetSemaphore
|
||||
|
||||
Description: get semaphore to be recieved from DSP.
|
||||
NOTE: sending semaphore is individual register
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: bit mask is set by DSP
|
||||
*---------------------------------------------------------------------------*/
|
||||
u16 DSP_GetSemaphore(void)
|
||||
{
|
||||
return reg_DSP_DSP_SEM_RECV_DATA;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ClearSemaphore
|
||||
|
||||
Description: clear semaphore to be recieved from DSP.
|
||||
|
||||
Arguments: mask: bit mask to clar
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ClearSemaphore(u16 mask)
|
||||
{
|
||||
reg_DSP_DSP_SEM_RECV_CLEAR |= mask;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_MaskSemaphore
|
||||
|
||||
Description: mask semaphore to interrupt to ARM9.
|
||||
|
||||
Arguments: mask: bit mask to disable to interrupt
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_MaskSemaphore(u16 mask)
|
||||
{
|
||||
reg_DSP_DSP_SEM_RECV_MASK |= mask;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_CheckSemaphoreRequest
|
||||
|
||||
Description: whether there is requested interrupt by semaphore
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: TRUE if requested.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_CheckSemaphoreRequest(void)
|
||||
{
|
||||
return (reg_DSP_DSP_STATUS & REG_DSP_DSP_STATUS_SEM_RECV_IF_MASK) >> REG_DSP_DSP_STATUS_SEM_RECV_IF_SHIFT;
|
||||
}
|
||||
|
||||
30
build/libraries/dsp/Makefile
Normal file
30
build/libraries/dsp/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
#! make -f
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: TwlSDK - libraries - pxi
|
||||
# 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 = ARM9
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||
|
||||
|
||||
#===== End of Makefile =====
|
||||
@ -23,6 +23,8 @@
|
||||
#include <twl/pm.h>
|
||||
#include <twl/aes.h>
|
||||
#include <twl/mic.h>
|
||||
#include <twl/camera.h>
|
||||
#include <twl/dsp.h>
|
||||
#ifdef SDK_DEBUGGER_KMC
|
||||
#include <twl/vlink.h>
|
||||
#endif // SDK_DEBUGGER_KMC
|
||||
|
||||
29
include/twl/dsp.h
Normal file
29
include/twl/dsp.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - DSP - include
|
||||
File: camera.h
|
||||
|
||||
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: $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TWL_DSP_H_
|
||||
#define TWL_DSP_H_
|
||||
|
||||
|
||||
#ifdef SDK_ARM7
|
||||
#else
|
||||
|
||||
#include <twl/dsp/ARM9/dsp_if.h>
|
||||
|
||||
#endif
|
||||
|
||||
/* TWL_LCDC_H_ */
|
||||
#endif
|
||||
315
include/twl/dsp/ARM9/dsp_if.h
Normal file
315
include/twl/dsp/ARM9/dsp_if.h
Normal file
@ -0,0 +1,315 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: TwlSDK - library - dsp
|
||||
File: dsp_if.h
|
||||
|
||||
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: $
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TWL_DSP_IF_H_
|
||||
#define TWL_DSP_IF_H_
|
||||
|
||||
#include <twl/types.h>
|
||||
#include <nitro/hw/ARM9/ioreg_DSP.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
’è<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
DSP_FIFO_MEMSEL_DATA = (0x0 << REG_DSP_DSP_CONFIG_FIFO_MEMSEL_SHIFT),
|
||||
DSP_FIFO_MEMSEL_MMIO = (0x1 << REG_DSP_DSP_CONFIG_FIFO_MEMSEL_SHIFT),
|
||||
DSP_FIFO_MEMSEL_PROGRAM = (0x5 << REG_DSP_DSP_CONFIG_FIFO_MEMSEL_SHIFT)
|
||||
}
|
||||
DSPFifoMemSel;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSP_FIFO_RECV_LEN_2B = (0x0 << REG_DSP_DSP_CONFIG_FIFO_RECV_LEN_SHIFT),
|
||||
DSP_FIFO_RECV_LEN_16B = (0x1 << REG_DSP_DSP_CONFIG_FIFO_RECV_LEN_SHIFT),
|
||||
DSP_FIFO_RECV_LEN_32B = (0x2 << REG_DSP_DSP_CONFIG_FIFO_RECV_LEN_SHIFT),
|
||||
DSP_FIFO_RECV_LEN_CONTINUOUS = (0x3 << REG_DSP_DSP_CONFIG_FIFO_RECV_LEN_SHIFT)
|
||||
}
|
||||
DSPFifoRecvLength;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSP_FIFO_FLAG_SRC_INC = (0UL << 0),
|
||||
DSP_FIFO_FLAG_SRC_FIX = (1UL << 0),
|
||||
|
||||
DSP_FIFO_FLAG_DEST_INC = (0UL << 1),
|
||||
DSP_FIFO_FLAG_DEST_FIX = (1UL << 1),
|
||||
|
||||
DSP_FIFO_FLAG_RECV_UNIT_CONTINUOUS = (0UL << 8),
|
||||
DSP_FIFO_FLAG_RECV_UNIT_2B = (1UL << 8),
|
||||
DSP_FIFO_FLAG_RECV_UNIT_16B = (2UL << 8),
|
||||
DSP_FIFO_FLAG_RECV_UNIT_32B = (3UL << 8),
|
||||
DSP_FIFO_FLAG_RECV_MASK = (3UL << 8)
|
||||
}
|
||||
DSPFifoFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSP_FIFO_INTR_RECV_FULL = (1 << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT),
|
||||
DSP_FIFO_INTR_RECV_NOT_EMPTY = (2 << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT),
|
||||
DSP_FIFO_INTR_SEND_FULL = (4 << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT),
|
||||
DSP_FIFO_INTR_SEND_EMPTY = (8 << REG_DSP_DSP_CONFIG_FIFO_IE_SHIFT)
|
||||
}
|
||||
DSPFifoIntr;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
<EFBFBD>\‘¢‘Ì’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
ŠÖ<EFBFBD>”’è‹`
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_PowerOn
|
||||
|
||||
Description: power DSP block on but reset yet.
|
||||
you should call DSP_ResetOff() to boot DSP.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_PowerOn(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_PowerOff
|
||||
|
||||
Description: power DSP block off
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_PowerOff(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ResetOn
|
||||
|
||||
Description: reset DSP.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ResetOn(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ResetOff
|
||||
|
||||
Description: boot DSP if in reset state.
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ResetOff(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_EnableRecvDataInterrupt
|
||||
|
||||
Description: enable interrupt for receive data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_EnableRecvDataInterrupt(u32 dataNo);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_DisableRecvDataInterrupt
|
||||
|
||||
Description: disable interrupt for receive data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_DisableRecvDataInterrupt(u32 dataNo);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendDataIsEmpty
|
||||
|
||||
Description: whether DSP is received sending data.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_SendDataIsEmpty(u32 dataNo);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvDataIsReady
|
||||
|
||||
Description: whether there is sent data from DSP.
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_RecvDataIsReady(u32 dataNo);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendData
|
||||
|
||||
Description: send data to DSP
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
data: data to send
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SendData(u32 dataNo, u16 data);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvData
|
||||
|
||||
Description: receive data from DSP
|
||||
|
||||
Arguments: dataNo: target data register (0-2)
|
||||
|
||||
Returns: receiving data
|
||||
*---------------------------------------------------------------------------*/
|
||||
u16 DSP_RecvData(u32 dataNo);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_EnableFifoInterrupt
|
||||
|
||||
Description: enable interrupt for FIFO.
|
||||
|
||||
Arguments: type: one of DSPFifoIntr
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_EnableFifoInterrupt(DSPFifoIntr type);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_DisableFifoInterrupt
|
||||
|
||||
Description: disable interrupt for FIFO.
|
||||
|
||||
Arguments: type: one of DSPFifoIntr
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_DisableFifoInterrupt(DSPFifoIntr type);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SendFifo
|
||||
|
||||
Description: write data into DSP memory space.
|
||||
|
||||
Arguments: memsel: one of DSPFifoMemSel
|
||||
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).
|
||||
flags: bitOR of DSPFifoFlag to specify special mode
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SendFifo(DSPFifoMemSel memsel, u16 dest, const u16 *src, int size, u16 flags);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_RecvFifo
|
||||
|
||||
Description: read data into DSP memory space.
|
||||
|
||||
Arguments: memsel: one of DSPFifoMemSel without PROGRAM area
|
||||
addr: source address (in half words).
|
||||
if you want to set high address, ask DSP to set
|
||||
DMA register.
|
||||
bufp: data to receive.
|
||||
size: data length to receive (in half words).
|
||||
ignore unless continuous mode
|
||||
flags: bitOR of DSPFifoFlag to specify special mode
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_RecvFifo(DSPFifoMemSel memsel, u16 addr, u16 *bufp, int size, u16 flags);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_SetSemaphore
|
||||
|
||||
Description: set semaphore to signal to DSP.
|
||||
NOTE: received semaphore is individual register
|
||||
|
||||
Arguments: mask: bit mask to set
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_SetSemaphore(u16 mask);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_GetSemaphore
|
||||
|
||||
Description: get semaphore to be recieved from DSP.
|
||||
NOTE: sending semaphore is individual register
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: bit mask is set by DSP
|
||||
*---------------------------------------------------------------------------*/
|
||||
u16 DSP_GetSemaphore(void);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_ClearSemaphore
|
||||
|
||||
Description: clear semaphore to be recieved from DSP.
|
||||
|
||||
Arguments: mask: bit mask to clar
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_ClearSemaphore(u16 mask);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_MaskSemaphore
|
||||
|
||||
Description: mask semaphore to interrupt to ARM9.
|
||||
|
||||
Arguments: mask: bit mask to disable to interrupt
|
||||
|
||||
Returns: None.
|
||||
*---------------------------------------------------------------------------*/
|
||||
void DSP_MaskSemaphore(u16 mask);
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
Name: DSP_CheckSemaphoreRequest
|
||||
|
||||
Description: whether there is requested interrupt by semaphore
|
||||
|
||||
Arguments: None.
|
||||
|
||||
Returns: TRUE if requested.
|
||||
*---------------------------------------------------------------------------*/
|
||||
BOOL DSP_CheckSemaphoreRequest(void);
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* TWL_DSP_H_ */
|
||||
Loading…
Reference in New Issue
Block a user