From 1c28baf5e3e9d8698574b32322cd3c815def43a1 Mon Sep 17 00:00:00 2001 From: nakasima Date: Wed, 3 Oct 2007 09:21:24 +0000 Subject: [PATCH] add pxi intf. git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@295 4ee2a332-4b2b-5046-8439-1ba90f034370 --- build/libraries/pxi/ARM7/Makefile | 6 ++- build/libraries/pxi/ARM9/Makefile | 4 +- build/libraries/pxi/common/pxi_intf.c | 63 +++++++++++++++++++++++++ include/twl.h | 1 + include/twl/pxi.h | 25 ++++++++++ include/twl/pxi/common/intf.h | 67 +++++++++++++++++++++++++++ 6 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 build/libraries/pxi/common/pxi_intf.c create mode 100644 include/twl/pxi.h create mode 100644 include/twl/pxi/common/intf.h diff --git a/build/libraries/pxi/ARM7/Makefile b/build/libraries/pxi/ARM7/Makefile index 3bedaa9..7da7a76 100644 --- a/build/libraries/pxi/ARM7/Makefile +++ b/build/libraries/pxi/ARM7/Makefile @@ -24,11 +24,13 @@ TWL_CODEGEN_ALL ?= True TWL_PROC = ARM7 -SRCDIR = ../common/src . +SRCDIR = ../common . SRCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/pxi/common/src \ $(TWL_NITROSDK_ROOT)/build/libraries/pxi/ARM7/src \ -SRCS = pxi_init.c pxi_fifo.c +SRCS = pxi_init.c \ + pxi_fifo.c \ + pxi_intf.c \ TARGET_LIB = libpxi_sp$(TWL_LIBSUFFIX).a diff --git a/build/libraries/pxi/ARM9/Makefile b/build/libraries/pxi/ARM9/Makefile index 008caba..d83ea96 100644 --- a/build/libraries/pxi/ARM9/Makefile +++ b/build/libraries/pxi/ARM9/Makefile @@ -28,7 +28,9 @@ SRCDIR = ../common . SRCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/pxi/common/src \ $(TWL_NITROSDK_ROOT)/build/libraries/pxi/ARM9/src \ -SRCS = pxi_init.c pxi_fifo.c +SRCS = pxi_init.c \ + pxi_fifo.c \ + pxi_intf.c \ TARGET_LIB = libpxi$(TWL_LIBSUFFIX).a diff --git a/build/libraries/pxi/common/pxi_intf.c b/build/libraries/pxi/common/pxi_intf.c new file mode 100644 index 0000000..bbe60bd --- /dev/null +++ b/build/libraries/pxi/common/pxi_intf.c @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - library - pxi + File: pxi_intf.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 +#include + + +/*---------------------------------------------------------------------------* + Name: PXI_SendByIntf + + Description: Send 4bit data to the other processor + + Arguments: id sending id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_SendByIntf( u32 data ) +{ + reg_PXI_INTF = (u16)(data << REG_PXI_INTF_SEND_SHIFT); +} + +/*---------------------------------------------------------------------------* + Name: PXI_RecvByIntf + + Description: Receive 4bit data from the other processor + + Arguments: None + + Returns: received id + *---------------------------------------------------------------------------*/ +u32 PXI_RecvByIntf( void ) +{ + return (u32)(((reg_PXI_INTF & REG_PXI_INTF_RECV_MASK) >> REG_PXI_INTF_RECV_SHIFT)); +} + +/*---------------------------------------------------------------------------* + Name: PXI_WaitByIntf + + Description: Wait 4bit data from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_WaitByIntf( u32 data ) +{ + while (PXI_RecvByIntf() != data) + { + } +} + diff --git a/include/twl.h b/include/twl.h index 2ce919d..592d84c 100644 --- a/include/twl.h +++ b/include/twl.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/include/twl/pxi.h b/include/twl/pxi.h new file mode 100644 index 0000000..deeb478 --- /dev/null +++ b/include/twl/pxi.h @@ -0,0 +1,25 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - include - PXI + File: pxi.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_PXI_H_ +#define TWL_PXI_H_ + +#include + +#include + +/* TWL_PXI_H_ */ +#endif diff --git a/include/twl/pxi/common/intf.h b/include/twl/pxi/common/intf.h new file mode 100644 index 0000000..a7326e9 --- /dev/null +++ b/include/twl/pxi/common/intf.h @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - -include - PXI + File: intf.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_PXI_COMMON_INTF_H_ +#define TWL_PXI_COMMON_INTF_H_ + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: PXI_SendByIntf + + Description: send 4bit data to other processor + + Arguments: id notifying id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_SendByIntf( u32 data ); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvByIntf + + Description: receive 4bit data from the other processor + + Arguments: None + + Returns: received id + *---------------------------------------------------------------------------*/ +u32 PXI_RecvByIntf( void ); + +/*---------------------------------------------------------------------------* + Name: PXI_WaitByIntf + + Description: Wait 4bit data from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_WaitByIntf( u32 data ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_PXI_COMMON_INTF_H_ */