ATMEL: power_drv.c Source File

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# power_drv.c

Go to the documentation of this file.

    00001 /*This file is prepared for Doxygen automatic documentation generation.*/
    00013
    00014 /* Copyright (c) 2009 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  * 4. This software may only be redistributed and used in connection with an Atmel
    00030  * AVR product.
    00031  *
    00032  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
    00033  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00034  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
    00035  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
    00036  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00037  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    00038  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00039  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    00041  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00042  */
    00043
    00044 //_____ I N C L U D E S ____________________________________________________
    00045
    00046 #include "config.h"
    00047 #include "power_drv.h"
    00048
    00049
    00050 //_____ D E C L A R A T I O N ______________________________________________
    00051
    00052
    00057 #ifndef __GNUC__
    00058 // Ignored if IAR compiler optimization option "Always do cross call optimization" is enabled
    00059 #pragma optimize=none
    00060 void Set_cpu_prescaler(U8 x)
    00061 {
    00062    U8 save_int=Get_interrupt_state();
    00063    Disable_interrupt();
    00064    CLKPR=(1<<CLKPCE);
    00065    CLKPR=x;
    00066    if(save_int) { Enable_interrupt(); }
    00067 }
    00068 #endif
    00069
    00070
    00073 void set_power_down_mode(void)
    00074 {
    00075    Setup_power_down_mode();
    00076    Sleep_instruction();
    00077 }
    00078
    00079
    00082 void set_idle_mode(void)
    00083 {
    00084    Setup_idle_mode();
    00085    Sleep_instruction();
    00086 }
    00087
    00088
    00091 void set_adc_noise_reduction_mode(void)
    00092 {
    00093    Setup_adc_noise_reduction_mode();
    00094    Sleep_instruction();
    00095 }
    00096
    00097
    00100 void set_power_save_mode(void)
    00101 {
    00102    Setup_power_save_mode();
    00103    Sleep_instruction();
    00104 }
    00105
    00106
    00109 void set_standby_mode(void)
    00110 {
    00111    Setup_standby_mode();
    00112    Sleep_instruction();
    00113 }
    00114
    00115
    00118 void set_ext_standby_mode(void)
    00119 {
    00120    Setup_ext_standby_mode();
    00121    Sleep_instruction();
    00122 }
    00123