/*---------------------------------------------------------------------------* 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_ */