ブートROM用PXI追加。

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@152 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
nakasima 2009-01-05 10:35:38 +00:00
parent 9d03ef2964
commit e060e43135
10 changed files with 1024 additions and 1 deletions

View File

@ -21,10 +21,11 @@ include $(CTRBROM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
vlink \
init \
os \
mi \
pxi \
vlink \
#----------------------------------------------------------------------------

View File

@ -0,0 +1,46 @@
#! make -f
#----------------------------------------------------------------------------
# Project: CtrBrom - libraries_sp - pxi
# File: Makefile
#
# Copyright 2009 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$
#----------------------------------------------------------------------------
SUBDIRS =
SUBMAKES =
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
BROM_CODEGEN_ALL ?= TRUE
SRCDIR = ../common .
SRCS = \
pxi_misc.c \
TARGET_LIB = libpxi$(BROM_LIBSUFFIX).a
include $(CTRBROM_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(BROM_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(CTRBROM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,61 @@
#! make -f
#----------------------------------------------------------------------------
# Project: CtrBrom - libraries_sp - pxi
# File: Makefile
#
# Copyright 2009 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$
#----------------------------------------------------------------------------
SUBDIRS =
#SUBMAKES = Makefile.CALLTRACE \
# Makefile.FUNCTIONCOST
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
BROM_CODEGEN_ALL ?= TRUE
# Codegen for sub processer
BROM_PROC = ARM9
SRCDIR = ../common .
SRCS = \
pxi_misc.c \
TARGET_LIB = libpxi_sp$(BROM_LIBSUFFIX).a
#----------------------------------------------------------------------------
# DEBUG版ビルドの場合、RELEASE版でビルドして
# DEBUG版のライブラリを装います。
ifdef NITRO_DEBUG
NITRO_BUILD_TYPE = RELEASE
endif
include $(CTRBROM_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(BROM_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(CTRBROM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,35 @@
#! make -f
#----------------------------------------------------------------------------
# Project: CtrBrom - libraries - pxi
# File: Makefile
#
# Copyright 2009 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 $(CTRBROM_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = ARM11
#ifdef CTR_WITH_ARM9
SUBDIRS += ARM9
#endif
#----------------------------------------------------------------------------
include $(CTRBROM_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,355 @@
/*---------------------------------------------------------------------------*
Project: CtrBrom - library - pxi
File: pxi_misc.c
Copyright 2009 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>
#include <brom/pxi.h>
static u16 FifoCtrlInit = 0;
/*********** function prototypes ******************/
static inline PXIFifoStatus i_pxiGetFromFifo(u32 *data_buf);
static inline PXIFifoStatus i_pxiSetToFifo(u32 data);
/*---------------------------------------------------------------------------*
Name: pxiInitFifoBROM
Description: initialize FIFO system for bootrom
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void pxiInitFifoBROM(void)
{
OSIntrMode enabled;
enabled = osDisableInterrupts();
if (!FifoCtrlInit)
{
int i;
FifoCtrlInit = TRUE;
reg_PXI_FIFO_CNT =
(REG_PXI_FIFO_CNT_SEND_CL_MASK |
REG_PXI_FIFO_CNT_E_MASK | REG_PXI_FIFO_CNT_ERR_MASK);
#ifdef SDK_ARM11
pxiSendIDByIntf( BROM_PXI_ID_INIT_ARM9 );
pxiWaitIDByIntf( BROM_PXI_ID_INIT_ARM7 );
#else // SDK_ARM9
pxiSendIDByIntf( BROM_PXI_ID_INIT_ARM7 );
pxiWaitIDByIntf( BROM_PXI_ID_INIT_ARM9 );
#endif // SDK_ARM9
}
(void)osRestoreInterrupts(enabled);
}
/*---------------------------------------------------------------------------*
Name: pxiNotifyID
Description: Send 4bit id to other processor
Arguments: id notifying id
Returns: None
*---------------------------------------------------------------------------*/
void pxiNotifyID( u32 id )
{
pxiSendIDByFifo( PXI_FIFO_TAG_SYSTEM, id );
}
/*---------------------------------------------------------------------------*
Name: pxiWaitID
Description: Wait 4bit id from the other processor
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitID( u32 id )
{
pxiWaitIDByFifo( PXI_FIFO_TAG_SYSTEM, id );
}
/*---------------------------------------------------------------------------*
Name: pxiRecvID
Description: Receive 4bit id from the other processor
Arguments: None
Returns: id
*---------------------------------------------------------------------------*/
u8 pxiRecvID( void )
{
u8 id;
while (pxiRecvIDByFifo(PXI_FIFO_TAG_SYSTEM, &id) != PXI_FIFO_SUCCESS)
{
}
return id;
}
/*---------------------------------------------------------------------------*
Name: pxiSendIDByIntf
Description: Send 4bit id to the other processor
Arguments: id sending id
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendIDByIntf( u32 id )
{
reg_PXI_INTF = id << REG_PXI_INTF_SEND_SHIFT;
}
/*---------------------------------------------------------------------------*
Name: pxiRecvIDByIntf
Description: Receive 4bit id from the other processor
Arguments: None
Returns: received id
*---------------------------------------------------------------------------*/
u32 pxiRecvIDByIntf( void )
{
return ((reg_PXI_INTF & REG_PXI_INTF_RECV_MASK) >> REG_PXI_INTF_RECV_SHIFT);
}
/*---------------------------------------------------------------------------*
Name: pxiWaitIDByIntf
Description: Wait 4bit id from the other processor
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitIDByIntf( u32 id )
{
while (pxiRecvIDByIntf() != id)
{
}
}
/*---------------------------------------------------------------------------*
Name: pxiSendIDByFifo
Description: Send 32bit-word to another CPU via FIFO
Arguments:
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendIDByFifo(PXIFifoTag tag, int id)
{
static PXIFifoMessage fifomsg;
fifomsg.e.tag = tag;
fifomsg.e.data = id;
while ( i_pxiSetToFifo(fifomsg.raw) != PXI_FIFO_SUCCESS )
{
}
}
/*---------------------------------------------------------------------------*
Name: pxiRecvIDByFifo
Description: Recv 32bit-word from another CPU via FIFO
Arguments:
Returns: if error occured, returns minus value
*---------------------------------------------------------------------------*/
PXIFifoStatus pxiRecvIDByFifo(PXIFifoTag tag, void* buf)
{
static PXIFifoMessage fifomsg;
u8* p = buf;
while ( i_pxiGetFromFifo(&fifomsg.raw) != PXI_FIFO_SUCCESS )
{
}
if (fifomsg.e.tag != tag)
{
return PXI_FIFO_FAIL_RECV_ERR;
}
*p = (u8)fifomsg.e.data;
return PXI_FIFO_SUCCESS;
}
/*---------------------------------------------------------------------------*
Name: pxiWaitIDByFifo
Description: Wait 32bit-word from another CPU via FIFO
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitIDByFifo(PXIFifoTag tag, u32 id)
{
u8 buf = (u8)id;
do
{
while (pxiRecvIDByFifo(tag, &buf) != PXI_FIFO_SUCCESS)
{
}
}
while ( buf != id );
}
/*---------------------------------------------------------------------------*
Name: pxiSendDataByFifo
Description: Send data to another CPU via FIFO
Arguments:
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendDataByFifo(PXIFifoTag tag, void* buf, int size)
{
static PXIFifoMessage fifomsg;
u32* p = buf;
int len = size/4;
int i;
fifomsg.e.tag = tag;
fifomsg.e.data = len;
while ( i_pxiSetToFifo(fifomsg.raw) != PXI_FIFO_SUCCESS )
{
}
for ( i=0; i<len; i++ )
{
while ( i_pxiSetToFifo(p[i]) != PXI_FIFO_SUCCESS )
{
}
}
}
/*---------------------------------------------------------------------------*
Name: pxiRecvDataByFifo
Description: Recv data to another CPU via FIFO
Arguments:
Returns: if error occured, returns minus value
*---------------------------------------------------------------------------*/
PXIFifoStatus pxiRecvDataByFifo(PXIFifoTag tag, void* buf, int max_size )
{
static PXIFifoMessage fifomsg;
u32* p = buf;
int len;
int i;
while ( i_pxiGetFromFifo(&fifomsg.raw) != PXI_FIFO_SUCCESS )
{
}
if (fifomsg.e.tag != tag)
{
return PXI_FIFO_FAIL_SEND_ERR;
}
len = fifomsg.e.data;
if (len > max_size/4)
{
return PXI_FIFO_FAIL_SEND_ERR;
}
for ( i=0; i<len; i++ )
{
while ( i_pxiGetFromFifo(&p[i]) != PXI_FIFO_SUCCESS )
{
}
}
return PXI_FIFO_SUCCESS;
}
//======================================================================
// Write Send-FIFO reg.
//======================================================================
static inline PXIFifoStatus i_pxiSetToFifo(u32 data)
{
OSIntrMode enabled;
if (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_ERR_MASK)
{
reg_PXI_FIFO_CNT |= (REG_PXI_FIFO_CNT_E_MASK | REG_PXI_FIFO_CNT_ERR_MASK);
return PXI_FIFO_FAIL_SEND_ERR;
}
enabled = osDisableInterrupts();
if (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_SEND_FULL_MASK)
{
(void)osRestoreInterrupts(enabled);
return PXI_FIFO_FAIL_SEND_FULL;
}
reg_PXI_SEND_FIFO = data;
(void)osRestoreInterrupts(enabled);
return PXI_FIFO_SUCCESS;
}
//======================================================================
// Read Send-FIFO reg.
//======================================================================
static inline PXIFifoStatus i_pxiGetFromFifo(u32 *data_buf)
{
OSIntrMode enabled;
if (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_ERR_MASK)
{
reg_PXI_FIFO_CNT |= (REG_PXI_FIFO_CNT_E_MASK | REG_PXI_FIFO_CNT_ERR_MASK);
return PXI_FIFO_FAIL_RECV_ERR;
}
enabled = osDisableInterrupts();
if (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_RECV_EMP_MASK)
{
(void)osRestoreInterrupts(enabled);
return PXI_FIFO_FAIL_RECV_EMPTY;
}
*data_buf = reg_PXI_RECV_FIFO;
(void)osRestoreInterrupts(enabled);
return PXI_FIFO_SUCCESS;
}

View File

@ -25,6 +25,7 @@
#include <brom/init.h>
#include <brom/os.h>
#include <brom/mi.h>
#include <brom/pxi.h>
/* BROM_H_ */
#endif

View File

@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------*
Project: CtrBrom - PXI
File: pxi.h
Copyright 2009 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 BROM_PXI_H_
#define BROM_PXI_H_
#include <brom/pxi/common/fifo.h>
#include <brom/pxi/common/misc.h>
/* BROM_PXI_H_ */
#endif

View File

@ -0,0 +1,197 @@
/*---------------------------------------------------------------------------*
Project: CtrBrom - -include - PXI
File: fifo.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef BROM_PXI_COMMON_FIFO_H_
#define BROM_PXI_COMMON_FIFO_H_
#include <brom/types.h>
#include <brom/memorymap.h>
#include <brom/pxi/common/regname.h>
#ifdef __cplusplus
extern "C" {
#endif
/* TAG ID definition */
typedef enum
{
PXI_FIFO_TAG_EX = 0, // Extension format
PXI_FIFO_TAG_USER_0, // for application programmer, use it in free
PXI_FIFO_TAG_USER_1, // for application programmer, use it in free
PXI_FIFO_TAG_SYSTEM, // SDK inner usage
PXI_FIFO_TAG_NVRAM, // NVRAM
PXI_FIFO_TAG_RTC, // RTC
PXI_FIFO_TAG_TOUCHPANEL, // Touch Panel
PXI_FIFO_TAG_SOUND, // Sound
PXI_FIFO_TAG_PM, // Power Management
PXI_FIFO_TAG_MIC, // Microphone
PXI_FIFO_TAG_WM, // Wireless Manager
PXI_FIFO_TAG_FS, // File System
PXI_FIFO_TAG_OS, // OS
PXI_FIFO_TAG_CARD, // Card
PXI_FIFO_TAG_SDMC,
PXI_MAX_FIFO_TAG = 32 // MAX FIFO TAG
}
PXIFifoTag;
/* for Compatibility */
#define PXI_FIFO_DEVICE_TEST PXI_FIFO_TAG_USR_0
#define PXI_FIFO_DEVICE_FLASH PXI_FIFO_TAG_NVRAM
#define PXI_FIFO_DEVICE_RTC PXI_FIFO_TAG_RTC
#define PXI_FIFO_DEVICE_TOUCHPANEL PXI_FIFO_TAG_TOUCHPANEL
#define PXI_MAX_DEVICES PXI_MAX_FIFO_TAG
/* PXI_FIFO return code */
typedef enum
{
PXI_FIFO_SUCCESS = 0,
PXI_FIFO_FAIL_SEND_ERR = -1,
PXI_FIFO_FAIL_SEND_FULL = -2,
PXI_FIFO_FAIL_RECV_ERR = -3,
PXI_FIFO_FAIL_RECV_EMPTY = -4,
PXI_FIFO_NO_CALLBACK_ENTRY = -5
}
PXIFifoStatus;
/* type definition */
#define PXI_FIFOMESSAGE_BITSZ_TAG 5
#define PXI_FIFOMESSAGE_BITSZ_ERR 1
#define PXI_FIFOMESSAGE_BITSZ_DATA 26
typedef union
{
struct
{
u32 tag:PXI_FIFOMESSAGE_BITSZ_TAG;
u32 err:PXI_FIFOMESSAGE_BITSZ_ERR;
u32 data:PXI_FIFOMESSAGE_BITSZ_DATA;
}
e;
u32 raw;
}
PXIFifoMessage;
// type definition
typedef void (*PXIFifoCallback) (PXIFifoTag tag, u32 data, BOOL err);
typedef void (*PXIFifoEmtpyCallback) (void);
/*---------------------------------------------------------------------------*
Name: pxiIsFifoError
Description: Check if error on fifo?
Arguments: status Status
Returns: None.
*---------------------------------------------------------------------------*/
static inline BOOL pxiIsFifoError(PXIFifoStatus status)
{
return PXI_FIFO_SUCCESS == status;
}
/*---------------------------------------------------------------------------*
Name: pxiInitFifo
Description: initialize FIFO system
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void pxiInitFifo(void);
/*---------------------------------------------------------------------------*
Name: pxiSetFifoRecvCallback
Description: set callback function when data arrive via FIFO
Arguments: device_no DEVICE NO.
callback callback function to be called
Returns: None.
*---------------------------------------------------------------------------*/
void pxiSetFifoRecvCallback(int fifotag, PXIFifoCallback callback);
/*---------------------------------------------------------------------------*
Name: pxiIsCallbackReady
pxiIsArm11CallbackReady
pxiIsArm9CallbackReady
Description: check if callback is ready
Arguments: fifotag fifo tag NO (0-31)
proc processor name PXI_PROC_ARM11 or PXI_PROC_ARM9
Returns: TRUE if callback is ready
*---------------------------------------------------------------------------*/
BOOL pxiIsCallbackReady(int fifotag, PXIProc proc);
static inline BOOL pxiIsArm9CallbackReady(int fifotag)
{
return pxiIsCallbackReady(fifotag, PXI_PROC_ARM9);
}
static inline BOOL pxiIsArm11CallbackReady(int fifotag)
{
return pxiIsCallbackReady(fifotag, PXI_PROC_ARM11);
}
/*---------------------------------------------------------------------------*
Name: pxiSetFifoSendCallback
Description: set callback function when data is sent via FIFO
Arguments: callback callback function to be called
Returns: None.
*---------------------------------------------------------------------------*/
void pxiSetFifoSendCallback(PXIFifoEmtpyCallback callback);
/*---------------------------------------------------------------------------*
Name: pxiSendWordByFifo
Description: Send 32bit-word to anothre CPU via FIFO
Arguments: device_no DEVICE NO.
data data(26-bit) whichi is sent
Returns: if error occured, returns minus value
*---------------------------------------------------------------------------*/
int pxiSendWordByFifo(int fifotag, u32 data, BOOL err);
//======================================================================
// Interrupt handler called when RECV FIFO not empty
//======================================================================
void PXIi_HandlerRecvFifoNotEmpty(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* BROM_PXI_COMMON_FIFO_H_ */

View File

@ -0,0 +1,218 @@
/*---------------------------------------------------------------------------*
Project: CtrBrom - -include - PXI
File: misc.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef BROM_PXI_COMMON_MISC_H_
#define BROM_PXI_COMMON_MISC_H_
#include <brom/types.h>
#include <brom/memorymap.h>
#include <brom/pxi/common/fifo.h>
#ifdef __cplusplus
extern "C" {
#endif
// PXI sync ID for bootrom
typedef enum
{
// from ARM7
BROM_PXI_ID_INIT_ARM7 = 7,
BROM_PXI_ID_BOOT_NOR = 8,
BROM_PXI_ID_BOOT_GCD = 9,
BROM_PXI_ID_BOOT_NAND = 10,
BROM_PXI_ID_LOAD_ARM7 = 6,
BROM_PXI_ID_LOAD_ARM9 = 5,
// from ARM9
BROM_PXI_ID_INIT_ARM9 = 9,
BROM_PXI_ID_AUTH_HEADER = 8,
BROM_PXI_ID_AUTH_FINAL = 5,
BROM_PXI_ID_REQ_HIDE_SEC = 4,
// from both of ARM9 and ARM7
BROM_PXI_ID_NULL = 0,
BROM_PXI_ID_PM = 3,
BROM_PXI_ID_ERR = 0xF
}
BROMPxiID;
/*---------------------------------------------------------------------------*
Name: pxiInitFifoBROM
Description: initialize FIFO system for bootrom
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void pxiInitFifoBROM(void);
/*---------------------------------------------------------------------------*
Name: pxiNotifyID
Description: send 4bit id to other processor
Arguments: id notifying id
Returns: None
*---------------------------------------------------------------------------*/
void pxiNotifyID( u32 id );
/*---------------------------------------------------------------------------*
Name: pxiWaitID
Description: Wait 4bit id from the other processor
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitID( u32 id );
/*---------------------------------------------------------------------------*
Name: pxiRecvID
Description: Receive 4bit id from the other processor
Arguments: None
Returns: id
*---------------------------------------------------------------------------*/
u8 pxiRecvID( void );
/*---------------------------------------------------------------------------*
Name: pxiSendIDByIntf
Description: send 4bit id to other processor
Arguments: id notifying id
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendIDByIntf( u32 id );
/*---------------------------------------------------------------------------*
Name: pxiRecvIDByIntf
Description: receive 4bit id from the other processor
Arguments: None
Returns: received id
*---------------------------------------------------------------------------*/
u32 pxiRecvIDByIntf( void );
/*---------------------------------------------------------------------------*
Name: pxiWaitIDByIntf
Description: Wait 4bit id from the other processor
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitIDByIntf( u32 id );
/*---------------------------------------------------------------------------*
Name: pxiSendIDByFifo
Description: Send 32bit-word to another CPU via FIFO
Arguments:
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendIDByFifo(PXIFifoTag tag, int id);
/*---------------------------------------------------------------------------*
Name: pxiRecvIDByFifo
Description: Recv 32bit-word from another CPU via FIFO
Arguments:
Returns: if error occured, returns minus value
*---------------------------------------------------------------------------*/
PXIFifoStatus pxiRecvIDByFifo(PXIFifoTag tag, void* buf);
/*---------------------------------------------------------------------------*
Name: pxiWaitIDByFifo
Description: Wait 32bit-word from another CPU via FIFO
Arguments: id waiting id
Returns: None
*---------------------------------------------------------------------------*/
void pxiWaitIDByFifo(PXIFifoTag tag, u32 id);
/*---------------------------------------------------------------------------*
Name: pxiSendDataByFifo
Description: Send 32bit-word to another CPU via FIFO
Arguments:
Returns: None
*---------------------------------------------------------------------------*/
void pxiSendDataByFifo(PXIFifoTag tag, void* buf, int size);
/*---------------------------------------------------------------------------*
Name: pxiRecvDataByFifo
Description: Recv 32bit-word to another CPU via FIFO
Arguments:
Returns: if error occured, returns minus value
*---------------------------------------------------------------------------*/
PXIFifoStatus pxiRecvDataByFifo(PXIFifoTag tag, void* buf, int max_size);
/*---------------------------------------------------------------------------*
Name: pxiIsSendFifoFull
Description: Check if send fifo is full?
Arguments: None.
Returns: if send fifo is full
*---------------------------------------------------------------------------*/
static inline BOOL pxiIsSendFifoFull(void)
{
return (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_SEND_FULL_MASK) >> REG_PXI_FIFO_CNT_SEND_FULL_SHIFT;
}
/*---------------------------------------------------------------------------*
Name: pxiIsRecvFifoEmpty
Description: Check if receive fifo is empty?
Arguments: None.
Returns: if receive fifo is empty
*---------------------------------------------------------------------------*/
static inline BOOL pxiIsRecvFifoEmpty(void)
{
return (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_RECV_EMP_MASK) >> REG_PXI_FIFO_CNT_RECV_EMP_SHIFT;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* BROM_PXI_COMMON_MISC_H_ */

View File

@ -0,0 +1,86 @@
/*---------------------------------------------------------------------------*
Project: CtrBrom - include - PXI
File: regname.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef BROM_PXI_COMMON_REGNAME_H_
#define BROM_PXI_COMMON_REGNAME_H_
#include <brom/types.h>
#ifdef __cplusplus
extern "C" {
#endif
// Register rename
typedef enum
{
PXI_PROC_ARM11 = 0,
PXI_PROC_ARM9 = 1
}
PXIProc;
#ifdef SDK_ARM11
#define PXI_PROC_ARM PXI_PROC_ARM11
#define reg_PXI_FIFO_CNT reg_PXI_SUBP_FIFO_CNT
#define REG_PXI_FIFO_CNT_ERR_MASK REG_PXI_SUBP_FIFO_CNT_ERR_MASK
#define REG_PXI_FIFO_CNT_SEND_CL_MASK REG_PXI_SUBP_FIFO_CNT_SEND_CL_MASK
#define REG_PXI_FIFO_CNT_SEND_FULL_MASK REG_PXI_SUBP_FIFO_CNT_SEND_FULL_MASK
#define REG_PXI_FIFO_CNT_SEND_FULL_SHIFT REG_PXI_SUBP_FIFO_CNT_SEND_FULL_SHIFT
#define REG_PXI_FIFO_CNT_SEND_TI_MASK REG_PXI_SUBP_FIFO_CNT_SEND_TI_MASK
#define REG_PXI_FIFO_CNT_RECV_RI_MASK REG_PXI_SUBP_FIFO_CNT_RECV_RI_MASK
#define REG_PXI_FIFO_CNT_RECV_EMP_MASK REG_PXI_SUBP_FIFO_CNT_RECV_EMP_MASK
#define REG_PXI_FIFO_CNT_RECV_EMP_SHIFT REG_PXI_SUBP_FIFO_CNT_RECV_EMP_SHIFT
#define REG_PXI_FIFO_CNT_E_MASK REG_PXI_SUBP_FIFO_CNT_E_MASK
#define reg_PXI_INTF reg_PXI_SUBPINTF
#define REG_PXI_INTF_I_MASK REG_PXI_SUBPINTF_I_MASK
#define REG_PXI_INTF_IREQ_MASK REG_PXI_SUBPINTF_IREQ_MASK
#define REG_PXI_INTF_SEND_MASK REG_PXI_SUBPINTF_A11STATUS_MASK
#define REG_PXI_INTF_SEND_SHIFT REG_PXI_SUBPINTF_A11STATUS_SHIFT
#define REG_PXI_INTF_RECV_MASK REG_PXI_SUBPINTF_A9STATUS_MASK
#define REG_PXI_INTF_RECV_SHIFT REG_PXI_SUBPINTF_A9STATUS_SHIFT
#else // SDK_ARM9
#define PXI_PROC_ARM PXI_PROC_ARM9
#define reg_PXI_FIFO_CNT reg_PXI_MAINP_FIFO_CNT
#define REG_PXI_FIFO_CNT_ERR_MASK REG_PXI_MAINP_FIFO_CNT_ERR_MASK
#define REG_PXI_FIFO_CNT_SEND_CL_MASK REG_PXI_MAINP_FIFO_CNT_SEND_CL_MASK
#define REG_PXI_FIFO_CNT_SEND_FULL_MASK REG_PXI_MAINP_FIFO_CNT_SEND_FULL_MASK
#define REG_PXI_FIFO_CNT_SEND_FULL_SHIFT REG_PXI_MAINP_FIFO_CNT_SEND_FULL_SHIFT
#define REG_PXI_FIFO_CNT_SEND_TI_MASK REG_PXI_MAINP_FIFO_CNT_SEND_TI_MASK
#define REG_PXI_FIFO_CNT_RECV_RI_MASK REG_PXI_MAINP_FIFO_CNT_RECV_RI_MASK
#define REG_PXI_FIFO_CNT_RECV_EMP_MASK REG_PXI_MAINP_FIFO_CNT_RECV_EMP_MASK
#define REG_PXI_FIFO_CNT_RECV_EMP_SHIFT REG_PXI_MAINP_FIFO_CNT_RECV_EMP_SHIFT
#define REG_PXI_FIFO_CNT_E_MASK REG_PXI_MAINP_FIFO_CNT_E_MASK
#define reg_PXI_INTF reg_PXI_MAINPINTF
#define REG_PXI_INTF_I_MASK REG_PXI_MAINPINTF_I_MASK
#define REG_PXI_INTF_IREQ_MASK REG_PXI_MAINPINTF_IREQ_MASK
#define REG_PXI_INTF_SEND_MASK REG_PXI_MAINPINTF_A9STATUS_MASK
#define REG_PXI_INTF_SEND_SHIFT REG_PXI_MAINPINTF_A9STATUS_SHIFT
#define REG_PXI_INTF_RECV_MASK REG_PXI_MAINPINTF_A11STATUS_MASK
#define REG_PXI_INTF_RECV_SHIFT REG_PXI_MAINPINTF_A11STATUS_SHIFT
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
/* BROM_PXI_COMMON_REGNAME_H_ */
#endif