diff --git a/trunk/bootrom/build/libraries/Makefile b/trunk/bootrom/build/libraries/Makefile index b4cc876..bfad43f 100644 --- a/trunk/bootrom/build/libraries/Makefile +++ b/trunk/bootrom/build/libraries/Makefile @@ -21,10 +21,11 @@ include $(CTRBROM_ROOT)/build/buildtools/commondefs #---------------------------------------------------------------------------- SUBDIRS = \ - vlink \ init \ os \ mi \ + pxi \ + vlink \ #---------------------------------------------------------------------------- diff --git a/trunk/bootrom/build/libraries/pxi/ARM11/Makefile b/trunk/bootrom/build/libraries/pxi/ARM11/Makefile new file mode 100644 index 0000000..664405b --- /dev/null +++ b/trunk/bootrom/build/libraries/pxi/ARM11/Makefile @@ -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 ===== diff --git a/trunk/bootrom/build/libraries/pxi/ARM9/Makefile b/trunk/bootrom/build/libraries/pxi/ARM9/Makefile new file mode 100644 index 0000000..4a1f9bf --- /dev/null +++ b/trunk/bootrom/build/libraries/pxi/ARM9/Makefile @@ -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 ===== diff --git a/trunk/bootrom/build/libraries/pxi/Makefile b/trunk/bootrom/build/libraries/pxi/Makefile new file mode 100644 index 0000000..39ab6a4 --- /dev/null +++ b/trunk/bootrom/build/libraries/pxi/Makefile @@ -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 ===== diff --git a/trunk/bootrom/build/libraries/pxi/common/pxi_misc.c b/trunk/bootrom/build/libraries/pxi/common/pxi_misc.c new file mode 100644 index 0000000..cc0ce78 --- /dev/null +++ b/trunk/bootrom/build/libraries/pxi/common/pxi_misc.c @@ -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 +#include + + +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 max_size/4) + { + return PXI_FIFO_FAIL_SEND_ERR; + } + + for ( i=0; i #include #include +#include /* BROM_H_ */ #endif diff --git a/trunk/bootrom/include/brom/pxi.h b/trunk/bootrom/include/brom/pxi.h new file mode 100644 index 0000000..805aa7f --- /dev/null +++ b/trunk/bootrom/include/brom/pxi.h @@ -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 +#include + +/* BROM_PXI_H_ */ +#endif diff --git a/trunk/bootrom/include/brom/pxi/common/fifo.h b/trunk/bootrom/include/brom/pxi/common/fifo.h new file mode 100644 index 0000000..e105719 --- /dev/null +++ b/trunk/bootrom/include/brom/pxi/common/fifo.h @@ -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 +#include +#include + + +#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_ */ diff --git a/trunk/bootrom/include/brom/pxi/common/misc.h b/trunk/bootrom/include/brom/pxi/common/misc.h new file mode 100644 index 0000000..7505f6c --- /dev/null +++ b/trunk/bootrom/include/brom/pxi/common/misc.h @@ -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 +#include +#include + + +#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_ */ diff --git a/trunk/bootrom/include/brom/pxi/common/regname.h b/trunk/bootrom/include/brom/pxi/common/regname.h new file mode 100644 index 0000000..e8c8b4c --- /dev/null +++ b/trunk/bootrom/include/brom/pxi/common/regname.h @@ -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 + +#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