Mouse code for the MacroRat
mbed-dev/targets/TARGET_Atmel/TARGET_SAM_CortexM4/drivers/supc/supc.h@18:6a4db94011d3, 2017-05-14 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sun May 14 23:18:57 2017 +0000
- Revision:
- 18:6a4db94011d3
Publishing again
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * \file |
sahilmgandhi | 18:6a4db94011d3 | 3 | * |
sahilmgandhi | 18:6a4db94011d3 | 4 | * \brief Supply Controller (SUPC) driver for SAM. |
sahilmgandhi | 18:6a4db94011d3 | 5 | * |
sahilmgandhi | 18:6a4db94011d3 | 6 | * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * \asf_license_start |
sahilmgandhi | 18:6a4db94011d3 | 9 | * |
sahilmgandhi | 18:6a4db94011d3 | 10 | * \page License |
sahilmgandhi | 18:6a4db94011d3 | 11 | * |
sahilmgandhi | 18:6a4db94011d3 | 12 | * Redistribution and use in source and binary forms, with or without |
sahilmgandhi | 18:6a4db94011d3 | 13 | * modification, are permitted provided that the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 14 | * |
sahilmgandhi | 18:6a4db94011d3 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
sahilmgandhi | 18:6a4db94011d3 | 16 | * this list of conditions and the following disclaimer. |
sahilmgandhi | 18:6a4db94011d3 | 17 | * |
sahilmgandhi | 18:6a4db94011d3 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
sahilmgandhi | 18:6a4db94011d3 | 19 | * this list of conditions and the following disclaimer in the documentation |
sahilmgandhi | 18:6a4db94011d3 | 20 | * and/or other materials provided with the distribution. |
sahilmgandhi | 18:6a4db94011d3 | 21 | * |
sahilmgandhi | 18:6a4db94011d3 | 22 | * 3. The name of Atmel may not be used to endorse or promote products derived |
sahilmgandhi | 18:6a4db94011d3 | 23 | * from this software without specific prior written permission. |
sahilmgandhi | 18:6a4db94011d3 | 24 | * |
sahilmgandhi | 18:6a4db94011d3 | 25 | * 4. This software may only be redistributed and used in connection with an |
sahilmgandhi | 18:6a4db94011d3 | 26 | * Atmel microcontroller product. |
sahilmgandhi | 18:6a4db94011d3 | 27 | * |
sahilmgandhi | 18:6a4db94011d3 | 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED |
sahilmgandhi | 18:6a4db94011d3 | 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
sahilmgandhi | 18:6a4db94011d3 | 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE |
sahilmgandhi | 18:6a4db94011d3 | 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR |
sahilmgandhi | 18:6a4db94011d3 | 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
sahilmgandhi | 18:6a4db94011d3 | 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
sahilmgandhi | 18:6a4db94011d3 | 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
sahilmgandhi | 18:6a4db94011d3 | 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
sahilmgandhi | 18:6a4db94011d3 | 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
sahilmgandhi | 18:6a4db94011d3 | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
sahilmgandhi | 18:6a4db94011d3 | 38 | * POSSIBILITY OF SUCH DAMAGE. |
sahilmgandhi | 18:6a4db94011d3 | 39 | * |
sahilmgandhi | 18:6a4db94011d3 | 40 | * \asf_license_stop |
sahilmgandhi | 18:6a4db94011d3 | 41 | * |
sahilmgandhi | 18:6a4db94011d3 | 42 | */ |
sahilmgandhi | 18:6a4db94011d3 | 43 | /* |
sahilmgandhi | 18:6a4db94011d3 | 44 | * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> |
sahilmgandhi | 18:6a4db94011d3 | 45 | */ |
sahilmgandhi | 18:6a4db94011d3 | 46 | |
sahilmgandhi | 18:6a4db94011d3 | 47 | #ifndef SUPC_H_INCLUDED |
sahilmgandhi | 18:6a4db94011d3 | 48 | #define SUPC_H_INCLUDED |
sahilmgandhi | 18:6a4db94011d3 | 49 | |
sahilmgandhi | 18:6a4db94011d3 | 50 | #include "compiler.h" |
sahilmgandhi | 18:6a4db94011d3 | 51 | |
sahilmgandhi | 18:6a4db94011d3 | 52 | /// @cond 0 |
sahilmgandhi | 18:6a4db94011d3 | 53 | /**INDENT-OFF**/ |
sahilmgandhi | 18:6a4db94011d3 | 54 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 55 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 56 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 57 | /**INDENT-ON**/ |
sahilmgandhi | 18:6a4db94011d3 | 58 | /// @endcond |
sahilmgandhi | 18:6a4db94011d3 | 59 | |
sahilmgandhi | 18:6a4db94011d3 | 60 | /** Key used to write SUPC registers */ |
sahilmgandhi | 18:6a4db94011d3 | 61 | #ifndef SUPC_CR_KEY_PASSWD |
sahilmgandhi | 18:6a4db94011d3 | 62 | #define SUPC_CR_KEY_PASSWD SUPC_CR_KEY(0xA5U) |
sahilmgandhi | 18:6a4db94011d3 | 63 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 64 | |
sahilmgandhi | 18:6a4db94011d3 | 65 | #ifndef SUPC_MR_KEY_PASSWD |
sahilmgandhi | 18:6a4db94011d3 | 66 | #define SUPC_MR_KEY_PASSWD SUPC_MR_KEY(0xA5U) |
sahilmgandhi | 18:6a4db94011d3 | 67 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 68 | |
sahilmgandhi | 18:6a4db94011d3 | 69 | #if (SAM4C || SAM4CP || SAM4CM) |
sahilmgandhi | 18:6a4db94011d3 | 70 | /** Power Mode */ |
sahilmgandhi | 18:6a4db94011d3 | 71 | enum slcdc_power_mode { |
sahilmgandhi | 18:6a4db94011d3 | 72 | /** The internal supply source and the external supply source are both deselected. */ |
sahilmgandhi | 18:6a4db94011d3 | 73 | SLCDC_POWER_MODE_LCDOFF = SUPC_MR_LCDMODE_LCDOFF, |
sahilmgandhi | 18:6a4db94011d3 | 74 | /** The external supply source for LCD is selected */ |
sahilmgandhi | 18:6a4db94011d3 | 75 | SLCDC_POWER_MODE_LCDON_EXTVR = SUPC_MR_LCDMODE_LCDON_EXTVR, |
sahilmgandhi | 18:6a4db94011d3 | 76 | /** The internal supply source for LCD is selected */ |
sahilmgandhi | 18:6a4db94011d3 | 77 | SLCDC_POWER_MODE_LCDON_INVR = SUPC_MR_LCDMODE_LCDON_INVR, |
sahilmgandhi | 18:6a4db94011d3 | 78 | }; |
sahilmgandhi | 18:6a4db94011d3 | 79 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 80 | |
sahilmgandhi | 18:6a4db94011d3 | 81 | #if (!SAMG) |
sahilmgandhi | 18:6a4db94011d3 | 82 | void supc_enable_backup_mode(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 83 | void supc_enable_voltage_regulator(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 84 | void supc_disable_voltage_regulator(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 85 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 86 | void supc_switch_sclk_to_32kxtal(Supc *p_supc, uint32_t ul_bypass); |
sahilmgandhi | 18:6a4db94011d3 | 87 | void supc_enable_brownout_detector(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 88 | void supc_disable_brownout_detector(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 89 | void supc_enable_brownout_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 90 | void supc_disable_brownout_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 91 | void supc_set_monitor_threshold(Supc *p_supc, uint32_t ul_threshold); |
sahilmgandhi | 18:6a4db94011d3 | 92 | void supc_set_monitor_sampling_period(Supc *p_supc, uint32_t ul_period); |
sahilmgandhi | 18:6a4db94011d3 | 93 | void supc_enable_monitor_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 94 | void supc_disable_monitor_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 95 | void supc_enable_monitor_interrupt(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 96 | void supc_disable_monitor_interrupt(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 97 | #if (!(SAMG51 || SAMG53 || SAMG54)) |
sahilmgandhi | 18:6a4db94011d3 | 98 | void supc_set_wakeup_mode(Supc *p_supc, uint32_t ul_mode); |
sahilmgandhi | 18:6a4db94011d3 | 99 | void supc_set_wakeup_inputs(Supc *p_supc, uint32_t ul_inputs, |
sahilmgandhi | 18:6a4db94011d3 | 100 | uint32_t ul_transition); |
sahilmgandhi | 18:6a4db94011d3 | 101 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 102 | uint32_t supc_get_status(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 103 | #if (SAM4C || SAM4CP || SAM4CM) |
sahilmgandhi | 18:6a4db94011d3 | 104 | void supc_enable_backup_power_on_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 105 | void supc_disable_backup_power_on_reset(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 106 | enum slcdc_power_mode supc_get_slcd_power_mode(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 107 | void supc_set_slcd_power_mode(Supc *p_supc, enum slcdc_power_mode mode); |
sahilmgandhi | 18:6a4db94011d3 | 108 | void supc_set_slcd_vol(Supc *p_supc, uint32_t vol); |
sahilmgandhi | 18:6a4db94011d3 | 109 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 110 | #if SAMG54 |
sahilmgandhi | 18:6a4db94011d3 | 111 | void supc_set_regulator_trim_factory(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 112 | void supc_set_regulator_trim_user(Supc *p_supc, uint32_t value); |
sahilmgandhi | 18:6a4db94011d3 | 113 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 114 | #if (SAMV70 || SAMV71 || SAME70 || SAMS70) |
sahilmgandhi | 18:6a4db94011d3 | 115 | void supc_backup_sram_on(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 116 | void supc_backup_sram_off(Supc *p_supc); |
sahilmgandhi | 18:6a4db94011d3 | 117 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 118 | |
sahilmgandhi | 18:6a4db94011d3 | 119 | /// @cond 0 |
sahilmgandhi | 18:6a4db94011d3 | 120 | /**INDENT-OFF**/ |
sahilmgandhi | 18:6a4db94011d3 | 121 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 122 | } |
sahilmgandhi | 18:6a4db94011d3 | 123 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 124 | /**INDENT-ON**/ |
sahilmgandhi | 18:6a4db94011d3 | 125 | /// @endcond |
sahilmgandhi | 18:6a4db94011d3 | 126 | |
sahilmgandhi | 18:6a4db94011d3 | 127 | #endif /* SUPC_H_INCLUDED */ |