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