/******************************************************************************* * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only * intended for use with Renesas products. No other uses are authorized. This * software is owned by Renesas Electronics Corporation and is protected under * all applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software * and to discontinue the availability of this software. By using this software, * you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * (c) 2014 Renesas Electronics Corporation All rights reserved. *******************************************************************************/ /****************************************************************************** * File Name : r_standby.c * Version : 1.0 * Device(s) : R7F701007 RH850/F1L * Tool-Chain : IAR Embedded Workbench 1.30.1 * Description : This file is a sample of the standby modes. * Operation : - ******************************************************************************* ******************************************************************************* * History : DD.MM.YYYY Version Description * : 20.03.2014 1.00 First Release ******************************************************************************/ /****************************************************************************** Includes ******************************************************************************/ #include "r_typedefs.h" #include "iodefine.h" #ifdef __ghs__ #include "device.h" #endif #ifdef __IAR_SYSTEMS_ICC__ #include #endif /****************************************************************************** Imported global variables and functions (from other files) ******************************************************************************/ /****************************************************************************** Macro definitions ******************************************************************************/ /****************************************************************************** Exported global variables and functions (to be accessed by other files) ******************************************************************************/ void shift_deep_stop( void ); /****************************************************************************** Private global variables and functions ******************************************************************************/ /****************************************************************************** * Function Name : void shift_deep_stop( void ) * Description : * Argument : none * Return Value : none ******************************************************************************/ void shift_deep_stop( void ) { uint32_t reg32_value; /* Stop all the peripheral functions to stop clock supply. */ /* Unused by the sample program. */ /* Interrupt disable */ __DI(); /* Set/Clear the interrupt flags */ /* Unused by the sample program. */ /* Clear all the wakeup factor WUFC0 - Wake-Up Factor Registers b31:b0 WUFy - Indicates the generation of a wake-up event. */ WUFC0 = 0xFFFFFFFFUL; /* Clear all the wakeup factor WUFC20 - Wake-Up Factor Registers b31:b0 WUFy - Indicates the generation of a wake-up event. */ WUFC20 = 0xFFFFFFFFUL; /* Clear all the wakeup factor WUFC_ISO0 - Wake-Up Factor Registers b31:b0 WUFy - Indicates the generation of a wake-up event. */ WUFC_ISO0 = 0xFFFFFFFFUL; /* Masked the interrupt of the unused wakeup factor, and Unmasked the interrupt of the wakeup factor. WUFMSK0 - Wake-Up Factor Mask Registers b31:b0 WUFMSKy - Enables/disables a wake-up event. */ WUFMSK0 = 0xFFF7FFFFUL; /* Wakeup factor 1 (Deep STOP �� RUN ) : WUTRG0 */ WUFMSK20 = 0xFFFFFFFFUL; /* none */ WUFMSK_ISO0 = 0xFFFFFFFFUL; /* none */ /* Set the clock stop mask and select the clock domains to be stopped and to continue operating. CKSC_ATAUJD_STPM - C_AWO_TAUJ Stop Mask Register b31:b 1 - When read, the value after reset is returned. When writing to these bits, write the value after reset. b 0 ATAUJDSTPMSK - Clock domain C_AWO_TAUJ is not stopped in stand-by mode. Set to 1'b. */ CKSC_ATAUJD_STPM = 0x00000003UL; /* Set MOSCSTPM.MOSCSTPMSK bit and ROSCSTPM.ROSCSTPMSK bit. */ /* Unused by the sample program. */ /* Shift to DEEPSTOP mode STBC0PSC - Power Save Control Register b31:b2 - Reserved set to 0 b 1 STBC0DISTRG - DEEPSTOP mode is entered. Set to 1 b 0 - Reserved set to 0 */ do { reg32_value = 0x00000002UL; PROTCMD0 = 0x000000A5UL; /* Protection release the STBC0PSC register */ STBC0PSC = reg32_value; STBC0PSC = ~reg32_value; STBC0PSC = reg32_value; } while ( PROTS0 != 0x00000000UL ); while ( STBC0PSC == reg32_value ) { /* Waiting for shift to DEEPSTOP mode. */ } while ( 1U ) { /* Waiting for shift to DEEPSTOP mode. */ } }