From 625d481a48f9e8d4b7bb18aa5cbffb7403f02a42 Mon Sep 17 00:00:00 2001 From: nakasima Date: Thu, 27 Sep 2007 05:27:16 +0000 Subject: [PATCH] add PM_GoDsMode. git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@284 4ee2a332-4b2b-5046-8439-1ba90f034370 --- build/libraries/spi/ARM7/pm/Makefile | 1 + build/libraries/spi/ARM7/pm/include/pm_ds.h | 44 ++++++++++++++ build/libraries/spi/ARM7/pm/pm_ds.c | 65 +++++++++++++++++++++ include/twl/pm/common/pm_reg_ex.h | 2 + 4 files changed, 112 insertions(+) create mode 100644 build/libraries/spi/ARM7/pm/include/pm_ds.h create mode 100644 build/libraries/spi/ARM7/pm/pm_ds.c diff --git a/build/libraries/spi/ARM7/pm/Makefile b/build/libraries/spi/ARM7/pm/Makefile index a183433..5e27a0f 100644 --- a/build/libraries/spi/ARM7/pm/Makefile +++ b/build/libraries/spi/ARM7/pm/Makefile @@ -31,6 +31,7 @@ SRCS = pm_sp.c \ pm_send.c \ pm_pmic.c \ pm_pmic_ex.c \ + pm_ds.c \ pm_utility.c \ pm_sleep.c \ pm_selfBlink.c \ diff --git a/build/libraries/spi/ARM7/pm/include/pm_ds.h b/build/libraries/spi/ARM7/pm/include/pm_ds.h new file mode 100644 index 0000000..97703c5 --- /dev/null +++ b/build/libraries/spi/ARM7/pm/include/pm_ds.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - spi - pm + File: pm_ds.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_DS_H_ +#define TWL_PM_DS_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: PM_GoDsMode + + Description: set control bit to ds mode + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_GoDsMode( void ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_PM_DS_H_ */ +#endif + diff --git a/build/libraries/spi/ARM7/pm/pm_ds.c b/build/libraries/spi/ARM7/pm/pm_ds.c new file mode 100644 index 0000000..a9cb098 --- /dev/null +++ b/build/libraries/spi/ARM7/pm/pm_ds.c @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - spi - pm + File: pm_ds.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 "../include/pm_pmic.h" +#include "./include/pm_pmic_ex.h" +#include "./include/pm_ds.h" + + +/*---------------------------------------------------------------------------* + Name: PM_GoDsMode + + Description: set control bit to ds mode + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_GoDsMode( void ) +{ + // LED + PMi_ResetFlags( REG_PMIC_LED_CTL_ADDR, PMIC_LED_CTL_L12_AT_BLK | PMIC_LED_CTL_L12_BLK_BY_SLP ); + PMi_SetParams( REG_PMIC_LED12_B4_ADDR, + PMIC_LED12_B4_L1_OFF | PMIC_LED12_B4_L2_OFF, + PMIC_LED12_B4_L1_MASK | PMIC_LED12_B4_L2_MASK + ); + PMi_SetParams( REG_PMIC_LED12_B3_ADDR, + PMIC_LED12_B3_L1_100 | PMIC_LED12_B3_L2_OFF, + PMIC_LED12_B3_L1_MASK | PMIC_LED12_B3_L2_MASK + ); + PMi_SetParams( REG_PMIC_LED12_B2_ADDR, + PMIC_LED12_B2_L1_OFF | PMIC_LED12_B2_L2_100, + PMIC_LED12_B2_L1_MASK | PMIC_LED12_B2_L2_MASK + ); + PMi_SetParams( REG_PMIC_LED12_B1_ADDR, + PMIC_LED12_B1_L1_100 | PMIC_LED12_B1_L2_100, + PMIC_LED12_B1_L1_MASK | PMIC_LED12_B1_L2_MASK + ); + + // LCD ON + PMi_SetFlags( REG_PMIC_CTL2_ADDR, PMIC_CTL2_LCD_PWR ); + + // back light ON + PMi_SetParams( REG_PMIC_BL1_BRT_ADDR, PMIC_BL_BRT_MAX, PMIC_BL1_BRT_MASK ); + PMi_SetParams( REG_PMIC_BL2_BRT_ADDR, PMIC_BL_BRT_MAX, PMIC_BL2_BRT_MASK ); + OS_SpinWait( OS_MSEC_TO_CPUCYC( 17*2 ) ); + PMi_SetFlags( REG_PMIC_CTL2_ADDR, PMIC_CTL2_BKLT1 | PMIC_CTL2_BKLT2 ); + + // battery correct + PMi_SetFlags( REG_PMIC_BT_CRCT_ADDR, PMIC_BT_CRCT_BT2_ON | PMIC_BT_CRCT_BT3_ON ); +} + diff --git a/include/twl/pm/common/pm_reg_ex.h b/include/twl/pm/common/pm_reg_ex.h index d0e2629..a216de7 100644 --- a/include/twl/pm/common/pm_reg_ex.h +++ b/include/twl/pm/common/pm_reg_ex.h @@ -111,6 +111,8 @@ extern "C" { //---- PMIC_BT_CRCT #define PMIC_BT_CRCT_TEMP_ON (1<< 0) #define PMIC_BT_CRCT_AMPR_ON (1<< 1) +#define PMIC_BT_CRCT_BT2_ON (1<< 2) +#define PMIC_BT_CRCT_BT3_ON (1<< 3) #define PMIC_BT_CRCT_AK_SHIFT 4 #define PMIC_BT_CRCT_AK_MASK (0x3<< PMIC_BT_CRCT_AK_SHIFT) #define PMIC_BT_CRCT_TK_SHIFT 6