00001 /*This file has been prepared for Doxygen automatic documentation generation.*/ 00013 00014 /* Copyright (c) 2007, Atmel Corporation All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions are met: 00018 * 00019 * 1. Redistributions of source code must retain the above copyright notice, 00020 * this list of conditions and the following disclaimer. 00021 * 00022 * 2. Redistributions in binary form must reproduce the above copyright notice, 00023 * this list of conditions and the following disclaimer in the documentation 00024 * and/or other materials provided with the distribution. 00025 * 00026 * 3. The name of ATMEL may not be used to endorse or promote products derived 00027 * from this software without specific prior written permission. 00028 * 00029 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 00030 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00031 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 00032 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 00033 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00034 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00035 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00036 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00037 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00038 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 */ 00040 00041 //_____ I N C L U D E S ____________________________________________________ 00042 00043 #include "config.h" 00044 #include "power_drv.h" 00045 00046 00047 //_____ D E C L A R A T I O N ______________________________________________ 00048 00049 00054 #ifndef __GNUC__ 00055 // Ignored if IAR compiler optimization option "Always do cross call optimization" is enabled 00056 #pragma optimize=none 00057 void Set_cpu_prescaler(U8 x) 00058 { 00059 U8 save_int=Get_interrupt_state(); 00060 Disable_interrupt(); 00061 CLKPR=(1<<CLKPCE); 00062 CLKPR=x; 00063 if(save_int) { Enable_interrupt(); } 00064 } 00065 #endif 00066 00067 00070 void set_power_down_mode(void) 00071 { 00072 Setup_power_down_mode(); 00073 Sleep_instruction(); 00074 } 00075 00076 00079 void set_idle_mode(void) 00080 { 00081 Setup_idle_mode(); 00082 Sleep_instruction(); 00083 } 00084 00085 00088 void set_adc_noise_reduction_mode(void) 00089 { 00090 Setup_adc_noise_reduction_mode(); 00091 Sleep_instruction(); 00092 } 00093 00094 00097 void set_power_save_mode(void) 00098 { 00099 Setup_power_save_mode(); 00100 Sleep_instruction(); 00101 } 00102 00103 00106 void set_standby_mode(void) 00107 { 00108 Setup_standby_mode(); 00109 Sleep_instruction(); 00110 } 00111 00112 00115 void set_ext_standby_mode(void) 00116 { 00117 Setup_ext_standby_mode(); 00118 Sleep_instruction(); 00119 } 00120