diff --git a/build/buildtools/commondefs b/build/buildtools/commondefs index b01d374..dea9bab 100644 --- a/build/buildtools/commondefs +++ b/build/buildtools/commondefs @@ -176,6 +176,7 @@ TWL_LIBS_BASE ?= \ libmi_sp \ libvlink_sp \ libnvram_sp \ + libpm_sp \ libaes_sp \ libi2c_sp \ libcdc_sp \ diff --git a/build/libraries/spi/ARM7/Makefile b/build/libraries/spi/ARM7/Makefile index ec2b9b3..df7a4b5 100644 --- a/build/libraries/spi/ARM7/Makefile +++ b/build/libraries/spi/ARM7/Makefile @@ -15,7 +15,7 @@ # $NoKeywords: $ #---------------------------------------------------------------------------- -SUBDIRS = nvram # tp mic pm +SUBDIRS = nvram pm # tp mic #---------------------------------------------------------------------------- diff --git a/build/libraries/spi/ARM7/pm/Makefile b/build/libraries/spi/ARM7/pm/Makefile new file mode 100644 index 0000000..a183433 --- /dev/null +++ b/build/libraries/spi/ARM7/pm/Makefile @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - spi +# 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 = ARM7 + +SRCDIR = . +SRCDIR += $(TWL_NITROSDK_ROOT)/build/libraries/spi/ARM7/pm/src \ + +SRCS = pm_sp.c \ + pm_send.c \ + pm_pmic.c \ + pm_pmic_ex.c \ + pm_utility.c \ + pm_sleep.c \ + pm_selfBlink.c \ + +TARGET_LIB = libpm_sp$(TWL_LIBSUFFIX).a +INCDIR = $(TWL_NITROSDK_ROOT)/build/libraries/spi/ARM7/include + +#---------------------------------------------------------------------------- + +# DEBUG版ビルドの場合、RELEASE版でビルドして +# DEBUG版のライブラリを装います。 + +ifdef NITRO_DEBUG +NITRO_BUILD_TYPE = RELEASE +endif + +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 ===== diff --git a/build/libraries/spi/ARM7/pm/include/pm_pmic_ex.h b/build/libraries/spi/ARM7/pm/include/pm_pmic_ex.h new file mode 100644 index 0000000..1a36c64 --- /dev/null +++ b/build/libraries/spi/ARM7/pm/include/pm_pmic_ex.h @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - spi - pm + File: pm_pmic_ex.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_PM_PMIC_EX_H_ +#define TWL_PM_PMIC_EX_H_ + +#include +#include +#include "../include/pm_pmic.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================================ +// PMIC ACCESS +//================================================================================ +/*---------------------------------------------------------------------------* + Name: PMi_SetParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetParams( u8 reg, u8 setBits, u8 maskBits ); + +/*---------------------------------------------------------------------------* + Name: PMi_SetFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetFlags( u8 reg, u8 setBits ); + +/*---------------------------------------------------------------------------* + Name: PMi_ResetFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_ResetFlags( u8 reg, u8 clrBits ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_PM_PMIC_EX_H_ */ +#endif diff --git a/build/libraries/spi/ARM7/pm/pm_pmic_ex.c b/build/libraries/spi/ARM7/pm/pm_pmic_ex.c new file mode 100644 index 0000000..a110b0a --- /dev/null +++ b/build/libraries/spi/ARM7/pm/pm_pmic_ex.c @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - spi - pm + File: pm_pmic_ex.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 "./include/pm_pmic_ex.h" + + +//================================================================================ +// PMIC BIT CONTROL +//================================================================================ +/*---------------------------------------------------------------------------* + Name: PMi_SetParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetParams( u8 reg, u8 setBits, u8 maskBits ) +{ + u8 tmp; + tmp = PMi_GetRegister( reg ); + tmp &= ~maskBits; + setBits &= maskBits; + tmp |= setBits; + PMi_SetRegister( reg, tmp ); +} + +/*---------------------------------------------------------------------------* + Name: PMi_SetFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetFlags( u8 reg, u8 setBits ) +{ + PMi_SetParams( reg, setBits, setBits ); +} + +/*---------------------------------------------------------------------------* + Name: PMi_ResetFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_ResetFlags( u8 reg, u8 clrBits ) +{ + PMi_SetParams( reg, 0, clrBits ); +} + diff --git a/include/nitro/spi/ARM7/spi.h b/include/nitro/spi/ARM7/spi.h index 14f1b39..f7a58aa 100644 --- a/include/nitro/spi/ARM7/spi.h +++ b/include/nitro/spi/ARM7/spi.h @@ -17,13 +17,14 @@ #ifndef TWL_SPI_SPI_H_ #define TWL_SPI_SPI_H_ +#include +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - //---------------------------------------------------------------- // enums // diff --git a/include/twl/pm.h b/include/twl/pm.h index 7fa7508..8a7aedd 100644 --- a/include/twl/pm.h +++ b/include/twl/pm.h @@ -19,7 +19,7 @@ #include -#include +#include /* TWL_PM_H_ */ #endif diff --git a/include/twl/pm/common/pm_ex_reg.h b/include/twl/pm/common/pm_reg_ex.h similarity index 96% rename from include/twl/pm/common/pm_ex_reg.h rename to include/twl/pm/common/pm_reg_ex.h index e683db0..b313908 100644 --- a/include/twl/pm/common/pm_ex_reg.h +++ b/include/twl/pm/common/pm_reg_ex.h @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------* Project: TwlSDK - PM - include - common - File: pm_ex_reg.h + File: pm_reg_ex.h Copyright 2006 Nintendo. All rights reserved. @@ -13,8 +13,8 @@ $Log: $ $NoKeywords: $ *---------------------------------------------------------------------------*/ -#ifndef TWL_PM_PM_EX_REG_H_ -#define TWL_PM_PM_EX_REG_H_ +#ifndef TWL_PM_PM_REG_EX_H_ +#define TWL_PM_PM_REG_EX_H_ #ifdef __cplusplus @@ -581,5 +581,5 @@ PMBackLightBrightness; } /* extern "C" */ #endif -/* TWL_PM_PM_EX_REG_H_ */ +/* TWL_PM_PM_REG_EX_H_ */ #endif