|
| 1 | +/* ---------------------------------------------------------------------------- */ |
| 2 | +/* Atmel Microcontroller Software Support */ |
| 3 | +/* SAM Software Package License */ |
| 4 | +/* ---------------------------------------------------------------------------- */ |
| 5 | +/* Copyright (c) %copyright_year%, Atmel Corporation */ |
| 6 | +/* */ |
| 7 | +/* All rights reserved. */ |
| 8 | +/* */ |
| 9 | +/* Redistribution and use in source and binary forms, with or without */ |
| 10 | +/* modification, are permitted provided that the following condition is met: */ |
| 11 | +/* */ |
| 12 | +/* - Redistributions of source code must retain the above copyright notice, */ |
| 13 | +/* this list of conditions and the disclaimer below. */ |
| 14 | +/* */ |
| 15 | +/* Atmel's name may not be used to endorse or promote products derived from */ |
| 16 | +/* this software without specific prior written permission. */ |
| 17 | +/* */ |
| 18 | +/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ |
| 19 | +/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
| 20 | +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
| 21 | +/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
| 22 | +/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
| 23 | +/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
| 24 | +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
| 25 | +/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
| 26 | +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
| 27 | +/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
| 28 | +/* ---------------------------------------------------------------------------- */ |
| 29 | + |
| 30 | +#ifndef _SAM4E_ACC_COMPONENT_ |
| 31 | +#define _SAM4E_ACC_COMPONENT_ |
| 32 | + |
| 33 | +/* ============================================================================= */ |
| 34 | +/** SOFTWARE API DEFINITION FOR Analog Comparator Controller */ |
| 35 | +/* ============================================================================= */ |
| 36 | +/** \addtogroup SAM4E_ACC Analog Comparator Controller */ |
| 37 | +/*@{*/ |
| 38 | + |
| 39 | +#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) |
| 40 | +/** \brief Acc hardware registers */ |
| 41 | +typedef struct { |
| 42 | + WoReg ACC_CR; /**< \brief (Acc Offset: 0x00) Control Register */ |
| 43 | + RwReg ACC_MR; /**< \brief (Acc Offset: 0x04) Mode Register */ |
| 44 | + RoReg Reserved1[7]; |
| 45 | + WoReg ACC_IER; /**< \brief (Acc Offset: 0x24) Interrupt Enable Register */ |
| 46 | + WoReg ACC_IDR; /**< \brief (Acc Offset: 0x28) Interrupt Disable Register */ |
| 47 | + RoReg ACC_IMR; /**< \brief (Acc Offset: 0x2C) Interrupt Mask Register */ |
| 48 | + RoReg ACC_ISR; /**< \brief (Acc Offset: 0x30) Interrupt Status Register */ |
| 49 | + RoReg Reserved2[24]; |
| 50 | + RwReg ACC_ACR; /**< \brief (Acc Offset: 0x94) Analog Control Register */ |
| 51 | + RoReg Reserved3[19]; |
| 52 | + RwReg ACC_WPMR; /**< \brief (Acc Offset: 0xE4) Write Protect Mode Register */ |
| 53 | + RoReg ACC_WPSR; /**< \brief (Acc Offset: 0xE8) Write Protect Status Register */ |
| 54 | +} Acc; |
| 55 | +#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ |
| 56 | +/* -------- ACC_CR : (ACC Offset: 0x00) Control Register -------- */ |
| 57 | +#define ACC_CR_SWRST (0x1u << 0) /**< \brief (ACC_CR) SoftWare ReSeT */ |
| 58 | +/* -------- ACC_MR : (ACC Offset: 0x04) Mode Register -------- */ |
| 59 | +#define ACC_MR_SELMINUS_Pos 0 |
| 60 | +#define ACC_MR_SELMINUS_Msk (0x7u << ACC_MR_SELMINUS_Pos) /**< \brief (ACC_MR) SELection for MINUS comparator input */ |
| 61 | +#define ACC_MR_SELMINUS_TS (0x0u << 0) /**< \brief (ACC_MR) SelectTS */ |
| 62 | +#define ACC_MR_SELMINUS_ADVREF (0x1u << 0) /**< \brief (ACC_MR) Select ADVREF */ |
| 63 | +#define ACC_MR_SELMINUS_DAC0 (0x2u << 0) /**< \brief (ACC_MR) Select DAC0 */ |
| 64 | +#define ACC_MR_SELMINUS_DAC1 (0x3u << 0) /**< \brief (ACC_MR) Select DAC1 */ |
| 65 | +#define ACC_MR_SELMINUS_AD0 (0x4u << 0) /**< \brief (ACC_MR) Select AD0 */ |
| 66 | +#define ACC_MR_SELMINUS_AD1 (0x5u << 0) /**< \brief (ACC_MR) Select AD1 */ |
| 67 | +#define ACC_MR_SELMINUS_AD2 (0x6u << 0) /**< \brief (ACC_MR) Select AD2 */ |
| 68 | +#define ACC_MR_SELMINUS_AD3 (0x7u << 0) /**< \brief (ACC_MR) Select AD3 */ |
| 69 | +#define ACC_MR_SELPLUS_Pos 4 |
| 70 | +#define ACC_MR_SELPLUS_Msk (0x7u << ACC_MR_SELPLUS_Pos) /**< \brief (ACC_MR) SELection for PLUS comparator input */ |
| 71 | +#define ACC_MR_SELPLUS_AD0 (0x0u << 4) /**< \brief (ACC_MR) Select AD0 */ |
| 72 | +#define ACC_MR_SELPLUS_AD1 (0x1u << 4) /**< \brief (ACC_MR) Select AD1 */ |
| 73 | +#define ACC_MR_SELPLUS_AD2 (0x2u << 4) /**< \brief (ACC_MR) Select AD2 */ |
| 74 | +#define ACC_MR_SELPLUS_AD3 (0x3u << 4) /**< \brief (ACC_MR) Select AD3 */ |
| 75 | +#define ACC_MR_SELPLUS_AD4 (0x4u << 4) /**< \brief (ACC_MR) Select AD4 */ |
| 76 | +#define ACC_MR_SELPLUS_AD5 (0x5u << 4) /**< \brief (ACC_MR) Select AD5 */ |
| 77 | +#define ACC_MR_SELPLUS_AD6 (0x6u << 4) /**< \brief (ACC_MR) Select AD6 */ |
| 78 | +#define ACC_MR_SELPLUS_AD7 (0x7u << 4) /**< \brief (ACC_MR) Select AD7 */ |
| 79 | +#define ACC_MR_ACEN (0x1u << 8) /**< \brief (ACC_MR) Analog Comparator ENable */ |
| 80 | +#define ACC_MR_ACEN_DIS (0x0u << 8) /**< \brief (ACC_MR) Analog Comparator Disabled. */ |
| 81 | +#define ACC_MR_ACEN_EN (0x1u << 8) /**< \brief (ACC_MR) Analog Comparator Enabled. */ |
| 82 | +#define ACC_MR_EDGETYP_Pos 9 |
| 83 | +#define ACC_MR_EDGETYP_Msk (0x3u << ACC_MR_EDGETYP_Pos) /**< \brief (ACC_MR) EDGE TYPe */ |
| 84 | +#define ACC_MR_EDGETYP_RISING (0x0u << 9) /**< \brief (ACC_MR) only rising edge of comparator output */ |
| 85 | +#define ACC_MR_EDGETYP_FALLING (0x1u << 9) /**< \brief (ACC_MR) falling edge of comparator output */ |
| 86 | +#define ACC_MR_EDGETYP_ANY (0x2u << 9) /**< \brief (ACC_MR) any edge of comparator output */ |
| 87 | +#define ACC_MR_INV (0x1u << 12) /**< \brief (ACC_MR) INVert comparator output */ |
| 88 | +#define ACC_MR_INV_DIS (0x0u << 12) /**< \brief (ACC_MR) Analog Comparator output is directly processed. */ |
| 89 | +#define ACC_MR_INV_EN (0x1u << 12) /**< \brief (ACC_MR) Analog Comparator output is inverted prior to being processed. */ |
| 90 | +#define ACC_MR_SELFS (0x1u << 13) /**< \brief (ACC_MR) SELection of Fault Source */ |
| 91 | +#define ACC_MR_SELFS_CF (0x0u << 13) /**< \brief (ACC_MR) the CF flag is used to drive the FAULT output. */ |
| 92 | +#define ACC_MR_SELFS_OUTPUT (0x1u << 13) /**< \brief (ACC_MR) the output of the Analog Comparator flag is used to drive the FAULT output. */ |
| 93 | +#define ACC_MR_FE (0x1u << 14) /**< \brief (ACC_MR) Fault Enable */ |
| 94 | +#define ACC_MR_FE_DIS (0x0u << 14) /**< \brief (ACC_MR) the FAULT output is tied to 0. */ |
| 95 | +#define ACC_MR_FE_EN (0x1u << 14) /**< \brief (ACC_MR) the FAULT output is driven by the signal defined by SELFS. */ |
| 96 | +/* -------- ACC_IER : (ACC Offset: 0x24) Interrupt Enable Register -------- */ |
| 97 | +#define ACC_IER_CE (0x1u << 0) /**< \brief (ACC_IER) Comparison Edge */ |
| 98 | +/* -------- ACC_IDR : (ACC Offset: 0x28) Interrupt Disable Register -------- */ |
| 99 | +#define ACC_IDR_CE (0x1u << 0) /**< \brief (ACC_IDR) Comparison Edge */ |
| 100 | +/* -------- ACC_IMR : (ACC Offset: 0x2C) Interrupt Mask Register -------- */ |
| 101 | +#define ACC_IMR_CE (0x1u << 0) /**< \brief (ACC_IMR) Comparison Edge */ |
| 102 | +/* -------- ACC_ISR : (ACC Offset: 0x30) Interrupt Status Register -------- */ |
| 103 | +#define ACC_ISR_CE (0x1u << 0) /**< \brief (ACC_ISR) Comparison Edge */ |
| 104 | +#define ACC_ISR_SCO (0x1u << 1) /**< \brief (ACC_ISR) Synchronized Comparator Output */ |
| 105 | +#define ACC_ISR_MASK (0x1u << 31) /**< \brief (ACC_ISR) */ |
| 106 | +/* -------- ACC_ACR : (ACC Offset: 0x94) Analog Control Register -------- */ |
| 107 | +#define ACC_ACR_ISEL (0x1u << 0) /**< \brief (ACC_ACR) Current SELection */ |
| 108 | +#define ACC_ACR_ISEL_LOPW (0x0u << 0) /**< \brief (ACC_ACR) low power option. */ |
| 109 | +#define ACC_ACR_ISEL_HISP (0x1u << 0) /**< \brief (ACC_ACR) high speed option. */ |
| 110 | +#define ACC_ACR_HYST_Pos 1 |
| 111 | +#define ACC_ACR_HYST_Msk (0x3u << ACC_ACR_HYST_Pos) /**< \brief (ACC_ACR) HYSTeresis selection */ |
| 112 | +#define ACC_ACR_HYST(value) ((ACC_ACR_HYST_Msk & ((value) << ACC_ACR_HYST_Pos))) |
| 113 | +/* -------- ACC_WPMR : (ACC Offset: 0xE4) Write Protect Mode Register -------- */ |
| 114 | +#define ACC_WPMR_WPEN (0x1u << 0) /**< \brief (ACC_WPMR) Write Protect Enable */ |
| 115 | +#define ACC_WPMR_WPKEY_Pos 8 |
| 116 | +#define ACC_WPMR_WPKEY_Msk (0xffffffu << ACC_WPMR_WPKEY_Pos) /**< \brief (ACC_WPMR) Write Protect KEY */ |
| 117 | +#define ACC_WPMR_WPKEY(value) ((ACC_WPMR_WPKEY_Msk & ((value) << ACC_WPMR_WPKEY_Pos))) |
| 118 | +/* -------- ACC_WPSR : (ACC Offset: 0xE8) Write Protect Status Register -------- */ |
| 119 | +#define ACC_WPSR_WPROTERR (0x1u << 0) /**< \brief (ACC_WPSR) Write PROTection ERRor */ |
| 120 | + |
| 121 | +/*@}*/ |
| 122 | + |
| 123 | + |
| 124 | +#endif /* _SAM4E_ACC_COMPONENT_ */ |
0 commit comments