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

OSCHINA-MIRROR/lupyuen-LoRaMac-node-nuttx

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
hri_mtb_l21.h 14 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Miguel Luis Отправлено 7 лет назад 8f4693d
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
/**
* \file
*
* \brief SAM MTB
*
* 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_MTB_COMPONENT_
#ifndef _HRI_MTB_L21_H_INCLUDED_
#define _HRI_MTB_L21_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <hal_atomic.h>
#if defined(ENABLE_MTB_CRITICAL_SECTIONS)
#define MTB_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
#define MTB_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
#else
#define MTB_CRITICAL_SECTION_ENTER()
#define MTB_CRITICAL_SECTION_LEAVE()
#endif
typedef uint32_t hri_mtb_authstatus_reg_t;
typedef uint32_t hri_mtb_base_reg_t;
typedef uint32_t hri_mtb_cid0_reg_t;
typedef uint32_t hri_mtb_cid1_reg_t;
typedef uint32_t hri_mtb_cid2_reg_t;
typedef uint32_t hri_mtb_cid3_reg_t;
typedef uint32_t hri_mtb_claimset_reg_t;
typedef uint32_t hri_mtb_devarch_reg_t;
typedef uint32_t hri_mtb_devid_reg_t;
typedef uint32_t hri_mtb_devtype_reg_t;
typedef uint32_t hri_mtb_flow_reg_t;
typedef uint32_t hri_mtb_itctrl_reg_t;
typedef uint32_t hri_mtb_lockaccess_reg_t;
typedef uint32_t hri_mtb_lockstatus_reg_t;
typedef uint32_t hri_mtb_master_reg_t;
typedef uint32_t hri_mtb_pid0_reg_t;
typedef uint32_t hri_mtb_pid1_reg_t;
typedef uint32_t hri_mtb_pid2_reg_t;
typedef uint32_t hri_mtb_pid3_reg_t;
typedef uint32_t hri_mtb_pid4_reg_t;
typedef uint32_t hri_mtb_pid5_reg_t;
typedef uint32_t hri_mtb_pid6_reg_t;
typedef uint32_t hri_mtb_pid7_reg_t;
typedef uint32_t hri_mtb_position_reg_t;
static inline void hri_mtb_set_CLAIM_reg(const void *const hw, hri_mtb_claimset_reg_t mask)
{
((Mtb *)hw)->CLAIMSET.reg = mask;
}
static inline hri_mtb_claimset_reg_t hri_mtb_get_CLAIM_reg(const void *const hw, hri_mtb_claimset_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->CLAIMSET.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_claimset_reg_t hri_mtb_read_CLAIM_reg(const void *const hw)
{
return ((Mtb *)hw)->CLAIMSET.reg;
}
static inline void hri_mtb_write_CLAIM_reg(const void *const hw, hri_mtb_claimset_reg_t data)
{
((Mtb *)hw)->CLAIMSET.reg = data;
((Mtb *)hw)->CLAIMCLR.reg = ~data;
}
static inline void hri_mtb_clear_CLAIM_reg(const void *const hw, hri_mtb_claimset_reg_t mask)
{
((Mtb *)hw)->CLAIMCLR.reg = mask;
}
static inline void hri_mtb_set_POSITION_reg(const void *const hw, hri_mtb_position_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->POSITION.reg |= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_position_reg_t hri_mtb_get_POSITION_reg(const void *const hw, hri_mtb_position_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->POSITION.reg;
tmp &= mask;
return tmp;
}
static inline void hri_mtb_write_POSITION_reg(const void *const hw, hri_mtb_position_reg_t data)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->POSITION.reg = data;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_clear_POSITION_reg(const void *const hw, hri_mtb_position_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->POSITION.reg &= ~mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_toggle_POSITION_reg(const void *const hw, hri_mtb_position_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->POSITION.reg ^= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_position_reg_t hri_mtb_read_POSITION_reg(const void *const hw)
{
return ((Mtb *)hw)->POSITION.reg;
}
static inline void hri_mtb_set_MASTER_reg(const void *const hw, hri_mtb_master_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->MASTER.reg |= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_master_reg_t hri_mtb_get_MASTER_reg(const void *const hw, hri_mtb_master_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->MASTER.reg;
tmp &= mask;
return tmp;
}
static inline void hri_mtb_write_MASTER_reg(const void *const hw, hri_mtb_master_reg_t data)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->MASTER.reg = data;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_clear_MASTER_reg(const void *const hw, hri_mtb_master_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->MASTER.reg &= ~mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_toggle_MASTER_reg(const void *const hw, hri_mtb_master_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->MASTER.reg ^= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_master_reg_t hri_mtb_read_MASTER_reg(const void *const hw)
{
return ((Mtb *)hw)->MASTER.reg;
}
static inline void hri_mtb_set_FLOW_reg(const void *const hw, hri_mtb_flow_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->FLOW.reg |= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_flow_reg_t hri_mtb_get_FLOW_reg(const void *const hw, hri_mtb_flow_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->FLOW.reg;
tmp &= mask;
return tmp;
}
static inline void hri_mtb_write_FLOW_reg(const void *const hw, hri_mtb_flow_reg_t data)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->FLOW.reg = data;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_clear_FLOW_reg(const void *const hw, hri_mtb_flow_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->FLOW.reg &= ~mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_toggle_FLOW_reg(const void *const hw, hri_mtb_flow_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->FLOW.reg ^= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_flow_reg_t hri_mtb_read_FLOW_reg(const void *const hw)
{
return ((Mtb *)hw)->FLOW.reg;
}
static inline void hri_mtb_set_ITCTRL_reg(const void *const hw, hri_mtb_itctrl_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->ITCTRL.reg |= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_itctrl_reg_t hri_mtb_get_ITCTRL_reg(const void *const hw, hri_mtb_itctrl_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->ITCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_mtb_write_ITCTRL_reg(const void *const hw, hri_mtb_itctrl_reg_t data)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->ITCTRL.reg = data;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_clear_ITCTRL_reg(const void *const hw, hri_mtb_itctrl_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->ITCTRL.reg &= ~mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_toggle_ITCTRL_reg(const void *const hw, hri_mtb_itctrl_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->ITCTRL.reg ^= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_itctrl_reg_t hri_mtb_read_ITCTRL_reg(const void *const hw)
{
return ((Mtb *)hw)->ITCTRL.reg;
}
static inline void hri_mtb_set_LOCKACCESS_reg(const void *const hw, hri_mtb_lockaccess_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->LOCKACCESS.reg |= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_lockaccess_reg_t hri_mtb_get_LOCKACCESS_reg(const void *const hw, hri_mtb_lockaccess_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->LOCKACCESS.reg;
tmp &= mask;
return tmp;
}
static inline void hri_mtb_write_LOCKACCESS_reg(const void *const hw, hri_mtb_lockaccess_reg_t data)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->LOCKACCESS.reg = data;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_clear_LOCKACCESS_reg(const void *const hw, hri_mtb_lockaccess_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->LOCKACCESS.reg &= ~mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline void hri_mtb_toggle_LOCKACCESS_reg(const void *const hw, hri_mtb_lockaccess_reg_t mask)
{
MTB_CRITICAL_SECTION_ENTER();
((Mtb *)hw)->LOCKACCESS.reg ^= mask;
MTB_CRITICAL_SECTION_LEAVE();
}
static inline hri_mtb_lockaccess_reg_t hri_mtb_read_LOCKACCESS_reg(const void *const hw)
{
return ((Mtb *)hw)->LOCKACCESS.reg;
}
static inline hri_mtb_base_reg_t hri_mtb_get_BASE_reg(const void *const hw, hri_mtb_base_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->BASE.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_base_reg_t hri_mtb_read_BASE_reg(const void *const hw)
{
return ((Mtb *)hw)->BASE.reg;
}
static inline hri_mtb_lockstatus_reg_t hri_mtb_get_LOCKSTATUS_reg(const void *const hw, hri_mtb_lockstatus_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->LOCKSTATUS.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_lockstatus_reg_t hri_mtb_read_LOCKSTATUS_reg(const void *const hw)
{
return ((Mtb *)hw)->LOCKSTATUS.reg;
}
static inline hri_mtb_authstatus_reg_t hri_mtb_get_AUTHSTATUS_reg(const void *const hw, hri_mtb_authstatus_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->AUTHSTATUS.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_authstatus_reg_t hri_mtb_read_AUTHSTATUS_reg(const void *const hw)
{
return ((Mtb *)hw)->AUTHSTATUS.reg;
}
static inline hri_mtb_devarch_reg_t hri_mtb_get_DEVARCH_reg(const void *const hw, hri_mtb_devarch_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->DEVARCH.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_devarch_reg_t hri_mtb_read_DEVARCH_reg(const void *const hw)
{
return ((Mtb *)hw)->DEVARCH.reg;
}
static inline hri_mtb_devid_reg_t hri_mtb_get_DEVID_reg(const void *const hw, hri_mtb_devid_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->DEVID.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_devid_reg_t hri_mtb_read_DEVID_reg(const void *const hw)
{
return ((Mtb *)hw)->DEVID.reg;
}
static inline hri_mtb_devtype_reg_t hri_mtb_get_DEVTYPE_reg(const void *const hw, hri_mtb_devtype_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->DEVTYPE.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_devtype_reg_t hri_mtb_read_DEVTYPE_reg(const void *const hw)
{
return ((Mtb *)hw)->DEVTYPE.reg;
}
static inline hri_mtb_pid4_reg_t hri_mtb_get_PID4_reg(const void *const hw, hri_mtb_pid4_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID4.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid4_reg_t hri_mtb_read_PID4_reg(const void *const hw)
{
return ((Mtb *)hw)->PID4.reg;
}
static inline hri_mtb_pid5_reg_t hri_mtb_get_PID5_reg(const void *const hw, hri_mtb_pid5_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID5.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid5_reg_t hri_mtb_read_PID5_reg(const void *const hw)
{
return ((Mtb *)hw)->PID5.reg;
}
static inline hri_mtb_pid6_reg_t hri_mtb_get_PID6_reg(const void *const hw, hri_mtb_pid6_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID6.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid6_reg_t hri_mtb_read_PID6_reg(const void *const hw)
{
return ((Mtb *)hw)->PID6.reg;
}
static inline hri_mtb_pid7_reg_t hri_mtb_get_PID7_reg(const void *const hw, hri_mtb_pid7_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID7.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid7_reg_t hri_mtb_read_PID7_reg(const void *const hw)
{
return ((Mtb *)hw)->PID7.reg;
}
static inline hri_mtb_pid0_reg_t hri_mtb_get_PID0_reg(const void *const hw, hri_mtb_pid0_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID0.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid0_reg_t hri_mtb_read_PID0_reg(const void *const hw)
{
return ((Mtb *)hw)->PID0.reg;
}
static inline hri_mtb_pid1_reg_t hri_mtb_get_PID1_reg(const void *const hw, hri_mtb_pid1_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID1.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid1_reg_t hri_mtb_read_PID1_reg(const void *const hw)
{
return ((Mtb *)hw)->PID1.reg;
}
static inline hri_mtb_pid2_reg_t hri_mtb_get_PID2_reg(const void *const hw, hri_mtb_pid2_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID2.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid2_reg_t hri_mtb_read_PID2_reg(const void *const hw)
{
return ((Mtb *)hw)->PID2.reg;
}
static inline hri_mtb_pid3_reg_t hri_mtb_get_PID3_reg(const void *const hw, hri_mtb_pid3_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->PID3.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_pid3_reg_t hri_mtb_read_PID3_reg(const void *const hw)
{
return ((Mtb *)hw)->PID3.reg;
}
static inline hri_mtb_cid0_reg_t hri_mtb_get_CID0_reg(const void *const hw, hri_mtb_cid0_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->CID0.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_cid0_reg_t hri_mtb_read_CID0_reg(const void *const hw)
{
return ((Mtb *)hw)->CID0.reg;
}
static inline hri_mtb_cid1_reg_t hri_mtb_get_CID1_reg(const void *const hw, hri_mtb_cid1_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->CID1.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_cid1_reg_t hri_mtb_read_CID1_reg(const void *const hw)
{
return ((Mtb *)hw)->CID1.reg;
}
static inline hri_mtb_cid2_reg_t hri_mtb_get_CID2_reg(const void *const hw, hri_mtb_cid2_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->CID2.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_cid2_reg_t hri_mtb_read_CID2_reg(const void *const hw)
{
return ((Mtb *)hw)->CID2.reg;
}
static inline hri_mtb_cid3_reg_t hri_mtb_get_CID3_reg(const void *const hw, hri_mtb_cid3_reg_t mask)
{
uint32_t tmp;
tmp = ((Mtb *)hw)->CID3.reg;
tmp &= mask;
return tmp;
}
static inline hri_mtb_cid3_reg_t hri_mtb_read_CID3_reg(const void *const hw)
{
return ((Mtb *)hw)->CID3.reg;
}
#ifdef __cplusplus
}
#endif
#endif /* _HRI_MTB_L21_H_INCLUDED */
#endif /* _SAML21_MTB_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