You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/04 01:40:04 UTC
[24/70] [abbrv] [partial] incubator-mynewt-larva git commit: Arduino
zero BSP and Atmel MCU in a different repository.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.c
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.c b/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.c
deleted file mode 100755
index b4da29a..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * \file
- *
- * \brief SAM TCC - Timer Counter for Control Applications Callback Driver
- *
- * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-
-#include "tcc_callback.h"
-
-void *_tcc_instances[TCC_INST_NUM];
-
-void _tcc_interrupt_handler(uint8_t module_index);
-
-const uint32_t _tcc_intflag[TCC_CALLBACK_N] = {
- TCC_INTFLAG_OVF,
- TCC_INTFLAG_TRG,
- TCC_INTFLAG_CNT,
- TCC_INTFLAG_ERR,
- TCC_INTFLAG_FAULTA,
- TCC_INTFLAG_FAULTB,
- TCC_INTFLAG_FAULT0,
- TCC_INTFLAG_FAULT1,
-#define _TCC_INTFLAG_MC(n,dummy) TCC_INTFLAG_MC##n,
- /* TCC_INTFLAG_MC0 ~ ... */
- MREPEAT(TCC_NUM_CHANNELS, _TCC_INTFLAG_MC, 0)
-#undef _TCC_INTFLAG_MC
-};
-
-# define _TCC_INTERRUPT_VECT_NUM(n, unused) \
- SYSTEM_INTERRUPT_MODULE_TCC##n,
-/**
- * \internal Get the interrupt vector for the given device instance
- *
- * \param[in] The TCC module instance number
- *
- * \return Interrupt vector for of the given TCC module instance.
- */
-static enum system_interrupt_vector _tcc_interrupt_get_interrupt_vector(
- uint32_t inst_num)
-{
- static uint8_t tcc_interrupt_vectors[TCC_INST_NUM] = {
- MREPEAT(TCC_INST_NUM, _TCC_INTERRUPT_VECT_NUM, 0)
- };
-
- return (enum system_interrupt_vector)tcc_interrupt_vectors[inst_num];
-}
-
-/**
- * \brief Registers a callback
- *
- * Registers a callback function which is implemented by the user.
- *
- * \note The callback must be enabled by \ref tcc_enable_callback,
- * in order for the interrupt handler to call it when the conditions for the
- * callback type is met.
- *
- * \param[in] module Pointer to TCC software instance struct
- * \param[in] callback_func Pointer to callback function
- * \param[in] callback_type Callback type given by an enum
- */
-enum status_code tcc_register_callback(
- struct tcc_module *const module,
- tcc_callback_t callback_func,
- const enum tcc_callback callback_type)
-{
- /* Sanity check arguments */
- Assert(module);
- Assert(callback_func);
-
- /* Register callback function */
- module->callback[callback_type] = callback_func;
-
- /* Set the bit corresponding to the callback_type */
- module->register_callback_mask |= _tcc_intflag[callback_type];
-
- return STATUS_OK;
-}
-
-/**
- * \brief Unregisters a callback
- *
- * Unregisters a callback function implemented by the user. The callback should
- * be disabled before it is unregistered.
- *
- * \param[in] module Pointer to TCC software instance struct
- * \param[in] callback_type Callback type given by an enum
- */
-enum status_code tcc_unregister_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type)
-{
- /* Sanity check arguments */
- Assert(module);
-
- /* Unregister callback function */
- module->callback[callback_type] = NULL;
-
- /* Clear the bit corresponding to the callback_type */
- module->register_callback_mask &= ~_tcc_intflag[callback_type];
-
- return STATUS_OK;
-}
-
-/**
- * \brief Enables callback
- *
- * Enables the callback function registered by the \ref
- * tcc_register_callback. The callback function will be called from the
- * interrupt handler when the conditions for the callback type are
- * met. This function will also enable the appropriate interrupts.
- *
- * \param[in] module Pointer to TCC software instance struct
- * \param[in] callback_type Callback type given by an enum
- */
-void tcc_enable_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type)
-{
- /* Sanity check arguments */
- Assert(module);
- Assert(module->hw);
-
- /* Enable interrupts for this TCC module */
- system_interrupt_enable(_tcc_interrupt_get_interrupt_vector(
- _tcc_get_inst_index(module->hw)));
-
- /* Enable channel or other callbacks */
- module->enable_callback_mask |= _tcc_intflag[callback_type];
- module->hw->INTENSET.reg = _tcc_intflag[callback_type];
-}
-
-/**
- * \brief Disables callback
- *
- * Disables the callback function registered by the \ref
- * tcc_register_callback, and the callback will not be called from the
- * interrupt routine. The function will also disable the appropriate
- * interrupts.
- *
- * \param[in] module Pointer to TCC software instance struct
- * \param[in] callback_type Callback type given by an enum
- */
-void tcc_disable_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type)
-{
- /* Sanity check arguments */
- Assert(module);
- Assert(module->hw);
-
- /* Disable interrupts for this TCC module */
- system_interrupt_enable(_tcc_interrupt_get_interrupt_vector(
- _tcc_get_inst_index(module->hw)));
-
- /* Disable channel or other callbacks */
- module->enable_callback_mask &= ~_tcc_intflag[callback_type];
- module->hw->INTENCLR.reg = _tcc_intflag[callback_type];
-}
-
-
-/**
- * \internal ISR handler for TCC
- *
- * Auto-generate a set of interrupt handlers for each TCC in the device.
- */
-#define _TCC_INTERRUPT_HANDLER(n, m) \
- void TCC##n##_Handler(void) \
- { \
- _tcc_interrupt_handler(n); \
- }
-
-MREPEAT(TCC_INST_NUM, _TCC_INTERRUPT_HANDLER, 0)
-
-/**
- * \internal Interrupt handler for the TCC module
- *
- * Handles interrupts as they occur, it will run the callback functions
- * that are registered and enabled.
- *
- * \param[in] module_index ID of the TCC instance calling the interrupt
- * handler
- */
-void _tcc_interrupt_handler(
- uint8_t module_index)
-{
- int i;
-
- uint32_t interrupt_and_callback_status_mask;
-
- struct tcc_module *module =
- (struct tcc_module *)_tcc_instances[module_index];
-
- interrupt_and_callback_status_mask = (module->hw->INTFLAG.reg &
- module->register_callback_mask &
- module->enable_callback_mask);
-
- /* Check if callback interrupt has occured */
- for (i = 0; i < TCC_CALLBACK_N; i ++) {
- if (interrupt_and_callback_status_mask & _tcc_intflag[i]) {
- /* Invoke the registered and enabled callback function */
- (module->callback[i])(module);
- /* Clear interrupt flag */
- module->hw->INTFLAG.reg = _tcc_intflag[i];
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.h
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.h b/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.h
deleted file mode 100755
index 37b0bbb..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/tcc/tcc_callback.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * \file
- *
- * \brief SAM TCC - Timer Counter for Control Applications Callback Driver
- *
- * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-
-
-#ifndef TCC_CALLBACK_H_INCLUDED
-#define TCC_CALLBACK_H_INCLUDED
-
-#include "tcc.h"
-#include <system_interrupt.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined(__DOXYGEN__)
-extern void *_tcc_instances[TCC_INST_NUM];
-#endif
-
-
-/**
- * \name Callback Management
- * {@
- */
-
-enum status_code tcc_register_callback(
- struct tcc_module *const module,
- tcc_callback_t callback_func,
- const enum tcc_callback callback_type);
-
-enum status_code tcc_unregister_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type);
-
-void tcc_enable_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type);
-
-void tcc_disable_callback(
- struct tcc_module *const module,
- const enum tcc_callback callback_type);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TCC_CALLBACK_H_INCLUDED */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.c
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.c b/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.c
deleted file mode 100755
index c5b0895..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/**
- * \file
- *
- * \brief SAM Watchdog Driver
- *
- * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-#include "wdt.h"
-#include <system.h>
-
-/**
- * \brief Sets up the WDT hardware module based on the configuration.
- *
- * Writes a given configuration of a WDT configuration to the
- * hardware module, and initializes the internal device struct.
- *
- * \param[in] config Pointer to the configuration struct
- *
- * \return Status of the configuration procedure.
- *
- * \retval STATUS_OK If the module was configured correctly
- * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were supplied
- * \retval STATUS_ERR_IO If the Watchdog module is locked to be always on
- */
-#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21)
-enum status_code wdt_set_config(
- const struct wdt_conf *const config)
-{
- /* Sanity check arguments */
- Assert(config);
-
- Wdt *const WDT_module = WDT;
-
- /* Turn on the digital interface clock */
- system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, MCLK_APBAMASK_WDT);
-
- /* Check of the Watchdog has been locked to be always on, if so, abort */
- if (wdt_is_locked()) {
- return STATUS_ERR_IO;
- }
-
- /* Check for an invalid timeout period, abort if found */
- if (config->timeout_period == WDT_PERIOD_NONE) {
- return STATUS_ERR_INVALID_ARG;
- }
-
- /* Make sure the Window and Early Warning periods are not more than the
- * reset period, abort if either is invalid */
- if ((config->timeout_period < config->window_period) ||
- (config->timeout_period < config->early_warning_period)) {
- return STATUS_ERR_INVALID_ARG;
- }
-
- /* Disable the Watchdog module */
- WDT_module->CTRLA.reg &= ~WDT_CTRLA_ENABLE;
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- if(config->enable == false) {
- return STATUS_OK;
- }
-
- uint32_t new_config = 0;
-
- /* Update the timeout period value with the requested period */
- new_config |= (config->timeout_period - 1) << WDT_CONFIG_PER_Pos;
-
- /* Check if the user has requested a reset window period */
- if (config->window_period != WDT_PERIOD_NONE) {
- WDT_module->CTRLA.reg |= WDT_CTRLA_WEN;
-
- /* Update and enable the timeout period value */
- new_config |= (config->window_period - 1) << WDT_CONFIG_WINDOW_Pos;
- } else {
- /* Ensure the window enable control flag is cleared */
- WDT_module->CTRLA.reg &= ~WDT_CTRLA_WEN;
- }
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- /* Write the new Watchdog configuration */
- WDT_module->CONFIG.reg = new_config;
-
- /* Check if the user has requested an early warning period */
- if (config->early_warning_period != WDT_PERIOD_NONE) {
- /* Set the Early Warning period */
- WDT_module->EWCTRL.reg
- = (config->early_warning_period - 1) << WDT_EWCTRL_EWOFFSET_Pos;
- }
-
- /* Either enable or lock-enable the Watchdog timer depending on the user
- * settings */
- if (config->always_on) {
- WDT_module->CTRLA.reg |= WDT_CTRLA_ALWAYSON;
- } else {
- WDT_module->CTRLA.reg |= WDT_CTRLA_ENABLE;
- }
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- return STATUS_OK;
-}
-#else
-enum status_code wdt_set_config(
- const struct wdt_conf *const config)
-{
- /* Sanity check arguments */
- Assert(config);
-
- Wdt *const WDT_module = WDT;
-
- /* Turn on the digital interface clock */
- system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, PM_APBAMASK_WDT);
-
- /* Check of the Watchdog has been locked to be always on, if so, abort */
- if (wdt_is_locked()) {
- return STATUS_ERR_IO;
- }
-
- /* Check for an invalid timeout period, abort if found */
- if (config->timeout_period == WDT_PERIOD_NONE) {
- return STATUS_ERR_INVALID_ARG;
- }
-
- /* Make sure the Window and Early Warning periods are not more than the
- * reset period, abort if either is invalid */
- if ((config->timeout_period < config->window_period) ||
- (config->timeout_period < config->early_warning_period)) {
- return STATUS_ERR_INVALID_ARG;
- }
-
- /* Disable the Watchdog module */
- WDT_module->CTRL.reg &= ~WDT_CTRL_ENABLE;
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- if(config->enable == false) {
- return STATUS_OK;
- }
-
- /* Configure GCLK channel and enable clock */
- struct system_gclk_chan_config gclk_chan_conf;
- gclk_chan_conf.source_generator = config->clock_source;
- system_gclk_chan_set_config(WDT_GCLK_ID, &gclk_chan_conf);
- system_gclk_chan_enable(WDT_GCLK_ID);
- if (config->always_on) {
- system_gclk_chan_lock(WDT_GCLK_ID);
- }
-
- uint32_t new_config = 0;
-
- /* Update the timeout period value with the requested period */
- new_config |= (config->timeout_period - 1) << WDT_CONFIG_PER_Pos;
-
- /* Check if the user has requested a reset window period */
- if (config->window_period != WDT_PERIOD_NONE) {
- WDT_module->CTRL.reg |= WDT_CTRL_WEN;
-
- /* Update and enable the timeout period value */
- new_config |= (config->window_period - 1) << WDT_CONFIG_WINDOW_Pos;
- } else {
- /* Ensure the window enable control flag is cleared */
- WDT_module->CTRL.reg &= ~WDT_CTRL_WEN;
- }
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- /* Write the new Watchdog configuration */
- WDT_module->CONFIG.reg = new_config;
-
- /* Check if the user has requested an early warning period */
- if (config->early_warning_period != WDT_PERIOD_NONE) {
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- /* Set the Early Warning period */
- WDT_module->EWCTRL.reg
- = (config->early_warning_period - 1) << WDT_EWCTRL_EWOFFSET_Pos;
- }
-
- /* Either enable or lock-enable the Watchdog timer depending on the user
- * settings */
- if (config->always_on) {
- WDT_module->CTRL.reg |= WDT_CTRL_ALWAYSON;
- } else {
- WDT_module->CTRL.reg |= WDT_CTRL_ENABLE;
- }
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-
- return STATUS_OK;
-}
-#endif
-
-/**
- * \brief Resets the count of the running Watchdog Timer that was previously enabled.
- *
- * Resets the current count of the Watchdog Timer, restarting the timeout
- * period count elapsed. This function should be called after the window
- * period (if one was set in the module configuration) but before the timeout
- * period to prevent a reset of the system.
- */
-void wdt_reset_count(void)
-{
- Wdt *const WDT_module = WDT;
-
- /* Disable the Watchdog module */
- WDT_module->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
-
- while (wdt_is_syncing()) {
- /* Wait for all hardware modules to complete synchronization */
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.h
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.h b/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.h
deleted file mode 100755
index a0b5345..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt.h
+++ /dev/null
@@ -1,501 +0,0 @@
-/**
- * \file
- *
- * \brief SAM Watchdog Driver
- *
- * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-#ifndef WDT_H_INCLUDED
-#define WDT_H_INCLUDED
-
-/**
- * \defgroup asfdoc_sam0_wdt_group SAM Watchdog Driver (WDT)
- *
- * This driver for Atmel® | SMART SAM devices provides an interface for the configuration
- * and management of the device's Watchdog Timer module, including the enabling,
- * disabling, and kicking within the device. The following driver API modes are
- * covered by this manual:
- *
- * - Polled APIs
- * \if WDT_CALLBACK_MODE
- * - Callback APIs
- * \endif
- *
- * The following peripherals are used by this module:
- * - WDT (Watchdog Timer)
- *
- * The following devices can use this module:
- * - Atmel | SMART SAM D20/D21
- * - Atmel | SMART SAM R21
- * - Atmel | SMART SAM D09/D10/D11
- * - Atmel | SMART SAM L21/L22
- * - Atmel | SMART SAM DA1
- * - Atmel | SMART SAM C20/C21
- *
- * The outline of this documentation is as follows:
- * - \ref asfdoc_sam0_wdt_prerequisites
- * - \ref asfdoc_sam0_wdt_module_overview
- * - \ref asfdoc_sam0_wdt_special_considerations
- * - \ref asfdoc_sam0_wdt_extra_info
- * - \ref asfdoc_sam0_wdt_examples
- * - \ref asfdoc_sam0_wdt_api_overview
- *
- *
- * \section asfdoc_sam0_wdt_prerequisites Prerequisites
- *
- * There are no prerequisites for this module.
- *
- *
- * \section asfdoc_sam0_wdt_module_overview Module Overview
- *
- * The Watchdog module (WDT) is designed to give an added level of safety in
- * critical systems, to ensure a system reset is triggered in the case of a
- * deadlock or other software malfunction that prevents normal device operation.
- *
- * At a basic level, the Watchdog is a system timer with a fixed period; once
- * enabled, it will continue to count ticks of its asynchronous clock until
- * it is periodically reset, or the timeout period is reached. In the event of a
- * Watchdog timeout, the module will trigger a system reset identical to a pulse
- * of the device's reset pin, resetting all peripherals to their power-on
- * default states and restarting the application software from the reset vector.
- *
- * In many systems, there is an obvious upper bound to the amount of time each
- * iteration of the main application loop can be expected to run, before a
- * malfunction can be assumed (either due to a deadlock waiting on hardware or
- * software, or due to other means). When the Watchdog is configured with a
- * timeout period equal to this upper bound, a malfunction in the system will
- * force a full system reset to allow for a graceful recovery.
- *
- * \subsection asfdoc_sam0_wdt_module_locked_mode Locked Mode
- * The Watchdog configuration can be set in the device fuses and locked in
- * hardware, so that no software changes can be made to the Watchdog
- * configuration. Additionally, the Watchdog can be locked on in software if it
- * is not already locked, so that the module configuration cannot be modified
- * until a power on reset of the device.
- *
- * The locked configuration can be used to ensure that faulty software does not
- * cause the Watchdog configuration to be changed, preserving the level of
- * safety given by the module.
- *
- * \subsection asfdoc_sam0_wdt_module_window_mode Window Mode
- * Just as there is a reasonable upper bound to the time the main program loop
- * should take for each iteration, there is also in many applications a lower
- * bound, i.e. a \a minimum time for which each loop iteration should run for
- * under normal circumstances. To guard against a system failure resetting the
- * Watchdog in a tight loop (or a failure in the system application causing the
- * main loop to run faster than expected) a "Window" mode can be enabled to
- * disallow resetting of the Watchdog counter before a certain period of time.
- * If the Watchdog is not reset \a after the window opens but not \a before the
- * Watchdog expires, the system will reset.
- *
- * \subsection asfdoc_sam0_wdt_module_early_warning Early Warning
- * In some cases it is desirable to receive an early warning that the Watchdog is
- * about to expire, so that some system action (such as saving any system
- * configuration data for failure analysis purposes) can be performed before the
- * system reset occurs. The Early Warning feature of the Watchdog module allows
- * such a notification to be requested; after the configured early warning time
- * (but before the expiry of the Watchdog counter) the Early Warning flag will
- * become set, so that the user application can take an appropriate action.
- *
- * \note It is important to note that the purpose of the Early Warning feature
- * is \a not to allow the user application to reset the Watchdog; doing
- * so will defeat the safety the module gives to the user application.
- * Instead, this feature should be used purely to perform any tasks that
- * need to be undertaken before the system reset occurs.
- *
- * \subsection asfdoc_sam0_wdt_module_overview_physical Physical Connection
- *
- * \ref asfdoc_sam0_wdt_module_int_connections "The figure below" shows how
- * this module is interconnected within the device.
- *
- * \anchor asfdoc_sam0_wdt_module_int_connections
- * \dot
- * digraph overview {
- * rankdir=LR;
- * node [label="GCLK*\nGeneric Clock" shape=square] wdt_clock;
- *
- * subgraph driver {
- * node [label="<f0> WDT | <f1> Watchdog Counter" shape=record] wdt_module;
- * node [label="System Reset Logic" shape=ellipse style=filled fillcolor=lightgray] sys_reset;
- * }
- *
- * wdt_clock -> wdt_module:f1;
- * wdt_module:f1 -> sys_reset;
- * }
- * \enddot
- *
- * \note Watchdog Counter of SAM L21/L22 is \a not provided by GCLK, but it uses an
- * internal 1KHz OSCULP32K output clock.
- *
- * \section asfdoc_sam0_wdt_special_considerations Special Considerations
- *
- * On some devices the Watchdog configuration can be fused to be always on in
- * a particular configuration; if this mode is enabled the Watchdog is not
- * software configurable and can have its count reset and early warning state
- * checked/cleared only.
- *
- * \section asfdoc_sam0_wdt_extra_info Extra Information
- *
- * For extra information, see \ref asfdoc_sam0_wdt_extra. This includes:
- * - \ref asfdoc_sam0_wdt_extra_acronyms
- * - \ref asfdoc_sam0_wdt_extra_dependencies
- * - \ref asfdoc_sam0_wdt_extra_errata
- * - \ref asfdoc_sam0_wdt_extra_history
- *
- *
- * \section asfdoc_sam0_wdt_examples Examples
- *
- * For a list of examples related to this driver, see
- * \ref asfdoc_sam0_wdt_exqsg.
- *
- * \section asfdoc_sam0_wdt_api_overview API Overview
- * @{
- */
-
-#include <compiler.h>
-#include <clock.h>
-#include <gclk.h>
-
-#if WDT_CALLBACK_MODE == true
-# include "wdt_callback.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Watchdog Timer period configuration enum.
- *
- * Enum for the possible period settings of the Watchdog timer module, for
- * values requiring a period as a number of Watchdog timer clock ticks.
- */
-enum wdt_period {
- /** No Watchdog period. This value can only be used when setting the
- * Window and Early Warning periods; its use as the Watchdog Reset
- * Period is invalid. */
- WDT_PERIOD_NONE = 0,
- /** Watchdog period of 8 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_8CLK = 1,
- /** Watchdog period of 16 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_16CLK = 2,
- /** Watchdog period of 32 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_32CLK = 3,
- /** Watchdog period of 64 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_64CLK = 4,
- /** Watchdog period of 128 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_128CLK = 5,
- /** Watchdog period of 256 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_256CLK = 6,
- /** Watchdog period of 512 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_512CLK = 7,
- /** Watchdog period of 1024 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_1024CLK = 8,
- /** Watchdog period of 2048 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_2048CLK = 9,
- /** Watchdog period of 4096 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_4096CLK = 10,
- /** Watchdog period of 8192 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_8192CLK = 11,
- /** Watchdog period of 16384 clocks of the Watchdog Timer Generic Clock */
- WDT_PERIOD_16384CLK = 12,
-};
-
-/**
- * \brief Watchdog Timer configuration structure.
- *
- * Configuration structure for a Watchdog Timer instance. This
- * structure should be initialized by the \ref wdt_get_config_defaults()
- * function before being modified by the user application.
- */
-struct wdt_conf {
- /** If \c true, the Watchdog will be locked to the current configuration
- * settings when the Watchdog is enabled */
- bool always_on;
- /** Enable/Disable the Watchdog Timer */
- bool enable;
-#if !(SAML21) && !(SAML22) && !(SAMC20) && !(SAMC21)
- /** GCLK generator used to clock the peripheral except SAM L21/L22/C21/C20*/
- enum gclk_generator clock_source;
-#endif
- /** Number of Watchdog timer clock ticks until the Watchdog expires */
- enum wdt_period timeout_period;
- /** Number of Watchdog timer clock ticks until the reset window opens */
- enum wdt_period window_period;
- /** Number of Watchdog timer clock ticks until the early warning flag is
- * set */
- enum wdt_period early_warning_period;
-};
-
-/** \name Configuration and Initialization
- * @{
- */
-
-/**
- * \brief Determines if the hardware module(s) are currently synchronizing to the bus.
- *
- * Checks to see if the underlying hardware peripheral module(s) are currently
- * synchronizing across multiple clock domains to the hardware bus. This
- * function can be used to delay further operations on a module until such time
- * that it is ready, to prevent blocking delays for synchronization in the
- * user application.
- *
- * \return Synchronization status of the underlying hardware module(s).
- *
- * \retval false If the module has completed synchronization
- * \retval true If the module synchronization is ongoing
- */
-static inline bool wdt_is_syncing(void)
-{
- Wdt *const WDT_module = WDT;
-
-#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21)
- if (WDT_module->SYNCBUSY.reg) {
-#else
- if (WDT_module->STATUS.reg & WDT_STATUS_SYNCBUSY) {
-#endif
- return true;
- }
-
- return false;
-}
-
-/**
- * \brief Initializes a Watchdog Timer configuration structure to defaults.
- *
- * Initializes a given Watchdog Timer configuration structure to a set of
- * known default values. This function should be called on all new
- * instances of these configuration structures before being modified by the
- * user application.
- *
- * The default configuration is as follows:
- * \li Not locked, to allow for further (re-)configuration
- * \li Enable WDT
- * \li Watchdog timer sourced from Generic Clock Channel 4
- * \li A timeout period of 16384 clocks of the Watchdog module clock
- * \li No window period, so that the Watchdog count can be reset at any time
- * \li No early warning period to indicate the Watchdog will soon expire
- *
- * \param[out] config Configuration structure to initialize to default values
- */
-static inline void wdt_get_config_defaults(
- struct wdt_conf *const config)
-{
- /* Sanity check arguments */
- Assert(config);
-
- /* Default configuration values */
- config->always_on = false;
- config->enable = true;
-#if !(SAML21) && !(SAML22) && !(SAMC20) && !(SAMC21)
- config->clock_source = GCLK_GENERATOR_4;
-#endif
- config->timeout_period = WDT_PERIOD_16384CLK;
- config->window_period = WDT_PERIOD_NONE;
- config->early_warning_period = WDT_PERIOD_NONE;
-}
-
-enum status_code wdt_set_config(
- const struct wdt_conf *const config);
-
-/** \brief Determines if the Watchdog timer is currently locked in an enabled state.
- *
- * Determines if the Watchdog timer is currently enabled and locked, so that
- * it cannot be disabled or otherwise reconfigured.
- *
- * \return Current Watchdog lock state.
- */
-static inline bool wdt_is_locked(void)
-{
- Wdt *const WDT_module = WDT;
-
-#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21)
- return (WDT_module->CTRLA.reg & WDT_CTRLA_ALWAYSON);
-#else
- return (WDT_module->CTRL.reg & WDT_CTRL_ALWAYSON);
-#endif
-}
-
-/** @} */
-
-/** \name Timeout and Early Warning Management
- * @{
- */
-
-/** \brief Clears the Watchdog timer early warning period elapsed flag.
- *
- * Clears the Watchdog timer early warning period elapsed flag, so that a new
- * early warning period can be detected.
- */
-static inline void wdt_clear_early_warning(void)
-{
- Wdt *const WDT_module = WDT;
-
- WDT_module->INTFLAG.reg = WDT_INTFLAG_EW;
-}
-
-/** \brief Determines if the Watchdog timer early warning period has elapsed.
- *
- * Determines if the Watchdog timer early warning period has elapsed.
- *
- * \note If no early warning period was configured, the value returned by this
- * function is invalid.
- *
- * \return Current Watchdog Early Warning state.
- */
-static inline bool wdt_is_early_warning(void)
-{
- Wdt *const WDT_module = WDT;
-
- return (WDT_module->INTFLAG.reg & WDT_INTFLAG_EW);
-}
-
-void wdt_reset_count(void);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-
-/**
- * \page asfdoc_sam0_wdt_extra Extra Information for WDT Driver
- *
- * \section asfdoc_sam0_wdt_extra_acronyms Acronyms
- * The table below presents the acronyms used in this module:
- *
- * <table>
- * <tr>
- * <th>Acronym</th>
- * <th>Description</th>
- * </tr>
- * <tr>
- * <td>WDT</td>
- * <td>Watchdog Timer</td>
- * </tr>
- * </table>
- *
- *
- * \section asfdoc_sam0_wdt_extra_dependencies Dependencies
- * This driver has the following dependencies:
- *
- * - \ref asfdoc_sam0_system_clock_group "System Clock Driver"
- *
- *
- * \section asfdoc_sam0_wdt_extra_errata Errata
- * There are no errata related to this driver.
- *
- *
- * \section asfdoc_sam0_wdt_extra_history Module History
- * An overview of the module history is presented in the table below, with
- * details on the enhancements and fixes made to the module since its first
- * release. The current version of this corresponds to the newest version in
- * the table.
- *
- * <table>
- * <tr>
- * <th>Changelog</th>
- * </tr>
- * <tr>
- * <td>Driver updated to follow driver type convention:
- * \li wdt_init, wdt_enable, wdt_disable functions removed
- * \li wdt_set_config function added
- * \li WDT module enable state moved inside the configuration struct </td>
- * </tr>
- * <tr>
- * <td>Initial Release</td>
- * </tr>
- * </table>
- */
-
-/**
- * \page asfdoc_sam0_wdt_exqsg Examples for WDT Driver
- *
- * This is a list of the available Quick Start guides (QSGs) and example
- * applications for \ref asfdoc_sam0_wdt_group. QSGs are simple examples with
- * step-by-step instructions to configure and use this driver in a selection of
- * use cases. Note that QSGs can be compiled as a standalone application or be
- * added to the user application.
- *
- * - \subpage asfdoc_sam0_wdt_basic_use_case
- * \if WDT_CALLBACK_MODE
- * - \subpage asfdoc_sam0_wdt_callback_use_case
- * \endif
- *
- * \page asfdoc_sam0_wdt_document_revision_history Document Revision History
- *
- * <table>
- * <tr>
- * <th>Doc. Rev.</th>
- * <th>Date</th>
- * <th>Comments</th>
- * </tr>
- * <tr>
- * <td>42124E</td>
- * <td>12/2015</td>
- * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C20/C21</td>
- * </tr>
- * <tr>
- * <td>42124D</td>
- * <td>12/2014</td>
- * <td>Added SAM R21 and SAM D10/D11 support</td>
- * </tr>
- * <tr>
- * <td>42124C</td>
- * <td>01/2014</td>
- * <td>Add SAM D21 support</td>
- * </tr>
- * <tr>
- * <td>42124B</td>
- * <td>06/2013</td>
- * <td>Corrected documentation typos</td>
- * </tr>
- * <tr>
- * <td>42124A</td>
- * <td>06/2013</td>
- * <td>Initial release</td>
- * </tr>
- * </table>
- */
-
-#endif /* WDT_H_INCLUDED */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.c
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.c b/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.c
deleted file mode 100755
index 8942959..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * \file
- *
- * \brief SAM Watchdog Driver
- *
- * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-#include "wdt.h"
-#include <system.h>
-#include <system_interrupt.h>
-
-wdt_callback_t wdt_early_warning_callback;
-
-/**
- * \brief Registers an asynchronous callback function with the driver.
- *
- * Registers an asynchronous callback with the WDT driver, fired when a
- * given criteria (such as an Early Warning) is met. Callbacks are fired once
- * for each event.
- *
- * \param[in] callback Pointer to the callback function to register
- * \param[in] type Type of callback function to register
- *
- * \return Status of the registration operation.
- * \retval STATUS_OK The callback was registered successfully
- * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied
- */
-enum status_code wdt_register_callback(
- const wdt_callback_t callback,
- const enum wdt_callback type)
-{
- /* Sanity check arguments */
- Assert(callback);
-
- switch (type)
- {
- case WDT_CALLBACK_EARLY_WARNING:
- wdt_early_warning_callback = callback;
- return STATUS_OK;
- default:
- Assert(false);
- return STATUS_ERR_INVALID_ARG;
- }
-}
-
-/**
- * \brief Unregisters an asynchronous callback function with the driver.
- *
- * Unregisters an asynchronous callback with the WDT driver, removing it
- * from the internal callback registration table.
- *
- * \param[in] type Type of callback function to unregister
- *
- * \return Status of the de-registration operation.
- * \retval STATUS_OK The callback was Unregistered successfully
- * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied
- */
-enum status_code wdt_unregister_callback(
- const enum wdt_callback type)
-{
- switch (type)
- {
- case WDT_CALLBACK_EARLY_WARNING:
- wdt_early_warning_callback = NULL;
- return STATUS_OK;
- default:
- Assert(false);
- return STATUS_ERR_INVALID_ARG;
- }
-}
-
-/**
- * \brief Enables asynchronous callback generation for a given type.
- *
- * Enables asynchronous callbacks for a given callback type. This must be
- * called before an external interrupt channel will generate callback events.
- *
- * \param[in] type Type of callback function to enable
- *
- * \return Status of the callback enable operation.
- * \retval STATUS_OK The callback was enabled successfully
- * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied
- */
-enum status_code wdt_enable_callback(
- const enum wdt_callback type)
-{
- Wdt *const WDT_module = WDT;
-
- switch (type)
- {
- case WDT_CALLBACK_EARLY_WARNING:
- WDT_module->INTENSET.reg = WDT_INTENSET_EW;
- system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_WDT);
- return STATUS_OK;
- default:
- Assert(false);
- return STATUS_ERR_INVALID_ARG;
- }
-}
-
-/**
- * \brief Disables asynchronous callback generation for a given type.
- *
- * Disables asynchronous callbacks for a given callback type.
- *
- * \param[in] type Type of callback function to disable
- *
- * \return Status of the callback disable operation.
- * \retval STATUS_OK The callback was disabled successfully
- * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied
- */
-enum status_code wdt_disable_callback(
- const enum wdt_callback type)
-{
- Wdt *const WDT_module = WDT;
-
- switch (type)
- {
- case WDT_CALLBACK_EARLY_WARNING:
- WDT_module->INTENCLR.reg = WDT_INTENCLR_EW;
- return STATUS_OK;
- default:
- Assert(false);
- return STATUS_ERR_INVALID_ARG;
- }
-}
-
-/** Handler for the WDT hardware module interrupt. */
-void WDT_Handler(void)
-{
- wdt_clear_early_warning();
-
- if (wdt_early_warning_callback) {
- wdt_early_warning_callback();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.h
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.h b/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.h
deleted file mode 100755
index fe289d5..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/drivers/wdt/wdt_callback.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * \file
- *
- * \brief SAM Watchdog Driver
- *
- * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-#ifndef WDT_CALLBACK_H_INCLUDED
-#define WDT_CALLBACK_H_INCLUDED
-
-#include <compiler.h>
-#include "wdt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \addtogroup asfdoc_sam0_wdt_group
- *
- * @{
- */
-
-/** \name Callback Configuration and Initialization
- * @{
- */
-
-/** Type definition for a WDT module callback function. */
-typedef void (*wdt_callback_t)(void);
-
-/** Enum for the possible callback types for the WDT module. */
-enum wdt_callback
-{
- /** Callback type for when an early warning callback from the WDT module
- * is issued.
- */
- WDT_CALLBACK_EARLY_WARNING,
-};
-
-enum status_code wdt_register_callback(
- const wdt_callback_t callback,
- const enum wdt_callback type);
-
-enum status_code wdt_unregister_callback(
- const enum wdt_callback type);
-
-/** @} */
-
-/** \name Callback Enabling and Disabling
- * @{
- */
-
-enum status_code wdt_enable_callback(
- const enum wdt_callback type);
-
-enum status_code wdt_disable_callback(
- const enum wdt_callback type);
-
-/** @} */
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/a280628a/hw/mcu/atmel/samd21xx/src/sam0/utils/cmsis/samd21/include/component/ac.h
----------------------------------------------------------------------
diff --git a/hw/mcu/atmel/samd21xx/src/sam0/utils/cmsis/samd21/include/component/ac.h b/hw/mcu/atmel/samd21xx/src/sam0/utils/cmsis/samd21/include/component/ac.h
deleted file mode 100755
index 7d133bf..0000000
--- a/hw/mcu/atmel/samd21xx/src/sam0/utils/cmsis/samd21/include/component/ac.h
+++ /dev/null
@@ -1,562 +0,0 @@
-/**
- * \file
- *
- * \brief Component description for AC
- *
- * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
- *
- * \asf_license_start
- *
- * \page License
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. The name of Atmel may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * 4. This software may only be redistributed and used in connection with an
- * Atmel microcontroller product.
- *
- * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
- * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * \asf_license_stop
- *
- */
-/*
- * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
- */
-
-#ifndef _SAMD21_AC_COMPONENT_
-#define _SAMD21_AC_COMPONENT_
-
-/* ========================================================================== */
-/** SOFTWARE API DEFINITION FOR AC */
-/* ========================================================================== */
-/** \addtogroup SAMD21_AC Analog Comparators */
-/*@{*/
-
-#define AC_U2205
-#define REV_AC 0x112
-
-/* -------- AC_CTRLA : (AC Offset: 0x00) (R/W 8) Control A -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t SWRST:1; /*!< bit: 0 Software Reset */
- uint8_t ENABLE:1; /*!< bit: 1 Enable */
- uint8_t RUNSTDBY:1; /*!< bit: 2 Run in Standby */
- uint8_t :4; /*!< bit: 3.. 6 Reserved */
- uint8_t LPMUX:1; /*!< bit: 7 Low-Power Mux */
- } bit; /*!< Structure used for bit access */
- uint8_t reg; /*!< Type used for register access */
-} AC_CTRLA_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_CTRLA_OFFSET 0x00 /**< \brief (AC_CTRLA offset) Control A */
-#define AC_CTRLA_RESETVALUE 0x00ul /**< \brief (AC_CTRLA reset_value) Control A */
-
-#define AC_CTRLA_SWRST_Pos 0 /**< \brief (AC_CTRLA) Software Reset */
-#define AC_CTRLA_SWRST (0x1ul << AC_CTRLA_SWRST_Pos)
-#define AC_CTRLA_ENABLE_Pos 1 /**< \brief (AC_CTRLA) Enable */
-#define AC_CTRLA_ENABLE (0x1ul << AC_CTRLA_ENABLE_Pos)
-#define AC_CTRLA_RUNSTDBY_Pos 2 /**< \brief (AC_CTRLA) Run in Standby */
-#define AC_CTRLA_RUNSTDBY_Msk (0x1ul << AC_CTRLA_RUNSTDBY_Pos)
-#define AC_CTRLA_RUNSTDBY(value) ((AC_CTRLA_RUNSTDBY_Msk & ((value) << AC_CTRLA_RUNSTDBY_Pos)))
-#define AC_CTRLA_LPMUX_Pos 7 /**< \brief (AC_CTRLA) Low-Power Mux */
-#define AC_CTRLA_LPMUX (0x1ul << AC_CTRLA_LPMUX_Pos)
-#define AC_CTRLA_MASK 0x87ul /**< \brief (AC_CTRLA) MASK Register */
-
-/* -------- AC_CTRLB : (AC Offset: 0x01) ( /W 8) Control B -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t START0:1; /*!< bit: 0 Comparator 0 Start Comparison */
- uint8_t START1:1; /*!< bit: 1 Comparator 1 Start Comparison */
- uint8_t :6; /*!< bit: 2.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t START:2; /*!< bit: 0.. 1 Comparator x Start Comparison */
- uint8_t :6; /*!< bit: 2.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_CTRLB_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_CTRLB_OFFSET 0x01 /**< \brief (AC_CTRLB offset) Control B */
-#define AC_CTRLB_RESETVALUE 0x00ul /**< \brief (AC_CTRLB reset_value) Control B */
-
-#define AC_CTRLB_START0_Pos 0 /**< \brief (AC_CTRLB) Comparator 0 Start Comparison */
-#define AC_CTRLB_START0 (1 << AC_CTRLB_START0_Pos)
-#define AC_CTRLB_START1_Pos 1 /**< \brief (AC_CTRLB) Comparator 1 Start Comparison */
-#define AC_CTRLB_START1 (1 << AC_CTRLB_START1_Pos)
-#define AC_CTRLB_START_Pos 0 /**< \brief (AC_CTRLB) Comparator x Start Comparison */
-#define AC_CTRLB_START_Msk (0x3ul << AC_CTRLB_START_Pos)
-#define AC_CTRLB_START(value) ((AC_CTRLB_START_Msk & ((value) << AC_CTRLB_START_Pos)))
-#define AC_CTRLB_MASK 0x03ul /**< \brief (AC_CTRLB) MASK Register */
-
-/* -------- AC_EVCTRL : (AC Offset: 0x02) (R/W 16) Event Control -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint16_t COMPEO0:1; /*!< bit: 0 Comparator 0 Event Output Enable */
- uint16_t COMPEO1:1; /*!< bit: 1 Comparator 1 Event Output Enable */
- uint16_t :2; /*!< bit: 2.. 3 Reserved */
- uint16_t WINEO0:1; /*!< bit: 4 Window 0 Event Output Enable */
- uint16_t :3; /*!< bit: 5.. 7 Reserved */
- uint16_t COMPEI0:1; /*!< bit: 8 Comparator 0 Event Input */
- uint16_t COMPEI1:1; /*!< bit: 9 Comparator 1 Event Input */
- uint16_t :6; /*!< bit: 10..15 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint16_t COMPEO:2; /*!< bit: 0.. 1 Comparator x Event Output Enable */
- uint16_t :2; /*!< bit: 2.. 3 Reserved */
- uint16_t WINEO:1; /*!< bit: 4 Window x Event Output Enable */
- uint16_t :3; /*!< bit: 5.. 7 Reserved */
- uint16_t COMPEI:2; /*!< bit: 8.. 9 Comparator x Event Input */
- uint16_t :6; /*!< bit: 10..15 Reserved */
- } vec; /*!< Structure used for vec access */
- uint16_t reg; /*!< Type used for register access */
-} AC_EVCTRL_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_EVCTRL_OFFSET 0x02 /**< \brief (AC_EVCTRL offset) Event Control */
-#define AC_EVCTRL_RESETVALUE 0x0000ul /**< \brief (AC_EVCTRL reset_value) Event Control */
-
-#define AC_EVCTRL_COMPEO0_Pos 0 /**< \brief (AC_EVCTRL) Comparator 0 Event Output Enable */
-#define AC_EVCTRL_COMPEO0 (1 << AC_EVCTRL_COMPEO0_Pos)
-#define AC_EVCTRL_COMPEO1_Pos 1 /**< \brief (AC_EVCTRL) Comparator 1 Event Output Enable */
-#define AC_EVCTRL_COMPEO1 (1 << AC_EVCTRL_COMPEO1_Pos)
-#define AC_EVCTRL_COMPEO_Pos 0 /**< \brief (AC_EVCTRL) Comparator x Event Output Enable */
-#define AC_EVCTRL_COMPEO_Msk (0x3ul << AC_EVCTRL_COMPEO_Pos)
-#define AC_EVCTRL_COMPEO(value) ((AC_EVCTRL_COMPEO_Msk & ((value) << AC_EVCTRL_COMPEO_Pos)))
-#define AC_EVCTRL_WINEO0_Pos 4 /**< \brief (AC_EVCTRL) Window 0 Event Output Enable */
-#define AC_EVCTRL_WINEO0 (1 << AC_EVCTRL_WINEO0_Pos)
-#define AC_EVCTRL_WINEO_Pos 4 /**< \brief (AC_EVCTRL) Window x Event Output Enable */
-#define AC_EVCTRL_WINEO_Msk (0x1ul << AC_EVCTRL_WINEO_Pos)
-#define AC_EVCTRL_WINEO(value) ((AC_EVCTRL_WINEO_Msk & ((value) << AC_EVCTRL_WINEO_Pos)))
-#define AC_EVCTRL_COMPEI0_Pos 8 /**< \brief (AC_EVCTRL) Comparator 0 Event Input */
-#define AC_EVCTRL_COMPEI0 (1 << AC_EVCTRL_COMPEI0_Pos)
-#define AC_EVCTRL_COMPEI1_Pos 9 /**< \brief (AC_EVCTRL) Comparator 1 Event Input */
-#define AC_EVCTRL_COMPEI1 (1 << AC_EVCTRL_COMPEI1_Pos)
-#define AC_EVCTRL_COMPEI_Pos 8 /**< \brief (AC_EVCTRL) Comparator x Event Input */
-#define AC_EVCTRL_COMPEI_Msk (0x3ul << AC_EVCTRL_COMPEI_Pos)
-#define AC_EVCTRL_COMPEI(value) ((AC_EVCTRL_COMPEI_Msk & ((value) << AC_EVCTRL_COMPEI_Pos)))
-#define AC_EVCTRL_MASK 0x0313ul /**< \brief (AC_EVCTRL) MASK Register */
-
-/* -------- AC_INTENCLR : (AC Offset: 0x04) (R/W 8) Interrupt Enable Clear -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t COMP0:1; /*!< bit: 0 Comparator 0 Interrupt Enable */
- uint8_t COMP1:1; /*!< bit: 1 Comparator 1 Interrupt Enable */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN0:1; /*!< bit: 4 Window 0 Interrupt Enable */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t COMP:2; /*!< bit: 0.. 1 Comparator x Interrupt Enable */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN:1; /*!< bit: 4 Window x Interrupt Enable */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_INTENCLR_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_INTENCLR_OFFSET 0x04 /**< \brief (AC_INTENCLR offset) Interrupt Enable Clear */
-#define AC_INTENCLR_RESETVALUE 0x00ul /**< \brief (AC_INTENCLR reset_value) Interrupt Enable Clear */
-
-#define AC_INTENCLR_COMP0_Pos 0 /**< \brief (AC_INTENCLR) Comparator 0 Interrupt Enable */
-#define AC_INTENCLR_COMP0 (1 << AC_INTENCLR_COMP0_Pos)
-#define AC_INTENCLR_COMP1_Pos 1 /**< \brief (AC_INTENCLR) Comparator 1 Interrupt Enable */
-#define AC_INTENCLR_COMP1 (1 << AC_INTENCLR_COMP1_Pos)
-#define AC_INTENCLR_COMP_Pos 0 /**< \brief (AC_INTENCLR) Comparator x Interrupt Enable */
-#define AC_INTENCLR_COMP_Msk (0x3ul << AC_INTENCLR_COMP_Pos)
-#define AC_INTENCLR_COMP(value) ((AC_INTENCLR_COMP_Msk & ((value) << AC_INTENCLR_COMP_Pos)))
-#define AC_INTENCLR_WIN0_Pos 4 /**< \brief (AC_INTENCLR) Window 0 Interrupt Enable */
-#define AC_INTENCLR_WIN0 (1 << AC_INTENCLR_WIN0_Pos)
-#define AC_INTENCLR_WIN_Pos 4 /**< \brief (AC_INTENCLR) Window x Interrupt Enable */
-#define AC_INTENCLR_WIN_Msk (0x1ul << AC_INTENCLR_WIN_Pos)
-#define AC_INTENCLR_WIN(value) ((AC_INTENCLR_WIN_Msk & ((value) << AC_INTENCLR_WIN_Pos)))
-#define AC_INTENCLR_MASK 0x13ul /**< \brief (AC_INTENCLR) MASK Register */
-
-/* -------- AC_INTENSET : (AC Offset: 0x05) (R/W 8) Interrupt Enable Set -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t COMP0:1; /*!< bit: 0 Comparator 0 Interrupt Enable */
- uint8_t COMP1:1; /*!< bit: 1 Comparator 1 Interrupt Enable */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN0:1; /*!< bit: 4 Window 0 Interrupt Enable */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t COMP:2; /*!< bit: 0.. 1 Comparator x Interrupt Enable */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN:1; /*!< bit: 4 Window x Interrupt Enable */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_INTENSET_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_INTENSET_OFFSET 0x05 /**< \brief (AC_INTENSET offset) Interrupt Enable Set */
-#define AC_INTENSET_RESETVALUE 0x00ul /**< \brief (AC_INTENSET reset_value) Interrupt Enable Set */
-
-#define AC_INTENSET_COMP0_Pos 0 /**< \brief (AC_INTENSET) Comparator 0 Interrupt Enable */
-#define AC_INTENSET_COMP0 (1 << AC_INTENSET_COMP0_Pos)
-#define AC_INTENSET_COMP1_Pos 1 /**< \brief (AC_INTENSET) Comparator 1 Interrupt Enable */
-#define AC_INTENSET_COMP1 (1 << AC_INTENSET_COMP1_Pos)
-#define AC_INTENSET_COMP_Pos 0 /**< \brief (AC_INTENSET) Comparator x Interrupt Enable */
-#define AC_INTENSET_COMP_Msk (0x3ul << AC_INTENSET_COMP_Pos)
-#define AC_INTENSET_COMP(value) ((AC_INTENSET_COMP_Msk & ((value) << AC_INTENSET_COMP_Pos)))
-#define AC_INTENSET_WIN0_Pos 4 /**< \brief (AC_INTENSET) Window 0 Interrupt Enable */
-#define AC_INTENSET_WIN0 (1 << AC_INTENSET_WIN0_Pos)
-#define AC_INTENSET_WIN_Pos 4 /**< \brief (AC_INTENSET) Window x Interrupt Enable */
-#define AC_INTENSET_WIN_Msk (0x1ul << AC_INTENSET_WIN_Pos)
-#define AC_INTENSET_WIN(value) ((AC_INTENSET_WIN_Msk & ((value) << AC_INTENSET_WIN_Pos)))
-#define AC_INTENSET_MASK 0x13ul /**< \brief (AC_INTENSET) MASK Register */
-
-/* -------- AC_INTFLAG : (AC Offset: 0x06) (R/W 8) Interrupt Flag Status and Clear -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t COMP0:1; /*!< bit: 0 Comparator 0 */
- uint8_t COMP1:1; /*!< bit: 1 Comparator 1 */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN0:1; /*!< bit: 4 Window 0 */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t COMP:2; /*!< bit: 0.. 1 Comparator x */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WIN:1; /*!< bit: 4 Window x */
- uint8_t :3; /*!< bit: 5.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_INTFLAG_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_INTFLAG_OFFSET 0x06 /**< \brief (AC_INTFLAG offset) Interrupt Flag Status and Clear */
-#define AC_INTFLAG_RESETVALUE 0x00ul /**< \brief (AC_INTFLAG reset_value) Interrupt Flag Status and Clear */
-
-#define AC_INTFLAG_COMP0_Pos 0 /**< \brief (AC_INTFLAG) Comparator 0 */
-#define AC_INTFLAG_COMP0 (1 << AC_INTFLAG_COMP0_Pos)
-#define AC_INTFLAG_COMP1_Pos 1 /**< \brief (AC_INTFLAG) Comparator 1 */
-#define AC_INTFLAG_COMP1 (1 << AC_INTFLAG_COMP1_Pos)
-#define AC_INTFLAG_COMP_Pos 0 /**< \brief (AC_INTFLAG) Comparator x */
-#define AC_INTFLAG_COMP_Msk (0x3ul << AC_INTFLAG_COMP_Pos)
-#define AC_INTFLAG_COMP(value) ((AC_INTFLAG_COMP_Msk & ((value) << AC_INTFLAG_COMP_Pos)))
-#define AC_INTFLAG_WIN0_Pos 4 /**< \brief (AC_INTFLAG) Window 0 */
-#define AC_INTFLAG_WIN0 (1 << AC_INTFLAG_WIN0_Pos)
-#define AC_INTFLAG_WIN_Pos 4 /**< \brief (AC_INTFLAG) Window x */
-#define AC_INTFLAG_WIN_Msk (0x1ul << AC_INTFLAG_WIN_Pos)
-#define AC_INTFLAG_WIN(value) ((AC_INTFLAG_WIN_Msk & ((value) << AC_INTFLAG_WIN_Pos)))
-#define AC_INTFLAG_MASK 0x13ul /**< \brief (AC_INTFLAG) MASK Register */
-
-/* -------- AC_STATUSA : (AC Offset: 0x08) (R/ 8) Status A -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t STATE0:1; /*!< bit: 0 Comparator 0 Current State */
- uint8_t STATE1:1; /*!< bit: 1 Comparator 1 Current State */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WSTATE0:2; /*!< bit: 4.. 5 Window 0 Current State */
- uint8_t :2; /*!< bit: 6.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t STATE:2; /*!< bit: 0.. 1 Comparator x Current State */
- uint8_t :6; /*!< bit: 2.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_STATUSA_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_STATUSA_OFFSET 0x08 /**< \brief (AC_STATUSA offset) Status A */
-#define AC_STATUSA_RESETVALUE 0x00ul /**< \brief (AC_STATUSA reset_value) Status A */
-
-#define AC_STATUSA_STATE0_Pos 0 /**< \brief (AC_STATUSA) Comparator 0 Current State */
-#define AC_STATUSA_STATE0 (1 << AC_STATUSA_STATE0_Pos)
-#define AC_STATUSA_STATE1_Pos 1 /**< \brief (AC_STATUSA) Comparator 1 Current State */
-#define AC_STATUSA_STATE1 (1 << AC_STATUSA_STATE1_Pos)
-#define AC_STATUSA_STATE_Pos 0 /**< \brief (AC_STATUSA) Comparator x Current State */
-#define AC_STATUSA_STATE_Msk (0x3ul << AC_STATUSA_STATE_Pos)
-#define AC_STATUSA_STATE(value) ((AC_STATUSA_STATE_Msk & ((value) << AC_STATUSA_STATE_Pos)))
-#define AC_STATUSA_WSTATE0_Pos 4 /**< \brief (AC_STATUSA) Window 0 Current State */
-#define AC_STATUSA_WSTATE0_Msk (0x3ul << AC_STATUSA_WSTATE0_Pos)
-#define AC_STATUSA_WSTATE0(value) ((AC_STATUSA_WSTATE0_Msk & ((value) << AC_STATUSA_WSTATE0_Pos)))
-#define AC_STATUSA_WSTATE0_ABOVE_Val 0x0ul /**< \brief (AC_STATUSA) Signal is above window */
-#define AC_STATUSA_WSTATE0_INSIDE_Val 0x1ul /**< \brief (AC_STATUSA) Signal is inside window */
-#define AC_STATUSA_WSTATE0_BELOW_Val 0x2ul /**< \brief (AC_STATUSA) Signal is below window */
-#define AC_STATUSA_WSTATE0_ABOVE (AC_STATUSA_WSTATE0_ABOVE_Val << AC_STATUSA_WSTATE0_Pos)
-#define AC_STATUSA_WSTATE0_INSIDE (AC_STATUSA_WSTATE0_INSIDE_Val << AC_STATUSA_WSTATE0_Pos)
-#define AC_STATUSA_WSTATE0_BELOW (AC_STATUSA_WSTATE0_BELOW_Val << AC_STATUSA_WSTATE0_Pos)
-#define AC_STATUSA_MASK 0x33ul /**< \brief (AC_STATUSA) MASK Register */
-
-/* -------- AC_STATUSB : (AC Offset: 0x09) (R/ 8) Status B -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t READY0:1; /*!< bit: 0 Comparator 0 Ready */
- uint8_t READY1:1; /*!< bit: 1 Comparator 1 Ready */
- uint8_t :5; /*!< bit: 2.. 6 Reserved */
- uint8_t SYNCBUSY:1; /*!< bit: 7 Synchronization Busy */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t READY:2; /*!< bit: 0.. 1 Comparator x Ready */
- uint8_t :6; /*!< bit: 2.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_STATUSB_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_STATUSB_OFFSET 0x09 /**< \brief (AC_STATUSB offset) Status B */
-#define AC_STATUSB_RESETVALUE 0x00ul /**< \brief (AC_STATUSB reset_value) Status B */
-
-#define AC_STATUSB_READY0_Pos 0 /**< \brief (AC_STATUSB) Comparator 0 Ready */
-#define AC_STATUSB_READY0 (1 << AC_STATUSB_READY0_Pos)
-#define AC_STATUSB_READY1_Pos 1 /**< \brief (AC_STATUSB) Comparator 1 Ready */
-#define AC_STATUSB_READY1 (1 << AC_STATUSB_READY1_Pos)
-#define AC_STATUSB_READY_Pos 0 /**< \brief (AC_STATUSB) Comparator x Ready */
-#define AC_STATUSB_READY_Msk (0x3ul << AC_STATUSB_READY_Pos)
-#define AC_STATUSB_READY(value) ((AC_STATUSB_READY_Msk & ((value) << AC_STATUSB_READY_Pos)))
-#define AC_STATUSB_SYNCBUSY_Pos 7 /**< \brief (AC_STATUSB) Synchronization Busy */
-#define AC_STATUSB_SYNCBUSY (0x1ul << AC_STATUSB_SYNCBUSY_Pos)
-#define AC_STATUSB_MASK 0x83ul /**< \brief (AC_STATUSB) MASK Register */
-
-/* -------- AC_STATUSC : (AC Offset: 0x0A) (R/ 8) Status C -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t STATE0:1; /*!< bit: 0 Comparator 0 Current State */
- uint8_t STATE1:1; /*!< bit: 1 Comparator 1 Current State */
- uint8_t :2; /*!< bit: 2.. 3 Reserved */
- uint8_t WSTATE0:2; /*!< bit: 4.. 5 Window 0 Current State */
- uint8_t :2; /*!< bit: 6.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- struct {
- uint8_t STATE:2; /*!< bit: 0.. 1 Comparator x Current State */
- uint8_t :6; /*!< bit: 2.. 7 Reserved */
- } vec; /*!< Structure used for vec access */
- uint8_t reg; /*!< Type used for register access */
-} AC_STATUSC_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_STATUSC_OFFSET 0x0A /**< \brief (AC_STATUSC offset) Status C */
-#define AC_STATUSC_RESETVALUE 0x00ul /**< \brief (AC_STATUSC reset_value) Status C */
-
-#define AC_STATUSC_STATE0_Pos 0 /**< \brief (AC_STATUSC) Comparator 0 Current State */
-#define AC_STATUSC_STATE0 (1 << AC_STATUSC_STATE0_Pos)
-#define AC_STATUSC_STATE1_Pos 1 /**< \brief (AC_STATUSC) Comparator 1 Current State */
-#define AC_STATUSC_STATE1 (1 << AC_STATUSC_STATE1_Pos)
-#define AC_STATUSC_STATE_Pos 0 /**< \brief (AC_STATUSC) Comparator x Current State */
-#define AC_STATUSC_STATE_Msk (0x3ul << AC_STATUSC_STATE_Pos)
-#define AC_STATUSC_STATE(value) ((AC_STATUSC_STATE_Msk & ((value) << AC_STATUSC_STATE_Pos)))
-#define AC_STATUSC_WSTATE0_Pos 4 /**< \brief (AC_STATUSC) Window 0 Current State */
-#define AC_STATUSC_WSTATE0_Msk (0x3ul << AC_STATUSC_WSTATE0_Pos)
-#define AC_STATUSC_WSTATE0(value) ((AC_STATUSC_WSTATE0_Msk & ((value) << AC_STATUSC_WSTATE0_Pos)))
-#define AC_STATUSC_WSTATE0_ABOVE_Val 0x0ul /**< \brief (AC_STATUSC) Signal is above window */
-#define AC_STATUSC_WSTATE0_INSIDE_Val 0x1ul /**< \brief (AC_STATUSC) Signal is inside window */
-#define AC_STATUSC_WSTATE0_BELOW_Val 0x2ul /**< \brief (AC_STATUSC) Signal is below window */
-#define AC_STATUSC_WSTATE0_ABOVE (AC_STATUSC_WSTATE0_ABOVE_Val << AC_STATUSC_WSTATE0_Pos)
-#define AC_STATUSC_WSTATE0_INSIDE (AC_STATUSC_WSTATE0_INSIDE_Val << AC_STATUSC_WSTATE0_Pos)
-#define AC_STATUSC_WSTATE0_BELOW (AC_STATUSC_WSTATE0_BELOW_Val << AC_STATUSC_WSTATE0_Pos)
-#define AC_STATUSC_MASK 0x33ul /**< \brief (AC_STATUSC) MASK Register */
-
-/* -------- AC_WINCTRL : (AC Offset: 0x0C) (R/W 8) Window Control -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t WEN0:1; /*!< bit: 0 Window 0 Mode Enable */
- uint8_t WINTSEL0:2; /*!< bit: 1.. 2 Window 0 Interrupt Selection */
- uint8_t :5; /*!< bit: 3.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- uint8_t reg; /*!< Type used for register access */
-} AC_WINCTRL_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_WINCTRL_OFFSET 0x0C /**< \brief (AC_WINCTRL offset) Window Control */
-#define AC_WINCTRL_RESETVALUE 0x00ul /**< \brief (AC_WINCTRL reset_value) Window Control */
-
-#define AC_WINCTRL_WEN0_Pos 0 /**< \brief (AC_WINCTRL) Window 0 Mode Enable */
-#define AC_WINCTRL_WEN0 (0x1ul << AC_WINCTRL_WEN0_Pos)
-#define AC_WINCTRL_WINTSEL0_Pos 1 /**< \brief (AC_WINCTRL) Window 0 Interrupt Selection */
-#define AC_WINCTRL_WINTSEL0_Msk (0x3ul << AC_WINCTRL_WINTSEL0_Pos)
-#define AC_WINCTRL_WINTSEL0(value) ((AC_WINCTRL_WINTSEL0_Msk & ((value) << AC_WINCTRL_WINTSEL0_Pos)))
-#define AC_WINCTRL_WINTSEL0_ABOVE_Val 0x0ul /**< \brief (AC_WINCTRL) Interrupt on signal above window */
-#define AC_WINCTRL_WINTSEL0_INSIDE_Val 0x1ul /**< \brief (AC_WINCTRL) Interrupt on signal inside window */
-#define AC_WINCTRL_WINTSEL0_BELOW_Val 0x2ul /**< \brief (AC_WINCTRL) Interrupt on signal below window */
-#define AC_WINCTRL_WINTSEL0_OUTSIDE_Val 0x3ul /**< \brief (AC_WINCTRL) Interrupt on signal outside window */
-#define AC_WINCTRL_WINTSEL0_ABOVE (AC_WINCTRL_WINTSEL0_ABOVE_Val << AC_WINCTRL_WINTSEL0_Pos)
-#define AC_WINCTRL_WINTSEL0_INSIDE (AC_WINCTRL_WINTSEL0_INSIDE_Val << AC_WINCTRL_WINTSEL0_Pos)
-#define AC_WINCTRL_WINTSEL0_BELOW (AC_WINCTRL_WINTSEL0_BELOW_Val << AC_WINCTRL_WINTSEL0_Pos)
-#define AC_WINCTRL_WINTSEL0_OUTSIDE (AC_WINCTRL_WINTSEL0_OUTSIDE_Val << AC_WINCTRL_WINTSEL0_Pos)
-#define AC_WINCTRL_MASK 0x07ul /**< \brief (AC_WINCTRL) MASK Register */
-
-/* -------- AC_COMPCTRL : (AC Offset: 0x10) (R/W 32) Comparator Control n -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint32_t ENABLE:1; /*!< bit: 0 Enable */
- uint32_t SINGLE:1; /*!< bit: 1 Single-Shot Mode */
- uint32_t SPEED:2; /*!< bit: 2.. 3 Speed Selection */
- uint32_t :1; /*!< bit: 4 Reserved */
- uint32_t INTSEL:2; /*!< bit: 5.. 6 Interrupt Selection */
- uint32_t :1; /*!< bit: 7 Reserved */
- uint32_t MUXNEG:3; /*!< bit: 8..10 Negative Input Mux Selection */
- uint32_t :1; /*!< bit: 11 Reserved */
- uint32_t MUXPOS:2; /*!< bit: 12..13 Positive Input Mux Selection */
- uint32_t :1; /*!< bit: 14 Reserved */
- uint32_t SWAP:1; /*!< bit: 15 Swap Inputs and Invert */
- uint32_t OUT:2; /*!< bit: 16..17 Output */
- uint32_t :1; /*!< bit: 18 Reserved */
- uint32_t HYST:1; /*!< bit: 19 Hysteresis Enable */
- uint32_t :4; /*!< bit: 20..23 Reserved */
- uint32_t FLEN:3; /*!< bit: 24..26 Filter Length */
- uint32_t :5; /*!< bit: 27..31 Reserved */
- } bit; /*!< Structure used for bit access */
- uint32_t reg; /*!< Type used for register access */
-} AC_COMPCTRL_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_COMPCTRL_OFFSET 0x10 /**< \brief (AC_COMPCTRL offset) Comparator Control n */
-#define AC_COMPCTRL_RESETVALUE 0x00000000ul /**< \brief (AC_COMPCTRL reset_value) Comparator Control n */
-
-#define AC_COMPCTRL_ENABLE_Pos 0 /**< \brief (AC_COMPCTRL) Enable */
-#define AC_COMPCTRL_ENABLE (0x1ul << AC_COMPCTRL_ENABLE_Pos)
-#define AC_COMPCTRL_SINGLE_Pos 1 /**< \brief (AC_COMPCTRL) Single-Shot Mode */
-#define AC_COMPCTRL_SINGLE (0x1ul << AC_COMPCTRL_SINGLE_Pos)
-#define AC_COMPCTRL_SPEED_Pos 2 /**< \brief (AC_COMPCTRL) Speed Selection */
-#define AC_COMPCTRL_SPEED_Msk (0x3ul << AC_COMPCTRL_SPEED_Pos)
-#define AC_COMPCTRL_SPEED(value) ((AC_COMPCTRL_SPEED_Msk & ((value) << AC_COMPCTRL_SPEED_Pos)))
-#define AC_COMPCTRL_SPEED_LOW_Val 0x0ul /**< \brief (AC_COMPCTRL) Low speed */
-#define AC_COMPCTRL_SPEED_HIGH_Val 0x1ul /**< \brief (AC_COMPCTRL) High speed */
-#define AC_COMPCTRL_SPEED_LOW (AC_COMPCTRL_SPEED_LOW_Val << AC_COMPCTRL_SPEED_Pos)
-#define AC_COMPCTRL_SPEED_HIGH (AC_COMPCTRL_SPEED_HIGH_Val << AC_COMPCTRL_SPEED_Pos)
-#define AC_COMPCTRL_INTSEL_Pos 5 /**< \brief (AC_COMPCTRL) Interrupt Selection */
-#define AC_COMPCTRL_INTSEL_Msk (0x3ul << AC_COMPCTRL_INTSEL_Pos)
-#define AC_COMPCTRL_INTSEL(value) ((AC_COMPCTRL_INTSEL_Msk & ((value) << AC_COMPCTRL_INTSEL_Pos)))
-#define AC_COMPCTRL_INTSEL_TOGGLE_Val 0x0ul /**< \brief (AC_COMPCTRL) Interrupt on comparator output toggle */
-#define AC_COMPCTRL_INTSEL_RISING_Val 0x1ul /**< \brief (AC_COMPCTRL) Interrupt on comparator output rising */
-#define AC_COMPCTRL_INTSEL_FALLING_Val 0x2ul /**< \brief (AC_COMPCTRL) Interrupt on comparator output falling */
-#define AC_COMPCTRL_INTSEL_EOC_Val 0x3ul /**< \brief (AC_COMPCTRL) Interrupt on end of comparison (single-shot mode only) */
-#define AC_COMPCTRL_INTSEL_TOGGLE (AC_COMPCTRL_INTSEL_TOGGLE_Val << AC_COMPCTRL_INTSEL_Pos)
-#define AC_COMPCTRL_INTSEL_RISING (AC_COMPCTRL_INTSEL_RISING_Val << AC_COMPCTRL_INTSEL_Pos)
-#define AC_COMPCTRL_INTSEL_FALLING (AC_COMPCTRL_INTSEL_FALLING_Val << AC_COMPCTRL_INTSEL_Pos)
-#define AC_COMPCTRL_INTSEL_EOC (AC_COMPCTRL_INTSEL_EOC_Val << AC_COMPCTRL_INTSEL_Pos)
-#define AC_COMPCTRL_MUXNEG_Pos 8 /**< \brief (AC_COMPCTRL) Negative Input Mux Selection */
-#define AC_COMPCTRL_MUXNEG_Msk (0x7ul << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG(value) ((AC_COMPCTRL_MUXNEG_Msk & ((value) << AC_COMPCTRL_MUXNEG_Pos)))
-#define AC_COMPCTRL_MUXNEG_PIN0_Val 0x0ul /**< \brief (AC_COMPCTRL) I/O pin 0 */
-#define AC_COMPCTRL_MUXNEG_PIN1_Val 0x1ul /**< \brief (AC_COMPCTRL) I/O pin 1 */
-#define AC_COMPCTRL_MUXNEG_PIN2_Val 0x2ul /**< \brief (AC_COMPCTRL) I/O pin 2 */
-#define AC_COMPCTRL_MUXNEG_PIN3_Val 0x3ul /**< \brief (AC_COMPCTRL) I/O pin 3 */
-#define AC_COMPCTRL_MUXNEG_GND_Val 0x4ul /**< \brief (AC_COMPCTRL) Ground */
-#define AC_COMPCTRL_MUXNEG_VSCALE_Val 0x5ul /**< \brief (AC_COMPCTRL) VDD scaler */
-#define AC_COMPCTRL_MUXNEG_BANDGAP_Val 0x6ul /**< \brief (AC_COMPCTRL) Internal bandgap voltage */
-#define AC_COMPCTRL_MUXNEG_DAC_Val 0x7ul /**< \brief (AC_COMPCTRL) DAC output */
-#define AC_COMPCTRL_MUXNEG_PIN0 (AC_COMPCTRL_MUXNEG_PIN0_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_PIN1 (AC_COMPCTRL_MUXNEG_PIN1_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_PIN2 (AC_COMPCTRL_MUXNEG_PIN2_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_PIN3 (AC_COMPCTRL_MUXNEG_PIN3_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_GND (AC_COMPCTRL_MUXNEG_GND_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_VSCALE (AC_COMPCTRL_MUXNEG_VSCALE_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_BANDGAP (AC_COMPCTRL_MUXNEG_BANDGAP_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXNEG_DAC (AC_COMPCTRL_MUXNEG_DAC_Val << AC_COMPCTRL_MUXNEG_Pos)
-#define AC_COMPCTRL_MUXPOS_Pos 12 /**< \brief (AC_COMPCTRL) Positive Input Mux Selection */
-#define AC_COMPCTRL_MUXPOS_Msk (0x3ul << AC_COMPCTRL_MUXPOS_Pos)
-#define AC_COMPCTRL_MUXPOS(value) ((AC_COMPCTRL_MUXPOS_Msk & ((value) << AC_COMPCTRL_MUXPOS_Pos)))
-#define AC_COMPCTRL_MUXPOS_PIN0_Val 0x0ul /**< \brief (AC_COMPCTRL) I/O pin 0 */
-#define AC_COMPCTRL_MUXPOS_PIN1_Val 0x1ul /**< \brief (AC_COMPCTRL) I/O pin 1 */
-#define AC_COMPCTRL_MUXPOS_PIN2_Val 0x2ul /**< \brief (AC_COMPCTRL) I/O pin 2 */
-#define AC_COMPCTRL_MUXPOS_PIN3_Val 0x3ul /**< \brief (AC_COMPCTRL) I/O pin 3 */
-#define AC_COMPCTRL_MUXPOS_PIN0 (AC_COMPCTRL_MUXPOS_PIN0_Val << AC_COMPCTRL_MUXPOS_Pos)
-#define AC_COMPCTRL_MUXPOS_PIN1 (AC_COMPCTRL_MUXPOS_PIN1_Val << AC_COMPCTRL_MUXPOS_Pos)
-#define AC_COMPCTRL_MUXPOS_PIN2 (AC_COMPCTRL_MUXPOS_PIN2_Val << AC_COMPCTRL_MUXPOS_Pos)
-#define AC_COMPCTRL_MUXPOS_PIN3 (AC_COMPCTRL_MUXPOS_PIN3_Val << AC_COMPCTRL_MUXPOS_Pos)
-#define AC_COMPCTRL_SWAP_Pos 15 /**< \brief (AC_COMPCTRL) Swap Inputs and Invert */
-#define AC_COMPCTRL_SWAP (0x1ul << AC_COMPCTRL_SWAP_Pos)
-#define AC_COMPCTRL_OUT_Pos 16 /**< \brief (AC_COMPCTRL) Output */
-#define AC_COMPCTRL_OUT_Msk (0x3ul << AC_COMPCTRL_OUT_Pos)
-#define AC_COMPCTRL_OUT(value) ((AC_COMPCTRL_OUT_Msk & ((value) << AC_COMPCTRL_OUT_Pos)))
-#define AC_COMPCTRL_OUT_OFF_Val 0x0ul /**< \brief (AC_COMPCTRL) The output of COMPn is not routed to the COMPn I/O port */
-#define AC_COMPCTRL_OUT_ASYNC_Val 0x1ul /**< \brief (AC_COMPCTRL) The asynchronous output of COMPn is routed to the COMPn I/O port */
-#define AC_COMPCTRL_OUT_SYNC_Val 0x2ul /**< \brief (AC_COMPCTRL) The synchronous output (including filtering) of COMPn is routed to the COMPn I/O port */
-#define AC_COMPCTRL_OUT_OFF (AC_COMPCTRL_OUT_OFF_Val << AC_COMPCTRL_OUT_Pos)
-#define AC_COMPCTRL_OUT_ASYNC (AC_COMPCTRL_OUT_ASYNC_Val << AC_COMPCTRL_OUT_Pos)
-#define AC_COMPCTRL_OUT_SYNC (AC_COMPCTRL_OUT_SYNC_Val << AC_COMPCTRL_OUT_Pos)
-#define AC_COMPCTRL_HYST_Pos 19 /**< \brief (AC_COMPCTRL) Hysteresis Enable */
-#define AC_COMPCTRL_HYST (0x1ul << AC_COMPCTRL_HYST_Pos)
-#define AC_COMPCTRL_FLEN_Pos 24 /**< \brief (AC_COMPCTRL) Filter Length */
-#define AC_COMPCTRL_FLEN_Msk (0x7ul << AC_COMPCTRL_FLEN_Pos)
-#define AC_COMPCTRL_FLEN(value) ((AC_COMPCTRL_FLEN_Msk & ((value) << AC_COMPCTRL_FLEN_Pos)))
-#define AC_COMPCTRL_FLEN_OFF_Val 0x0ul /**< \brief (AC_COMPCTRL) No filtering */
-#define AC_COMPCTRL_FLEN_MAJ3_Val 0x1ul /**< \brief (AC_COMPCTRL) 3-bit majority function (2 of 3) */
-#define AC_COMPCTRL_FLEN_MAJ5_Val 0x2ul /**< \brief (AC_COMPCTRL) 5-bit majority function (3 of 5) */
-#define AC_COMPCTRL_FLEN_OFF (AC_COMPCTRL_FLEN_OFF_Val << AC_COMPCTRL_FLEN_Pos)
-#define AC_COMPCTRL_FLEN_MAJ3 (AC_COMPCTRL_FLEN_MAJ3_Val << AC_COMPCTRL_FLEN_Pos)
-#define AC_COMPCTRL_FLEN_MAJ5 (AC_COMPCTRL_FLEN_MAJ5_Val << AC_COMPCTRL_FLEN_Pos)
-#define AC_COMPCTRL_MASK 0x070BB76Ful /**< \brief (AC_COMPCTRL) MASK Register */
-
-/* -------- AC_SCALER : (AC Offset: 0x20) (R/W 8) Scaler n -------- */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef union {
- struct {
- uint8_t VALUE:6; /*!< bit: 0.. 5 Scaler Value */
- uint8_t :2; /*!< bit: 6.. 7 Reserved */
- } bit; /*!< Structure used for bit access */
- uint8_t reg; /*!< Type used for register access */
-} AC_SCALER_Type;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-#define AC_SCALER_OFFSET 0x20 /**< \brief (AC_SCALER offset) Scaler n */
-#define AC_SCALER_RESETVALUE 0x00ul /**< \brief (AC_SCALER reset_value) Scaler n */
-
-#define AC_SCALER_VALUE_Pos 0 /**< \brief (AC_SCALER) Scaler Value */
-#define AC_SCALER_VALUE_Msk (0x3Ful << AC_SCALER_VALUE_Pos)
-#define AC_SCALER_VALUE(value) ((AC_SCALER_VALUE_Msk & ((value) << AC_SCALER_VALUE_Pos)))
-#define AC_SCALER_MASK 0x3Ful /**< \brief (AC_SCALER) MASK Register */
-
-/** \brief AC hardware registers */
-#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
-typedef struct {
- __IO AC_CTRLA_Type CTRLA; /**< \brief Offset: 0x00 (R/W 8) Control A */
- __O AC_CTRLB_Type CTRLB; /**< \brief Offset: 0x01 ( /W 8) Control B */
- __IO AC_EVCTRL_Type EVCTRL; /**< \brief Offset: 0x02 (R/W 16) Event Control */
- __IO AC_INTENCLR_Type INTENCLR; /**< \brief Offset: 0x04 (R/W 8) Interrupt Enable Clear */
- __IO AC_INTENSET_Type INTENSET; /**< \brief Offset: 0x05 (R/W 8) Interrupt Enable Set */
- __IO AC_INTFLAG_Type INTFLAG; /**< \brief Offset: 0x06 (R/W 8) Interrupt Flag Status and Clear */
- RoReg8 Reserved1[0x1];
- __I AC_STATUSA_Type STATUSA; /**< \brief Offset: 0x08 (R/ 8) Status A */
- __I AC_STATUSB_Type STATUSB; /**< \brief Offset: 0x09 (R/ 8) Status B */
- __I AC_STATUSC_Type STATUSC; /**< \brief Offset: 0x0A (R/ 8) Status C */
- RoReg8 Reserved2[0x1];
- __IO AC_WINCTRL_Type WINCTRL; /**< \brief Offset: 0x0C (R/W 8) Window Control */
- RoReg8 Reserved3[0x3];
- __IO AC_COMPCTRL_Type COMPCTRL[2]; /**< \brief Offset: 0x10 (R/W 32) Comparator Control n */
- RoReg8 Reserved4[0x8];
- __IO AC_SCALER_Type SCALER[2]; /**< \brief Offset: 0x20 (R/W 8) Scaler n */
-} Ac;
-#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
-
-/*@}*/
-
-#endif /* _SAMD21_AC_COMPONENT_ */