1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/lupyuen-LoRaMac-node-nuttx

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
hri_wdt_l21.h 18 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Miguel Luis Отправлено 7 лет назад 8f4693d
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
/**
* \file
*
* \brief SAM WDT
*
* Copyright (C) 2016 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
*/
#ifdef _SAML21_WDT_COMPONENT_
#ifndef _HRI_WDT_L21_H_INCLUDED_
#define _HRI_WDT_L21_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <hal_atomic.h>
#if defined(ENABLE_WDT_CRITICAL_SECTIONS)
#define WDT_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
#define WDT_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
#else
#define WDT_CRITICAL_SECTION_ENTER()
#define WDT_CRITICAL_SECTION_LEAVE()
#endif
typedef uint32_t hri_wdt_syncbusy_reg_t;
typedef uint8_t hri_wdt_clear_reg_t;
typedef uint8_t hri_wdt_config_reg_t;
typedef uint8_t hri_wdt_ctrla_reg_t;
typedef uint8_t hri_wdt_ewctrl_reg_t;
typedef uint8_t hri_wdt_intenset_reg_t;
typedef uint8_t hri_wdt_intflag_reg_t;
static inline void hri_wdt_wait_for_sync(const void *const hw, hri_wdt_syncbusy_reg_t reg)
{
while (((Wdt *)hw)->SYNCBUSY.reg & reg) {
};
}
static inline bool hri_wdt_is_syncing(const void *const hw, hri_wdt_syncbusy_reg_t reg)
{
return ((Wdt *)hw)->SYNCBUSY.reg & reg;
}
static inline void hri_wdt_set_INTEN_EW_bit(const void *const hw)
{
((Wdt *)hw)->INTENSET.reg = WDT_INTENSET_EW;
}
static inline bool hri_wdt_get_INTEN_EW_bit(const void *const hw)
{
return (((Wdt *)hw)->INTENSET.reg & WDT_INTENSET_EW) >> WDT_INTENSET_EW_Pos;
}
static inline void hri_wdt_write_INTEN_EW_bit(const void *const hw, bool value)
{
if (value == 0x0) {
((Wdt *)hw)->INTENCLR.reg = WDT_INTENSET_EW;
} else {
((Wdt *)hw)->INTENSET.reg = WDT_INTENSET_EW;
}
}
static inline void hri_wdt_clear_INTEN_EW_bit(const void *const hw)
{
((Wdt *)hw)->INTENCLR.reg = WDT_INTENSET_EW;
}
static inline void hri_wdt_set_INTEN_reg(const void *const hw, hri_wdt_intenset_reg_t mask)
{
((Wdt *)hw)->INTENSET.reg = mask;
}
static inline hri_wdt_intenset_reg_t hri_wdt_get_INTEN_reg(const void *const hw, hri_wdt_intenset_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->INTENSET.reg;
tmp &= mask;
return tmp;
}
static inline hri_wdt_intenset_reg_t hri_wdt_read_INTEN_reg(const void *const hw)
{
return ((Wdt *)hw)->INTENSET.reg;
}
static inline void hri_wdt_write_INTEN_reg(const void *const hw, hri_wdt_intenset_reg_t data)
{
((Wdt *)hw)->INTENSET.reg = data;
((Wdt *)hw)->INTENCLR.reg = ~data;
}
static inline void hri_wdt_clear_INTEN_reg(const void *const hw, hri_wdt_intenset_reg_t mask)
{
((Wdt *)hw)->INTENCLR.reg = mask;
}
static inline bool hri_wdt_get_INTFLAG_EW_bit(const void *const hw)
{
return (((Wdt *)hw)->INTFLAG.reg & WDT_INTFLAG_EW) >> WDT_INTFLAG_EW_Pos;
}
static inline void hri_wdt_clear_INTFLAG_EW_bit(const void *const hw)
{
((Wdt *)hw)->INTFLAG.reg = WDT_INTFLAG_EW;
}
static inline bool hri_wdt_get_interrupt_EW_bit(const void *const hw)
{
return (((Wdt *)hw)->INTFLAG.reg & WDT_INTFLAG_EW) >> WDT_INTFLAG_EW_Pos;
}
static inline void hri_wdt_clear_interrupt_EW_bit(const void *const hw)
{
((Wdt *)hw)->INTFLAG.reg = WDT_INTFLAG_EW;
}
static inline hri_wdt_intflag_reg_t hri_wdt_get_INTFLAG_reg(const void *const hw, hri_wdt_intflag_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->INTFLAG.reg;
tmp &= mask;
return tmp;
}
static inline hri_wdt_intflag_reg_t hri_wdt_read_INTFLAG_reg(const void *const hw)
{
return ((Wdt *)hw)->INTFLAG.reg;
}
static inline void hri_wdt_clear_INTFLAG_reg(const void *const hw, hri_wdt_intflag_reg_t mask)
{
((Wdt *)hw)->INTFLAG.reg = mask;
}
static inline void hri_wdt_write_CLEAR_reg(const void *const hw, hri_wdt_clear_reg_t data)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CLEAR.reg = data;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_set_CTRLA_ENABLE_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg |= WDT_CTRLA_ENABLE;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_wdt_get_CTRLA_ENABLE_bit(const void *const hw)
{
uint8_t tmp;
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp = (tmp & WDT_CTRLA_ENABLE) >> WDT_CTRLA_ENABLE_Pos;
return (bool)tmp;
}
static inline void hri_wdt_write_CTRLA_ENABLE_bit(const void *const hw, bool value)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp &= ~WDT_CTRLA_ENABLE;
tmp |= value << WDT_CTRLA_ENABLE_Pos;
((Wdt *)hw)->CTRLA.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CTRLA_ENABLE_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg &= ~WDT_CTRLA_ENABLE;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CTRLA_ENABLE_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg ^= WDT_CTRLA_ENABLE;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_set_CTRLA_WEN_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg |= WDT_CTRLA_WEN;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_wdt_get_CTRLA_WEN_bit(const void *const hw)
{
uint8_t tmp;
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp = (tmp & WDT_CTRLA_WEN) >> WDT_CTRLA_WEN_Pos;
return (bool)tmp;
}
static inline void hri_wdt_write_CTRLA_WEN_bit(const void *const hw, bool value)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp &= ~WDT_CTRLA_WEN;
tmp |= value << WDT_CTRLA_WEN_Pos;
((Wdt *)hw)->CTRLA.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CTRLA_WEN_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg &= ~WDT_CTRLA_WEN;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CTRLA_WEN_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg ^= WDT_CTRLA_WEN;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_set_CTRLA_ALWAYSON_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg |= WDT_CTRLA_ALWAYSON;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_wdt_get_CTRLA_ALWAYSON_bit(const void *const hw)
{
uint8_t tmp;
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp = (tmp & WDT_CTRLA_ALWAYSON) >> WDT_CTRLA_ALWAYSON_Pos;
return (bool)tmp;
}
static inline void hri_wdt_write_CTRLA_ALWAYSON_bit(const void *const hw, bool value)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp &= ~WDT_CTRLA_ALWAYSON;
tmp |= value << WDT_CTRLA_ALWAYSON_Pos;
((Wdt *)hw)->CTRLA.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CTRLA_ALWAYSON_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg &= ~WDT_CTRLA_ALWAYSON;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CTRLA_ALWAYSON_bit(const void *const hw)
{
WDT_CRITICAL_SECTION_ENTER();
hri_wdt_wait_for_sync(hw, WDT_SYNCBUSY_ENABLE | WDT_SYNCBUSY_WEN | WDT_SYNCBUSY_ALWAYSON);
((Wdt *)hw)->CTRLA.reg ^= WDT_CTRLA_ALWAYSON;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_set_CTRLA_reg(const void *const hw, hri_wdt_ctrla_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CTRLA.reg |= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ctrla_reg_t hri_wdt_get_CTRLA_reg(const void *const hw, hri_wdt_ctrla_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CTRLA.reg;
tmp &= mask;
return tmp;
}
static inline void hri_wdt_write_CTRLA_reg(const void *const hw, hri_wdt_ctrla_reg_t data)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CTRLA.reg = data;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CTRLA_reg(const void *const hw, hri_wdt_ctrla_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CTRLA.reg &= ~mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CTRLA_reg(const void *const hw, hri_wdt_ctrla_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CTRLA.reg ^= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ctrla_reg_t hri_wdt_read_CTRLA_reg(const void *const hw)
{
return ((Wdt *)hw)->CTRLA.reg;
}
static inline void hri_wdt_set_CONFIG_PER_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg |= WDT_CONFIG_PER(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_get_CONFIG_PER_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp = (tmp & WDT_CONFIG_PER(mask)) >> WDT_CONFIG_PER_Pos;
return tmp;
}
static inline void hri_wdt_write_CONFIG_PER_bf(const void *const hw, hri_wdt_config_reg_t data)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp &= ~WDT_CONFIG_PER_Msk;
tmp |= WDT_CONFIG_PER(data);
((Wdt *)hw)->CONFIG.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CONFIG_PER_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg &= ~WDT_CONFIG_PER(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CONFIG_PER_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg ^= WDT_CONFIG_PER(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_read_CONFIG_PER_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp = (tmp & WDT_CONFIG_PER_Msk) >> WDT_CONFIG_PER_Pos;
return tmp;
}
static inline void hri_wdt_set_CONFIG_WINDOW_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg |= WDT_CONFIG_WINDOW(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_get_CONFIG_WINDOW_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp = (tmp & WDT_CONFIG_WINDOW(mask)) >> WDT_CONFIG_WINDOW_Pos;
return tmp;
}
static inline void hri_wdt_write_CONFIG_WINDOW_bf(const void *const hw, hri_wdt_config_reg_t data)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp &= ~WDT_CONFIG_WINDOW_Msk;
tmp |= WDT_CONFIG_WINDOW(data);
((Wdt *)hw)->CONFIG.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CONFIG_WINDOW_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg &= ~WDT_CONFIG_WINDOW(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CONFIG_WINDOW_bf(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg ^= WDT_CONFIG_WINDOW(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_read_CONFIG_WINDOW_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp = (tmp & WDT_CONFIG_WINDOW_Msk) >> WDT_CONFIG_WINDOW_Pos;
return tmp;
}
static inline void hri_wdt_set_CONFIG_reg(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg |= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_get_CONFIG_reg(const void *const hw, hri_wdt_config_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->CONFIG.reg;
tmp &= mask;
return tmp;
}
static inline void hri_wdt_write_CONFIG_reg(const void *const hw, hri_wdt_config_reg_t data)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg = data;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_CONFIG_reg(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg &= ~mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_CONFIG_reg(const void *const hw, hri_wdt_config_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->CONFIG.reg ^= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_config_reg_t hri_wdt_read_CONFIG_reg(const void *const hw)
{
return ((Wdt *)hw)->CONFIG.reg;
}
static inline void hri_wdt_set_EWCTRL_EWOFFSET_bf(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg |= WDT_EWCTRL_EWOFFSET(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ewctrl_reg_t hri_wdt_get_EWCTRL_EWOFFSET_bf(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->EWCTRL.reg;
tmp = (tmp & WDT_EWCTRL_EWOFFSET(mask)) >> WDT_EWCTRL_EWOFFSET_Pos;
return tmp;
}
static inline void hri_wdt_write_EWCTRL_EWOFFSET_bf(const void *const hw, hri_wdt_ewctrl_reg_t data)
{
uint8_t tmp;
WDT_CRITICAL_SECTION_ENTER();
tmp = ((Wdt *)hw)->EWCTRL.reg;
tmp &= ~WDT_EWCTRL_EWOFFSET_Msk;
tmp |= WDT_EWCTRL_EWOFFSET(data);
((Wdt *)hw)->EWCTRL.reg = tmp;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_EWCTRL_EWOFFSET_bf(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg &= ~WDT_EWCTRL_EWOFFSET(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_EWCTRL_EWOFFSET_bf(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg ^= WDT_EWCTRL_EWOFFSET(mask);
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ewctrl_reg_t hri_wdt_read_EWCTRL_EWOFFSET_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->EWCTRL.reg;
tmp = (tmp & WDT_EWCTRL_EWOFFSET_Msk) >> WDT_EWCTRL_EWOFFSET_Pos;
return tmp;
}
static inline void hri_wdt_set_EWCTRL_reg(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg |= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ewctrl_reg_t hri_wdt_get_EWCTRL_reg(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Wdt *)hw)->EWCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_wdt_write_EWCTRL_reg(const void *const hw, hri_wdt_ewctrl_reg_t data)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg = data;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_clear_EWCTRL_reg(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg &= ~mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline void hri_wdt_toggle_EWCTRL_reg(const void *const hw, hri_wdt_ewctrl_reg_t mask)
{
WDT_CRITICAL_SECTION_ENTER();
((Wdt *)hw)->EWCTRL.reg ^= mask;
WDT_CRITICAL_SECTION_LEAVE();
}
static inline hri_wdt_ewctrl_reg_t hri_wdt_read_EWCTRL_reg(const void *const hw)
{
return ((Wdt *)hw)->EWCTRL.reg;
}
static inline bool hri_wdt_get_SYNCBUSY_ENABLE_bit(const void *const hw)
{
return (((Wdt *)hw)->SYNCBUSY.reg & WDT_SYNCBUSY_ENABLE) >> WDT_SYNCBUSY_ENABLE_Pos;
}
static inline bool hri_wdt_get_SYNCBUSY_WEN_bit(const void *const hw)
{
return (((Wdt *)hw)->SYNCBUSY.reg & WDT_SYNCBUSY_WEN) >> WDT_SYNCBUSY_WEN_Pos;
}
static inline bool hri_wdt_get_SYNCBUSY_ALWAYSON_bit(const void *const hw)
{
return (((Wdt *)hw)->SYNCBUSY.reg & WDT_SYNCBUSY_ALWAYSON) >> WDT_SYNCBUSY_ALWAYSON_Pos;
}
static inline bool hri_wdt_get_SYNCBUSY_CLEAR_bit(const void *const hw)
{
return (((Wdt *)hw)->SYNCBUSY.reg & WDT_SYNCBUSY_CLEAR) >> WDT_SYNCBUSY_CLEAR_Pos;
}
static inline hri_wdt_syncbusy_reg_t hri_wdt_get_SYNCBUSY_reg(const void *const hw, hri_wdt_syncbusy_reg_t mask)
{
uint32_t tmp;
tmp = ((Wdt *)hw)->SYNCBUSY.reg;
tmp &= mask;
return tmp;
}
static inline hri_wdt_syncbusy_reg_t hri_wdt_read_SYNCBUSY_reg(const void *const hw)
{
return ((Wdt *)hw)->SYNCBUSY.reg;
}
#ifdef __cplusplus
}
#endif
#endif /* _HRI_WDT_L21_H_INCLUDED */
#endif /* _SAML21_WDT_COMPONENT_ */

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/lupyuen-LoRaMac-node-nuttx.git
git@gitlife.ru:oschina-mirror/lupyuen-LoRaMac-node-nuttx.git
oschina-mirror
lupyuen-LoRaMac-node-nuttx
lupyuen-LoRaMac-node-nuttx
v4.5.0