Files
mongoose/tutorials/nxp/frdm-rw612-xpresso-freertos-lwip/device/periph/PERI_MRT.h
T

312 lines
12 KiB
C

/*
** ###################################################################
** Processors: RW610ETA2I
** RW610HNA2I
** RW610UKA2I
** RW612ETA2I
** RW612HNA2I
** RW612UKA2I
**
** Version: rev. 1.0, 2021-03-16
** Build: b240715
**
** Abstract:
** CMSIS Peripheral Access Layer for MRT
**
** Copyright 1997-2016 Freescale Semiconductor, Inc.
** Copyright 2016-2024 NXP
** SPDX-License-Identifier: BSD-3-Clause
**
** http: www.nxp.com
** mail: support@nxp.com
**
** Revisions:
** - rev. 1.0 (2021-03-16)
** Initial version.
**
** ###################################################################
*/
/*!
* @file MRT.h
* @version 1.0
* @date 2021-03-16
* @brief CMSIS Peripheral Access Layer for MRT
*
* CMSIS Peripheral Access Layer for MRT
*/
#if !defined(MRT_H_)
#define MRT_H_ /**< Symbol preventing repeated inclusion */
#if (defined(CPU_RW610ETA2I) || defined(CPU_RW610HNA2I) || defined(CPU_RW610UKA2I))
#include "RW610_COMMON.h"
#elif (defined(CPU_RW612ETA2I) || defined(CPU_RW612HNA2I) || defined(CPU_RW612UKA2I))
#include "RW612_COMMON.h"
#else
#error "No valid CPU defined!"
#endif
/* ----------------------------------------------------------------------------
-- Device Peripheral Access Layer
---------------------------------------------------------------------------- */
/*!
* @addtogroup Peripheral_access_layer Device Peripheral Access Layer
* @{
*/
/*
** Start of section using anonymous unions
*/
#if defined(__ARMCC_VERSION)
#if (__ARMCC_VERSION >= 6010050)
#pragma clang diagnostic push
#else
#pragma push
#pragma anon_unions
#endif
#elif defined(__GNUC__)
/* anonymous unions are enabled by default */
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma language=extended
#else
#error Not supported compiler type
#endif
/* ----------------------------------------------------------------------------
-- MRT Peripheral Access Layer
---------------------------------------------------------------------------- */
/*!
* @addtogroup MRT_Peripheral_Access_Layer MRT Peripheral Access Layer
* @{
*/
/** MRT - Size of Registers Arrays */
#define MRT_CHANNEL_COUNT 8u
/** MRT - Register Layout Typedef */
typedef struct {
struct { /* offset: 0x0, array step: 0x10 */
__IO uint32_t INTVAL; /**< Time Interval Value, array offset: 0x0, array step: 0x10, irregular array, not all indices are valid */
__I uint32_t TIMER; /**< Timer, array offset: 0x4, array step: 0x10, irregular array, not all indices are valid */
__IO uint32_t CTRL; /**< Control, array offset: 0x8, array step: 0x10, irregular array, not all indices are valid */
__IO uint32_t STAT; /**< Status, array offset: 0xC, array step: 0x10, irregular array, not all indices are valid */
} CHANNEL[MRT_CHANNEL_COUNT];
uint8_t RESERVED_0[112];
__IO uint32_t MODCFG; /**< Module Configuration, offset: 0xF0 */
__I uint32_t IDLE_CH; /**< Idle Channel, offset: 0xF4 */
__IO uint32_t IRQ_FLAG; /**< Global Interrupt Flag, offset: 0xF8 */
__I uint32_t ID_CODE; /**< Multi-Rate Timer ID code, offset: 0xFC */
} MRT_Type;
/* ----------------------------------------------------------------------------
-- MRT Register Masks
---------------------------------------------------------------------------- */
/*!
* @addtogroup MRT_Register_Masks MRT Register Masks
* @{
*/
/*! @name CHANNEL_INTVAL - Time Interval Value */
/*! @{ */
#define MRT_CHANNEL_INTVAL_IVALUE_MASK (0xFFFFFFU)
#define MRT_CHANNEL_INTVAL_IVALUE_SHIFT (0U)
/*! IVALUE - Time interval load value. */
#define MRT_CHANNEL_INTVAL_IVALUE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_INTVAL_IVALUE_SHIFT)) & MRT_CHANNEL_INTVAL_IVALUE_MASK)
#define MRT_CHANNEL_INTVAL_LOAD_MASK (0x80000000U)
#define MRT_CHANNEL_INTVAL_LOAD_SHIFT (31U)
/*! LOAD - Determines how the timer interval value (IVALUE -1) is loaded into the TIMER n register.
* 0b0..No force load.
* 0b1..Force load. T
*/
#define MRT_CHANNEL_INTVAL_LOAD(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_INTVAL_LOAD_SHIFT)) & MRT_CHANNEL_INTVAL_LOAD_MASK)
/*! @} */
/* The count of MRT_CHANNEL_INTVAL */
#define MRT_CHANNEL_INTVAL_COUNT (8U)
/*! @name CHANNEL_TIMER - Timer */
/*! @{ */
#define MRT_CHANNEL_TIMER_VALUE_MASK (0xFFFFFFU)
#define MRT_CHANNEL_TIMER_VALUE_SHIFT (0U)
/*! VALUE - Holds the current timer value of the down-counter. */
#define MRT_CHANNEL_TIMER_VALUE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_TIMER_VALUE_SHIFT)) & MRT_CHANNEL_TIMER_VALUE_MASK)
/*! @} */
/* The count of MRT_CHANNEL_TIMER */
#define MRT_CHANNEL_TIMER_COUNT (8U)
/*! @name CHANNEL_CTRL - Control */
/*! @{ */
#define MRT_CHANNEL_CTRL_INTEN_MASK (0x1U)
#define MRT_CHANNEL_CTRL_INTEN_SHIFT (0U)
/*! INTEN - Enable the TIMER n interrupt.
* 0b0..Disabled. TIMER n interrupt is disabled.
* 0b1..Enabled. TIMER n interrupt is enabled.
*/
#define MRT_CHANNEL_CTRL_INTEN(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_CTRL_INTEN_SHIFT)) & MRT_CHANNEL_CTRL_INTEN_MASK)
#define MRT_CHANNEL_CTRL_MODE_MASK (0x6U)
#define MRT_CHANNEL_CTRL_MODE_SHIFT (1U)
/*! MODE - Selects the timer mode
* 0b00..Repeat interrupt mode
* 0b01..One-shot interrupt mode
* 0b10..One-shot stall mode
* 0b11..Reserved
*/
#define MRT_CHANNEL_CTRL_MODE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_CTRL_MODE_SHIFT)) & MRT_CHANNEL_CTRL_MODE_MASK)
/*! @} */
/* The count of MRT_CHANNEL_CTRL */
#define MRT_CHANNEL_CTRL_COUNT (8U)
/*! @name CHANNEL_STAT - Status */
/*! @{ */
#define MRT_CHANNEL_STAT_INTFLAG_MASK (0x1U)
#define MRT_CHANNEL_STAT_INTFLAG_SHIFT (0U)
/*! INTFLAG - Monitors the interrupt flag
* 0b0..No pending interrupt. Writing a zero is equivalent to no operation.
* 0b1..Pending interrupt.
*/
#define MRT_CHANNEL_STAT_INTFLAG(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_INTFLAG_SHIFT)) & MRT_CHANNEL_STAT_INTFLAG_MASK)
#define MRT_CHANNEL_STAT_RUN_MASK (0x2U)
#define MRT_CHANNEL_STAT_RUN_SHIFT (1U)
/*! RUN - Indicates the state of TIMER n . RUN bit is read-only.
* 0b0..Idle state. TIMER n has stopped.
* 0b1..Running. TIMER n is running.
*/
#define MRT_CHANNEL_STAT_RUN(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_RUN_SHIFT)) & MRT_CHANNEL_STAT_RUN_MASK)
#define MRT_CHANNEL_STAT_INUSE_MASK (0x4U)
#define MRT_CHANNEL_STAT_INUSE_SHIFT (2U)
/*! INUSE - Channel-In-Use flag. Operating details depend on the operating mode bit
* (MODCFG.MULTITASK), and affects the use of the Idle Channel register (IDLE_CH).
* 0b0..This timer channel is not in use.
* 0b1..This timer channel is in use.
*/
#define MRT_CHANNEL_STAT_INUSE(x) (((uint32_t)(((uint32_t)(x)) << MRT_CHANNEL_STAT_INUSE_SHIFT)) & MRT_CHANNEL_STAT_INUSE_MASK)
/*! @} */
/* The count of MRT_CHANNEL_STAT */
#define MRT_CHANNEL_STAT_COUNT (8U)
/*! @name MODCFG - Module Configuration */
/*! @{ */
#define MRT_MODCFG_NOC_MASK (0xFU)
#define MRT_MODCFG_NOC_SHIFT (0U)
/*! NOC - Number Of Channels: identifies the number of channels in this MRT. (Minus 1 encoded) */
#define MRT_MODCFG_NOC(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_NOC_SHIFT)) & MRT_MODCFG_NOC_MASK)
#define MRT_MODCFG_NOB_MASK (0x1F0U)
#define MRT_MODCFG_NOB_SHIFT (4U)
/*! NOB - Number Of Bits: identifies the number of timer bits in this MRT. (24 bits on this device) */
#define MRT_MODCFG_NOB(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_NOB_SHIFT)) & MRT_MODCFG_NOB_MASK)
#define MRT_MODCFG_MULTITASK_MASK (0x80000000U)
#define MRT_MODCFG_MULTITASK_SHIFT (31U)
/*! MULTITASK - Selects the operating mode for the INUSE flags and the IDLE_CH register.
* 0b0..Hardware status mode. In this mode, the INUSE(n) flags for all channels are reset.
* 0b1..Multi-task mode
*/
#define MRT_MODCFG_MULTITASK(x) (((uint32_t)(((uint32_t)(x)) << MRT_MODCFG_MULTITASK_SHIFT)) & MRT_MODCFG_MULTITASK_MASK)
/*! @} */
/*! @name IDLE_CH - Idle Channel */
/*! @{ */
#define MRT_IDLE_CH_CHAN_MASK (0xF0U)
#define MRT_IDLE_CH_CHAN_SHIFT (4U)
/*! CHAN - Idle channel. Reading the CHAN bits, returns the lowest idle timer channel. The number is
* positioned so that it can be used as an offset from the MRT base address, to access the
* registers for the allocated channel. If all timer channels are running, then CHAN = 0xF.
*/
#define MRT_IDLE_CH_CHAN(x) (((uint32_t)(((uint32_t)(x)) << MRT_IDLE_CH_CHAN_SHIFT)) & MRT_IDLE_CH_CHAN_MASK)
/*! @} */
/*! @name IRQ_FLAG - Global Interrupt Flag */
/*! @{ */
#define MRT_IRQ_FLAG_GFLAG0_MASK (0x1U)
#define MRT_IRQ_FLAG_GFLAG0_SHIFT (0U)
/*! GFLAG0 - Monitors the interrupt flag of TIMER0.
* 0b0..No pending interrupt. Writing a zero is equivalent to no operation.
* 0b1..Pending interrupt. The interrupt is pending because TIMER0 has reached the end of the time interval. If
* the INTEN bit in the CONTROL0 register is also set to 1, then the interrupt for timer channel 0 and the
* global interrupt are generated. Writing a 1 to GFLAG0 bit clears the interrupt request.
*/
#define MRT_IRQ_FLAG_GFLAG0(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG0_SHIFT)) & MRT_IRQ_FLAG_GFLAG0_MASK)
#define MRT_IRQ_FLAG_GFLAG1_MASK (0x2U)
#define MRT_IRQ_FLAG_GFLAG1_SHIFT (1U)
/*! GFLAG1 - Monitors the interrupt flag of TIMER1, and acts similarly to channel 0. */
#define MRT_IRQ_FLAG_GFLAG1(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG1_SHIFT)) & MRT_IRQ_FLAG_GFLAG1_MASK)
#define MRT_IRQ_FLAG_GFLAG2_MASK (0x4U)
#define MRT_IRQ_FLAG_GFLAG2_SHIFT (2U)
/*! GFLAG2 - Monitors the interrupt flag of TIMER2, and acts similarly to channel 0. */
#define MRT_IRQ_FLAG_GFLAG2(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG2_SHIFT)) & MRT_IRQ_FLAG_GFLAG2_MASK)
#define MRT_IRQ_FLAG_GFLAG3_MASK (0x8U)
#define MRT_IRQ_FLAG_GFLAG3_SHIFT (3U)
/*! GFLAG3 - Monitors the interrupt flag of TIMER3, and acts similarly to channel 0. */
#define MRT_IRQ_FLAG_GFLAG3(x) (((uint32_t)(((uint32_t)(x)) << MRT_IRQ_FLAG_GFLAG3_SHIFT)) & MRT_IRQ_FLAG_GFLAG3_MASK)
/*! @} */
/*! @name ID_CODE - Multi-Rate Timer ID code */
/*! @{ */
#define MRT_ID_CODE_ID_CODE_MASK (0xFFFFFFFFU)
#define MRT_ID_CODE_ID_CODE_SHIFT (0U)
/*! ID_CODE - Multi-Rate Timer ID code */
#define MRT_ID_CODE_ID_CODE(x) (((uint32_t)(((uint32_t)(x)) << MRT_ID_CODE_ID_CODE_SHIFT)) & MRT_ID_CODE_ID_CODE_MASK)
/*! @} */
/*!
* @}
*/ /* end of group MRT_Register_Masks */
/*!
* @}
*/ /* end of group MRT_Peripheral_Access_Layer */
/*
** End of section using anonymous unions
*/
#if defined(__ARMCC_VERSION)
#if (__ARMCC_VERSION >= 6010050)
#pragma clang diagnostic pop
#else
#pragma pop
#endif
#elif defined(__GNUC__)
/* leave anonymous unions enabled */
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma language=default
#else
#error Not supported compiler type
#endif
/*!
* @}
*/ /* end of group Peripheral_access_layer */
#endif /* MRT_H_ */