[HAL] KSDK update - step 1

pull/476/head
0xc0170 2014-07-21 15:54:51 +01:00
parent df84f2b3e9
commit 920a372916
63 changed files with 0 additions and 119950 deletions

View File

@ -1,879 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_DAC_REGISTERS_H__
#define __HW_DAC_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 DAC
*
* 12-Bit Digital-to-Analog Converter
*
* Registers defined in this header file:
* - HW_DAC_DATnL - DAC Data Low Register
* - HW_DAC_DATnH - DAC Data High Register
* - HW_DAC_SR - DAC Status Register
* - HW_DAC_C0 - DAC Control Register
* - HW_DAC_C1 - DAC Control Register 1
* - HW_DAC_C2 - DAC Control Register 2
*
* - hw_dac_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_DAC_BASE
#define HW_DAC_INSTANCE_COUNT (2U) //!< Number of instances of the DAC module.
#define HW_DAC0 (0U) //!< Instance number for DAC0.
#define HW_DAC1 (1U) //!< Instance number for DAC1.
#define REGS_DAC0_BASE (0x400CC000U) //!< Base address for DAC0.
#define REGS_DAC1_BASE (0x400CD000U) //!< Base address for DAC1.
//! @brief Table of base addresses for DAC instances.
static const uint32_t __g_regs_DAC_base_addresses[] = {
REGS_DAC0_BASE,
REGS_DAC1_BASE,
};
//! @brief Get the base address of DAC by instance number.
//! @param x DAC instance number, from 0 through 1.
#define REGS_DAC_BASE(x) (__g_regs_DAC_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of DAC.
#define REGS_DAC_INSTANCE(b) ((b) == REGS_DAC0_BASE ? HW_DAC0 : (b) == REGS_DAC1_BASE ? HW_DAC1 : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_DATnL - DAC Data Low Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_DATnL - DAC Data Low Register (RW)
*
* Reset value: 0x00U
*/
typedef union _hw_dac_datnl
{
uint8_t U;
struct _hw_dac_datnl_bitfields
{
uint8_t DATA0 : 8; //!< [7:0]
} B;
} hw_dac_datnl_t;
#endif
/*!
* @name Constants and macros for entire DAC_DATnL register
*/
//@{
#define HW_DAC_DATnL_COUNT (16U)
#define HW_DAC_DATnL_ADDR(x, n) (REGS_DAC_BASE(x) + 0x0U + (0x2U * n))
#ifndef __LANGUAGE_ASM__
#define HW_DAC_DATnL(x, n) (*(__IO hw_dac_datnl_t *) HW_DAC_DATnL_ADDR(x, n))
#define HW_DAC_DATnL_RD(x, n) (HW_DAC_DATnL(x, n).U)
#define HW_DAC_DATnL_WR(x, n, v) (HW_DAC_DATnL(x, n).U = (v))
#define HW_DAC_DATnL_SET(x, n, v) (HW_DAC_DATnL_WR(x, n, HW_DAC_DATnL_RD(x, n) | (v)))
#define HW_DAC_DATnL_CLR(x, n, v) (HW_DAC_DATnL_WR(x, n, HW_DAC_DATnL_RD(x, n) & ~(v)))
#define HW_DAC_DATnL_TOG(x, n, v) (HW_DAC_DATnL_WR(x, n, HW_DAC_DATnL_RD(x, n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_DATnL bitfields
*/
/*!
* @name Register DAC_DATnL, field DATA0[7:0] (RW)
*
* When the DAC buffer is not enabled, DATA[11:0] controls the output voltage
* based on the following formula: V out = V in * (1 + DACDAT0[11:0])/4096 When the
* DAC buffer is enabled, DATA is mapped to the 16-word buffer.
*/
//@{
#define BP_DAC_DATnL_DATA0 (0U) //!< Bit position for DAC_DATnL_DATA0.
#define BM_DAC_DATnL_DATA0 (0xFFU) //!< Bit mask for DAC_DATnL_DATA0.
#define BS_DAC_DATnL_DATA0 (8U) //!< Bit field size in bits for DAC_DATnL_DATA0.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_DATnL_DATA0 field.
#define BR_DAC_DATnL_DATA0(x, n) (HW_DAC_DATnL(x, n).U)
#endif
//! @brief Format value for bitfield DAC_DATnL_DATA0.
#define BF_DAC_DATnL_DATA0(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_DATnL_DATA0), uint8_t) & BM_DAC_DATnL_DATA0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DATA0 field to a new value.
#define BW_DAC_DATnL_DATA0(x, n, v) (HW_DAC_DATnL_WR(x, n, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_DATnH - DAC Data High Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_DATnH - DAC Data High Register (RW)
*
* Reset value: 0x00U
*/
typedef union _hw_dac_datnh
{
uint8_t U;
struct _hw_dac_datnh_bitfields
{
uint8_t DATA1 : 4; //!< [3:0]
uint8_t RESERVED0 : 4; //!< [7:4]
} B;
} hw_dac_datnh_t;
#endif
/*!
* @name Constants and macros for entire DAC_DATnH register
*/
//@{
#define HW_DAC_DATnH_COUNT (16U)
#define HW_DAC_DATnH_ADDR(x, n) (REGS_DAC_BASE(x) + 0x1U + (0x2U * n))
#ifndef __LANGUAGE_ASM__
#define HW_DAC_DATnH(x, n) (*(__IO hw_dac_datnh_t *) HW_DAC_DATnH_ADDR(x, n))
#define HW_DAC_DATnH_RD(x, n) (HW_DAC_DATnH(x, n).U)
#define HW_DAC_DATnH_WR(x, n, v) (HW_DAC_DATnH(x, n).U = (v))
#define HW_DAC_DATnH_SET(x, n, v) (HW_DAC_DATnH_WR(x, n, HW_DAC_DATnH_RD(x, n) | (v)))
#define HW_DAC_DATnH_CLR(x, n, v) (HW_DAC_DATnH_WR(x, n, HW_DAC_DATnH_RD(x, n) & ~(v)))
#define HW_DAC_DATnH_TOG(x, n, v) (HW_DAC_DATnH_WR(x, n, HW_DAC_DATnH_RD(x, n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_DATnH bitfields
*/
/*!
* @name Register DAC_DATnH, field DATA1[3:0] (RW)
*
* When the DAC Buffer is not enabled, DATA[11:0] controls the output voltage
* based on the following formula. V out = V in * (1 + DACDAT0[11:0])/4096 When the
* DAC buffer is enabled, DATA[11:0] is mapped to the 16-word buffer.
*/
//@{
#define BP_DAC_DATnH_DATA1 (0U) //!< Bit position for DAC_DATnH_DATA1.
#define BM_DAC_DATnH_DATA1 (0x0FU) //!< Bit mask for DAC_DATnH_DATA1.
#define BS_DAC_DATnH_DATA1 (4U) //!< Bit field size in bits for DAC_DATnH_DATA1.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_DATnH_DATA1 field.
#define BR_DAC_DATnH_DATA1(x, n) (HW_DAC_DATnH(x, n).B.DATA1)
#endif
//! @brief Format value for bitfield DAC_DATnH_DATA1.
#define BF_DAC_DATnH_DATA1(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_DATnH_DATA1), uint8_t) & BM_DAC_DATnH_DATA1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DATA1 field to a new value.
#define BW_DAC_DATnH_DATA1(x, n, v) (HW_DAC_DATnH_WR(x, n, (HW_DAC_DATnH_RD(x, n) & ~BM_DAC_DATnH_DATA1) | BF_DAC_DATnH_DATA1(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_SR - DAC Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_SR - DAC Status Register (RW)
*
* Reset value: 0x02U
*
* If DMA is enabled, the flags can be cleared automatically by DMA when the DMA
* request is done. Writing 0 to a field clears it whereas writing 1 has no
* effect. After reset, DACBFRPTF is set and can be cleared by software, if needed.
* The flags are set only when the data buffer status is changed. Do not use
* 32/16-bit accesses to this register.
*/
typedef union _hw_dac_sr
{
uint8_t U;
struct _hw_dac_sr_bitfields
{
uint8_t DACBFRPBF : 1; //!< [0] DAC Buffer Read Pointer Bottom
//! Position Flag
uint8_t DACBFRPTF : 1; //!< [1] DAC Buffer Read Pointer Top Position
//! Flag
uint8_t DACBFWMF : 1; //!< [2] DAC Buffer Watermark Flag
uint8_t RESERVED0 : 5; //!< [7:3]
} B;
} hw_dac_sr_t;
#endif
/*!
* @name Constants and macros for entire DAC_SR register
*/
//@{
#define HW_DAC_SR_ADDR(x) (REGS_DAC_BASE(x) + 0x20U)
#ifndef __LANGUAGE_ASM__
#define HW_DAC_SR(x) (*(__IO hw_dac_sr_t *) HW_DAC_SR_ADDR(x))
#define HW_DAC_SR_RD(x) (HW_DAC_SR(x).U)
#define HW_DAC_SR_WR(x, v) (HW_DAC_SR(x).U = (v))
#define HW_DAC_SR_SET(x, v) (HW_DAC_SR_WR(x, HW_DAC_SR_RD(x) | (v)))
#define HW_DAC_SR_CLR(x, v) (HW_DAC_SR_WR(x, HW_DAC_SR_RD(x) & ~(v)))
#define HW_DAC_SR_TOG(x, v) (HW_DAC_SR_WR(x, HW_DAC_SR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_SR bitfields
*/
/*!
* @name Register DAC_SR, field DACBFRPBF[0] (RW)
*
* Values:
* - 0 - The DAC buffer read pointer is not equal to C2[DACBFUP].
* - 1 - The DAC buffer read pointer is equal to C2[DACBFUP].
*/
//@{
#define BP_DAC_SR_DACBFRPBF (0U) //!< Bit position for DAC_SR_DACBFRPBF.
#define BM_DAC_SR_DACBFRPBF (0x01U) //!< Bit mask for DAC_SR_DACBFRPBF.
#define BS_DAC_SR_DACBFRPBF (1U) //!< Bit field size in bits for DAC_SR_DACBFRPBF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_SR_DACBFRPBF field.
#define BR_DAC_SR_DACBFRPBF(x) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFRPBF))
#endif
//! @brief Format value for bitfield DAC_SR_DACBFRPBF.
#define BF_DAC_SR_DACBFRPBF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_SR_DACBFRPBF), uint8_t) & BM_DAC_SR_DACBFRPBF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFRPBF field to a new value.
#define BW_DAC_SR_DACBFRPBF(x, v) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFRPBF) = (v))
#endif
//@}
/*!
* @name Register DAC_SR, field DACBFRPTF[1] (RW)
*
* Values:
* - 0 - The DAC buffer read pointer is not zero.
* - 1 - The DAC buffer read pointer is zero.
*/
//@{
#define BP_DAC_SR_DACBFRPTF (1U) //!< Bit position for DAC_SR_DACBFRPTF.
#define BM_DAC_SR_DACBFRPTF (0x02U) //!< Bit mask for DAC_SR_DACBFRPTF.
#define BS_DAC_SR_DACBFRPTF (1U) //!< Bit field size in bits for DAC_SR_DACBFRPTF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_SR_DACBFRPTF field.
#define BR_DAC_SR_DACBFRPTF(x) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFRPTF))
#endif
//! @brief Format value for bitfield DAC_SR_DACBFRPTF.
#define BF_DAC_SR_DACBFRPTF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_SR_DACBFRPTF), uint8_t) & BM_DAC_SR_DACBFRPTF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFRPTF field to a new value.
#define BW_DAC_SR_DACBFRPTF(x, v) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFRPTF) = (v))
#endif
//@}
/*!
* @name Register DAC_SR, field DACBFWMF[2] (RW)
*
* Values:
* - 0 - The DAC buffer read pointer has not reached the watermark level.
* - 1 - The DAC buffer read pointer has reached the watermark level.
*/
//@{
#define BP_DAC_SR_DACBFWMF (2U) //!< Bit position for DAC_SR_DACBFWMF.
#define BM_DAC_SR_DACBFWMF (0x04U) //!< Bit mask for DAC_SR_DACBFWMF.
#define BS_DAC_SR_DACBFWMF (1U) //!< Bit field size in bits for DAC_SR_DACBFWMF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_SR_DACBFWMF field.
#define BR_DAC_SR_DACBFWMF(x) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFWMF))
#endif
//! @brief Format value for bitfield DAC_SR_DACBFWMF.
#define BF_DAC_SR_DACBFWMF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_SR_DACBFWMF), uint8_t) & BM_DAC_SR_DACBFWMF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFWMF field to a new value.
#define BW_DAC_SR_DACBFWMF(x, v) (BITBAND_ACCESS8(HW_DAC_SR_ADDR(x), BP_DAC_SR_DACBFWMF) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_C0 - DAC Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_C0 - DAC Control Register (RW)
*
* Reset value: 0x00U
*
* Do not use 32- or 16-bit accesses to this register.
*/
typedef union _hw_dac_c0
{
uint8_t U;
struct _hw_dac_c0_bitfields
{
uint8_t DACBBIEN : 1; //!< [0] DAC Buffer Read Pointer Bottom Flag
//! Interrupt Enable
uint8_t DACBTIEN : 1; //!< [1] DAC Buffer Read Pointer Top Flag
//! Interrupt Enable
uint8_t DACBWIEN : 1; //!< [2] DAC Buffer Watermark Interrupt Enable
uint8_t LPEN : 1; //!< [3] DAC Low Power Control
uint8_t DACSWTRG : 1; //!< [4] DAC Software Trigger
uint8_t DACTRGSEL : 1; //!< [5] DAC Trigger Select
uint8_t DACRFS : 1; //!< [6] DAC Reference Select
uint8_t DACEN : 1; //!< [7] DAC Enable
} B;
} hw_dac_c0_t;
#endif
/*!
* @name Constants and macros for entire DAC_C0 register
*/
//@{
#define HW_DAC_C0_ADDR(x) (REGS_DAC_BASE(x) + 0x21U)
#ifndef __LANGUAGE_ASM__
#define HW_DAC_C0(x) (*(__IO hw_dac_c0_t *) HW_DAC_C0_ADDR(x))
#define HW_DAC_C0_RD(x) (HW_DAC_C0(x).U)
#define HW_DAC_C0_WR(x, v) (HW_DAC_C0(x).U = (v))
#define HW_DAC_C0_SET(x, v) (HW_DAC_C0_WR(x, HW_DAC_C0_RD(x) | (v)))
#define HW_DAC_C0_CLR(x, v) (HW_DAC_C0_WR(x, HW_DAC_C0_RD(x) & ~(v)))
#define HW_DAC_C0_TOG(x, v) (HW_DAC_C0_WR(x, HW_DAC_C0_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_C0 bitfields
*/
/*!
* @name Register DAC_C0, field DACBBIEN[0] (RW)
*
* Values:
* - 0 - The DAC buffer read pointer bottom flag interrupt is disabled.
* - 1 - The DAC buffer read pointer bottom flag interrupt is enabled.
*/
//@{
#define BP_DAC_C0_DACBBIEN (0U) //!< Bit position for DAC_C0_DACBBIEN.
#define BM_DAC_C0_DACBBIEN (0x01U) //!< Bit mask for DAC_C0_DACBBIEN.
#define BS_DAC_C0_DACBBIEN (1U) //!< Bit field size in bits for DAC_C0_DACBBIEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACBBIEN field.
#define BR_DAC_C0_DACBBIEN(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBBIEN))
#endif
//! @brief Format value for bitfield DAC_C0_DACBBIEN.
#define BF_DAC_C0_DACBBIEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACBBIEN), uint8_t) & BM_DAC_C0_DACBBIEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBBIEN field to a new value.
#define BW_DAC_C0_DACBBIEN(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBBIEN) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACBTIEN[1] (RW)
*
* Values:
* - 0 - The DAC buffer read pointer top flag interrupt is disabled.
* - 1 - The DAC buffer read pointer top flag interrupt is enabled.
*/
//@{
#define BP_DAC_C0_DACBTIEN (1U) //!< Bit position for DAC_C0_DACBTIEN.
#define BM_DAC_C0_DACBTIEN (0x02U) //!< Bit mask for DAC_C0_DACBTIEN.
#define BS_DAC_C0_DACBTIEN (1U) //!< Bit field size in bits for DAC_C0_DACBTIEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACBTIEN field.
#define BR_DAC_C0_DACBTIEN(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBTIEN))
#endif
//! @brief Format value for bitfield DAC_C0_DACBTIEN.
#define BF_DAC_C0_DACBTIEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACBTIEN), uint8_t) & BM_DAC_C0_DACBTIEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBTIEN field to a new value.
#define BW_DAC_C0_DACBTIEN(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBTIEN) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACBWIEN[2] (RW)
*
* Values:
* - 0 - The DAC buffer watermark interrupt is disabled.
* - 1 - The DAC buffer watermark interrupt is enabled.
*/
//@{
#define BP_DAC_C0_DACBWIEN (2U) //!< Bit position for DAC_C0_DACBWIEN.
#define BM_DAC_C0_DACBWIEN (0x04U) //!< Bit mask for DAC_C0_DACBWIEN.
#define BS_DAC_C0_DACBWIEN (1U) //!< Bit field size in bits for DAC_C0_DACBWIEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACBWIEN field.
#define BR_DAC_C0_DACBWIEN(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBWIEN))
#endif
//! @brief Format value for bitfield DAC_C0_DACBWIEN.
#define BF_DAC_C0_DACBWIEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACBWIEN), uint8_t) & BM_DAC_C0_DACBWIEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBWIEN field to a new value.
#define BW_DAC_C0_DACBWIEN(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACBWIEN) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field LPEN[3] (RW)
*
* See the 12-bit DAC electrical characteristics of the device data sheet for
* details on the impact of the modes below.
*
* Values:
* - 0 - High-Power mode
* - 1 - Low-Power mode
*/
//@{
#define BP_DAC_C0_LPEN (3U) //!< Bit position for DAC_C0_LPEN.
#define BM_DAC_C0_LPEN (0x08U) //!< Bit mask for DAC_C0_LPEN.
#define BS_DAC_C0_LPEN (1U) //!< Bit field size in bits for DAC_C0_LPEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_LPEN field.
#define BR_DAC_C0_LPEN(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_LPEN))
#endif
//! @brief Format value for bitfield DAC_C0_LPEN.
#define BF_DAC_C0_LPEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_LPEN), uint8_t) & BM_DAC_C0_LPEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LPEN field to a new value.
#define BW_DAC_C0_LPEN(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_LPEN) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACSWTRG[4] (WORZ)
*
* Active high. This is a write-only field, which always reads 0. If DAC
* software trigger is selected and buffer is enabled, writing 1 to this field will
* advance the buffer read pointer once.
*
* Values:
* - 0 - The DAC soft trigger is not valid.
* - 1 - The DAC soft trigger is valid.
*/
//@{
#define BP_DAC_C0_DACSWTRG (4U) //!< Bit position for DAC_C0_DACSWTRG.
#define BM_DAC_C0_DACSWTRG (0x10U) //!< Bit mask for DAC_C0_DACSWTRG.
#define BS_DAC_C0_DACSWTRG (1U) //!< Bit field size in bits for DAC_C0_DACSWTRG.
//! @brief Format value for bitfield DAC_C0_DACSWTRG.
#define BF_DAC_C0_DACSWTRG(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACSWTRG), uint8_t) & BM_DAC_C0_DACSWTRG)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACSWTRG field to a new value.
#define BW_DAC_C0_DACSWTRG(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACSWTRG) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACTRGSEL[5] (RW)
*
* Values:
* - 0 - The DAC hardware trigger is selected.
* - 1 - The DAC software trigger is selected.
*/
//@{
#define BP_DAC_C0_DACTRGSEL (5U) //!< Bit position for DAC_C0_DACTRGSEL.
#define BM_DAC_C0_DACTRGSEL (0x20U) //!< Bit mask for DAC_C0_DACTRGSEL.
#define BS_DAC_C0_DACTRGSEL (1U) //!< Bit field size in bits for DAC_C0_DACTRGSEL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACTRGSEL field.
#define BR_DAC_C0_DACTRGSEL(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACTRGSEL))
#endif
//! @brief Format value for bitfield DAC_C0_DACTRGSEL.
#define BF_DAC_C0_DACTRGSEL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACTRGSEL), uint8_t) & BM_DAC_C0_DACTRGSEL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACTRGSEL field to a new value.
#define BW_DAC_C0_DACTRGSEL(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACTRGSEL) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACRFS[6] (RW)
*
* Values:
* - 0 - The DAC selects DACREF_1 as the reference voltage.
* - 1 - The DAC selects DACREF_2 as the reference voltage.
*/
//@{
#define BP_DAC_C0_DACRFS (6U) //!< Bit position for DAC_C0_DACRFS.
#define BM_DAC_C0_DACRFS (0x40U) //!< Bit mask for DAC_C0_DACRFS.
#define BS_DAC_C0_DACRFS (1U) //!< Bit field size in bits for DAC_C0_DACRFS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACRFS field.
#define BR_DAC_C0_DACRFS(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACRFS))
#endif
//! @brief Format value for bitfield DAC_C0_DACRFS.
#define BF_DAC_C0_DACRFS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACRFS), uint8_t) & BM_DAC_C0_DACRFS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACRFS field to a new value.
#define BW_DAC_C0_DACRFS(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACRFS) = (v))
#endif
//@}
/*!
* @name Register DAC_C0, field DACEN[7] (RW)
*
* Starts the Programmable Reference Generator operation.
*
* Values:
* - 0 - The DAC system is disabled.
* - 1 - The DAC system is enabled.
*/
//@{
#define BP_DAC_C0_DACEN (7U) //!< Bit position for DAC_C0_DACEN.
#define BM_DAC_C0_DACEN (0x80U) //!< Bit mask for DAC_C0_DACEN.
#define BS_DAC_C0_DACEN (1U) //!< Bit field size in bits for DAC_C0_DACEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C0_DACEN field.
#define BR_DAC_C0_DACEN(x) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACEN))
#endif
//! @brief Format value for bitfield DAC_C0_DACEN.
#define BF_DAC_C0_DACEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C0_DACEN), uint8_t) & BM_DAC_C0_DACEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACEN field to a new value.
#define BW_DAC_C0_DACEN(x, v) (BITBAND_ACCESS8(HW_DAC_C0_ADDR(x), BP_DAC_C0_DACEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_C1 - DAC Control Register 1
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_C1 - DAC Control Register 1 (RW)
*
* Reset value: 0x00U
*
* Do not use 32- or 16-bit accesses to this register.
*/
typedef union _hw_dac_c1
{
uint8_t U;
struct _hw_dac_c1_bitfields
{
uint8_t DACBFEN : 1; //!< [0] DAC Buffer Enable
uint8_t DACBFMD : 2; //!< [2:1] DAC Buffer Work Mode Select
uint8_t DACBFWM : 2; //!< [4:3] DAC Buffer Watermark Select
uint8_t RESERVED0 : 2; //!< [6:5]
uint8_t DMAEN : 1; //!< [7] DMA Enable Select
} B;
} hw_dac_c1_t;
#endif
/*!
* @name Constants and macros for entire DAC_C1 register
*/
//@{
#define HW_DAC_C1_ADDR(x) (REGS_DAC_BASE(x) + 0x22U)
#ifndef __LANGUAGE_ASM__
#define HW_DAC_C1(x) (*(__IO hw_dac_c1_t *) HW_DAC_C1_ADDR(x))
#define HW_DAC_C1_RD(x) (HW_DAC_C1(x).U)
#define HW_DAC_C1_WR(x, v) (HW_DAC_C1(x).U = (v))
#define HW_DAC_C1_SET(x, v) (HW_DAC_C1_WR(x, HW_DAC_C1_RD(x) | (v)))
#define HW_DAC_C1_CLR(x, v) (HW_DAC_C1_WR(x, HW_DAC_C1_RD(x) & ~(v)))
#define HW_DAC_C1_TOG(x, v) (HW_DAC_C1_WR(x, HW_DAC_C1_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_C1 bitfields
*/
/*!
* @name Register DAC_C1, field DACBFEN[0] (RW)
*
* Values:
* - 0 - Buffer read pointer is disabled. The converted data is always the first
* word of the buffer.
* - 1 - Buffer read pointer is enabled. The converted data is the word that the
* read pointer points to. It means converted data can be from any word of
* the buffer.
*/
//@{
#define BP_DAC_C1_DACBFEN (0U) //!< Bit position for DAC_C1_DACBFEN.
#define BM_DAC_C1_DACBFEN (0x01U) //!< Bit mask for DAC_C1_DACBFEN.
#define BS_DAC_C1_DACBFEN (1U) //!< Bit field size in bits for DAC_C1_DACBFEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C1_DACBFEN field.
#define BR_DAC_C1_DACBFEN(x) (BITBAND_ACCESS8(HW_DAC_C1_ADDR(x), BP_DAC_C1_DACBFEN))
#endif
//! @brief Format value for bitfield DAC_C1_DACBFEN.
#define BF_DAC_C1_DACBFEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C1_DACBFEN), uint8_t) & BM_DAC_C1_DACBFEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFEN field to a new value.
#define BW_DAC_C1_DACBFEN(x, v) (BITBAND_ACCESS8(HW_DAC_C1_ADDR(x), BP_DAC_C1_DACBFEN) = (v))
#endif
//@}
/*!
* @name Register DAC_C1, field DACBFMD[2:1] (RW)
*
* Values:
* - 00 - Normal mode
* - 01 - Swing mode
* - 10 - One-Time Scan mode
* - 11 - Reserved
*/
//@{
#define BP_DAC_C1_DACBFMD (1U) //!< Bit position for DAC_C1_DACBFMD.
#define BM_DAC_C1_DACBFMD (0x06U) //!< Bit mask for DAC_C1_DACBFMD.
#define BS_DAC_C1_DACBFMD (2U) //!< Bit field size in bits for DAC_C1_DACBFMD.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C1_DACBFMD field.
#define BR_DAC_C1_DACBFMD(x) (HW_DAC_C1(x).B.DACBFMD)
#endif
//! @brief Format value for bitfield DAC_C1_DACBFMD.
#define BF_DAC_C1_DACBFMD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C1_DACBFMD), uint8_t) & BM_DAC_C1_DACBFMD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFMD field to a new value.
#define BW_DAC_C1_DACBFMD(x, v) (HW_DAC_C1_WR(x, (HW_DAC_C1_RD(x) & ~BM_DAC_C1_DACBFMD) | BF_DAC_C1_DACBFMD(v)))
#endif
//@}
/*!
* @name Register DAC_C1, field DACBFWM[4:3] (RW)
*
* Controls when SR[DACBFWMF] is set. When the DAC buffer read pointer reaches
* the word defined by this field, which is 1-4 words away from the upper limit
* (DACBUP), SR[DACBFWMF] will be set. This allows user configuration of the
* watermark interrupt.
*
* Values:
* - 00 - 1 word
* - 01 - 2 words
* - 10 - 3 words
* - 11 - 4 words
*/
//@{
#define BP_DAC_C1_DACBFWM (3U) //!< Bit position for DAC_C1_DACBFWM.
#define BM_DAC_C1_DACBFWM (0x18U) //!< Bit mask for DAC_C1_DACBFWM.
#define BS_DAC_C1_DACBFWM (2U) //!< Bit field size in bits for DAC_C1_DACBFWM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C1_DACBFWM field.
#define BR_DAC_C1_DACBFWM(x) (HW_DAC_C1(x).B.DACBFWM)
#endif
//! @brief Format value for bitfield DAC_C1_DACBFWM.
#define BF_DAC_C1_DACBFWM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C1_DACBFWM), uint8_t) & BM_DAC_C1_DACBFWM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFWM field to a new value.
#define BW_DAC_C1_DACBFWM(x, v) (HW_DAC_C1_WR(x, (HW_DAC_C1_RD(x) & ~BM_DAC_C1_DACBFWM) | BF_DAC_C1_DACBFWM(v)))
#endif
//@}
/*!
* @name Register DAC_C1, field DMAEN[7] (RW)
*
* Values:
* - 0 - DMA is disabled.
* - 1 - DMA is enabled. When DMA is enabled, the DMA request will be generated
* by original interrupts. The interrupts will not be presented on this
* module at the same time.
*/
//@{
#define BP_DAC_C1_DMAEN (7U) //!< Bit position for DAC_C1_DMAEN.
#define BM_DAC_C1_DMAEN (0x80U) //!< Bit mask for DAC_C1_DMAEN.
#define BS_DAC_C1_DMAEN (1U) //!< Bit field size in bits for DAC_C1_DMAEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C1_DMAEN field.
#define BR_DAC_C1_DMAEN(x) (BITBAND_ACCESS8(HW_DAC_C1_ADDR(x), BP_DAC_C1_DMAEN))
#endif
//! @brief Format value for bitfield DAC_C1_DMAEN.
#define BF_DAC_C1_DMAEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C1_DMAEN), uint8_t) & BM_DAC_C1_DMAEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DMAEN field to a new value.
#define BW_DAC_C1_DMAEN(x, v) (BITBAND_ACCESS8(HW_DAC_C1_ADDR(x), BP_DAC_C1_DMAEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DAC_C2 - DAC Control Register 2
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DAC_C2 - DAC Control Register 2 (RW)
*
* Reset value: 0x0FU
*/
typedef union _hw_dac_c2
{
uint8_t U;
struct _hw_dac_c2_bitfields
{
uint8_t DACBFUP : 4; //!< [3:0] DAC Buffer Upper Limit
uint8_t DACBFRP : 4; //!< [7:4] DAC Buffer Read Pointer
} B;
} hw_dac_c2_t;
#endif
/*!
* @name Constants and macros for entire DAC_C2 register
*/
//@{
#define HW_DAC_C2_ADDR(x) (REGS_DAC_BASE(x) + 0x23U)
#ifndef __LANGUAGE_ASM__
#define HW_DAC_C2(x) (*(__IO hw_dac_c2_t *) HW_DAC_C2_ADDR(x))
#define HW_DAC_C2_RD(x) (HW_DAC_C2(x).U)
#define HW_DAC_C2_WR(x, v) (HW_DAC_C2(x).U = (v))
#define HW_DAC_C2_SET(x, v) (HW_DAC_C2_WR(x, HW_DAC_C2_RD(x) | (v)))
#define HW_DAC_C2_CLR(x, v) (HW_DAC_C2_WR(x, HW_DAC_C2_RD(x) & ~(v)))
#define HW_DAC_C2_TOG(x, v) (HW_DAC_C2_WR(x, HW_DAC_C2_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DAC_C2 bitfields
*/
/*!
* @name Register DAC_C2, field DACBFUP[3:0] (RW)
*
* Selects the upper limit of the DAC buffer. The buffer read pointer cannot
* exceed it.
*/
//@{
#define BP_DAC_C2_DACBFUP (0U) //!< Bit position for DAC_C2_DACBFUP.
#define BM_DAC_C2_DACBFUP (0x0FU) //!< Bit mask for DAC_C2_DACBFUP.
#define BS_DAC_C2_DACBFUP (4U) //!< Bit field size in bits for DAC_C2_DACBFUP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C2_DACBFUP field.
#define BR_DAC_C2_DACBFUP(x) (HW_DAC_C2(x).B.DACBFUP)
#endif
//! @brief Format value for bitfield DAC_C2_DACBFUP.
#define BF_DAC_C2_DACBFUP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C2_DACBFUP), uint8_t) & BM_DAC_C2_DACBFUP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFUP field to a new value.
#define BW_DAC_C2_DACBFUP(x, v) (HW_DAC_C2_WR(x, (HW_DAC_C2_RD(x) & ~BM_DAC_C2_DACBFUP) | BF_DAC_C2_DACBFUP(v)))
#endif
//@}
/*!
* @name Register DAC_C2, field DACBFRP[7:4] (RW)
*
* Keeps the current value of the buffer read pointer.
*/
//@{
#define BP_DAC_C2_DACBFRP (4U) //!< Bit position for DAC_C2_DACBFRP.
#define BM_DAC_C2_DACBFRP (0xF0U) //!< Bit mask for DAC_C2_DACBFRP.
#define BS_DAC_C2_DACBFRP (4U) //!< Bit field size in bits for DAC_C2_DACBFRP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DAC_C2_DACBFRP field.
#define BR_DAC_C2_DACBFRP(x) (HW_DAC_C2(x).B.DACBFRP)
#endif
//! @brief Format value for bitfield DAC_C2_DACBFRP.
#define BF_DAC_C2_DACBFRP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DAC_C2_DACBFRP), uint8_t) & BM_DAC_C2_DACBFRP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DACBFRP field to a new value.
#define BW_DAC_C2_DACBFRP(x, v) (HW_DAC_C2_WR(x, (HW_DAC_C2_RD(x) & ~BM_DAC_C2_DACBFRP) | BF_DAC_C2_DACBFRP(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_dac_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All DAC module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_dac
{
struct {
__IO hw_dac_datnl_t DATnL; //!< [0x0] DAC Data Low Register
__IO hw_dac_datnh_t DATnH; //!< [0x1] DAC Data High Register
} DAT[16];
__IO hw_dac_sr_t SR; //!< [0x20] DAC Status Register
__IO hw_dac_c0_t C0; //!< [0x21] DAC Control Register
__IO hw_dac_c1_t C1; //!< [0x22] DAC Control Register 1
__IO hw_dac_c2_t C2; //!< [0x23] DAC Control Register 2
} hw_dac_t;
#pragma pack()
//! @brief Macro to access all DAC registers.
//! @param x DAC instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_DAC(0)</code>.
#define HW_DAC(x) (*(hw_dac_t *) REGS_DAC_BASE(x))
#endif
#endif // __HW_DAC_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,220 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_DMAMUX_REGISTERS_H__
#define __HW_DMAMUX_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 DMAMUX
*
* DMA channel multiplexor
*
* Registers defined in this header file:
* - HW_DMAMUX_CHCFGn - Channel Configuration register
*
* - hw_dmamux_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_DMAMUX_BASE
#define HW_DMAMUX_INSTANCE_COUNT (1U) //!< Number of instances of the DMAMUX module.
#define HW_DMAMUX0 (0U) //!< Instance number for DMAMUX.
#define REGS_DMAMUX0_BASE (0x40021000U) //!< Base address for DMAMUX.
//! @brief Table of base addresses for DMAMUX instances.
static const uint32_t __g_regs_DMAMUX_base_addresses[] = {
REGS_DMAMUX0_BASE,
};
//! @brief Get the base address of DMAMUX by instance number.
//! @param x DMAMUX instance number, from 0 through 0.
#define REGS_DMAMUX_BASE(x) (__g_regs_DMAMUX_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of DMAMUX.
#define REGS_DMAMUX_INSTANCE(b) ((b) == REGS_DMAMUX0_BASE ? HW_DMAMUX0 : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_DMAMUX_CHCFGn - Channel Configuration register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_DMAMUX_CHCFGn - Channel Configuration register (RW)
*
* Reset value: 0x00U
*
* Each of the DMA channels can be independently enabled/disabled and associated
* with one of the DMA slots (peripheral slots or always-on slots) in the
* system. Setting multiple CHCFG registers with the same source value will result in
* unpredictable behavior. This is true, even if a channel is disabled (ENBL==0).
* Before changing the trigger or source settings, a DMA channel must be disabled
* via CHCFGn[ENBL].
*/
typedef union _hw_dmamux_chcfgn
{
uint8_t U;
struct _hw_dmamux_chcfgn_bitfields
{
uint8_t SOURCE : 6; //!< [5:0] DMA Channel Source (Slot)
uint8_t TRIG : 1; //!< [6] DMA Channel Trigger Enable
uint8_t ENBL : 1; //!< [7] DMA Channel Enable
} B;
} hw_dmamux_chcfgn_t;
#endif
/*!
* @name Constants and macros for entire DMAMUX_CHCFGn register
*/
//@{
#define HW_DMAMUX_CHCFGn_COUNT (16U)
#define HW_DMAMUX_CHCFGn_ADDR(x, n) (REGS_DMAMUX_BASE(x) + 0x0U + (0x1U * n))
#ifndef __LANGUAGE_ASM__
#define HW_DMAMUX_CHCFGn(x, n) (*(__IO hw_dmamux_chcfgn_t *) HW_DMAMUX_CHCFGn_ADDR(x, n))
#define HW_DMAMUX_CHCFGn_RD(x, n) (HW_DMAMUX_CHCFGn(x, n).U)
#define HW_DMAMUX_CHCFGn_WR(x, n, v) (HW_DMAMUX_CHCFGn(x, n).U = (v))
#define HW_DMAMUX_CHCFGn_SET(x, n, v) (HW_DMAMUX_CHCFGn_WR(x, n, HW_DMAMUX_CHCFGn_RD(x, n) | (v)))
#define HW_DMAMUX_CHCFGn_CLR(x, n, v) (HW_DMAMUX_CHCFGn_WR(x, n, HW_DMAMUX_CHCFGn_RD(x, n) & ~(v)))
#define HW_DMAMUX_CHCFGn_TOG(x, n, v) (HW_DMAMUX_CHCFGn_WR(x, n, HW_DMAMUX_CHCFGn_RD(x, n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual DMAMUX_CHCFGn bitfields
*/
/*!
* @name Register DMAMUX_CHCFGn, field SOURCE[5:0] (RW)
*
* Specifies which DMA source, if any, is routed to a particular DMA channel.
* See your device's chip configuration details for information about the
* peripherals and their slot numbers.
*/
//@{
#define BP_DMAMUX_CHCFGn_SOURCE (0U) //!< Bit position for DMAMUX_CHCFGn_SOURCE.
#define BM_DMAMUX_CHCFGn_SOURCE (0x3FU) //!< Bit mask for DMAMUX_CHCFGn_SOURCE.
#define BS_DMAMUX_CHCFGn_SOURCE (6U) //!< Bit field size in bits for DMAMUX_CHCFGn_SOURCE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DMAMUX_CHCFGn_SOURCE field.
#define BR_DMAMUX_CHCFGn_SOURCE(x, n) (HW_DMAMUX_CHCFGn(x, n).B.SOURCE)
#endif
//! @brief Format value for bitfield DMAMUX_CHCFGn_SOURCE.
#define BF_DMAMUX_CHCFGn_SOURCE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DMAMUX_CHCFGn_SOURCE), uint8_t) & BM_DMAMUX_CHCFGn_SOURCE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SOURCE field to a new value.
#define BW_DMAMUX_CHCFGn_SOURCE(x, n, v) (HW_DMAMUX_CHCFGn_WR(x, n, (HW_DMAMUX_CHCFGn_RD(x, n) & ~BM_DMAMUX_CHCFGn_SOURCE) | BF_DMAMUX_CHCFGn_SOURCE(v)))
#endif
//@}
/*!
* @name Register DMAMUX_CHCFGn, field TRIG[6] (RW)
*
* Enables the periodic trigger capability for the triggered DMA channel.
*
* Values:
* - 0 - Triggering is disabled. If triggering is disabled and ENBL is set, the
* DMA Channel will simply route the specified source to the DMA channel.
* (Normal mode)
* - 1 - Triggering is enabled. If triggering is enabled and ENBL is set, the
* DMAMUX is in Periodic Trigger mode.
*/
//@{
#define BP_DMAMUX_CHCFGn_TRIG (6U) //!< Bit position for DMAMUX_CHCFGn_TRIG.
#define BM_DMAMUX_CHCFGn_TRIG (0x40U) //!< Bit mask for DMAMUX_CHCFGn_TRIG.
#define BS_DMAMUX_CHCFGn_TRIG (1U) //!< Bit field size in bits for DMAMUX_CHCFGn_TRIG.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DMAMUX_CHCFGn_TRIG field.
#define BR_DMAMUX_CHCFGn_TRIG(x, n) (BITBAND_ACCESS8(HW_DMAMUX_CHCFGn_ADDR(x, n), BP_DMAMUX_CHCFGn_TRIG))
#endif
//! @brief Format value for bitfield DMAMUX_CHCFGn_TRIG.
#define BF_DMAMUX_CHCFGn_TRIG(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DMAMUX_CHCFGn_TRIG), uint8_t) & BM_DMAMUX_CHCFGn_TRIG)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TRIG field to a new value.
#define BW_DMAMUX_CHCFGn_TRIG(x, n, v) (BITBAND_ACCESS8(HW_DMAMUX_CHCFGn_ADDR(x, n), BP_DMAMUX_CHCFGn_TRIG) = (v))
#endif
//@}
/*!
* @name Register DMAMUX_CHCFGn, field ENBL[7] (RW)
*
* Enables the DMA channel.
*
* Values:
* - 0 - DMA channel is disabled. This mode is primarily used during
* configuration of the DMAMux. The DMA has separate channel enables/disables, which
* should be used to disable or reconfigure a DMA channel.
* - 1 - DMA channel is enabled
*/
//@{
#define BP_DMAMUX_CHCFGn_ENBL (7U) //!< Bit position for DMAMUX_CHCFGn_ENBL.
#define BM_DMAMUX_CHCFGn_ENBL (0x80U) //!< Bit mask for DMAMUX_CHCFGn_ENBL.
#define BS_DMAMUX_CHCFGn_ENBL (1U) //!< Bit field size in bits for DMAMUX_CHCFGn_ENBL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the DMAMUX_CHCFGn_ENBL field.
#define BR_DMAMUX_CHCFGn_ENBL(x, n) (BITBAND_ACCESS8(HW_DMAMUX_CHCFGn_ADDR(x, n), BP_DMAMUX_CHCFGn_ENBL))
#endif
//! @brief Format value for bitfield DMAMUX_CHCFGn_ENBL.
#define BF_DMAMUX_CHCFGn_ENBL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_DMAMUX_CHCFGn_ENBL), uint8_t) & BM_DMAMUX_CHCFGn_ENBL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ENBL field to a new value.
#define BW_DMAMUX_CHCFGn_ENBL(x, n, v) (BITBAND_ACCESS8(HW_DMAMUX_CHCFGn_ADDR(x, n), BP_DMAMUX_CHCFGn_ENBL) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_dmamux_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All DMAMUX module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_dmamux
{
__IO hw_dmamux_chcfgn_t CHCFGn[16]; //!< [0x0] Channel Configuration register
} hw_dmamux_t;
#pragma pack()
//! @brief Macro to access all DMAMUX registers.
//! @param x DMAMUX instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_DMAMUX(0)</code>.
#define HW_DMAMUX(x) (*(hw_dmamux_t *) REGS_DMAMUX_BASE(x))
#endif
#endif // __HW_DMAMUX_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,430 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_EWM_REGISTERS_H__
#define __HW_EWM_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 EWM
*
* External Watchdog Monitor
*
* Registers defined in this header file:
* - HW_EWM_CTRL - Control Register
* - HW_EWM_SERV - Service Register
* - HW_EWM_CMPL - Compare Low Register
* - HW_EWM_CMPH - Compare High Register
*
* - hw_ewm_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_EWM_BASE
#define HW_EWM_INSTANCE_COUNT (1U) //!< Number of instances of the EWM module.
#define REGS_EWM_BASE (0x40061000U) //!< Base address for EWM.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_EWM_CTRL - Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_EWM_CTRL - Control Register (RW)
*
* Reset value: 0x00U
*
* The CTRL register is cleared by any reset. INEN, ASSIN and EWMEN bits can be
* written once after a CPU reset. Modifying these bits more than once, generates
* a bus transfer error.
*/
typedef union _hw_ewm_ctrl
{
uint8_t U;
struct _hw_ewm_ctrl_bitfields
{
uint8_t EWMEN : 1; //!< [0] EWM enable.
uint8_t ASSIN : 1; //!< [1] EWM_in's Assertion State Select.
uint8_t INEN : 1; //!< [2] Input Enable.
uint8_t INTEN : 1; //!< [3] Interrupt Enable.
uint8_t RESERVED0 : 4; //!< [7:4]
} B;
} hw_ewm_ctrl_t;
#endif
/*!
* @name Constants and macros for entire EWM_CTRL register
*/
//@{
#define HW_EWM_CTRL_ADDR (REGS_EWM_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_EWM_CTRL (*(__IO hw_ewm_ctrl_t *) HW_EWM_CTRL_ADDR)
#define HW_EWM_CTRL_RD() (HW_EWM_CTRL.U)
#define HW_EWM_CTRL_WR(v) (HW_EWM_CTRL.U = (v))
#define HW_EWM_CTRL_SET(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() | (v)))
#define HW_EWM_CTRL_CLR(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() & ~(v)))
#define HW_EWM_CTRL_TOG(v) (HW_EWM_CTRL_WR(HW_EWM_CTRL_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual EWM_CTRL bitfields
*/
/*!
* @name Register EWM_CTRL, field EWMEN[0] (RW)
*
* This bit when set, enables the EWM module. This resets the EWM counter to
* zero and deasserts the EWM_out signal. Clearing EWMEN bit disables the EWM, and
* therefore it cannot be enabled until a reset occurs, due to the write-once
* nature of this bit.
*/
//@{
#define BP_EWM_CTRL_EWMEN (0U) //!< Bit position for EWM_CTRL_EWMEN.
#define BM_EWM_CTRL_EWMEN (0x01U) //!< Bit mask for EWM_CTRL_EWMEN.
#define BS_EWM_CTRL_EWMEN (1U) //!< Bit field size in bits for EWM_CTRL_EWMEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CTRL_EWMEN field.
#define BR_EWM_CTRL_EWMEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_EWMEN))
#endif
//! @brief Format value for bitfield EWM_CTRL_EWMEN.
#define BF_EWM_CTRL_EWMEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_EWMEN), uint8_t) & BM_EWM_CTRL_EWMEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the EWMEN field to a new value.
#define BW_EWM_CTRL_EWMEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_EWMEN) = (v))
#endif
//@}
/*!
* @name Register EWM_CTRL, field ASSIN[1] (RW)
*
* Default assert state of the EWM_in signal is logic zero. Setting ASSIN bit
* inverts the assert state to a logic one.
*/
//@{
#define BP_EWM_CTRL_ASSIN (1U) //!< Bit position for EWM_CTRL_ASSIN.
#define BM_EWM_CTRL_ASSIN (0x02U) //!< Bit mask for EWM_CTRL_ASSIN.
#define BS_EWM_CTRL_ASSIN (1U) //!< Bit field size in bits for EWM_CTRL_ASSIN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CTRL_ASSIN field.
#define BR_EWM_CTRL_ASSIN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_ASSIN))
#endif
//! @brief Format value for bitfield EWM_CTRL_ASSIN.
#define BF_EWM_CTRL_ASSIN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_ASSIN), uint8_t) & BM_EWM_CTRL_ASSIN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ASSIN field to a new value.
#define BW_EWM_CTRL_ASSIN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_ASSIN) = (v))
#endif
//@}
/*!
* @name Register EWM_CTRL, field INEN[2] (RW)
*
* This bit when set, enables the EWM_in port.
*/
//@{
#define BP_EWM_CTRL_INEN (2U) //!< Bit position for EWM_CTRL_INEN.
#define BM_EWM_CTRL_INEN (0x04U) //!< Bit mask for EWM_CTRL_INEN.
#define BS_EWM_CTRL_INEN (1U) //!< Bit field size in bits for EWM_CTRL_INEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CTRL_INEN field.
#define BR_EWM_CTRL_INEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INEN))
#endif
//! @brief Format value for bitfield EWM_CTRL_INEN.
#define BF_EWM_CTRL_INEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_INEN), uint8_t) & BM_EWM_CTRL_INEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the INEN field to a new value.
#define BW_EWM_CTRL_INEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INEN) = (v))
#endif
//@}
/*!
* @name Register EWM_CTRL, field INTEN[3] (RW)
*
* This bit when set and EWM_out is asserted, an interrupt request is generated.
* To de-assert interrupt request, user should clear this bit by writing 0.
*/
//@{
#define BP_EWM_CTRL_INTEN (3U) //!< Bit position for EWM_CTRL_INTEN.
#define BM_EWM_CTRL_INTEN (0x08U) //!< Bit mask for EWM_CTRL_INTEN.
#define BS_EWM_CTRL_INTEN (1U) //!< Bit field size in bits for EWM_CTRL_INTEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CTRL_INTEN field.
#define BR_EWM_CTRL_INTEN (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INTEN))
#endif
//! @brief Format value for bitfield EWM_CTRL_INTEN.
#define BF_EWM_CTRL_INTEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CTRL_INTEN), uint8_t) & BM_EWM_CTRL_INTEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the INTEN field to a new value.
#define BW_EWM_CTRL_INTEN(v) (BITBAND_ACCESS8(HW_EWM_CTRL_ADDR, BP_EWM_CTRL_INTEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_EWM_SERV - Service Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_EWM_SERV - Service Register (WORZ)
*
* Reset value: 0x00U
*
* The SERV register provides the interface from the CPU to the EWM module. It
* is write-only and reads of this register return zero.
*/
typedef union _hw_ewm_serv
{
uint8_t U;
struct _hw_ewm_serv_bitfields
{
uint8_t SERVICE : 8; //!< [7:0]
} B;
} hw_ewm_serv_t;
#endif
/*!
* @name Constants and macros for entire EWM_SERV register
*/
//@{
#define HW_EWM_SERV_ADDR (REGS_EWM_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_EWM_SERV (*(__O hw_ewm_serv_t *) HW_EWM_SERV_ADDR)
#define HW_EWM_SERV_RD() (HW_EWM_SERV.U)
#define HW_EWM_SERV_WR(v) (HW_EWM_SERV.U = (v))
#endif
//@}
/*
* Constants & macros for individual EWM_SERV bitfields
*/
/*!
* @name Register EWM_SERV, field SERVICE[7:0] (WORZ)
*
* The EWM service mechanism requires the CPU to write two values to the SERV
* register: a first data byte of 0xB4, followed by a second data byte of 0x2C. The
* EWM service is illegal if either of the following conditions is true. The
* first or second data byte is not written correctly. The second data byte is not
* written within a fixed number of peripheral bus cycles of the first data byte.
* This fixed number of cycles is called EWM_service_time.
*/
//@{
#define BP_EWM_SERV_SERVICE (0U) //!< Bit position for EWM_SERV_SERVICE.
#define BM_EWM_SERV_SERVICE (0xFFU) //!< Bit mask for EWM_SERV_SERVICE.
#define BS_EWM_SERV_SERVICE (8U) //!< Bit field size in bits for EWM_SERV_SERVICE.
//! @brief Format value for bitfield EWM_SERV_SERVICE.
#define BF_EWM_SERV_SERVICE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_SERV_SERVICE), uint8_t) & BM_EWM_SERV_SERVICE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SERVICE field to a new value.
#define BW_EWM_SERV_SERVICE(v) (HW_EWM_SERV_WR(v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_EWM_CMPL - Compare Low Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_EWM_CMPL - Compare Low Register (RW)
*
* Reset value: 0x00U
*
* The CMPL register is reset to zero after a CPU reset. This provides no
* minimum time for the CPU to service the EWM counter. This register can be written
* only once after a CPU reset. Writing this register more than once generates a
* bus transfer error.
*/
typedef union _hw_ewm_cmpl
{
uint8_t U;
struct _hw_ewm_cmpl_bitfields
{
uint8_t COMPAREL : 8; //!< [7:0]
} B;
} hw_ewm_cmpl_t;
#endif
/*!
* @name Constants and macros for entire EWM_CMPL register
*/
//@{
#define HW_EWM_CMPL_ADDR (REGS_EWM_BASE + 0x2U)
#ifndef __LANGUAGE_ASM__
#define HW_EWM_CMPL (*(__IO hw_ewm_cmpl_t *) HW_EWM_CMPL_ADDR)
#define HW_EWM_CMPL_RD() (HW_EWM_CMPL.U)
#define HW_EWM_CMPL_WR(v) (HW_EWM_CMPL.U = (v))
#define HW_EWM_CMPL_SET(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() | (v)))
#define HW_EWM_CMPL_CLR(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() & ~(v)))
#define HW_EWM_CMPL_TOG(v) (HW_EWM_CMPL_WR(HW_EWM_CMPL_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual EWM_CMPL bitfields
*/
/*!
* @name Register EWM_CMPL, field COMPAREL[7:0] (RW)
*
* To prevent runaway code from changing this field, software should write to
* this field after a CPU reset even if the (default) minimum service time is
* required.
*/
//@{
#define BP_EWM_CMPL_COMPAREL (0U) //!< Bit position for EWM_CMPL_COMPAREL.
#define BM_EWM_CMPL_COMPAREL (0xFFU) //!< Bit mask for EWM_CMPL_COMPAREL.
#define BS_EWM_CMPL_COMPAREL (8U) //!< Bit field size in bits for EWM_CMPL_COMPAREL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CMPL_COMPAREL field.
#define BR_EWM_CMPL_COMPAREL (HW_EWM_CMPL.U)
#endif
//! @brief Format value for bitfield EWM_CMPL_COMPAREL.
#define BF_EWM_CMPL_COMPAREL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CMPL_COMPAREL), uint8_t) & BM_EWM_CMPL_COMPAREL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the COMPAREL field to a new value.
#define BW_EWM_CMPL_COMPAREL(v) (HW_EWM_CMPL_WR(v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_EWM_CMPH - Compare High Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_EWM_CMPH - Compare High Register (RW)
*
* Reset value: 0xFFU
*
* The CMPH register is reset to 0xFF after a CPU reset. This provides a maximum
* of 256 clocks time, for the CPU to service the EWM counter. This register can
* be written only once after a CPU reset. Writing this register more than once
* generates a bus transfer error. The valid values for CMPH are up to 0xFE
* because the EWM counter never expires when CMPH = 0xFF. The expiration happens only
* if EWM counter is greater than CMPH.
*/
typedef union _hw_ewm_cmph
{
uint8_t U;
struct _hw_ewm_cmph_bitfields
{
uint8_t COMPAREH : 8; //!< [7:0]
} B;
} hw_ewm_cmph_t;
#endif
/*!
* @name Constants and macros for entire EWM_CMPH register
*/
//@{
#define HW_EWM_CMPH_ADDR (REGS_EWM_BASE + 0x3U)
#ifndef __LANGUAGE_ASM__
#define HW_EWM_CMPH (*(__IO hw_ewm_cmph_t *) HW_EWM_CMPH_ADDR)
#define HW_EWM_CMPH_RD() (HW_EWM_CMPH.U)
#define HW_EWM_CMPH_WR(v) (HW_EWM_CMPH.U = (v))
#define HW_EWM_CMPH_SET(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() | (v)))
#define HW_EWM_CMPH_CLR(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() & ~(v)))
#define HW_EWM_CMPH_TOG(v) (HW_EWM_CMPH_WR(HW_EWM_CMPH_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual EWM_CMPH bitfields
*/
/*!
* @name Register EWM_CMPH, field COMPAREH[7:0] (RW)
*
* To prevent runaway code from changing this field, software should write to
* this field after a CPU reset even if the (default) maximum service time is
* required.
*/
//@{
#define BP_EWM_CMPH_COMPAREH (0U) //!< Bit position for EWM_CMPH_COMPAREH.
#define BM_EWM_CMPH_COMPAREH (0xFFU) //!< Bit mask for EWM_CMPH_COMPAREH.
#define BS_EWM_CMPH_COMPAREH (8U) //!< Bit field size in bits for EWM_CMPH_COMPAREH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the EWM_CMPH_COMPAREH field.
#define BR_EWM_CMPH_COMPAREH (HW_EWM_CMPH.U)
#endif
//! @brief Format value for bitfield EWM_CMPH_COMPAREH.
#define BF_EWM_CMPH_COMPAREH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_EWM_CMPH_COMPAREH), uint8_t) & BM_EWM_CMPH_COMPAREH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the COMPAREH field to a new value.
#define BW_EWM_CMPH_COMPAREH(v) (HW_EWM_CMPH_WR(v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_ewm_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All EWM module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_ewm
{
__IO hw_ewm_ctrl_t CTRL; //!< [0x0] Control Register
__O hw_ewm_serv_t SERV; //!< [0x1] Service Register
__IO hw_ewm_cmpl_t CMPL; //!< [0x2] Compare Low Register
__IO hw_ewm_cmph_t CMPH; //!< [0x3] Compare High Register
} hw_ewm_t;
#pragma pack()
//! @brief Macro to access all EWM registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_EWM</code>.
#define HW_EWM (*(hw_ewm_t *) REGS_EWM_BASE)
#endif
#endif // __HW_EWM_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,959 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_FB_REGISTERS_H__
#define __HW_FB_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 FB
*
* FlexBus external bus interface
*
* Registers defined in this header file:
* - HW_FB_CSARn - Chip Select Address Register
* - HW_FB_CSMRn - Chip Select Mask Register
* - HW_FB_CSCRn - Chip Select Control Register
* - HW_FB_CSPMCR - Chip Select port Multiplexing Control Register
*
* - hw_fb_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_FB_BASE
#define HW_FB_INSTANCE_COUNT (1U) //!< Number of instances of the FB module.
#define REGS_FB_BASE (0x4000C000U) //!< Base address for FB.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_FB_CSARn - Chip Select Address Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_FB_CSARn - Chip Select Address Register (RW)
*
* Reset value: 0x00000000U
*
* Specifies the associated chip-select's base address.
*/
typedef union _hw_fb_csarn
{
uint32_t U;
struct _hw_fb_csarn_bitfields
{
uint32_t RESERVED0 : 16; //!< [15:0]
uint32_t BA : 16; //!< [31:16] Base Address
} B;
} hw_fb_csarn_t;
#endif
/*!
* @name Constants and macros for entire FB_CSARn register
*/
//@{
#define HW_FB_CSARn_COUNT (6U)
#define HW_FB_CSARn_ADDR(n) (REGS_FB_BASE + 0x0U + (0xCU * n))
#ifndef __LANGUAGE_ASM__
#define HW_FB_CSARn(n) (*(__IO hw_fb_csarn_t *) HW_FB_CSARn_ADDR(n))
#define HW_FB_CSARn_RD(n) (HW_FB_CSARn(n).U)
#define HW_FB_CSARn_WR(n, v) (HW_FB_CSARn(n).U = (v))
#define HW_FB_CSARn_SET(n, v) (HW_FB_CSARn_WR(n, HW_FB_CSARn_RD(n) | (v)))
#define HW_FB_CSARn_CLR(n, v) (HW_FB_CSARn_WR(n, HW_FB_CSARn_RD(n) & ~(v)))
#define HW_FB_CSARn_TOG(n, v) (HW_FB_CSARn_WR(n, HW_FB_CSARn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual FB_CSARn bitfields
*/
/*!
* @name Register FB_CSARn, field BA[31:16] (RW)
*
* Defines the base address for memory dedicated to the associated chip-select.
* BA is compared to bits 31-16 on the internal address bus to determine if the
* associated chip-select's memory is being accessed. Because the FlexBus module
* is one of the slaves connected to the crossbar switch, it is only accessible
* within a certain memory range. See the chip memory map for the applicable
* FlexBus "expansion" address range for which the chip-selects can be active. Set the
* CSARn and CSMRn registers appropriately before accessing this region.
*/
//@{
#define BP_FB_CSARn_BA (16U) //!< Bit position for FB_CSARn_BA.
#define BM_FB_CSARn_BA (0xFFFF0000U) //!< Bit mask for FB_CSARn_BA.
#define BS_FB_CSARn_BA (16U) //!< Bit field size in bits for FB_CSARn_BA.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSARn_BA field.
#define BR_FB_CSARn_BA(n) (HW_FB_CSARn(n).B.BA)
#endif
//! @brief Format value for bitfield FB_CSARn_BA.
#define BF_FB_CSARn_BA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSARn_BA), uint32_t) & BM_FB_CSARn_BA)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BA field to a new value.
#define BW_FB_CSARn_BA(n, v) (HW_FB_CSARn_WR(n, (HW_FB_CSARn_RD(n) & ~BM_FB_CSARn_BA) | BF_FB_CSARn_BA(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_FB_CSMRn - Chip Select Mask Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_FB_CSMRn - Chip Select Mask Register (RW)
*
* Reset value: 0x00000000U
*
* Specifies the address mask and allowable access types for the associated
* chip-select.
*/
typedef union _hw_fb_csmrn
{
uint32_t U;
struct _hw_fb_csmrn_bitfields
{
uint32_t V : 1; //!< [0] Valid
uint32_t RESERVED0 : 7; //!< [7:1]
uint32_t WP : 1; //!< [8] Write Protect
uint32_t RESERVED1 : 7; //!< [15:9]
uint32_t BAM : 16; //!< [31:16] Base Address Mask
} B;
} hw_fb_csmrn_t;
#endif
/*!
* @name Constants and macros for entire FB_CSMRn register
*/
//@{
#define HW_FB_CSMRn_COUNT (6U)
#define HW_FB_CSMRn_ADDR(n) (REGS_FB_BASE + 0x4U + (0xCU * n))
#ifndef __LANGUAGE_ASM__
#define HW_FB_CSMRn(n) (*(__IO hw_fb_csmrn_t *) HW_FB_CSMRn_ADDR(n))
#define HW_FB_CSMRn_RD(n) (HW_FB_CSMRn(n).U)
#define HW_FB_CSMRn_WR(n, v) (HW_FB_CSMRn(n).U = (v))
#define HW_FB_CSMRn_SET(n, v) (HW_FB_CSMRn_WR(n, HW_FB_CSMRn_RD(n) | (v)))
#define HW_FB_CSMRn_CLR(n, v) (HW_FB_CSMRn_WR(n, HW_FB_CSMRn_RD(n) & ~(v)))
#define HW_FB_CSMRn_TOG(n, v) (HW_FB_CSMRn_WR(n, HW_FB_CSMRn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual FB_CSMRn bitfields
*/
/*!
* @name Register FB_CSMRn, field V[0] (RW)
*
* Specifies whether the corresponding CSAR, CSMR, and CSCR contents are valid.
* Programmed chip-selects do not assert until the V bit is 1b (except for
* FB_CS0, which acts as the global chip-select). At reset, FB_CS0 will fire for any
* access to the FlexBus memory region. CSMR0[V] must be set as part of the chip
* select initialization sequence to allow other chip selects to function as
* programmed.
*
* Values:
* - 0 - Chip-select is invalid.
* - 1 - Chip-select is valid.
*/
//@{
#define BP_FB_CSMRn_V (0U) //!< Bit position for FB_CSMRn_V.
#define BM_FB_CSMRn_V (0x00000001U) //!< Bit mask for FB_CSMRn_V.
#define BS_FB_CSMRn_V (1U) //!< Bit field size in bits for FB_CSMRn_V.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSMRn_V field.
#define BR_FB_CSMRn_V(n) (BITBAND_ACCESS32(HW_FB_CSMRn_ADDR(n), BP_FB_CSMRn_V))
#endif
//! @brief Format value for bitfield FB_CSMRn_V.
#define BF_FB_CSMRn_V(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSMRn_V), uint32_t) & BM_FB_CSMRn_V)
#ifndef __LANGUAGE_ASM__
//! @brief Set the V field to a new value.
#define BW_FB_CSMRn_V(n, v) (BITBAND_ACCESS32(HW_FB_CSMRn_ADDR(n), BP_FB_CSMRn_V) = (v))
#endif
//@}
/*!
* @name Register FB_CSMRn, field WP[8] (RW)
*
* Controls write accesses to the address range in the corresponding CSAR.
*
* Values:
* - 0 - Write accesses are allowed.
* - 1 - Write accesses are not allowed. Attempting to write to the range of
* addresses for which the WP bit is set results in a bus error termination of
* the internal cycle and no external cycle.
*/
//@{
#define BP_FB_CSMRn_WP (8U) //!< Bit position for FB_CSMRn_WP.
#define BM_FB_CSMRn_WP (0x00000100U) //!< Bit mask for FB_CSMRn_WP.
#define BS_FB_CSMRn_WP (1U) //!< Bit field size in bits for FB_CSMRn_WP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSMRn_WP field.
#define BR_FB_CSMRn_WP(n) (BITBAND_ACCESS32(HW_FB_CSMRn_ADDR(n), BP_FB_CSMRn_WP))
#endif
//! @brief Format value for bitfield FB_CSMRn_WP.
#define BF_FB_CSMRn_WP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSMRn_WP), uint32_t) & BM_FB_CSMRn_WP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WP field to a new value.
#define BW_FB_CSMRn_WP(n, v) (BITBAND_ACCESS32(HW_FB_CSMRn_ADDR(n), BP_FB_CSMRn_WP) = (v))
#endif
//@}
/*!
* @name Register FB_CSMRn, field BAM[31:16] (RW)
*
* Defines the associated chip-select's block size by masking address bits.
*
* Values:
* - 0 - The corresponding address bit in CSAR is used in the chip-select decode.
* - 1 - The corresponding address bit in CSAR is a don't care in the
* chip-select decode.
*/
//@{
#define BP_FB_CSMRn_BAM (16U) //!< Bit position for FB_CSMRn_BAM.
#define BM_FB_CSMRn_BAM (0xFFFF0000U) //!< Bit mask for FB_CSMRn_BAM.
#define BS_FB_CSMRn_BAM (16U) //!< Bit field size in bits for FB_CSMRn_BAM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSMRn_BAM field.
#define BR_FB_CSMRn_BAM(n) (HW_FB_CSMRn(n).B.BAM)
#endif
//! @brief Format value for bitfield FB_CSMRn_BAM.
#define BF_FB_CSMRn_BAM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSMRn_BAM), uint32_t) & BM_FB_CSMRn_BAM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BAM field to a new value.
#define BW_FB_CSMRn_BAM(n, v) (HW_FB_CSMRn_WR(n, (HW_FB_CSMRn_RD(n) & ~BM_FB_CSMRn_BAM) | BF_FB_CSMRn_BAM(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_FB_CSCRn - Chip Select Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_FB_CSCRn - Chip Select Control Register (RW)
*
* Reset value: 0x003FFC00U
*
* Controls the auto-acknowledge, address setup and hold times, port size, burst
* capability, and number of wait states for the associated chip select. To
* support the global chip-select (FB_CS0), the CSCR0 reset values differ from the
* other CSCRs. The reset value of CSCR0 is as follows: Bits 31-24 are 0b Bit 23-3
* are chip-dependent Bits 3-0 are 0b See the chip configuration details for your
* particular chip for information on the exact CSCR0 reset value.
*/
typedef union _hw_fb_cscrn
{
uint32_t U;
struct _hw_fb_cscrn_bitfields
{
uint32_t RESERVED0 : 3; //!< [2:0]
uint32_t BSTW : 1; //!< [3] Burst-Write Enable
uint32_t BSTR : 1; //!< [4] Burst-Read Enable
uint32_t BEM : 1; //!< [5] Byte-Enable Mode
uint32_t PS : 2; //!< [7:6] Port Size
uint32_t AA : 1; //!< [8] Auto-Acknowledge Enable
uint32_t BLS : 1; //!< [9] Byte-Lane Shift
uint32_t WS : 6; //!< [15:10] Wait States
uint32_t WRAH : 2; //!< [17:16] Write Address Hold or Deselect
uint32_t RDAH : 2; //!< [19:18] Read Address Hold or Deselect
uint32_t ASET : 2; //!< [21:20] Address Setup
uint32_t EXTS : 1; //!< [22]
uint32_t SWSEN : 1; //!< [23] Secondary Wait State Enable
uint32_t RESERVED1 : 2; //!< [25:24]
uint32_t SWS : 6; //!< [31:26] Secondary Wait States
} B;
} hw_fb_cscrn_t;
#endif
/*!
* @name Constants and macros for entire FB_CSCRn register
*/
//@{
#define HW_FB_CSCRn_COUNT (6U)
#define HW_FB_CSCRn_ADDR(n) (REGS_FB_BASE + 0x8U + (0xCU * n))
#ifndef __LANGUAGE_ASM__
#define HW_FB_CSCRn(n) (*(__IO hw_fb_cscrn_t *) HW_FB_CSCRn_ADDR(n))
#define HW_FB_CSCRn_RD(n) (HW_FB_CSCRn(n).U)
#define HW_FB_CSCRn_WR(n, v) (HW_FB_CSCRn(n).U = (v))
#define HW_FB_CSCRn_SET(n, v) (HW_FB_CSCRn_WR(n, HW_FB_CSCRn_RD(n) | (v)))
#define HW_FB_CSCRn_CLR(n, v) (HW_FB_CSCRn_WR(n, HW_FB_CSCRn_RD(n) & ~(v)))
#define HW_FB_CSCRn_TOG(n, v) (HW_FB_CSCRn_WR(n, HW_FB_CSCRn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual FB_CSCRn bitfields
*/
/*!
* @name Register FB_CSCRn, field BSTW[3] (RW)
*
* Specifies whether burst writes are enabled for memory associated with each
* chip select.
*
* Values:
* - 0 - Disabled. Data exceeding the specified port size is broken into
* individual, port-sized, non-burst writes. For example, a 32-bit write to an 8-bit
* port takes four byte writes.
* - 1 - Enabled. Enables burst write of data larger than the specified port
* size, including 32-bit writes to 8- and 16-bit ports, 16-bit writes to 8-bit
* ports, and line writes to 8-, 16-, and 32-bit ports.
*/
//@{
#define BP_FB_CSCRn_BSTW (3U) //!< Bit position for FB_CSCRn_BSTW.
#define BM_FB_CSCRn_BSTW (0x00000008U) //!< Bit mask for FB_CSCRn_BSTW.
#define BS_FB_CSCRn_BSTW (1U) //!< Bit field size in bits for FB_CSCRn_BSTW.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_BSTW field.
#define BR_FB_CSCRn_BSTW(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BSTW))
#endif
//! @brief Format value for bitfield FB_CSCRn_BSTW.
#define BF_FB_CSCRn_BSTW(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_BSTW), uint32_t) & BM_FB_CSCRn_BSTW)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BSTW field to a new value.
#define BW_FB_CSCRn_BSTW(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BSTW) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field BSTR[4] (RW)
*
* Specifies whether burst reads are enabled for memory associated with each
* chip select.
*
* Values:
* - 0 - Disabled. Data exceeding the specified port size is broken into
* individual, port-sized, non-burst reads. For example, a 32-bit read from an 8-bit
* port is broken into four 8-bit reads.
* - 1 - Enabled. Enables data burst reads larger than the specified port size,
* including 32-bit reads from 8- and 16-bit ports, 16-bit reads from 8-bit
* ports, and line reads from 8-, 16-, and 32-bit ports.
*/
//@{
#define BP_FB_CSCRn_BSTR (4U) //!< Bit position for FB_CSCRn_BSTR.
#define BM_FB_CSCRn_BSTR (0x00000010U) //!< Bit mask for FB_CSCRn_BSTR.
#define BS_FB_CSCRn_BSTR (1U) //!< Bit field size in bits for FB_CSCRn_BSTR.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_BSTR field.
#define BR_FB_CSCRn_BSTR(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BSTR))
#endif
//! @brief Format value for bitfield FB_CSCRn_BSTR.
#define BF_FB_CSCRn_BSTR(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_BSTR), uint32_t) & BM_FB_CSCRn_BSTR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BSTR field to a new value.
#define BW_FB_CSCRn_BSTR(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BSTR) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field BEM[5] (RW)
*
* Specifies whether the corresponding FB_BE is asserted for read accesses.
* Certain memories have byte enables that must be asserted during reads and writes.
* Write 1b to the BEM bit in the relevant CSCR to provide the appropriate mode
* of byte enable support for these SRAMs.
*
* Values:
* - 0 - FB_BE is asserted for data write only.
* - 1 - FB_BE is asserted for data read and write accesses.
*/
//@{
#define BP_FB_CSCRn_BEM (5U) //!< Bit position for FB_CSCRn_BEM.
#define BM_FB_CSCRn_BEM (0x00000020U) //!< Bit mask for FB_CSCRn_BEM.
#define BS_FB_CSCRn_BEM (1U) //!< Bit field size in bits for FB_CSCRn_BEM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_BEM field.
#define BR_FB_CSCRn_BEM(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BEM))
#endif
//! @brief Format value for bitfield FB_CSCRn_BEM.
#define BF_FB_CSCRn_BEM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_BEM), uint32_t) & BM_FB_CSCRn_BEM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BEM field to a new value.
#define BW_FB_CSCRn_BEM(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BEM) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field PS[7:6] (RW)
*
* Specifies the data port width of the associated chip-select, and determines
* where data is driven during write cycles and where data is sampled during read
* cycles.
*
* Values:
* - 00 - 32-bit port size. Valid data is sampled and driven on FB_D[31:0].
* - 01 - 8-bit port size. Valid data is sampled and driven on FB_D[31:24] when
* BLS is 0b, or FB_D[7:0] when BLS is 1b.
*/
//@{
#define BP_FB_CSCRn_PS (6U) //!< Bit position for FB_CSCRn_PS.
#define BM_FB_CSCRn_PS (0x000000C0U) //!< Bit mask for FB_CSCRn_PS.
#define BS_FB_CSCRn_PS (2U) //!< Bit field size in bits for FB_CSCRn_PS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_PS field.
#define BR_FB_CSCRn_PS(n) (HW_FB_CSCRn(n).B.PS)
#endif
//! @brief Format value for bitfield FB_CSCRn_PS.
#define BF_FB_CSCRn_PS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_PS), uint32_t) & BM_FB_CSCRn_PS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PS field to a new value.
#define BW_FB_CSCRn_PS(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_PS) | BF_FB_CSCRn_PS(v)))
#endif
//@}
/*!
* @name Register FB_CSCRn, field AA[8] (RW)
*
* Asserts the internal transfer acknowledge for accesses specified by the
* chip-select address. If AA is 1b for a corresponding FB_CSn and the external system
* asserts an external FB_TA before the wait-state countdown asserts the
* internal FB_TA, the cycle is terminated. Burst cycles increment the address bus
* between each internal termination. This field must be 1b if CSPMCR disables FB_TA.
*
* Values:
* - 0 - Disabled. No internal transfer acknowledge is asserted and the cycle is
* terminated externally.
* - 1 - Enabled. Internal transfer acknowledge is asserted as specified by WS.
*/
//@{
#define BP_FB_CSCRn_AA (8U) //!< Bit position for FB_CSCRn_AA.
#define BM_FB_CSCRn_AA (0x00000100U) //!< Bit mask for FB_CSCRn_AA.
#define BS_FB_CSCRn_AA (1U) //!< Bit field size in bits for FB_CSCRn_AA.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_AA field.
#define BR_FB_CSCRn_AA(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_AA))
#endif
//! @brief Format value for bitfield FB_CSCRn_AA.
#define BF_FB_CSCRn_AA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_AA), uint32_t) & BM_FB_CSCRn_AA)
#ifndef __LANGUAGE_ASM__
//! @brief Set the AA field to a new value.
#define BW_FB_CSCRn_AA(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_AA) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field BLS[9] (RW)
*
* Specifies if data on FB_AD appears left-aligned or right-aligned during the
* data phase of a FlexBus access.
*
* Values:
* - 0 - Not shifted. Data is left-aligned on FB_AD.
* - 1 - Shifted. Data is right-aligned on FB_AD.
*/
//@{
#define BP_FB_CSCRn_BLS (9U) //!< Bit position for FB_CSCRn_BLS.
#define BM_FB_CSCRn_BLS (0x00000200U) //!< Bit mask for FB_CSCRn_BLS.
#define BS_FB_CSCRn_BLS (1U) //!< Bit field size in bits for FB_CSCRn_BLS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_BLS field.
#define BR_FB_CSCRn_BLS(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BLS))
#endif
//! @brief Format value for bitfield FB_CSCRn_BLS.
#define BF_FB_CSCRn_BLS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_BLS), uint32_t) & BM_FB_CSCRn_BLS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BLS field to a new value.
#define BW_FB_CSCRn_BLS(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_BLS) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field WS[15:10] (RW)
*
* Specifies the number of wait states inserted after FlexBus asserts the
* associated chip-select and before an internal transfer acknowledge is generated (WS
* = 00h inserts 0 wait states, ..., WS = 3Fh inserts 63 wait states).
*/
//@{
#define BP_FB_CSCRn_WS (10U) //!< Bit position for FB_CSCRn_WS.
#define BM_FB_CSCRn_WS (0x0000FC00U) //!< Bit mask for FB_CSCRn_WS.
#define BS_FB_CSCRn_WS (6U) //!< Bit field size in bits for FB_CSCRn_WS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_WS field.
#define BR_FB_CSCRn_WS(n) (HW_FB_CSCRn(n).B.WS)
#endif
//! @brief Format value for bitfield FB_CSCRn_WS.
#define BF_FB_CSCRn_WS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_WS), uint32_t) & BM_FB_CSCRn_WS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WS field to a new value.
#define BW_FB_CSCRn_WS(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_WS) | BF_FB_CSCRn_WS(v)))
#endif
//@}
/*!
* @name Register FB_CSCRn, field WRAH[17:16] (RW)
*
* Controls the address, data, and attribute hold time after the termination of
* a write cycle that hits in the associated chip-select's address space. The
* hold time applies only at the end of a transfer. Therefore, during a burst
* transfer or a transfer to a port size smaller than the transfer size, the hold time
* is only added after the last bus cycle.
*
* Values:
* - 00 - 1 cycle (default for all but FB_CS0 )
* - 01 - 2 cycles
* - 10 - 3 cycles
* - 11 - 4 cycles (default for FB_CS0 )
*/
//@{
#define BP_FB_CSCRn_WRAH (16U) //!< Bit position for FB_CSCRn_WRAH.
#define BM_FB_CSCRn_WRAH (0x00030000U) //!< Bit mask for FB_CSCRn_WRAH.
#define BS_FB_CSCRn_WRAH (2U) //!< Bit field size in bits for FB_CSCRn_WRAH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_WRAH field.
#define BR_FB_CSCRn_WRAH(n) (HW_FB_CSCRn(n).B.WRAH)
#endif
//! @brief Format value for bitfield FB_CSCRn_WRAH.
#define BF_FB_CSCRn_WRAH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_WRAH), uint32_t) & BM_FB_CSCRn_WRAH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WRAH field to a new value.
#define BW_FB_CSCRn_WRAH(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_WRAH) | BF_FB_CSCRn_WRAH(v)))
#endif
//@}
/*!
* @name Register FB_CSCRn, field RDAH[19:18] (RW)
*
* Controls the address and attribute hold time after the termination during a
* read cycle that hits in the associated chip-select's address space. The hold
* time applies only at the end of a transfer. Therefore, during a burst transfer
* or a transfer to a port size smaller than the transfer size, the hold time is
* only added after the last bus cycle. The number of cycles the address and
* attributes are held after FB_CSn deassertion depends on the value of the AA bit.
*
* Values:
* - 00 - When AA is 0b, 1 cycle. When AA is 1b, 0 cycles.
* - 01 - When AA is 0b, 2 cycles. When AA is 1b, 1 cycle.
* - 10 - When AA is 0b, 3 cycles. When AA is 1b, 2 cycles.
* - 11 - When AA is 0b, 4 cycles. When AA is 1b, 3 cycles.
*/
//@{
#define BP_FB_CSCRn_RDAH (18U) //!< Bit position for FB_CSCRn_RDAH.
#define BM_FB_CSCRn_RDAH (0x000C0000U) //!< Bit mask for FB_CSCRn_RDAH.
#define BS_FB_CSCRn_RDAH (2U) //!< Bit field size in bits for FB_CSCRn_RDAH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_RDAH field.
#define BR_FB_CSCRn_RDAH(n) (HW_FB_CSCRn(n).B.RDAH)
#endif
//! @brief Format value for bitfield FB_CSCRn_RDAH.
#define BF_FB_CSCRn_RDAH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_RDAH), uint32_t) & BM_FB_CSCRn_RDAH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RDAH field to a new value.
#define BW_FB_CSCRn_RDAH(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_RDAH) | BF_FB_CSCRn_RDAH(v)))
#endif
//@}
/*!
* @name Register FB_CSCRn, field ASET[21:20] (RW)
*
* Controls when the chip-select is asserted with respect to assertion of a
* valid address and attributes.
*
* Values:
* - 00 - Assert FB_CSn on the first rising clock edge after the address is
* asserted (default for all but FB_CS0 ).
* - 01 - Assert FB_CSn on the second rising clock edge after the address is
* asserted.
* - 10 - Assert FB_CSn on the third rising clock edge after the address is
* asserted.
* - 11 - Assert FB_CSn on the fourth rising clock edge after the address is
* asserted (default for FB_CS0 ).
*/
//@{
#define BP_FB_CSCRn_ASET (20U) //!< Bit position for FB_CSCRn_ASET.
#define BM_FB_CSCRn_ASET (0x00300000U) //!< Bit mask for FB_CSCRn_ASET.
#define BS_FB_CSCRn_ASET (2U) //!< Bit field size in bits for FB_CSCRn_ASET.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_ASET field.
#define BR_FB_CSCRn_ASET(n) (HW_FB_CSCRn(n).B.ASET)
#endif
//! @brief Format value for bitfield FB_CSCRn_ASET.
#define BF_FB_CSCRn_ASET(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_ASET), uint32_t) & BM_FB_CSCRn_ASET)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ASET field to a new value.
#define BW_FB_CSCRn_ASET(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_ASET) | BF_FB_CSCRn_ASET(v)))
#endif
//@}
/*!
* @name Register FB_CSCRn, field EXTS[22] (RW)
*
* Extended Transfer Start/Extended Address Latch Enable Controls how long FB_TS
* /FB_ALE is asserted.
*
* Values:
* - 0 - Disabled. FB_TS /FB_ALE asserts for one bus clock cycle.
* - 1 - Enabled. FB_TS /FB_ALE remains asserted until the first positive clock
* edge after FB_CSn asserts.
*/
//@{
#define BP_FB_CSCRn_EXTS (22U) //!< Bit position for FB_CSCRn_EXTS.
#define BM_FB_CSCRn_EXTS (0x00400000U) //!< Bit mask for FB_CSCRn_EXTS.
#define BS_FB_CSCRn_EXTS (1U) //!< Bit field size in bits for FB_CSCRn_EXTS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_EXTS field.
#define BR_FB_CSCRn_EXTS(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_EXTS))
#endif
//! @brief Format value for bitfield FB_CSCRn_EXTS.
#define BF_FB_CSCRn_EXTS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_EXTS), uint32_t) & BM_FB_CSCRn_EXTS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the EXTS field to a new value.
#define BW_FB_CSCRn_EXTS(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_EXTS) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field SWSEN[23] (RW)
*
* Values:
* - 0 - Disabled. A number of wait states (specified by WS) are inserted before
* an internal transfer acknowledge is generated for all transfers.
* - 1 - Enabled. A number of wait states (specified by SWS) are inserted before
* an internal transfer acknowledge is generated for burst transfer
* secondary terminations.
*/
//@{
#define BP_FB_CSCRn_SWSEN (23U) //!< Bit position for FB_CSCRn_SWSEN.
#define BM_FB_CSCRn_SWSEN (0x00800000U) //!< Bit mask for FB_CSCRn_SWSEN.
#define BS_FB_CSCRn_SWSEN (1U) //!< Bit field size in bits for FB_CSCRn_SWSEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_SWSEN field.
#define BR_FB_CSCRn_SWSEN(n) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_SWSEN))
#endif
//! @brief Format value for bitfield FB_CSCRn_SWSEN.
#define BF_FB_CSCRn_SWSEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_SWSEN), uint32_t) & BM_FB_CSCRn_SWSEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SWSEN field to a new value.
#define BW_FB_CSCRn_SWSEN(n, v) (BITBAND_ACCESS32(HW_FB_CSCRn_ADDR(n), BP_FB_CSCRn_SWSEN) = (v))
#endif
//@}
/*!
* @name Register FB_CSCRn, field SWS[31:26] (RW)
*
* Used only when the SWSEN bit is 1b. Specifies the number of wait states
* inserted before an internal transfer acknowledge is generated for a burst transfer
* (except for the first termination, which is controlled by WS).
*/
//@{
#define BP_FB_CSCRn_SWS (26U) //!< Bit position for FB_CSCRn_SWS.
#define BM_FB_CSCRn_SWS (0xFC000000U) //!< Bit mask for FB_CSCRn_SWS.
#define BS_FB_CSCRn_SWS (6U) //!< Bit field size in bits for FB_CSCRn_SWS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSCRn_SWS field.
#define BR_FB_CSCRn_SWS(n) (HW_FB_CSCRn(n).B.SWS)
#endif
//! @brief Format value for bitfield FB_CSCRn_SWS.
#define BF_FB_CSCRn_SWS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSCRn_SWS), uint32_t) & BM_FB_CSCRn_SWS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SWS field to a new value.
#define BW_FB_CSCRn_SWS(n, v) (HW_FB_CSCRn_WR(n, (HW_FB_CSCRn_RD(n) & ~BM_FB_CSCRn_SWS) | BF_FB_CSCRn_SWS(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_FB_CSPMCR - Chip Select port Multiplexing Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_FB_CSPMCR - Chip Select port Multiplexing Control Register (RW)
*
* Reset value: 0x00000000U
*
* Controls the multiplexing of the FlexBus signals. A bus error occurs when you
* do any of the following: Write to a reserved address Write to a reserved
* field in this register, or Access this register using a size other than 32 bits.
*/
typedef union _hw_fb_cspmcr
{
uint32_t U;
struct _hw_fb_cspmcr_bitfields
{
uint32_t RESERVED0 : 12; //!< [11:0]
uint32_t GROUP5 : 4; //!< [15:12] FlexBus Signal Group 5 Multiplex
//! control
uint32_t GROUP4 : 4; //!< [19:16] FlexBus Signal Group 4 Multiplex
//! control
uint32_t GROUP3 : 4; //!< [23:20] FlexBus Signal Group 3 Multiplex
//! control
uint32_t GROUP2 : 4; //!< [27:24] FlexBus Signal Group 2 Multiplex
//! control
uint32_t GROUP1 : 4; //!< [31:28] FlexBus Signal Group 1 Multiplex
//! control
} B;
} hw_fb_cspmcr_t;
#endif
/*!
* @name Constants and macros for entire FB_CSPMCR register
*/
//@{
#define HW_FB_CSPMCR_ADDR (REGS_FB_BASE + 0x60U)
#ifndef __LANGUAGE_ASM__
#define HW_FB_CSPMCR (*(__IO hw_fb_cspmcr_t *) HW_FB_CSPMCR_ADDR)
#define HW_FB_CSPMCR_RD() (HW_FB_CSPMCR.U)
#define HW_FB_CSPMCR_WR(v) (HW_FB_CSPMCR.U = (v))
#define HW_FB_CSPMCR_SET(v) (HW_FB_CSPMCR_WR(HW_FB_CSPMCR_RD() | (v)))
#define HW_FB_CSPMCR_CLR(v) (HW_FB_CSPMCR_WR(HW_FB_CSPMCR_RD() & ~(v)))
#define HW_FB_CSPMCR_TOG(v) (HW_FB_CSPMCR_WR(HW_FB_CSPMCR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual FB_CSPMCR bitfields
*/
/*!
* @name Register FB_CSPMCR, field GROUP5[15:12] (RW)
*
* Controls the multiplexing of the FB_TA , FB_CS3 , and FB_BE_7_0 signals. When
* GROUP5 is not 0000b, you must write 1b to the CSCR[AA] bit. Otherwise, the
* bus hangs during a transfer.
*
* Values:
* - 0000 - FB_TA
* - 0001 - FB_CS3 . You must also write 1b to CSCR[AA].
* - 0010 - FB_BE_7_0 . You must also write 1b to CSCR[AA].
*/
//@{
#define BP_FB_CSPMCR_GROUP5 (12U) //!< Bit position for FB_CSPMCR_GROUP5.
#define BM_FB_CSPMCR_GROUP5 (0x0000F000U) //!< Bit mask for FB_CSPMCR_GROUP5.
#define BS_FB_CSPMCR_GROUP5 (4U) //!< Bit field size in bits for FB_CSPMCR_GROUP5.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSPMCR_GROUP5 field.
#define BR_FB_CSPMCR_GROUP5 (HW_FB_CSPMCR.B.GROUP5)
#endif
//! @brief Format value for bitfield FB_CSPMCR_GROUP5.
#define BF_FB_CSPMCR_GROUP5(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSPMCR_GROUP5), uint32_t) & BM_FB_CSPMCR_GROUP5)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GROUP5 field to a new value.
#define BW_FB_CSPMCR_GROUP5(v) (HW_FB_CSPMCR_WR((HW_FB_CSPMCR_RD() & ~BM_FB_CSPMCR_GROUP5) | BF_FB_CSPMCR_GROUP5(v)))
#endif
//@}
/*!
* @name Register FB_CSPMCR, field GROUP4[19:16] (RW)
*
* Controls the multiplexing of the FB_TBST , FB_CS2 , and FB_BE_15_8 signals.
*
* Values:
* - 0000 - FB_TBST
* - 0001 - FB_CS2
* - 0010 - FB_BE_15_8
*/
//@{
#define BP_FB_CSPMCR_GROUP4 (16U) //!< Bit position for FB_CSPMCR_GROUP4.
#define BM_FB_CSPMCR_GROUP4 (0x000F0000U) //!< Bit mask for FB_CSPMCR_GROUP4.
#define BS_FB_CSPMCR_GROUP4 (4U) //!< Bit field size in bits for FB_CSPMCR_GROUP4.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSPMCR_GROUP4 field.
#define BR_FB_CSPMCR_GROUP4 (HW_FB_CSPMCR.B.GROUP4)
#endif
//! @brief Format value for bitfield FB_CSPMCR_GROUP4.
#define BF_FB_CSPMCR_GROUP4(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSPMCR_GROUP4), uint32_t) & BM_FB_CSPMCR_GROUP4)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GROUP4 field to a new value.
#define BW_FB_CSPMCR_GROUP4(v) (HW_FB_CSPMCR_WR((HW_FB_CSPMCR_RD() & ~BM_FB_CSPMCR_GROUP4) | BF_FB_CSPMCR_GROUP4(v)))
#endif
//@}
/*!
* @name Register FB_CSPMCR, field GROUP3[23:20] (RW)
*
* Controls the multiplexing of the FB_CS5 , FB_TSIZ1, and FB_BE_23_16 signals.
*
* Values:
* - 0000 - FB_CS5
* - 0001 - FB_TSIZ1
* - 0010 - FB_BE_23_16
*/
//@{
#define BP_FB_CSPMCR_GROUP3 (20U) //!< Bit position for FB_CSPMCR_GROUP3.
#define BM_FB_CSPMCR_GROUP3 (0x00F00000U) //!< Bit mask for FB_CSPMCR_GROUP3.
#define BS_FB_CSPMCR_GROUP3 (4U) //!< Bit field size in bits for FB_CSPMCR_GROUP3.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSPMCR_GROUP3 field.
#define BR_FB_CSPMCR_GROUP3 (HW_FB_CSPMCR.B.GROUP3)
#endif
//! @brief Format value for bitfield FB_CSPMCR_GROUP3.
#define BF_FB_CSPMCR_GROUP3(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSPMCR_GROUP3), uint32_t) & BM_FB_CSPMCR_GROUP3)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GROUP3 field to a new value.
#define BW_FB_CSPMCR_GROUP3(v) (HW_FB_CSPMCR_WR((HW_FB_CSPMCR_RD() & ~BM_FB_CSPMCR_GROUP3) | BF_FB_CSPMCR_GROUP3(v)))
#endif
//@}
/*!
* @name Register FB_CSPMCR, field GROUP2[27:24] (RW)
*
* Controls the multiplexing of the FB_CS4 , FB_TSIZ0, and FB_BE_31_24 signals.
*
* Values:
* - 0000 - FB_CS4
* - 0001 - FB_TSIZ0
* - 0010 - FB_BE_31_24
*/
//@{
#define BP_FB_CSPMCR_GROUP2 (24U) //!< Bit position for FB_CSPMCR_GROUP2.
#define BM_FB_CSPMCR_GROUP2 (0x0F000000U) //!< Bit mask for FB_CSPMCR_GROUP2.
#define BS_FB_CSPMCR_GROUP2 (4U) //!< Bit field size in bits for FB_CSPMCR_GROUP2.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSPMCR_GROUP2 field.
#define BR_FB_CSPMCR_GROUP2 (HW_FB_CSPMCR.B.GROUP2)
#endif
//! @brief Format value for bitfield FB_CSPMCR_GROUP2.
#define BF_FB_CSPMCR_GROUP2(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSPMCR_GROUP2), uint32_t) & BM_FB_CSPMCR_GROUP2)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GROUP2 field to a new value.
#define BW_FB_CSPMCR_GROUP2(v) (HW_FB_CSPMCR_WR((HW_FB_CSPMCR_RD() & ~BM_FB_CSPMCR_GROUP2) | BF_FB_CSPMCR_GROUP2(v)))
#endif
//@}
/*!
* @name Register FB_CSPMCR, field GROUP1[31:28] (RW)
*
* Controls the multiplexing of the FB_ALE, FB_CS1 , and FB_TS signals.
*
* Values:
* - 0000 - FB_ALE
* - 0001 - FB_CS1
* - 0010 - FB_TS
*/
//@{
#define BP_FB_CSPMCR_GROUP1 (28U) //!< Bit position for FB_CSPMCR_GROUP1.
#define BM_FB_CSPMCR_GROUP1 (0xF0000000U) //!< Bit mask for FB_CSPMCR_GROUP1.
#define BS_FB_CSPMCR_GROUP1 (4U) //!< Bit field size in bits for FB_CSPMCR_GROUP1.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the FB_CSPMCR_GROUP1 field.
#define BR_FB_CSPMCR_GROUP1 (HW_FB_CSPMCR.B.GROUP1)
#endif
//! @brief Format value for bitfield FB_CSPMCR_GROUP1.
#define BF_FB_CSPMCR_GROUP1(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_FB_CSPMCR_GROUP1), uint32_t) & BM_FB_CSPMCR_GROUP1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GROUP1 field to a new value.
#define BW_FB_CSPMCR_GROUP1(v) (HW_FB_CSPMCR_WR((HW_FB_CSPMCR_RD() & ~BM_FB_CSPMCR_GROUP1) | BF_FB_CSPMCR_GROUP1(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_fb_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All FB module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_fb
{
struct {
__IO hw_fb_csarn_t CSARn; //!< [0x0] Chip Select Address Register
__IO hw_fb_csmrn_t CSMRn; //!< [0x4] Chip Select Mask Register
__IO hw_fb_cscrn_t CSCRn; //!< [0x8] Chip Select Control Register
} CS[6];
uint8_t _reserved0[24];
__IO hw_fb_cspmcr_t CSPMCR; //!< [0x60] Chip Select port Multiplexing Control Register
} hw_fb_t;
#pragma pack()
//! @brief Macro to access all FB registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_FB</code>.
#define HW_FB (*(hw_fb_t *) REGS_FB_BASE)
#endif
#endif // __HW_FB_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,500 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_GPIO_REGISTERS_H__
#define __HW_GPIO_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 GPIO
*
* General Purpose Input/Output
*
* Registers defined in this header file:
* - HW_GPIO_PDOR - Port Data Output Register
* - HW_GPIO_PSOR - Port Set Output Register
* - HW_GPIO_PCOR - Port Clear Output Register
* - HW_GPIO_PTOR - Port Toggle Output Register
* - HW_GPIO_PDIR - Port Data Input Register
* - HW_GPIO_PDDR - Port Data Direction Register
*
* - hw_gpio_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_GPIO_BASE
#define HW_GPIO_INSTANCE_COUNT (5U) //!< Number of instances of the GPIO module.
#define HW_GPIOA (0U) //!< Instance number for GPIOA.
#define HW_GPIOB (1U) //!< Instance number for GPIOB.
#define HW_GPIOC (2U) //!< Instance number for GPIOC.
#define HW_GPIOD (3U) //!< Instance number for GPIOD.
#define HW_GPIOE (4U) //!< Instance number for GPIOE.
#define REGS_GPIOA_BASE (0x400FF000U) //!< Base address for GPIOA.
#define REGS_GPIOB_BASE (0x400FF040U) //!< Base address for GPIOB.
#define REGS_GPIOC_BASE (0x400FF080U) //!< Base address for GPIOC.
#define REGS_GPIOD_BASE (0x400FF0C0U) //!< Base address for GPIOD.
#define REGS_GPIOE_BASE (0x400FF100U) //!< Base address for GPIOE.
//! @brief Table of base addresses for GPIO instances.
static const uint32_t __g_regs_GPIO_base_addresses[] = {
REGS_GPIOA_BASE,
REGS_GPIOB_BASE,
REGS_GPIOC_BASE,
REGS_GPIOD_BASE,
REGS_GPIOE_BASE,
};
//! @brief Get the base address of GPIO by instance number.
//! @param x GPIO instance number, from 0 through 4.
#define REGS_GPIO_BASE(x) (__g_regs_GPIO_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of GPIO.
#define REGS_GPIO_INSTANCE(b) ((b) == REGS_GPIOA_BASE ? HW_GPIOA : (b) == REGS_GPIOB_BASE ? HW_GPIOB : (b) == REGS_GPIOC_BASE ? HW_GPIOC : (b) == REGS_GPIOD_BASE ? HW_GPIOD : (b) == REGS_GPIOE_BASE ? HW_GPIOE : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PDOR - Port Data Output Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PDOR - Port Data Output Register (RW)
*
* Reset value: 0x00000000U
*
* This register configures the logic levels that are driven on each
* general-purpose output pins. Do not modify pin configuration registers associated with
* pins not available in your selected package. All unbonded pins not available in
* your package will default to DISABLE state for lowest power consumption.
*/
typedef union _hw_gpio_pdor
{
uint32_t U;
struct _hw_gpio_pdor_bitfields
{
uint32_t PDO : 32; //!< [31:0] Port Data Output
} B;
} hw_gpio_pdor_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PDOR register
*/
//@{
#define HW_GPIO_PDOR_ADDR(x) (REGS_GPIO_BASE(x) + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PDOR(x) (*(__IO hw_gpio_pdor_t *) HW_GPIO_PDOR_ADDR(x))
#define HW_GPIO_PDOR_RD(x) (HW_GPIO_PDOR(x).U)
#define HW_GPIO_PDOR_WR(x, v) (HW_GPIO_PDOR(x).U = (v))
#define HW_GPIO_PDOR_SET(x, v) (HW_GPIO_PDOR_WR(x, HW_GPIO_PDOR_RD(x) | (v)))
#define HW_GPIO_PDOR_CLR(x, v) (HW_GPIO_PDOR_WR(x, HW_GPIO_PDOR_RD(x) & ~(v)))
#define HW_GPIO_PDOR_TOG(x, v) (HW_GPIO_PDOR_WR(x, HW_GPIO_PDOR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual GPIO_PDOR bitfields
*/
/*!
* @name Register GPIO_PDOR, field PDO[31:0] (RW)
*
* Register bits for unbonded pins return a undefined value when read.
*
* Values:
* - 0 - Logic level 0 is driven on pin, provided pin is configured for
* general-purpose output.
* - 1 - Logic level 1 is driven on pin, provided pin is configured for
* general-purpose output.
*/
//@{
#define BP_GPIO_PDOR_PDO (0U) //!< Bit position for GPIO_PDOR_PDO.
#define BM_GPIO_PDOR_PDO (0xFFFFFFFFU) //!< Bit mask for GPIO_PDOR_PDO.
#define BS_GPIO_PDOR_PDO (32U) //!< Bit field size in bits for GPIO_PDOR_PDO.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the GPIO_PDOR_PDO field.
#define BR_GPIO_PDOR_PDO(x) (HW_GPIO_PDOR(x).U)
#endif
//! @brief Format value for bitfield GPIO_PDOR_PDO.
#define BF_GPIO_PDOR_PDO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_GPIO_PDOR_PDO), uint32_t) & BM_GPIO_PDOR_PDO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PDO field to a new value.
#define BW_GPIO_PDOR_PDO(x, v) (HW_GPIO_PDOR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PSOR - Port Set Output Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PSOR - Port Set Output Register (WORZ)
*
* Reset value: 0x00000000U
*
* This register configures whether to set the fields of the PDOR.
*/
typedef union _hw_gpio_psor
{
uint32_t U;
struct _hw_gpio_psor_bitfields
{
uint32_t PTSO : 32; //!< [31:0] Port Set Output
} B;
} hw_gpio_psor_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PSOR register
*/
//@{
#define HW_GPIO_PSOR_ADDR(x) (REGS_GPIO_BASE(x) + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PSOR(x) (*(__O hw_gpio_psor_t *) HW_GPIO_PSOR_ADDR(x))
#define HW_GPIO_PSOR_RD(x) (HW_GPIO_PSOR(x).U)
#define HW_GPIO_PSOR_WR(x, v) (HW_GPIO_PSOR(x).U = (v))
#endif
//@}
/*
* Constants & macros for individual GPIO_PSOR bitfields
*/
/*!
* @name Register GPIO_PSOR, field PTSO[31:0] (WORZ)
*
* Writing to this register will update the contents of the corresponding bit in
* the PDOR as follows:
*
* Values:
* - 0 - Corresponding bit in PDORn does not change.
* - 1 - Corresponding bit in PDORn is set to logic 1.
*/
//@{
#define BP_GPIO_PSOR_PTSO (0U) //!< Bit position for GPIO_PSOR_PTSO.
#define BM_GPIO_PSOR_PTSO (0xFFFFFFFFU) //!< Bit mask for GPIO_PSOR_PTSO.
#define BS_GPIO_PSOR_PTSO (32U) //!< Bit field size in bits for GPIO_PSOR_PTSO.
//! @brief Format value for bitfield GPIO_PSOR_PTSO.
#define BF_GPIO_PSOR_PTSO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_GPIO_PSOR_PTSO), uint32_t) & BM_GPIO_PSOR_PTSO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PTSO field to a new value.
#define BW_GPIO_PSOR_PTSO(x, v) (HW_GPIO_PSOR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PCOR - Port Clear Output Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PCOR - Port Clear Output Register (WORZ)
*
* Reset value: 0x00000000U
*
* This register configures whether to clear the fields of PDOR.
*/
typedef union _hw_gpio_pcor
{
uint32_t U;
struct _hw_gpio_pcor_bitfields
{
uint32_t PTCO : 32; //!< [31:0] Port Clear Output
} B;
} hw_gpio_pcor_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PCOR register
*/
//@{
#define HW_GPIO_PCOR_ADDR(x) (REGS_GPIO_BASE(x) + 0x8U)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PCOR(x) (*(__O hw_gpio_pcor_t *) HW_GPIO_PCOR_ADDR(x))
#define HW_GPIO_PCOR_RD(x) (HW_GPIO_PCOR(x).U)
#define HW_GPIO_PCOR_WR(x, v) (HW_GPIO_PCOR(x).U = (v))
#endif
//@}
/*
* Constants & macros for individual GPIO_PCOR bitfields
*/
/*!
* @name Register GPIO_PCOR, field PTCO[31:0] (WORZ)
*
* Writing to this register will update the contents of the corresponding bit in
* the Port Data Output Register (PDOR) as follows:
*
* Values:
* - 0 - Corresponding bit in PDORn does not change.
* - 1 - Corresponding bit in PDORn is cleared to logic 0.
*/
//@{
#define BP_GPIO_PCOR_PTCO (0U) //!< Bit position for GPIO_PCOR_PTCO.
#define BM_GPIO_PCOR_PTCO (0xFFFFFFFFU) //!< Bit mask for GPIO_PCOR_PTCO.
#define BS_GPIO_PCOR_PTCO (32U) //!< Bit field size in bits for GPIO_PCOR_PTCO.
//! @brief Format value for bitfield GPIO_PCOR_PTCO.
#define BF_GPIO_PCOR_PTCO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_GPIO_PCOR_PTCO), uint32_t) & BM_GPIO_PCOR_PTCO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PTCO field to a new value.
#define BW_GPIO_PCOR_PTCO(x, v) (HW_GPIO_PCOR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PTOR - Port Toggle Output Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PTOR - Port Toggle Output Register (WORZ)
*
* Reset value: 0x00000000U
*/
typedef union _hw_gpio_ptor
{
uint32_t U;
struct _hw_gpio_ptor_bitfields
{
uint32_t PTTO : 32; //!< [31:0] Port Toggle Output
} B;
} hw_gpio_ptor_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PTOR register
*/
//@{
#define HW_GPIO_PTOR_ADDR(x) (REGS_GPIO_BASE(x) + 0xCU)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PTOR(x) (*(__O hw_gpio_ptor_t *) HW_GPIO_PTOR_ADDR(x))
#define HW_GPIO_PTOR_RD(x) (HW_GPIO_PTOR(x).U)
#define HW_GPIO_PTOR_WR(x, v) (HW_GPIO_PTOR(x).U = (v))
#endif
//@}
/*
* Constants & macros for individual GPIO_PTOR bitfields
*/
/*!
* @name Register GPIO_PTOR, field PTTO[31:0] (WORZ)
*
* Writing to this register will update the contents of the corresponding bit in
* the PDOR as follows:
*
* Values:
* - 0 - Corresponding bit in PDORn does not change.
* - 1 - Corresponding bit in PDORn is set to the inverse of its existing logic
* state.
*/
//@{
#define BP_GPIO_PTOR_PTTO (0U) //!< Bit position for GPIO_PTOR_PTTO.
#define BM_GPIO_PTOR_PTTO (0xFFFFFFFFU) //!< Bit mask for GPIO_PTOR_PTTO.
#define BS_GPIO_PTOR_PTTO (32U) //!< Bit field size in bits for GPIO_PTOR_PTTO.
//! @brief Format value for bitfield GPIO_PTOR_PTTO.
#define BF_GPIO_PTOR_PTTO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_GPIO_PTOR_PTTO), uint32_t) & BM_GPIO_PTOR_PTTO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PTTO field to a new value.
#define BW_GPIO_PTOR_PTTO(x, v) (HW_GPIO_PTOR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PDIR - Port Data Input Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PDIR - Port Data Input Register (RO)
*
* Reset value: 0x00000000U
*
* Do not modify pin configuration registers associated with pins not available
* in your selected package. All unbonded pins not available in your package will
* default to DISABLE state for lowest power consumption.
*/
typedef union _hw_gpio_pdir
{
uint32_t U;
struct _hw_gpio_pdir_bitfields
{
uint32_t PDI : 32; //!< [31:0] Port Data Input
} B;
} hw_gpio_pdir_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PDIR register
*/
//@{
#define HW_GPIO_PDIR_ADDR(x) (REGS_GPIO_BASE(x) + 0x10U)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PDIR(x) (*(__I hw_gpio_pdir_t *) HW_GPIO_PDIR_ADDR(x))
#define HW_GPIO_PDIR_RD(x) (HW_GPIO_PDIR(x).U)
#endif
//@}
/*
* Constants & macros for individual GPIO_PDIR bitfields
*/
/*!
* @name Register GPIO_PDIR, field PDI[31:0] (RO)
*
* Reads 0 at the unimplemented pins for a particular device. Pins that are not
* configured for a digital function read 0. If the Port Control and Interrupt
* module is disabled, then the corresponding bit in PDIR does not update.
*
* Values:
* - 0 - Pin logic level is logic 0, or is not configured for use by digital
* function.
* - 1 - Pin logic level is logic 1.
*/
//@{
#define BP_GPIO_PDIR_PDI (0U) //!< Bit position for GPIO_PDIR_PDI.
#define BM_GPIO_PDIR_PDI (0xFFFFFFFFU) //!< Bit mask for GPIO_PDIR_PDI.
#define BS_GPIO_PDIR_PDI (32U) //!< Bit field size in bits for GPIO_PDIR_PDI.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the GPIO_PDIR_PDI field.
#define BR_GPIO_PDIR_PDI(x) (HW_GPIO_PDIR(x).U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_GPIO_PDDR - Port Data Direction Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_GPIO_PDDR - Port Data Direction Register (RW)
*
* Reset value: 0x00000000U
*
* The PDDR configures the individual port pins for input or output.
*/
typedef union _hw_gpio_pddr
{
uint32_t U;
struct _hw_gpio_pddr_bitfields
{
uint32_t PDD : 32; //!< [31:0] Port Data Direction
} B;
} hw_gpio_pddr_t;
#endif
/*!
* @name Constants and macros for entire GPIO_PDDR register
*/
//@{
#define HW_GPIO_PDDR_ADDR(x) (REGS_GPIO_BASE(x) + 0x14U)
#ifndef __LANGUAGE_ASM__
#define HW_GPIO_PDDR(x) (*(__IO hw_gpio_pddr_t *) HW_GPIO_PDDR_ADDR(x))
#define HW_GPIO_PDDR_RD(x) (HW_GPIO_PDDR(x).U)
#define HW_GPIO_PDDR_WR(x, v) (HW_GPIO_PDDR(x).U = (v))
#define HW_GPIO_PDDR_SET(x, v) (HW_GPIO_PDDR_WR(x, HW_GPIO_PDDR_RD(x) | (v)))
#define HW_GPIO_PDDR_CLR(x, v) (HW_GPIO_PDDR_WR(x, HW_GPIO_PDDR_RD(x) & ~(v)))
#define HW_GPIO_PDDR_TOG(x, v) (HW_GPIO_PDDR_WR(x, HW_GPIO_PDDR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual GPIO_PDDR bitfields
*/
/*!
* @name Register GPIO_PDDR, field PDD[31:0] (RW)
*
* Configures individual port pins for input or output.
*
* Values:
* - 0 - Pin is configured as general-purpose input, for the GPIO function.
* - 1 - Pin is configured as general-purpose output, for the GPIO function.
*/
//@{
#define BP_GPIO_PDDR_PDD (0U) //!< Bit position for GPIO_PDDR_PDD.
#define BM_GPIO_PDDR_PDD (0xFFFFFFFFU) //!< Bit mask for GPIO_PDDR_PDD.
#define BS_GPIO_PDDR_PDD (32U) //!< Bit field size in bits for GPIO_PDDR_PDD.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the GPIO_PDDR_PDD field.
#define BR_GPIO_PDDR_PDD(x) (HW_GPIO_PDDR(x).U)
#endif
//! @brief Format value for bitfield GPIO_PDDR_PDD.
#define BF_GPIO_PDDR_PDD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_GPIO_PDDR_PDD), uint32_t) & BM_GPIO_PDDR_PDD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PDD field to a new value.
#define BW_GPIO_PDDR_PDD(x, v) (HW_GPIO_PDDR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_gpio_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All GPIO module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_gpio
{
__IO hw_gpio_pdor_t PDOR; //!< [0x0] Port Data Output Register
__O hw_gpio_psor_t PSOR; //!< [0x4] Port Set Output Register
__O hw_gpio_pcor_t PCOR; //!< [0x8] Port Clear Output Register
__O hw_gpio_ptor_t PTOR; //!< [0xC] Port Toggle Output Register
__I hw_gpio_pdir_t PDIR; //!< [0x10] Port Data Input Register
__IO hw_gpio_pddr_t PDDR; //!< [0x14] Port Data Direction Register
} hw_gpio_t;
#pragma pack()
//! @brief Macro to access all GPIO registers.
//! @param x GPIO instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_GPIO(0)</code>.
#define HW_GPIO(x) (*(hw_gpio_t *) REGS_GPIO_BASE(x))
#endif
#endif // __HW_GPIO_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,629 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_LPTMR_REGISTERS_H__
#define __HW_LPTMR_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 LPTMR
*
* Low Power Timer
*
* Registers defined in this header file:
* - HW_LPTMR_CSR - Low Power Timer Control Status Register
* - HW_LPTMR_PSR - Low Power Timer Prescale Register
* - HW_LPTMR_CMR - Low Power Timer Compare Register
* - HW_LPTMR_CNR - Low Power Timer Counter Register
*
* - hw_lptmr_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_LPTMR_BASE
#define HW_LPTMR_INSTANCE_COUNT (1U) //!< Number of instances of the LPTMR module.
#define REGS_LPTMR_BASE (0x40040000U) //!< Base address for LPTMR0.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_LPTMR_CSR - Low Power Timer Control Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_LPTMR_CSR - Low Power Timer Control Status Register (RW)
*
* Reset value: 0x00000000U
*/
typedef union _hw_lptmr_csr
{
uint32_t U;
struct _hw_lptmr_csr_bitfields
{
uint32_t TEN : 1; //!< [0] Timer Enable
uint32_t TMS : 1; //!< [1] Timer Mode Select
uint32_t TFC : 1; //!< [2] Timer Free-Running Counter
uint32_t TPP : 1; //!< [3] Timer Pin Polarity
uint32_t TPS : 2; //!< [5:4] Timer Pin Select
uint32_t TIE : 1; //!< [6] Timer Interrupt Enable
uint32_t TCF : 1; //!< [7] Timer Compare Flag
uint32_t RESERVED0 : 24; //!< [31:8]
} B;
} hw_lptmr_csr_t;
#endif
/*!
* @name Constants and macros for entire LPTMR_CSR register
*/
//@{
#define HW_LPTMR_CSR_ADDR (REGS_LPTMR_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_LPTMR_CSR (*(__IO hw_lptmr_csr_t *) HW_LPTMR_CSR_ADDR)
#define HW_LPTMR_CSR_RD() (HW_LPTMR_CSR.U)
#define HW_LPTMR_CSR_WR(v) (HW_LPTMR_CSR.U = (v))
#define HW_LPTMR_CSR_SET(v) (HW_LPTMR_CSR_WR(HW_LPTMR_CSR_RD() | (v)))
#define HW_LPTMR_CSR_CLR(v) (HW_LPTMR_CSR_WR(HW_LPTMR_CSR_RD() & ~(v)))
#define HW_LPTMR_CSR_TOG(v) (HW_LPTMR_CSR_WR(HW_LPTMR_CSR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual LPTMR_CSR bitfields
*/
/*!
* @name Register LPTMR_CSR, field TEN[0] (RW)
*
* When TEN is clear, it resets the LPTMR internal logic, including the CNR and
* TCF. When TEN is set, the LPTMR is enabled. While writing 1 to this field,
* CSR[5:1] must not be altered.
*
* Values:
* - 0 - LPTMR is disabled and internal logic is reset.
* - 1 - LPTMR is enabled.
*/
//@{
#define BP_LPTMR_CSR_TEN (0U) //!< Bit position for LPTMR_CSR_TEN.
#define BM_LPTMR_CSR_TEN (0x00000001U) //!< Bit mask for LPTMR_CSR_TEN.
#define BS_LPTMR_CSR_TEN (1U) //!< Bit field size in bits for LPTMR_CSR_TEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TEN field.
#define BR_LPTMR_CSR_TEN (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TEN))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TEN.
#define BF_LPTMR_CSR_TEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TEN), uint32_t) & BM_LPTMR_CSR_TEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TEN field to a new value.
#define BW_LPTMR_CSR_TEN(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TEN) = (v))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TMS[1] (RW)
*
* Configures the mode of the LPTMR. TMS must be altered only when the LPTMR is
* disabled.
*
* Values:
* - 0 - Time Counter mode.
* - 1 - Pulse Counter mode.
*/
//@{
#define BP_LPTMR_CSR_TMS (1U) //!< Bit position for LPTMR_CSR_TMS.
#define BM_LPTMR_CSR_TMS (0x00000002U) //!< Bit mask for LPTMR_CSR_TMS.
#define BS_LPTMR_CSR_TMS (1U) //!< Bit field size in bits for LPTMR_CSR_TMS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TMS field.
#define BR_LPTMR_CSR_TMS (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TMS))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TMS.
#define BF_LPTMR_CSR_TMS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TMS), uint32_t) & BM_LPTMR_CSR_TMS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TMS field to a new value.
#define BW_LPTMR_CSR_TMS(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TMS) = (v))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TFC[2] (RW)
*
* When clear, TFC configures the CNR to reset whenever TCF is set. When set,
* TFC configures the CNR to reset on overflow. TFC must be altered only when the
* LPTMR is disabled.
*
* Values:
* - 0 - CNR is reset whenever TCF is set.
* - 1 - CNR is reset on overflow.
*/
//@{
#define BP_LPTMR_CSR_TFC (2U) //!< Bit position for LPTMR_CSR_TFC.
#define BM_LPTMR_CSR_TFC (0x00000004U) //!< Bit mask for LPTMR_CSR_TFC.
#define BS_LPTMR_CSR_TFC (1U) //!< Bit field size in bits for LPTMR_CSR_TFC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TFC field.
#define BR_LPTMR_CSR_TFC (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TFC))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TFC.
#define BF_LPTMR_CSR_TFC(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TFC), uint32_t) & BM_LPTMR_CSR_TFC)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFC field to a new value.
#define BW_LPTMR_CSR_TFC(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TFC) = (v))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TPP[3] (RW)
*
* Configures the polarity of the input source in Pulse Counter mode. TPP must
* be changed only when the LPTMR is disabled.
*
* Values:
* - 0 - Pulse Counter input source is active-high, and the CNR will increment
* on the rising-edge.
* - 1 - Pulse Counter input source is active-low, and the CNR will increment on
* the falling-edge.
*/
//@{
#define BP_LPTMR_CSR_TPP (3U) //!< Bit position for LPTMR_CSR_TPP.
#define BM_LPTMR_CSR_TPP (0x00000008U) //!< Bit mask for LPTMR_CSR_TPP.
#define BS_LPTMR_CSR_TPP (1U) //!< Bit field size in bits for LPTMR_CSR_TPP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TPP field.
#define BR_LPTMR_CSR_TPP (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TPP))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TPP.
#define BF_LPTMR_CSR_TPP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TPP), uint32_t) & BM_LPTMR_CSR_TPP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TPP field to a new value.
#define BW_LPTMR_CSR_TPP(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TPP) = (v))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TPS[5:4] (RW)
*
* Configures the input source to be used in Pulse Counter mode. TPS must be
* altered only when the LPTMR is disabled. The input connections vary by device.
* See the chip configuration details for information on the connections to these
* inputs.
*
* Values:
* - 00 - Pulse counter input 0 is selected.
* - 01 - Pulse counter input 1 is selected.
* - 10 - Pulse counter input 2 is selected.
* - 11 - Pulse counter input 3 is selected.
*/
//@{
#define BP_LPTMR_CSR_TPS (4U) //!< Bit position for LPTMR_CSR_TPS.
#define BM_LPTMR_CSR_TPS (0x00000030U) //!< Bit mask for LPTMR_CSR_TPS.
#define BS_LPTMR_CSR_TPS (2U) //!< Bit field size in bits for LPTMR_CSR_TPS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TPS field.
#define BR_LPTMR_CSR_TPS (HW_LPTMR_CSR.B.TPS)
#endif
//! @brief Format value for bitfield LPTMR_CSR_TPS.
#define BF_LPTMR_CSR_TPS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TPS), uint32_t) & BM_LPTMR_CSR_TPS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TPS field to a new value.
#define BW_LPTMR_CSR_TPS(v) (HW_LPTMR_CSR_WR((HW_LPTMR_CSR_RD() & ~BM_LPTMR_CSR_TPS) | BF_LPTMR_CSR_TPS(v)))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TIE[6] (RW)
*
* When TIE is set, the LPTMR Interrupt is generated whenever TCF is also set.
*
* Values:
* - 0 - Timer interrupt disabled.
* - 1 - Timer interrupt enabled.
*/
//@{
#define BP_LPTMR_CSR_TIE (6U) //!< Bit position for LPTMR_CSR_TIE.
#define BM_LPTMR_CSR_TIE (0x00000040U) //!< Bit mask for LPTMR_CSR_TIE.
#define BS_LPTMR_CSR_TIE (1U) //!< Bit field size in bits for LPTMR_CSR_TIE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TIE field.
#define BR_LPTMR_CSR_TIE (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TIE))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TIE.
#define BF_LPTMR_CSR_TIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TIE), uint32_t) & BM_LPTMR_CSR_TIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TIE field to a new value.
#define BW_LPTMR_CSR_TIE(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TIE) = (v))
#endif
//@}
/*!
* @name Register LPTMR_CSR, field TCF[7] (W1C)
*
* TCF is set when the LPTMR is enabled and the CNR equals the CMR and
* increments. TCF is cleared when the LPTMR is disabled or a logic 1 is written to it.
*
* Values:
* - 0 - The value of CNR is not equal to CMR and increments.
* - 1 - The value of CNR is equal to CMR and increments.
*/
//@{
#define BP_LPTMR_CSR_TCF (7U) //!< Bit position for LPTMR_CSR_TCF.
#define BM_LPTMR_CSR_TCF (0x00000080U) //!< Bit mask for LPTMR_CSR_TCF.
#define BS_LPTMR_CSR_TCF (1U) //!< Bit field size in bits for LPTMR_CSR_TCF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CSR_TCF field.
#define BR_LPTMR_CSR_TCF (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TCF))
#endif
//! @brief Format value for bitfield LPTMR_CSR_TCF.
#define BF_LPTMR_CSR_TCF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CSR_TCF), uint32_t) & BM_LPTMR_CSR_TCF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TCF field to a new value.
#define BW_LPTMR_CSR_TCF(v) (BITBAND_ACCESS32(HW_LPTMR_CSR_ADDR, BP_LPTMR_CSR_TCF) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_LPTMR_PSR - Low Power Timer Prescale Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_LPTMR_PSR - Low Power Timer Prescale Register (RW)
*
* Reset value: 0x00000000U
*/
typedef union _hw_lptmr_psr
{
uint32_t U;
struct _hw_lptmr_psr_bitfields
{
uint32_t PCS : 2; //!< [1:0] Prescaler Clock Select
uint32_t PBYP : 1; //!< [2] Prescaler Bypass
uint32_t PRESCALE : 4; //!< [6:3] Prescale Value
uint32_t RESERVED0 : 25; //!< [31:7]
} B;
} hw_lptmr_psr_t;
#endif
/*!
* @name Constants and macros for entire LPTMR_PSR register
*/
//@{
#define HW_LPTMR_PSR_ADDR (REGS_LPTMR_BASE + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_LPTMR_PSR (*(__IO hw_lptmr_psr_t *) HW_LPTMR_PSR_ADDR)
#define HW_LPTMR_PSR_RD() (HW_LPTMR_PSR.U)
#define HW_LPTMR_PSR_WR(v) (HW_LPTMR_PSR.U = (v))
#define HW_LPTMR_PSR_SET(v) (HW_LPTMR_PSR_WR(HW_LPTMR_PSR_RD() | (v)))
#define HW_LPTMR_PSR_CLR(v) (HW_LPTMR_PSR_WR(HW_LPTMR_PSR_RD() & ~(v)))
#define HW_LPTMR_PSR_TOG(v) (HW_LPTMR_PSR_WR(HW_LPTMR_PSR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual LPTMR_PSR bitfields
*/
/*!
* @name Register LPTMR_PSR, field PCS[1:0] (RW)
*
* Selects the clock to be used by the LPTMR prescaler/glitch filter. PCS must
* be altered only when the LPTMR is disabled. The clock connections vary by
* device. See the chip configuration details for information on the connections to
* these inputs.
*
* Values:
* - 00 - Prescaler/glitch filter clock 0 selected.
* - 01 - Prescaler/glitch filter clock 1 selected.
* - 10 - Prescaler/glitch filter clock 2 selected.
* - 11 - Prescaler/glitch filter clock 3 selected.
*/
//@{
#define BP_LPTMR_PSR_PCS (0U) //!< Bit position for LPTMR_PSR_PCS.
#define BM_LPTMR_PSR_PCS (0x00000003U) //!< Bit mask for LPTMR_PSR_PCS.
#define BS_LPTMR_PSR_PCS (2U) //!< Bit field size in bits for LPTMR_PSR_PCS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_PSR_PCS field.
#define BR_LPTMR_PSR_PCS (HW_LPTMR_PSR.B.PCS)
#endif
//! @brief Format value for bitfield LPTMR_PSR_PCS.
#define BF_LPTMR_PSR_PCS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_PSR_PCS), uint32_t) & BM_LPTMR_PSR_PCS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PCS field to a new value.
#define BW_LPTMR_PSR_PCS(v) (HW_LPTMR_PSR_WR((HW_LPTMR_PSR_RD() & ~BM_LPTMR_PSR_PCS) | BF_LPTMR_PSR_PCS(v)))
#endif
//@}
/*!
* @name Register LPTMR_PSR, field PBYP[2] (RW)
*
* When PBYP is set, the selected prescaler clock in Time Counter mode or
* selected input source in Pulse Counter mode directly clocks the CNR. When PBYP is
* clear, the CNR is clocked by the output of the prescaler/glitch filter. PBYP
* must be altered only when the LPTMR is disabled.
*
* Values:
* - 0 - Prescaler/glitch filter is enabled.
* - 1 - Prescaler/glitch filter is bypassed.
*/
//@{
#define BP_LPTMR_PSR_PBYP (2U) //!< Bit position for LPTMR_PSR_PBYP.
#define BM_LPTMR_PSR_PBYP (0x00000004U) //!< Bit mask for LPTMR_PSR_PBYP.
#define BS_LPTMR_PSR_PBYP (1U) //!< Bit field size in bits for LPTMR_PSR_PBYP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_PSR_PBYP field.
#define BR_LPTMR_PSR_PBYP (BITBAND_ACCESS32(HW_LPTMR_PSR_ADDR, BP_LPTMR_PSR_PBYP))
#endif
//! @brief Format value for bitfield LPTMR_PSR_PBYP.
#define BF_LPTMR_PSR_PBYP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_PSR_PBYP), uint32_t) & BM_LPTMR_PSR_PBYP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PBYP field to a new value.
#define BW_LPTMR_PSR_PBYP(v) (BITBAND_ACCESS32(HW_LPTMR_PSR_ADDR, BP_LPTMR_PSR_PBYP) = (v))
#endif
//@}
/*!
* @name Register LPTMR_PSR, field PRESCALE[6:3] (RW)
*
* Configures the size of the Prescaler in Time Counter mode or width of the
* glitch filter in Pulse Counter mode. PRESCALE must be altered only when the LPTMR
* is disabled.
*
* Values:
* - 0000 - Prescaler divides the prescaler clock by 2; glitch filter does not
* support this configuration.
* - 0001 - Prescaler divides the prescaler clock by 4; glitch filter recognizes
* change on input pin after 2 rising clock edges.
* - 0010 - Prescaler divides the prescaler clock by 8; glitch filter recognizes
* change on input pin after 4 rising clock edges.
* - 0011 - Prescaler divides the prescaler clock by 16; glitch filter
* recognizes change on input pin after 8 rising clock edges.
* - 0100 - Prescaler divides the prescaler clock by 32; glitch filter
* recognizes change on input pin after 16 rising clock edges.
* - 0101 - Prescaler divides the prescaler clock by 64; glitch filter
* recognizes change on input pin after 32 rising clock edges.
* - 0110 - Prescaler divides the prescaler clock by 128; glitch filter
* recognizes change on input pin after 64 rising clock edges.
* - 0111 - Prescaler divides the prescaler clock by 256; glitch filter
* recognizes change on input pin after 128 rising clock edges.
* - 1000 - Prescaler divides the prescaler clock by 512; glitch filter
* recognizes change on input pin after 256 rising clock edges.
* - 1001 - Prescaler divides the prescaler clock by 1024; glitch filter
* recognizes change on input pin after 512 rising clock edges.
* - 1010 - Prescaler divides the prescaler clock by 2048; glitch filter
* recognizes change on input pin after 1024 rising clock edges.
* - 1011 - Prescaler divides the prescaler clock by 4096; glitch filter
* recognizes change on input pin after 2048 rising clock edges.
* - 1100 - Prescaler divides the prescaler clock by 8192; glitch filter
* recognizes change on input pin after 4096 rising clock edges.
* - 1101 - Prescaler divides the prescaler clock by 16,384; glitch filter
* recognizes change on input pin after 8192 rising clock edges.
* - 1110 - Prescaler divides the prescaler clock by 32,768; glitch filter
* recognizes change on input pin after 16,384 rising clock edges.
* - 1111 - Prescaler divides the prescaler clock by 65,536; glitch filter
* recognizes change on input pin after 32,768 rising clock edges.
*/
//@{
#define BP_LPTMR_PSR_PRESCALE (3U) //!< Bit position for LPTMR_PSR_PRESCALE.
#define BM_LPTMR_PSR_PRESCALE (0x00000078U) //!< Bit mask for LPTMR_PSR_PRESCALE.
#define BS_LPTMR_PSR_PRESCALE (4U) //!< Bit field size in bits for LPTMR_PSR_PRESCALE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_PSR_PRESCALE field.
#define BR_LPTMR_PSR_PRESCALE (HW_LPTMR_PSR.B.PRESCALE)
#endif
//! @brief Format value for bitfield LPTMR_PSR_PRESCALE.
#define BF_LPTMR_PSR_PRESCALE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_PSR_PRESCALE), uint32_t) & BM_LPTMR_PSR_PRESCALE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PRESCALE field to a new value.
#define BW_LPTMR_PSR_PRESCALE(v) (HW_LPTMR_PSR_WR((HW_LPTMR_PSR_RD() & ~BM_LPTMR_PSR_PRESCALE) | BF_LPTMR_PSR_PRESCALE(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_LPTMR_CMR - Low Power Timer Compare Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_LPTMR_CMR - Low Power Timer Compare Register (RW)
*
* Reset value: 0x00000000U
*/
typedef union _hw_lptmr_cmr
{
uint32_t U;
struct _hw_lptmr_cmr_bitfields
{
uint32_t COMPARE : 16; //!< [15:0] Compare Value
uint32_t RESERVED0 : 16; //!< [31:16]
} B;
} hw_lptmr_cmr_t;
#endif
/*!
* @name Constants and macros for entire LPTMR_CMR register
*/
//@{
#define HW_LPTMR_CMR_ADDR (REGS_LPTMR_BASE + 0x8U)
#ifndef __LANGUAGE_ASM__
#define HW_LPTMR_CMR (*(__IO hw_lptmr_cmr_t *) HW_LPTMR_CMR_ADDR)
#define HW_LPTMR_CMR_RD() (HW_LPTMR_CMR.U)
#define HW_LPTMR_CMR_WR(v) (HW_LPTMR_CMR.U = (v))
#define HW_LPTMR_CMR_SET(v) (HW_LPTMR_CMR_WR(HW_LPTMR_CMR_RD() | (v)))
#define HW_LPTMR_CMR_CLR(v) (HW_LPTMR_CMR_WR(HW_LPTMR_CMR_RD() & ~(v)))
#define HW_LPTMR_CMR_TOG(v) (HW_LPTMR_CMR_WR(HW_LPTMR_CMR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual LPTMR_CMR bitfields
*/
/*!
* @name Register LPTMR_CMR, field COMPARE[15:0] (RW)
*
* When the LPTMR is enabled and the CNR equals the value in the CMR and
* increments, TCF is set and the hardware trigger asserts until the next time the CNR
* increments. If the CMR is 0, the hardware trigger will remain asserted until
* the LPTMR is disabled. If the LPTMR is enabled, the CMR must be altered only
* when TCF is set.
*/
//@{
#define BP_LPTMR_CMR_COMPARE (0U) //!< Bit position for LPTMR_CMR_COMPARE.
#define BM_LPTMR_CMR_COMPARE (0x0000FFFFU) //!< Bit mask for LPTMR_CMR_COMPARE.
#define BS_LPTMR_CMR_COMPARE (16U) //!< Bit field size in bits for LPTMR_CMR_COMPARE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CMR_COMPARE field.
#define BR_LPTMR_CMR_COMPARE (HW_LPTMR_CMR.B.COMPARE)
#endif
//! @brief Format value for bitfield LPTMR_CMR_COMPARE.
#define BF_LPTMR_CMR_COMPARE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CMR_COMPARE), uint32_t) & BM_LPTMR_CMR_COMPARE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the COMPARE field to a new value.
#define BW_LPTMR_CMR_COMPARE(v) (HW_LPTMR_CMR_WR((HW_LPTMR_CMR_RD() & ~BM_LPTMR_CMR_COMPARE) | BF_LPTMR_CMR_COMPARE(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_LPTMR_CNR - Low Power Timer Counter Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_LPTMR_CNR - Low Power Timer Counter Register (RW)
*
* Reset value: 0x00000000U
*/
typedef union _hw_lptmr_cnr
{
uint32_t U;
struct _hw_lptmr_cnr_bitfields
{
uint32_t COUNTER : 16; //!< [15:0] Counter Value
uint32_t RESERVED0 : 16; //!< [31:16]
} B;
} hw_lptmr_cnr_t;
#endif
/*!
* @name Constants and macros for entire LPTMR_CNR register
*/
//@{
#define HW_LPTMR_CNR_ADDR (REGS_LPTMR_BASE + 0xCU)
#ifndef __LANGUAGE_ASM__
#define HW_LPTMR_CNR (*(__IO hw_lptmr_cnr_t *) HW_LPTMR_CNR_ADDR)
#define HW_LPTMR_CNR_RD() (HW_LPTMR_CNR.U)
#define HW_LPTMR_CNR_WR(v) (HW_LPTMR_CNR.U = (v))
#define HW_LPTMR_CNR_SET(v) (HW_LPTMR_CNR_WR(HW_LPTMR_CNR_RD() | (v)))
#define HW_LPTMR_CNR_CLR(v) (HW_LPTMR_CNR_WR(HW_LPTMR_CNR_RD() & ~(v)))
#define HW_LPTMR_CNR_TOG(v) (HW_LPTMR_CNR_WR(HW_LPTMR_CNR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual LPTMR_CNR bitfields
*/
/*!
* @name Register LPTMR_CNR, field COUNTER[15:0] (RW)
*/
//@{
#define BP_LPTMR_CNR_COUNTER (0U) //!< Bit position for LPTMR_CNR_COUNTER.
#define BM_LPTMR_CNR_COUNTER (0x0000FFFFU) //!< Bit mask for LPTMR_CNR_COUNTER.
#define BS_LPTMR_CNR_COUNTER (16U) //!< Bit field size in bits for LPTMR_CNR_COUNTER.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the LPTMR_CNR_COUNTER field.
#define BR_LPTMR_CNR_COUNTER (HW_LPTMR_CNR.B.COUNTER)
#endif
//! @brief Format value for bitfield LPTMR_CNR_COUNTER.
#define BF_LPTMR_CNR_COUNTER(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_LPTMR_CNR_COUNTER), uint32_t) & BM_LPTMR_CNR_COUNTER)
#ifndef __LANGUAGE_ASM__
//! @brief Set the COUNTER field to a new value.
#define BW_LPTMR_CNR_COUNTER(v) (HW_LPTMR_CNR_WR((HW_LPTMR_CNR_RD() & ~BM_LPTMR_CNR_COUNTER) | BF_LPTMR_CNR_COUNTER(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_lptmr_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All LPTMR module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_lptmr
{
__IO hw_lptmr_csr_t CSR; //!< [0x0] Low Power Timer Control Status Register
__IO hw_lptmr_psr_t PSR; //!< [0x4] Low Power Timer Prescale Register
__IO hw_lptmr_cmr_t CMR; //!< [0x8] Low Power Timer Compare Register
__IO hw_lptmr_cnr_t CNR; //!< [0xC] Low Power Timer Counter Register
} hw_lptmr_t;
#pragma pack()
//! @brief Macro to access all LPTMR registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_LPTMR</code>.
#define HW_LPTMR (*(hw_lptmr_t *) REGS_LPTMR_BASE)
#endif
#endif // __HW_LPTMR_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,958 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_NV_REGISTERS_H__
#define __HW_NV_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 NV
*
* Flash configuration field
*
* Registers defined in this header file:
* - HW_NV_BACKKEY3 - Backdoor Comparison Key 3.
* - HW_NV_BACKKEY2 - Backdoor Comparison Key 2.
* - HW_NV_BACKKEY1 - Backdoor Comparison Key 1.
* - HW_NV_BACKKEY0 - Backdoor Comparison Key 0.
* - HW_NV_BACKKEY7 - Backdoor Comparison Key 7.
* - HW_NV_BACKKEY6 - Backdoor Comparison Key 6.
* - HW_NV_BACKKEY5 - Backdoor Comparison Key 5.
* - HW_NV_BACKKEY4 - Backdoor Comparison Key 4.
* - HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
* - HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
* - HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
* - HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
* - HW_NV_FSEC - Non-volatile Flash Security Register
* - HW_NV_FOPT - Non-volatile Flash Option Register
* - HW_NV_FEPROT - Non-volatile EERAM Protection Register
* - HW_NV_FDPROT - Non-volatile D-Flash Protection Register
*
* - hw_nv_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_NV_BASE
#define HW_NV_INSTANCE_COUNT (1U) //!< Number of instances of the NV module.
#define REGS_NV_BASE (0x400U) //!< Base address for FTFE_FlashConfig.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY3 - Backdoor Comparison Key 3.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY3 - Backdoor Comparison Key 3. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey3
{
uint8_t U;
struct _hw_nv_backkey3_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey3_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY3 register
*/
//@{
#define HW_NV_BACKKEY3_ADDR (REGS_NV_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY3 (*(__I hw_nv_backkey3_t *) HW_NV_BACKKEY3_ADDR)
#define HW_NV_BACKKEY3_RD() (HW_NV_BACKKEY3.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY3 bitfields
*/
/*!
* @name Register NV_BACKKEY3, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY3_KEY (0U) //!< Bit position for NV_BACKKEY3_KEY.
#define BM_NV_BACKKEY3_KEY (0xFFU) //!< Bit mask for NV_BACKKEY3_KEY.
#define BS_NV_BACKKEY3_KEY (8U) //!< Bit field size in bits for NV_BACKKEY3_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY3_KEY field.
#define BR_NV_BACKKEY3_KEY (HW_NV_BACKKEY3.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY2 - Backdoor Comparison Key 2.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY2 - Backdoor Comparison Key 2. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey2
{
uint8_t U;
struct _hw_nv_backkey2_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey2_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY2 register
*/
//@{
#define HW_NV_BACKKEY2_ADDR (REGS_NV_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY2 (*(__I hw_nv_backkey2_t *) HW_NV_BACKKEY2_ADDR)
#define HW_NV_BACKKEY2_RD() (HW_NV_BACKKEY2.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY2 bitfields
*/
/*!
* @name Register NV_BACKKEY2, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY2_KEY (0U) //!< Bit position for NV_BACKKEY2_KEY.
#define BM_NV_BACKKEY2_KEY (0xFFU) //!< Bit mask for NV_BACKKEY2_KEY.
#define BS_NV_BACKKEY2_KEY (8U) //!< Bit field size in bits for NV_BACKKEY2_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY2_KEY field.
#define BR_NV_BACKKEY2_KEY (HW_NV_BACKKEY2.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY1 - Backdoor Comparison Key 1.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY1 - Backdoor Comparison Key 1. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey1
{
uint8_t U;
struct _hw_nv_backkey1_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey1_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY1 register
*/
//@{
#define HW_NV_BACKKEY1_ADDR (REGS_NV_BASE + 0x2U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY1 (*(__I hw_nv_backkey1_t *) HW_NV_BACKKEY1_ADDR)
#define HW_NV_BACKKEY1_RD() (HW_NV_BACKKEY1.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY1 bitfields
*/
/*!
* @name Register NV_BACKKEY1, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY1_KEY (0U) //!< Bit position for NV_BACKKEY1_KEY.
#define BM_NV_BACKKEY1_KEY (0xFFU) //!< Bit mask for NV_BACKKEY1_KEY.
#define BS_NV_BACKKEY1_KEY (8U) //!< Bit field size in bits for NV_BACKKEY1_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY1_KEY field.
#define BR_NV_BACKKEY1_KEY (HW_NV_BACKKEY1.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY0 - Backdoor Comparison Key 0.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY0 - Backdoor Comparison Key 0. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey0
{
uint8_t U;
struct _hw_nv_backkey0_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey0_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY0 register
*/
//@{
#define HW_NV_BACKKEY0_ADDR (REGS_NV_BASE + 0x3U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY0 (*(__I hw_nv_backkey0_t *) HW_NV_BACKKEY0_ADDR)
#define HW_NV_BACKKEY0_RD() (HW_NV_BACKKEY0.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY0 bitfields
*/
/*!
* @name Register NV_BACKKEY0, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY0_KEY (0U) //!< Bit position for NV_BACKKEY0_KEY.
#define BM_NV_BACKKEY0_KEY (0xFFU) //!< Bit mask for NV_BACKKEY0_KEY.
#define BS_NV_BACKKEY0_KEY (8U) //!< Bit field size in bits for NV_BACKKEY0_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY0_KEY field.
#define BR_NV_BACKKEY0_KEY (HW_NV_BACKKEY0.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY7 - Backdoor Comparison Key 7.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY7 - Backdoor Comparison Key 7. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey7
{
uint8_t U;
struct _hw_nv_backkey7_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey7_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY7 register
*/
//@{
#define HW_NV_BACKKEY7_ADDR (REGS_NV_BASE + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY7 (*(__I hw_nv_backkey7_t *) HW_NV_BACKKEY7_ADDR)
#define HW_NV_BACKKEY7_RD() (HW_NV_BACKKEY7.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY7 bitfields
*/
/*!
* @name Register NV_BACKKEY7, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY7_KEY (0U) //!< Bit position for NV_BACKKEY7_KEY.
#define BM_NV_BACKKEY7_KEY (0xFFU) //!< Bit mask for NV_BACKKEY7_KEY.
#define BS_NV_BACKKEY7_KEY (8U) //!< Bit field size in bits for NV_BACKKEY7_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY7_KEY field.
#define BR_NV_BACKKEY7_KEY (HW_NV_BACKKEY7.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY6 - Backdoor Comparison Key 6.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY6 - Backdoor Comparison Key 6. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey6
{
uint8_t U;
struct _hw_nv_backkey6_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey6_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY6 register
*/
//@{
#define HW_NV_BACKKEY6_ADDR (REGS_NV_BASE + 0x5U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY6 (*(__I hw_nv_backkey6_t *) HW_NV_BACKKEY6_ADDR)
#define HW_NV_BACKKEY6_RD() (HW_NV_BACKKEY6.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY6 bitfields
*/
/*!
* @name Register NV_BACKKEY6, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY6_KEY (0U) //!< Bit position for NV_BACKKEY6_KEY.
#define BM_NV_BACKKEY6_KEY (0xFFU) //!< Bit mask for NV_BACKKEY6_KEY.
#define BS_NV_BACKKEY6_KEY (8U) //!< Bit field size in bits for NV_BACKKEY6_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY6_KEY field.
#define BR_NV_BACKKEY6_KEY (HW_NV_BACKKEY6.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY5 - Backdoor Comparison Key 5.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY5 - Backdoor Comparison Key 5. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey5
{
uint8_t U;
struct _hw_nv_backkey5_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey5_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY5 register
*/
//@{
#define HW_NV_BACKKEY5_ADDR (REGS_NV_BASE + 0x6U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY5 (*(__I hw_nv_backkey5_t *) HW_NV_BACKKEY5_ADDR)
#define HW_NV_BACKKEY5_RD() (HW_NV_BACKKEY5.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY5 bitfields
*/
/*!
* @name Register NV_BACKKEY5, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY5_KEY (0U) //!< Bit position for NV_BACKKEY5_KEY.
#define BM_NV_BACKKEY5_KEY (0xFFU) //!< Bit mask for NV_BACKKEY5_KEY.
#define BS_NV_BACKKEY5_KEY (8U) //!< Bit field size in bits for NV_BACKKEY5_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY5_KEY field.
#define BR_NV_BACKKEY5_KEY (HW_NV_BACKKEY5.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_BACKKEY4 - Backdoor Comparison Key 4.
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_BACKKEY4 - Backdoor Comparison Key 4. (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_backkey4
{
uint8_t U;
struct _hw_nv_backkey4_bitfields
{
uint8_t KEY : 8; //!< [7:0] Backdoor Comparison Key.
} B;
} hw_nv_backkey4_t;
#endif
/*!
* @name Constants and macros for entire NV_BACKKEY4 register
*/
//@{
#define HW_NV_BACKKEY4_ADDR (REGS_NV_BASE + 0x7U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_BACKKEY4 (*(__I hw_nv_backkey4_t *) HW_NV_BACKKEY4_ADDR)
#define HW_NV_BACKKEY4_RD() (HW_NV_BACKKEY4.U)
#endif
//@}
/*
* Constants & macros for individual NV_BACKKEY4 bitfields
*/
/*!
* @name Register NV_BACKKEY4, field KEY[7:0] (RO)
*/
//@{
#define BP_NV_BACKKEY4_KEY (0U) //!< Bit position for NV_BACKKEY4_KEY.
#define BM_NV_BACKKEY4_KEY (0xFFU) //!< Bit mask for NV_BACKKEY4_KEY.
#define BS_NV_BACKKEY4_KEY (8U) //!< Bit field size in bits for NV_BACKKEY4_KEY.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_BACKKEY4_KEY field.
#define BR_NV_BACKKEY4_KEY (HW_NV_BACKKEY4.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fprot3
{
uint8_t U;
struct _hw_nv_fprot3_bitfields
{
uint8_t PROT : 8; //!< [7:0] P-Flash Region Protect
} B;
} hw_nv_fprot3_t;
#endif
/*!
* @name Constants and macros for entire NV_FPROT3 register
*/
//@{
#define HW_NV_FPROT3_ADDR (REGS_NV_BASE + 0x8U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FPROT3 (*(__I hw_nv_fprot3_t *) HW_NV_FPROT3_ADDR)
#define HW_NV_FPROT3_RD() (HW_NV_FPROT3.U)
#endif
//@}
/*
* Constants & macros for individual NV_FPROT3 bitfields
*/
/*!
* @name Register NV_FPROT3, field PROT[7:0] (RO)
*/
//@{
#define BP_NV_FPROT3_PROT (0U) //!< Bit position for NV_FPROT3_PROT.
#define BM_NV_FPROT3_PROT (0xFFU) //!< Bit mask for NV_FPROT3_PROT.
#define BS_NV_FPROT3_PROT (8U) //!< Bit field size in bits for NV_FPROT3_PROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FPROT3_PROT field.
#define BR_NV_FPROT3_PROT (HW_NV_FPROT3.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fprot2
{
uint8_t U;
struct _hw_nv_fprot2_bitfields
{
uint8_t PROT : 8; //!< [7:0] P-Flash Region Protect
} B;
} hw_nv_fprot2_t;
#endif
/*!
* @name Constants and macros for entire NV_FPROT2 register
*/
//@{
#define HW_NV_FPROT2_ADDR (REGS_NV_BASE + 0x9U)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FPROT2 (*(__I hw_nv_fprot2_t *) HW_NV_FPROT2_ADDR)
#define HW_NV_FPROT2_RD() (HW_NV_FPROT2.U)
#endif
//@}
/*
* Constants & macros for individual NV_FPROT2 bitfields
*/
/*!
* @name Register NV_FPROT2, field PROT[7:0] (RO)
*/
//@{
#define BP_NV_FPROT2_PROT (0U) //!< Bit position for NV_FPROT2_PROT.
#define BM_NV_FPROT2_PROT (0xFFU) //!< Bit mask for NV_FPROT2_PROT.
#define BS_NV_FPROT2_PROT (8U) //!< Bit field size in bits for NV_FPROT2_PROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FPROT2_PROT field.
#define BR_NV_FPROT2_PROT (HW_NV_FPROT2.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fprot1
{
uint8_t U;
struct _hw_nv_fprot1_bitfields
{
uint8_t PROT : 8; //!< [7:0] P-Flash Region Protect
} B;
} hw_nv_fprot1_t;
#endif
/*!
* @name Constants and macros for entire NV_FPROT1 register
*/
//@{
#define HW_NV_FPROT1_ADDR (REGS_NV_BASE + 0xAU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FPROT1 (*(__I hw_nv_fprot1_t *) HW_NV_FPROT1_ADDR)
#define HW_NV_FPROT1_RD() (HW_NV_FPROT1.U)
#endif
//@}
/*
* Constants & macros for individual NV_FPROT1 bitfields
*/
/*!
* @name Register NV_FPROT1, field PROT[7:0] (RO)
*/
//@{
#define BP_NV_FPROT1_PROT (0U) //!< Bit position for NV_FPROT1_PROT.
#define BM_NV_FPROT1_PROT (0xFFU) //!< Bit mask for NV_FPROT1_PROT.
#define BS_NV_FPROT1_PROT (8U) //!< Bit field size in bits for NV_FPROT1_PROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FPROT1_PROT field.
#define BR_NV_FPROT1_PROT (HW_NV_FPROT1.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fprot0
{
uint8_t U;
struct _hw_nv_fprot0_bitfields
{
uint8_t PROT : 8; //!< [7:0] P-Flash Region Protect
} B;
} hw_nv_fprot0_t;
#endif
/*!
* @name Constants and macros for entire NV_FPROT0 register
*/
//@{
#define HW_NV_FPROT0_ADDR (REGS_NV_BASE + 0xBU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FPROT0 (*(__I hw_nv_fprot0_t *) HW_NV_FPROT0_ADDR)
#define HW_NV_FPROT0_RD() (HW_NV_FPROT0.U)
#endif
//@}
/*
* Constants & macros for individual NV_FPROT0 bitfields
*/
/*!
* @name Register NV_FPROT0, field PROT[7:0] (RO)
*/
//@{
#define BP_NV_FPROT0_PROT (0U) //!< Bit position for NV_FPROT0_PROT.
#define BM_NV_FPROT0_PROT (0xFFU) //!< Bit mask for NV_FPROT0_PROT.
#define BS_NV_FPROT0_PROT (8U) //!< Bit field size in bits for NV_FPROT0_PROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FPROT0_PROT field.
#define BR_NV_FPROT0_PROT (HW_NV_FPROT0.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FSEC - Non-volatile Flash Security Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FSEC - Non-volatile Flash Security Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fsec
{
uint8_t U;
struct _hw_nv_fsec_bitfields
{
uint8_t SEC : 2; //!< [1:0] Flash Security
uint8_t FSLACC : 2; //!< [3:2] Freescale Failure Analysis Access Code
uint8_t MEEN : 2; //!< [5:4]
uint8_t KEYEN : 2; //!< [7:6] Backdoor Key Security Enable
} B;
} hw_nv_fsec_t;
#endif
/*!
* @name Constants and macros for entire NV_FSEC register
*/
//@{
#define HW_NV_FSEC_ADDR (REGS_NV_BASE + 0xCU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FSEC (*(__I hw_nv_fsec_t *) HW_NV_FSEC_ADDR)
#define HW_NV_FSEC_RD() (HW_NV_FSEC.U)
#endif
//@}
/*
* Constants & macros for individual NV_FSEC bitfields
*/
/*!
* @name Register NV_FSEC, field SEC[1:0] (RO)
*/
//@{
#define BP_NV_FSEC_SEC (0U) //!< Bit position for NV_FSEC_SEC.
#define BM_NV_FSEC_SEC (0x03U) //!< Bit mask for NV_FSEC_SEC.
#define BS_NV_FSEC_SEC (2U) //!< Bit field size in bits for NV_FSEC_SEC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FSEC_SEC field.
#define BR_NV_FSEC_SEC (HW_NV_FSEC.B.SEC)
#endif
//@}
/*!
* @name Register NV_FSEC, field FSLACC[3:2] (RO)
*/
//@{
#define BP_NV_FSEC_FSLACC (2U) //!< Bit position for NV_FSEC_FSLACC.
#define BM_NV_FSEC_FSLACC (0x0CU) //!< Bit mask for NV_FSEC_FSLACC.
#define BS_NV_FSEC_FSLACC (2U) //!< Bit field size in bits for NV_FSEC_FSLACC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FSEC_FSLACC field.
#define BR_NV_FSEC_FSLACC (HW_NV_FSEC.B.FSLACC)
#endif
//@}
/*!
* @name Register NV_FSEC, field MEEN[5:4] (RO)
*/
//@{
#define BP_NV_FSEC_MEEN (4U) //!< Bit position for NV_FSEC_MEEN.
#define BM_NV_FSEC_MEEN (0x30U) //!< Bit mask for NV_FSEC_MEEN.
#define BS_NV_FSEC_MEEN (2U) //!< Bit field size in bits for NV_FSEC_MEEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FSEC_MEEN field.
#define BR_NV_FSEC_MEEN (HW_NV_FSEC.B.MEEN)
#endif
//@}
/*!
* @name Register NV_FSEC, field KEYEN[7:6] (RO)
*/
//@{
#define BP_NV_FSEC_KEYEN (6U) //!< Bit position for NV_FSEC_KEYEN.
#define BM_NV_FSEC_KEYEN (0xC0U) //!< Bit mask for NV_FSEC_KEYEN.
#define BS_NV_FSEC_KEYEN (2U) //!< Bit field size in bits for NV_FSEC_KEYEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FSEC_KEYEN field.
#define BR_NV_FSEC_KEYEN (HW_NV_FSEC.B.KEYEN)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FOPT - Non-volatile Flash Option Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FOPT - Non-volatile Flash Option Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fopt
{
uint8_t U;
struct _hw_nv_fopt_bitfields
{
uint8_t LPBOOT : 1; //!< [0]
uint8_t EZPORT_DIS : 1; //!< [1]
uint8_t RESERVED0 : 6; //!< [7:2]
} B;
} hw_nv_fopt_t;
#endif
/*!
* @name Constants and macros for entire NV_FOPT register
*/
//@{
#define HW_NV_FOPT_ADDR (REGS_NV_BASE + 0xDU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FOPT (*(__I hw_nv_fopt_t *) HW_NV_FOPT_ADDR)
#define HW_NV_FOPT_RD() (HW_NV_FOPT.U)
#endif
//@}
/*
* Constants & macros for individual NV_FOPT bitfields
*/
/*!
* @name Register NV_FOPT, field LPBOOT[0] (RO)
*/
//@{
#define BP_NV_FOPT_LPBOOT (0U) //!< Bit position for NV_FOPT_LPBOOT.
#define BM_NV_FOPT_LPBOOT (0x01U) //!< Bit mask for NV_FOPT_LPBOOT.
#define BS_NV_FOPT_LPBOOT (1U) //!< Bit field size in bits for NV_FOPT_LPBOOT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FOPT_LPBOOT field.
#define BR_NV_FOPT_LPBOOT (BITBAND_ACCESS8(HW_NV_FOPT_ADDR, BP_NV_FOPT_LPBOOT))
#endif
//@}
/*!
* @name Register NV_FOPT, field EZPORT_DIS[1] (RO)
*/
//@{
#define BP_NV_FOPT_EZPORT_DIS (1U) //!< Bit position for NV_FOPT_EZPORT_DIS.
#define BM_NV_FOPT_EZPORT_DIS (0x02U) //!< Bit mask for NV_FOPT_EZPORT_DIS.
#define BS_NV_FOPT_EZPORT_DIS (1U) //!< Bit field size in bits for NV_FOPT_EZPORT_DIS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FOPT_EZPORT_DIS field.
#define BR_NV_FOPT_EZPORT_DIS (BITBAND_ACCESS8(HW_NV_FOPT_ADDR, BP_NV_FOPT_EZPORT_DIS))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FEPROT - Non-volatile EERAM Protection Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FEPROT - Non-volatile EERAM Protection Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_feprot
{
uint8_t U;
struct _hw_nv_feprot_bitfields
{
uint8_t EPROT : 8; //!< [7:0]
} B;
} hw_nv_feprot_t;
#endif
/*!
* @name Constants and macros for entire NV_FEPROT register
*/
//@{
#define HW_NV_FEPROT_ADDR (REGS_NV_BASE + 0xEU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FEPROT (*(__I hw_nv_feprot_t *) HW_NV_FEPROT_ADDR)
#define HW_NV_FEPROT_RD() (HW_NV_FEPROT.U)
#endif
//@}
/*
* Constants & macros for individual NV_FEPROT bitfields
*/
/*!
* @name Register NV_FEPROT, field EPROT[7:0] (RO)
*/
//@{
#define BP_NV_FEPROT_EPROT (0U) //!< Bit position for NV_FEPROT_EPROT.
#define BM_NV_FEPROT_EPROT (0xFFU) //!< Bit mask for NV_FEPROT_EPROT.
#define BS_NV_FEPROT_EPROT (8U) //!< Bit field size in bits for NV_FEPROT_EPROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FEPROT_EPROT field.
#define BR_NV_FEPROT_EPROT (HW_NV_FEPROT.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_NV_FDPROT - Non-volatile D-Flash Protection Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_NV_FDPROT - Non-volatile D-Flash Protection Register (RO)
*
* Reset value: 0xFFU
*/
typedef union _hw_nv_fdprot
{
uint8_t U;
struct _hw_nv_fdprot_bitfields
{
uint8_t DPROT : 8; //!< [7:0] D-Flash Region Protect
} B;
} hw_nv_fdprot_t;
#endif
/*!
* @name Constants and macros for entire NV_FDPROT register
*/
//@{
#define HW_NV_FDPROT_ADDR (REGS_NV_BASE + 0xFU)
#ifndef __LANGUAGE_ASM__
#define HW_NV_FDPROT (*(__I hw_nv_fdprot_t *) HW_NV_FDPROT_ADDR)
#define HW_NV_FDPROT_RD() (HW_NV_FDPROT.U)
#endif
//@}
/*
* Constants & macros for individual NV_FDPROT bitfields
*/
/*!
* @name Register NV_FDPROT, field DPROT[7:0] (RO)
*/
//@{
#define BP_NV_FDPROT_DPROT (0U) //!< Bit position for NV_FDPROT_DPROT.
#define BM_NV_FDPROT_DPROT (0xFFU) //!< Bit mask for NV_FDPROT_DPROT.
#define BS_NV_FDPROT_DPROT (8U) //!< Bit field size in bits for NV_FDPROT_DPROT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the NV_FDPROT_DPROT field.
#define BR_NV_FDPROT_DPROT (HW_NV_FDPROT.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_nv_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All NV module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_nv
{
__I hw_nv_backkey3_t BACKKEY3; //!< [0x0] Backdoor Comparison Key 3.
__I hw_nv_backkey2_t BACKKEY2; //!< [0x1] Backdoor Comparison Key 2.
__I hw_nv_backkey1_t BACKKEY1; //!< [0x2] Backdoor Comparison Key 1.
__I hw_nv_backkey0_t BACKKEY0; //!< [0x3] Backdoor Comparison Key 0.
__I hw_nv_backkey7_t BACKKEY7; //!< [0x4] Backdoor Comparison Key 7.
__I hw_nv_backkey6_t BACKKEY6; //!< [0x5] Backdoor Comparison Key 6.
__I hw_nv_backkey5_t BACKKEY5; //!< [0x6] Backdoor Comparison Key 5.
__I hw_nv_backkey4_t BACKKEY4; //!< [0x7] Backdoor Comparison Key 4.
__I hw_nv_fprot3_t FPROT3; //!< [0x8] Non-volatile P-Flash Protection 1 - Low Register
__I hw_nv_fprot2_t FPROT2; //!< [0x9] Non-volatile P-Flash Protection 1 - High Register
__I hw_nv_fprot1_t FPROT1; //!< [0xA] Non-volatile P-Flash Protection 0 - Low Register
__I hw_nv_fprot0_t FPROT0; //!< [0xB] Non-volatile P-Flash Protection 0 - High Register
__I hw_nv_fsec_t FSEC; //!< [0xC] Non-volatile Flash Security Register
__I hw_nv_fopt_t FOPT; //!< [0xD] Non-volatile Flash Option Register
__I hw_nv_feprot_t FEPROT; //!< [0xE] Non-volatile EERAM Protection Register
__I hw_nv_fdprot_t FDPROT; //!< [0xF] Non-volatile D-Flash Protection Register
} hw_nv_t;
#pragma pack()
//! @brief Macro to access all NV registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_NV</code>.
#define HW_NV (*(hw_nv_t *) REGS_NV_BASE)
#endif
#endif // __HW_NV_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,302 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_OSC_REGISTERS_H__
#define __HW_OSC_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 OSC
*
* Oscillator
*
* Registers defined in this header file:
* - HW_OSC_CR - OSC Control Register
*
* - hw_osc_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_OSC_BASE
#define HW_OSC_INSTANCE_COUNT (1U) //!< Number of instances of the OSC module.
#define HW_OSC0 (0U) //!< Instance number for OSC.
#define REGS_OSC0_BASE (0x40065000U) //!< Base address for OSC.
//! @brief Table of base addresses for OSC instances.
static const uint32_t __g_regs_OSC_base_addresses[] = {
REGS_OSC0_BASE,
};
//! @brief Get the base address of OSC by instance number.
//! @param x OSC instance number, from 0 through 0.
#define REGS_OSC_BASE(x) (__g_regs_OSC_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of OSC.
#define REGS_OSC_INSTANCE(b) ((b) == REGS_OSC0_BASE ? HW_OSC0 : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_OSC_CR - OSC Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_OSC_CR - OSC Control Register (RW)
*
* Reset value: 0x00U
*
* After OSC is enabled and starts generating the clocks, the configurations
* such as low power and frequency range, must not be changed.
*/
typedef union _hw_osc_cr
{
uint8_t U;
struct _hw_osc_cr_bitfields
{
uint8_t SC16P : 1; //!< [0] Oscillator 16 pF Capacitor Load Configure
uint8_t SC8P : 1; //!< [1] Oscillator 8 pF Capacitor Load Configure
uint8_t SC4P : 1; //!< [2] Oscillator 4 pF Capacitor Load Configure
uint8_t SC2P : 1; //!< [3] Oscillator 2 pF Capacitor Load Configure
uint8_t RESERVED0 : 1; //!< [4]
uint8_t EREFSTEN : 1; //!< [5] External Reference Stop Enable
uint8_t RESERVED1 : 1; //!< [6]
uint8_t ERCLKEN : 1; //!< [7] External Reference Enable
} B;
} hw_osc_cr_t;
#endif
/*!
* @name Constants and macros for entire OSC_CR register
*/
//@{
#define HW_OSC_CR_ADDR(x) (REGS_OSC_BASE(x) + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_OSC_CR(x) (*(__IO hw_osc_cr_t *) HW_OSC_CR_ADDR(x))
#define HW_OSC_CR_RD(x) (HW_OSC_CR(x).U)
#define HW_OSC_CR_WR(x, v) (HW_OSC_CR(x).U = (v))
#define HW_OSC_CR_SET(x, v) (HW_OSC_CR_WR(x, HW_OSC_CR_RD(x) | (v)))
#define HW_OSC_CR_CLR(x, v) (HW_OSC_CR_WR(x, HW_OSC_CR_RD(x) & ~(v)))
#define HW_OSC_CR_TOG(x, v) (HW_OSC_CR_WR(x, HW_OSC_CR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual OSC_CR bitfields
*/
/*!
* @name Register OSC_CR, field SC16P[0] (RW)
*
* Configures the oscillator load.
*
* Values:
* - 0 - Disable the selection.
* - 1 - Add 16 pF capacitor to the oscillator load.
*/
//@{
#define BP_OSC_CR_SC16P (0U) //!< Bit position for OSC_CR_SC16P.
#define BM_OSC_CR_SC16P (0x01U) //!< Bit mask for OSC_CR_SC16P.
#define BS_OSC_CR_SC16P (1U) //!< Bit field size in bits for OSC_CR_SC16P.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_SC16P field.
#define BR_OSC_CR_SC16P(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC16P))
#endif
//! @brief Format value for bitfield OSC_CR_SC16P.
#define BF_OSC_CR_SC16P(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_SC16P), uint8_t) & BM_OSC_CR_SC16P)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SC16P field to a new value.
#define BW_OSC_CR_SC16P(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC16P) = (v))
#endif
//@}
/*!
* @name Register OSC_CR, field SC8P[1] (RW)
*
* Configures the oscillator load.
*
* Values:
* - 0 - Disable the selection.
* - 1 - Add 8 pF capacitor to the oscillator load.
*/
//@{
#define BP_OSC_CR_SC8P (1U) //!< Bit position for OSC_CR_SC8P.
#define BM_OSC_CR_SC8P (0x02U) //!< Bit mask for OSC_CR_SC8P.
#define BS_OSC_CR_SC8P (1U) //!< Bit field size in bits for OSC_CR_SC8P.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_SC8P field.
#define BR_OSC_CR_SC8P(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC8P))
#endif
//! @brief Format value for bitfield OSC_CR_SC8P.
#define BF_OSC_CR_SC8P(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_SC8P), uint8_t) & BM_OSC_CR_SC8P)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SC8P field to a new value.
#define BW_OSC_CR_SC8P(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC8P) = (v))
#endif
//@}
/*!
* @name Register OSC_CR, field SC4P[2] (RW)
*
* Configures the oscillator load.
*
* Values:
* - 0 - Disable the selection.
* - 1 - Add 4 pF capacitor to the oscillator load.
*/
//@{
#define BP_OSC_CR_SC4P (2U) //!< Bit position for OSC_CR_SC4P.
#define BM_OSC_CR_SC4P (0x04U) //!< Bit mask for OSC_CR_SC4P.
#define BS_OSC_CR_SC4P (1U) //!< Bit field size in bits for OSC_CR_SC4P.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_SC4P field.
#define BR_OSC_CR_SC4P(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC4P))
#endif
//! @brief Format value for bitfield OSC_CR_SC4P.
#define BF_OSC_CR_SC4P(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_SC4P), uint8_t) & BM_OSC_CR_SC4P)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SC4P field to a new value.
#define BW_OSC_CR_SC4P(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC4P) = (v))
#endif
//@}
/*!
* @name Register OSC_CR, field SC2P[3] (RW)
*
* Configures the oscillator load.
*
* Values:
* - 0 - Disable the selection.
* - 1 - Add 2 pF capacitor to the oscillator load.
*/
//@{
#define BP_OSC_CR_SC2P (3U) //!< Bit position for OSC_CR_SC2P.
#define BM_OSC_CR_SC2P (0x08U) //!< Bit mask for OSC_CR_SC2P.
#define BS_OSC_CR_SC2P (1U) //!< Bit field size in bits for OSC_CR_SC2P.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_SC2P field.
#define BR_OSC_CR_SC2P(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC2P))
#endif
//! @brief Format value for bitfield OSC_CR_SC2P.
#define BF_OSC_CR_SC2P(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_SC2P), uint8_t) & BM_OSC_CR_SC2P)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SC2P field to a new value.
#define BW_OSC_CR_SC2P(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_SC2P) = (v))
#endif
//@}
/*!
* @name Register OSC_CR, field EREFSTEN[5] (RW)
*
* Controls whether or not the external reference clock (OSCERCLK) remains
* enabled when MCU enters Stop mode.
*
* Values:
* - 0 - External reference clock is disabled in Stop mode.
* - 1 - External reference clock stays enabled in Stop mode if ERCLKEN is set
* before entering Stop mode.
*/
//@{
#define BP_OSC_CR_EREFSTEN (5U) //!< Bit position for OSC_CR_EREFSTEN.
#define BM_OSC_CR_EREFSTEN (0x20U) //!< Bit mask for OSC_CR_EREFSTEN.
#define BS_OSC_CR_EREFSTEN (1U) //!< Bit field size in bits for OSC_CR_EREFSTEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_EREFSTEN field.
#define BR_OSC_CR_EREFSTEN(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_EREFSTEN))
#endif
//! @brief Format value for bitfield OSC_CR_EREFSTEN.
#define BF_OSC_CR_EREFSTEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_EREFSTEN), uint8_t) & BM_OSC_CR_EREFSTEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the EREFSTEN field to a new value.
#define BW_OSC_CR_EREFSTEN(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_EREFSTEN) = (v))
#endif
//@}
/*!
* @name Register OSC_CR, field ERCLKEN[7] (RW)
*
* Enables external reference clock (OSCERCLK).
*
* Values:
* - 0 - External reference clock is inactive.
* - 1 - External reference clock is enabled.
*/
//@{
#define BP_OSC_CR_ERCLKEN (7U) //!< Bit position for OSC_CR_ERCLKEN.
#define BM_OSC_CR_ERCLKEN (0x80U) //!< Bit mask for OSC_CR_ERCLKEN.
#define BS_OSC_CR_ERCLKEN (1U) //!< Bit field size in bits for OSC_CR_ERCLKEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the OSC_CR_ERCLKEN field.
#define BR_OSC_CR_ERCLKEN(x) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_ERCLKEN))
#endif
//! @brief Format value for bitfield OSC_CR_ERCLKEN.
#define BF_OSC_CR_ERCLKEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_OSC_CR_ERCLKEN), uint8_t) & BM_OSC_CR_ERCLKEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ERCLKEN field to a new value.
#define BW_OSC_CR_ERCLKEN(x, v) (BITBAND_ACCESS8(HW_OSC_CR_ADDR(x), BP_OSC_CR_ERCLKEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_osc_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All OSC module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_osc
{
__IO hw_osc_cr_t CR; //!< [0x0] OSC Control Register
} hw_osc_t;
#pragma pack()
//! @brief Macro to access all OSC registers.
//! @param x OSC instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_OSC(0)</code>.
#define HW_OSC(x) (*(hw_osc_t *) REGS_OSC_BASE(x))
#endif
#endif // __HW_OSC_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,517 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_PIT_REGISTERS_H__
#define __HW_PIT_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 PIT
*
* Periodic Interrupt Timer
*
* Registers defined in this header file:
* - HW_PIT_MCR - PIT Module Control Register
* - HW_PIT_LDVALn - Timer Load Value Register
* - HW_PIT_CVALn - Current Timer Value Register
* - HW_PIT_TCTRLn - Timer Control Register
* - HW_PIT_TFLGn - Timer Flag Register
*
* - hw_pit_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_PIT_BASE
#define HW_PIT_INSTANCE_COUNT (1U) //!< Number of instances of the PIT module.
#define REGS_PIT_BASE (0x40037000U) //!< Base address for PIT.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PIT_MCR - PIT Module Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PIT_MCR - PIT Module Control Register (RW)
*
* Reset value: 0x00000006U
*
* This register enables or disables the PIT timer clocks and controls the
* timers when the PIT enters the Debug mode.
*/
typedef union _hw_pit_mcr
{
uint32_t U;
struct _hw_pit_mcr_bitfields
{
uint32_t FRZ : 1; //!< [0] Freeze
uint32_t MDIS : 1; //!< [1] Module Disable - (PIT section)
uint32_t RESERVED0 : 30; //!< [31:2]
} B;
} hw_pit_mcr_t;
#endif
/*!
* @name Constants and macros for entire PIT_MCR register
*/
//@{
#define HW_PIT_MCR_ADDR (REGS_PIT_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_PIT_MCR (*(__IO hw_pit_mcr_t *) HW_PIT_MCR_ADDR)
#define HW_PIT_MCR_RD() (HW_PIT_MCR.U)
#define HW_PIT_MCR_WR(v) (HW_PIT_MCR.U = (v))
#define HW_PIT_MCR_SET(v) (HW_PIT_MCR_WR(HW_PIT_MCR_RD() | (v)))
#define HW_PIT_MCR_CLR(v) (HW_PIT_MCR_WR(HW_PIT_MCR_RD() & ~(v)))
#define HW_PIT_MCR_TOG(v) (HW_PIT_MCR_WR(HW_PIT_MCR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PIT_MCR bitfields
*/
/*!
* @name Register PIT_MCR, field FRZ[0] (RW)
*
* Allows the timers to be stopped when the device enters the Debug mode.
*
* Values:
* - 0 - Timers continue to run in Debug mode.
* - 1 - Timers are stopped in Debug mode.
*/
//@{
#define BP_PIT_MCR_FRZ (0U) //!< Bit position for PIT_MCR_FRZ.
#define BM_PIT_MCR_FRZ (0x00000001U) //!< Bit mask for PIT_MCR_FRZ.
#define BS_PIT_MCR_FRZ (1U) //!< Bit field size in bits for PIT_MCR_FRZ.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_MCR_FRZ field.
#define BR_PIT_MCR_FRZ (BITBAND_ACCESS32(HW_PIT_MCR_ADDR, BP_PIT_MCR_FRZ))
#endif
//! @brief Format value for bitfield PIT_MCR_FRZ.
#define BF_PIT_MCR_FRZ(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_MCR_FRZ), uint32_t) & BM_PIT_MCR_FRZ)
#ifndef __LANGUAGE_ASM__
//! @brief Set the FRZ field to a new value.
#define BW_PIT_MCR_FRZ(v) (BITBAND_ACCESS32(HW_PIT_MCR_ADDR, BP_PIT_MCR_FRZ) = (v))
#endif
//@}
/*!
* @name Register PIT_MCR, field MDIS[1] (RW)
*
* Disables the standard timers. This field must be enabled before any other
* setup is done.
*
* Values:
* - 0 - Clock for standard PIT timers is enabled.
* - 1 - Clock for standard PIT timers is disabled.
*/
//@{
#define BP_PIT_MCR_MDIS (1U) //!< Bit position for PIT_MCR_MDIS.
#define BM_PIT_MCR_MDIS (0x00000002U) //!< Bit mask for PIT_MCR_MDIS.
#define BS_PIT_MCR_MDIS (1U) //!< Bit field size in bits for PIT_MCR_MDIS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_MCR_MDIS field.
#define BR_PIT_MCR_MDIS (BITBAND_ACCESS32(HW_PIT_MCR_ADDR, BP_PIT_MCR_MDIS))
#endif
//! @brief Format value for bitfield PIT_MCR_MDIS.
#define BF_PIT_MCR_MDIS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_MCR_MDIS), uint32_t) & BM_PIT_MCR_MDIS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the MDIS field to a new value.
#define BW_PIT_MCR_MDIS(v) (BITBAND_ACCESS32(HW_PIT_MCR_ADDR, BP_PIT_MCR_MDIS) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PIT_LDVALn - Timer Load Value Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PIT_LDVALn - Timer Load Value Register (RW)
*
* Reset value: 0x00000000U
*
* These registers select the timeout period for the timer interrupts.
*/
typedef union _hw_pit_ldvaln
{
uint32_t U;
struct _hw_pit_ldvaln_bitfields
{
uint32_t TSV : 32; //!< [31:0] Timer Start Value
} B;
} hw_pit_ldvaln_t;
#endif
/*!
* @name Constants and macros for entire PIT_LDVALn register
*/
//@{
#define HW_PIT_LDVALn_COUNT (4U)
#define HW_PIT_LDVALn_ADDR(n) (REGS_PIT_BASE + 0x100U + (0x10U * n))
#ifndef __LANGUAGE_ASM__
#define HW_PIT_LDVALn(n) (*(__IO hw_pit_ldvaln_t *) HW_PIT_LDVALn_ADDR(n))
#define HW_PIT_LDVALn_RD(n) (HW_PIT_LDVALn(n).U)
#define HW_PIT_LDVALn_WR(n, v) (HW_PIT_LDVALn(n).U = (v))
#define HW_PIT_LDVALn_SET(n, v) (HW_PIT_LDVALn_WR(n, HW_PIT_LDVALn_RD(n) | (v)))
#define HW_PIT_LDVALn_CLR(n, v) (HW_PIT_LDVALn_WR(n, HW_PIT_LDVALn_RD(n) & ~(v)))
#define HW_PIT_LDVALn_TOG(n, v) (HW_PIT_LDVALn_WR(n, HW_PIT_LDVALn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PIT_LDVALn bitfields
*/
/*!
* @name Register PIT_LDVALn, field TSV[31:0] (RW)
*
* Sets the timer start value. The timer will count down until it reaches 0,
* then it will generate an interrupt and load this register value again. Writing a
* new value to this register will not restart the timer; instead the value will
* be loaded after the timer expires. To abort the current cycle and start a
* timer period with the new value, the timer must be disabled and enabled again.
*/
//@{
#define BP_PIT_LDVALn_TSV (0U) //!< Bit position for PIT_LDVALn_TSV.
#define BM_PIT_LDVALn_TSV (0xFFFFFFFFU) //!< Bit mask for PIT_LDVALn_TSV.
#define BS_PIT_LDVALn_TSV (32U) //!< Bit field size in bits for PIT_LDVALn_TSV.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_LDVALn_TSV field.
#define BR_PIT_LDVALn_TSV(n) (HW_PIT_LDVALn(n).U)
#endif
//! @brief Format value for bitfield PIT_LDVALn_TSV.
#define BF_PIT_LDVALn_TSV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_LDVALn_TSV), uint32_t) & BM_PIT_LDVALn_TSV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TSV field to a new value.
#define BW_PIT_LDVALn_TSV(n, v) (HW_PIT_LDVALn_WR(n, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PIT_CVALn - Current Timer Value Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PIT_CVALn - Current Timer Value Register (RO)
*
* Reset value: 0x00000000U
*
* These registers indicate the current timer position.
*/
typedef union _hw_pit_cvaln
{
uint32_t U;
struct _hw_pit_cvaln_bitfields
{
uint32_t TVL : 32; //!< [31:0] Current Timer Value
} B;
} hw_pit_cvaln_t;
#endif
/*!
* @name Constants and macros for entire PIT_CVALn register
*/
//@{
#define HW_PIT_CVALn_COUNT (4U)
#define HW_PIT_CVALn_ADDR(n) (REGS_PIT_BASE + 0x104U + (0x10U * n))
#ifndef __LANGUAGE_ASM__
#define HW_PIT_CVALn(n) (*(__I hw_pit_cvaln_t *) HW_PIT_CVALn_ADDR(n))
#define HW_PIT_CVALn_RD(n) (HW_PIT_CVALn(n).U)
#endif
//@}
/*
* Constants & macros for individual PIT_CVALn bitfields
*/
/*!
* @name Register PIT_CVALn, field TVL[31:0] (RO)
*
* Represents the current timer value, if the timer is enabled. If the timer is
* disabled, do not use this field as its value is unreliable. The timer uses a
* downcounter. The timer values are frozen in Debug mode if MCR[FRZ] is set.
*/
//@{
#define BP_PIT_CVALn_TVL (0U) //!< Bit position for PIT_CVALn_TVL.
#define BM_PIT_CVALn_TVL (0xFFFFFFFFU) //!< Bit mask for PIT_CVALn_TVL.
#define BS_PIT_CVALn_TVL (32U) //!< Bit field size in bits for PIT_CVALn_TVL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_CVALn_TVL field.
#define BR_PIT_CVALn_TVL(n) (HW_PIT_CVALn(n).U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PIT_TCTRLn - Timer Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PIT_TCTRLn - Timer Control Register (RW)
*
* Reset value: 0x00000000U
*
* These registers contain the control bits for each timer.
*/
typedef union _hw_pit_tctrln
{
uint32_t U;
struct _hw_pit_tctrln_bitfields
{
uint32_t TEN : 1; //!< [0] Timer Enable
uint32_t TIE : 1; //!< [1] Timer Interrupt Enable
uint32_t CHN : 1; //!< [2] Chain Mode
uint32_t RESERVED0 : 29; //!< [31:3]
} B;
} hw_pit_tctrln_t;
#endif
/*!
* @name Constants and macros for entire PIT_TCTRLn register
*/
//@{
#define HW_PIT_TCTRLn_COUNT (4U)
#define HW_PIT_TCTRLn_ADDR(n) (REGS_PIT_BASE + 0x108U + (0x10U * n))
#ifndef __LANGUAGE_ASM__
#define HW_PIT_TCTRLn(n) (*(__IO hw_pit_tctrln_t *) HW_PIT_TCTRLn_ADDR(n))
#define HW_PIT_TCTRLn_RD(n) (HW_PIT_TCTRLn(n).U)
#define HW_PIT_TCTRLn_WR(n, v) (HW_PIT_TCTRLn(n).U = (v))
#define HW_PIT_TCTRLn_SET(n, v) (HW_PIT_TCTRLn_WR(n, HW_PIT_TCTRLn_RD(n) | (v)))
#define HW_PIT_TCTRLn_CLR(n, v) (HW_PIT_TCTRLn_WR(n, HW_PIT_TCTRLn_RD(n) & ~(v)))
#define HW_PIT_TCTRLn_TOG(n, v) (HW_PIT_TCTRLn_WR(n, HW_PIT_TCTRLn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PIT_TCTRLn bitfields
*/
/*!
* @name Register PIT_TCTRLn, field TEN[0] (RW)
*
* Enables or disables the timer.
*
* Values:
* - 0 - Timer n is disabled.
* - 1 - Timer n is enabled.
*/
//@{
#define BP_PIT_TCTRLn_TEN (0U) //!< Bit position for PIT_TCTRLn_TEN.
#define BM_PIT_TCTRLn_TEN (0x00000001U) //!< Bit mask for PIT_TCTRLn_TEN.
#define BS_PIT_TCTRLn_TEN (1U) //!< Bit field size in bits for PIT_TCTRLn_TEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_TCTRLn_TEN field.
#define BR_PIT_TCTRLn_TEN(n) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_TEN))
#endif
//! @brief Format value for bitfield PIT_TCTRLn_TEN.
#define BF_PIT_TCTRLn_TEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_TCTRLn_TEN), uint32_t) & BM_PIT_TCTRLn_TEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TEN field to a new value.
#define BW_PIT_TCTRLn_TEN(n, v) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_TEN) = (v))
#endif
//@}
/*!
* @name Register PIT_TCTRLn, field TIE[1] (RW)
*
* When an interrupt is pending, or, TFLGn[TIF] is set, enabling the interrupt
* will immediately cause an interrupt event. To avoid this, the associated
* TFLGn[TIF] must be cleared first.
*
* Values:
* - 0 - Interrupt requests from Timer n are disabled.
* - 1 - Interrupt will be requested whenever TIF is set.
*/
//@{
#define BP_PIT_TCTRLn_TIE (1U) //!< Bit position for PIT_TCTRLn_TIE.
#define BM_PIT_TCTRLn_TIE (0x00000002U) //!< Bit mask for PIT_TCTRLn_TIE.
#define BS_PIT_TCTRLn_TIE (1U) //!< Bit field size in bits for PIT_TCTRLn_TIE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_TCTRLn_TIE field.
#define BR_PIT_TCTRLn_TIE(n) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_TIE))
#endif
//! @brief Format value for bitfield PIT_TCTRLn_TIE.
#define BF_PIT_TCTRLn_TIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_TCTRLn_TIE), uint32_t) & BM_PIT_TCTRLn_TIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TIE field to a new value.
#define BW_PIT_TCTRLn_TIE(n, v) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_TIE) = (v))
#endif
//@}
/*!
* @name Register PIT_TCTRLn, field CHN[2] (RW)
*
* When activated, Timer n-1 needs to expire before timer n can decrement by 1.
* Timer 0 cannot be chained.
*
* Values:
* - 0 - Timer is not chained.
* - 1 - Timer is chained to previous timer. For example, for Channel 2, if this
* field is set, Timer 2 is chained to Timer 1.
*/
//@{
#define BP_PIT_TCTRLn_CHN (2U) //!< Bit position for PIT_TCTRLn_CHN.
#define BM_PIT_TCTRLn_CHN (0x00000004U) //!< Bit mask for PIT_TCTRLn_CHN.
#define BS_PIT_TCTRLn_CHN (1U) //!< Bit field size in bits for PIT_TCTRLn_CHN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_TCTRLn_CHN field.
#define BR_PIT_TCTRLn_CHN(n) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_CHN))
#endif
//! @brief Format value for bitfield PIT_TCTRLn_CHN.
#define BF_PIT_TCTRLn_CHN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_TCTRLn_CHN), uint32_t) & BM_PIT_TCTRLn_CHN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CHN field to a new value.
#define BW_PIT_TCTRLn_CHN(n, v) (BITBAND_ACCESS32(HW_PIT_TCTRLn_ADDR(n), BP_PIT_TCTRLn_CHN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PIT_TFLGn - Timer Flag Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PIT_TFLGn - Timer Flag Register (RW)
*
* Reset value: 0x00000000U
*
* These registers hold the PIT interrupt flags.
*/
typedef union _hw_pit_tflgn
{
uint32_t U;
struct _hw_pit_tflgn_bitfields
{
uint32_t TIF : 1; //!< [0] Timer Interrupt Flag
uint32_t RESERVED0 : 31; //!< [31:1]
} B;
} hw_pit_tflgn_t;
#endif
/*!
* @name Constants and macros for entire PIT_TFLGn register
*/
//@{
#define HW_PIT_TFLGn_COUNT (4U)
#define HW_PIT_TFLGn_ADDR(n) (REGS_PIT_BASE + 0x10CU + (0x10U * n))
#ifndef __LANGUAGE_ASM__
#define HW_PIT_TFLGn(n) (*(__IO hw_pit_tflgn_t *) HW_PIT_TFLGn_ADDR(n))
#define HW_PIT_TFLGn_RD(n) (HW_PIT_TFLGn(n).U)
#define HW_PIT_TFLGn_WR(n, v) (HW_PIT_TFLGn(n).U = (v))
#define HW_PIT_TFLGn_SET(n, v) (HW_PIT_TFLGn_WR(n, HW_PIT_TFLGn_RD(n) | (v)))
#define HW_PIT_TFLGn_CLR(n, v) (HW_PIT_TFLGn_WR(n, HW_PIT_TFLGn_RD(n) & ~(v)))
#define HW_PIT_TFLGn_TOG(n, v) (HW_PIT_TFLGn_WR(n, HW_PIT_TFLGn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PIT_TFLGn bitfields
*/
/*!
* @name Register PIT_TFLGn, field TIF[0] (W1C)
*
* Sets to 1 at the end of the timer period. Writing 1 to this flag clears it.
* Writing 0 has no effect. If enabled, or, when TCTRLn[TIE] = 1, TIF causes an
* interrupt request.
*
* Values:
* - 0 - Timeout has not yet occurred.
* - 1 - Timeout has occurred.
*/
//@{
#define BP_PIT_TFLGn_TIF (0U) //!< Bit position for PIT_TFLGn_TIF.
#define BM_PIT_TFLGn_TIF (0x00000001U) //!< Bit mask for PIT_TFLGn_TIF.
#define BS_PIT_TFLGn_TIF (1U) //!< Bit field size in bits for PIT_TFLGn_TIF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PIT_TFLGn_TIF field.
#define BR_PIT_TFLGn_TIF(n) (BITBAND_ACCESS32(HW_PIT_TFLGn_ADDR(n), BP_PIT_TFLGn_TIF))
#endif
//! @brief Format value for bitfield PIT_TFLGn_TIF.
#define BF_PIT_TFLGn_TIF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PIT_TFLGn_TIF), uint32_t) & BM_PIT_TFLGn_TIF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TIF field to a new value.
#define BW_PIT_TFLGn_TIF(n, v) (BITBAND_ACCESS32(HW_PIT_TFLGn_ADDR(n), BP_PIT_TFLGn_TIF) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_pit_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All PIT module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_pit
{
__IO hw_pit_mcr_t MCR; //!< [0x0] PIT Module Control Register
uint8_t _reserved0[252];
struct {
__IO hw_pit_ldvaln_t LDVALn; //!< [0x100] Timer Load Value Register
__I hw_pit_cvaln_t CVALn; //!< [0x104] Current Timer Value Register
__IO hw_pit_tctrln_t TCTRLn; //!< [0x108] Timer Control Register
__IO hw_pit_tflgn_t TFLGn; //!< [0x10C] Timer Flag Register
} CHANNEL[4];
} hw_pit_t;
#pragma pack()
//! @brief Macro to access all PIT registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_PIT</code>.
#define HW_PIT (*(hw_pit_t *) REGS_PIT_BASE)
#endif
#endif // __HW_PIT_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,577 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_PMC_REGISTERS_H__
#define __HW_PMC_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 PMC
*
* Power Management Controller
*
* Registers defined in this header file:
* - HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
* - HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
* - HW_PMC_REGSC - Regulator Status And Control register
*
* - hw_pmc_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_PMC_BASE
#define HW_PMC_INSTANCE_COUNT (1U) //!< Number of instances of the PMC module.
#define REGS_PMC_BASE (0x4007D000U) //!< Base address for PMC.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PMC_LVDSC1 - Low Voltage Detect Status And Control 1 register (RW)
*
* Reset value: 0x10U
*
* This register contains status and control bits to support the low voltage
* detect function. This register should be written during the reset initialization
* program to set the desired controls even if the desired settings are the same
* as the reset settings. While the device is in the very low power or low
* leakage modes, the LVD system is disabled regardless of LVDSC1 settings. To protect
* systems that must have LVD always on, configure the Power Mode Protection
* (PMPROT) register of the SMC module (SMC_PMPROT) to disallow any very low power or
* low leakage modes from being enabled. See the device's data sheet for the
* exact LVD trip voltages. The LVDV bits are reset solely on a POR Only event. The
* register's other bits are reset on Chip Reset Not VLLS. For more information
* about these reset types, refer to the Reset section details.
*/
typedef union _hw_pmc_lvdsc1
{
uint8_t U;
struct _hw_pmc_lvdsc1_bitfields
{
uint8_t LVDV : 2; //!< [1:0] Low-Voltage Detect Voltage Select
uint8_t RESERVED0 : 2; //!< [3:2]
uint8_t LVDRE : 1; //!< [4] Low-Voltage Detect Reset Enable
uint8_t LVDIE : 1; //!< [5] Low-Voltage Detect Interrupt Enable
uint8_t LVDACK : 1; //!< [6] Low-Voltage Detect Acknowledge
uint8_t LVDF : 1; //!< [7] Low-Voltage Detect Flag
} B;
} hw_pmc_lvdsc1_t;
#endif
/*!
* @name Constants and macros for entire PMC_LVDSC1 register
*/
//@{
#define HW_PMC_LVDSC1_ADDR (REGS_PMC_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_PMC_LVDSC1 (*(__IO hw_pmc_lvdsc1_t *) HW_PMC_LVDSC1_ADDR)
#define HW_PMC_LVDSC1_RD() (HW_PMC_LVDSC1.U)
#define HW_PMC_LVDSC1_WR(v) (HW_PMC_LVDSC1.U = (v))
#define HW_PMC_LVDSC1_SET(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() | (v)))
#define HW_PMC_LVDSC1_CLR(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() & ~(v)))
#define HW_PMC_LVDSC1_TOG(v) (HW_PMC_LVDSC1_WR(HW_PMC_LVDSC1_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PMC_LVDSC1 bitfields
*/
/*!
* @name Register PMC_LVDSC1, field LVDV[1:0] (RW)
*
* Selects the LVD trip point voltage (V LVD ).
*
* Values:
* - 00 - Low trip point selected (V LVD = V LVDL )
* - 01 - High trip point selected (V LVD = V LVDH )
* - 10 - Reserved
* - 11 - Reserved
*/
//@{
#define BP_PMC_LVDSC1_LVDV (0U) //!< Bit position for PMC_LVDSC1_LVDV.
#define BM_PMC_LVDSC1_LVDV (0x03U) //!< Bit mask for PMC_LVDSC1_LVDV.
#define BS_PMC_LVDSC1_LVDV (2U) //!< Bit field size in bits for PMC_LVDSC1_LVDV.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC1_LVDV field.
#define BR_PMC_LVDSC1_LVDV (HW_PMC_LVDSC1.B.LVDV)
#endif
//! @brief Format value for bitfield PMC_LVDSC1_LVDV.
#define BF_PMC_LVDSC1_LVDV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDV), uint8_t) & BM_PMC_LVDSC1_LVDV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVDV field to a new value.
#define BW_PMC_LVDSC1_LVDV(v) (HW_PMC_LVDSC1_WR((HW_PMC_LVDSC1_RD() & ~BM_PMC_LVDSC1_LVDV) | BF_PMC_LVDSC1_LVDV(v)))
#endif
//@}
/*!
* @name Register PMC_LVDSC1, field LVDRE[4] (RW)
*
* This write-once bit enables LVDF events to generate a hardware reset.
* Additional writes are ignored.
*
* Values:
* - 0 - LVDF does not generate hardware resets
* - 1 - Force an MCU reset when LVDF = 1
*/
//@{
#define BP_PMC_LVDSC1_LVDRE (4U) //!< Bit position for PMC_LVDSC1_LVDRE.
#define BM_PMC_LVDSC1_LVDRE (0x10U) //!< Bit mask for PMC_LVDSC1_LVDRE.
#define BS_PMC_LVDSC1_LVDRE (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDRE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC1_LVDRE field.
#define BR_PMC_LVDSC1_LVDRE (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDRE))
#endif
//! @brief Format value for bitfield PMC_LVDSC1_LVDRE.
#define BF_PMC_LVDSC1_LVDRE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDRE), uint8_t) & BM_PMC_LVDSC1_LVDRE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVDRE field to a new value.
#define BW_PMC_LVDSC1_LVDRE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDRE) = (v))
#endif
//@}
/*!
* @name Register PMC_LVDSC1, field LVDIE[5] (RW)
*
* Enables hardware interrupt requests for LVDF.
*
* Values:
* - 0 - Hardware interrupt disabled (use polling)
* - 1 - Request a hardware interrupt when LVDF = 1
*/
//@{
#define BP_PMC_LVDSC1_LVDIE (5U) //!< Bit position for PMC_LVDSC1_LVDIE.
#define BM_PMC_LVDSC1_LVDIE (0x20U) //!< Bit mask for PMC_LVDSC1_LVDIE.
#define BS_PMC_LVDSC1_LVDIE (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDIE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC1_LVDIE field.
#define BR_PMC_LVDSC1_LVDIE (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDIE))
#endif
//! @brief Format value for bitfield PMC_LVDSC1_LVDIE.
#define BF_PMC_LVDSC1_LVDIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDIE), uint8_t) & BM_PMC_LVDSC1_LVDIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVDIE field to a new value.
#define BW_PMC_LVDSC1_LVDIE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDIE) = (v))
#endif
//@}
/*!
* @name Register PMC_LVDSC1, field LVDACK[6] (WORZ)
*
* This write-only field is used to acknowledge low voltage detection errors.
* Write 1 to clear LVDF. Reads always return 0.
*/
//@{
#define BP_PMC_LVDSC1_LVDACK (6U) //!< Bit position for PMC_LVDSC1_LVDACK.
#define BM_PMC_LVDSC1_LVDACK (0x40U) //!< Bit mask for PMC_LVDSC1_LVDACK.
#define BS_PMC_LVDSC1_LVDACK (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDACK.
//! @brief Format value for bitfield PMC_LVDSC1_LVDACK.
#define BF_PMC_LVDSC1_LVDACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC1_LVDACK), uint8_t) & BM_PMC_LVDSC1_LVDACK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVDACK field to a new value.
#define BW_PMC_LVDSC1_LVDACK(v) (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDACK) = (v))
#endif
//@}
/*!
* @name Register PMC_LVDSC1, field LVDF[7] (RO)
*
* This read-only status field indicates a low-voltage detect event.
*
* Values:
* - 0 - Low-voltage event not detected
* - 1 - Low-voltage event detected
*/
//@{
#define BP_PMC_LVDSC1_LVDF (7U) //!< Bit position for PMC_LVDSC1_LVDF.
#define BM_PMC_LVDSC1_LVDF (0x80U) //!< Bit mask for PMC_LVDSC1_LVDF.
#define BS_PMC_LVDSC1_LVDF (1U) //!< Bit field size in bits for PMC_LVDSC1_LVDF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC1_LVDF field.
#define BR_PMC_LVDSC1_LVDF (BITBAND_ACCESS8(HW_PMC_LVDSC1_ADDR, BP_PMC_LVDSC1_LVDF))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PMC_LVDSC2 - Low Voltage Detect Status And Control 2 register (RW)
*
* Reset value: 0x00U
*
* This register contains status and control bits to support the low voltage
* warning function. While the device is in the very low power or low leakage modes,
* the LVD system is disabled regardless of LVDSC2 settings. See the device's
* data sheet for the exact LVD trip voltages. The LVW trip voltages depend on LVWV
* and LVDV. LVWV is reset solely on a POR Only event. The other fields of the
* register are reset on Chip Reset Not VLLS. For more information about these
* reset types, refer to the Reset section details.
*/
typedef union _hw_pmc_lvdsc2
{
uint8_t U;
struct _hw_pmc_lvdsc2_bitfields
{
uint8_t LVWV : 2; //!< [1:0] Low-Voltage Warning Voltage Select
uint8_t RESERVED0 : 3; //!< [4:2]
uint8_t LVWIE : 1; //!< [5] Low-Voltage Warning Interrupt Enable
uint8_t LVWACK : 1; //!< [6] Low-Voltage Warning Acknowledge
uint8_t LVWF : 1; //!< [7] Low-Voltage Warning Flag
} B;
} hw_pmc_lvdsc2_t;
#endif
/*!
* @name Constants and macros for entire PMC_LVDSC2 register
*/
//@{
#define HW_PMC_LVDSC2_ADDR (REGS_PMC_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_PMC_LVDSC2 (*(__IO hw_pmc_lvdsc2_t *) HW_PMC_LVDSC2_ADDR)
#define HW_PMC_LVDSC2_RD() (HW_PMC_LVDSC2.U)
#define HW_PMC_LVDSC2_WR(v) (HW_PMC_LVDSC2.U = (v))
#define HW_PMC_LVDSC2_SET(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() | (v)))
#define HW_PMC_LVDSC2_CLR(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() & ~(v)))
#define HW_PMC_LVDSC2_TOG(v) (HW_PMC_LVDSC2_WR(HW_PMC_LVDSC2_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PMC_LVDSC2 bitfields
*/
/*!
* @name Register PMC_LVDSC2, field LVWV[1:0] (RW)
*
* Selects the LVW trip point voltage (VLVW). The actual voltage for the warning
* depends on LVDSC1[LVDV].
*
* Values:
* - 00 - Low trip point selected (VLVW = VLVW1)
* - 01 - Mid 1 trip point selected (VLVW = VLVW2)
* - 10 - Mid 2 trip point selected (VLVW = VLVW3)
* - 11 - High trip point selected (VLVW = VLVW4)
*/
//@{
#define BP_PMC_LVDSC2_LVWV (0U) //!< Bit position for PMC_LVDSC2_LVWV.
#define BM_PMC_LVDSC2_LVWV (0x03U) //!< Bit mask for PMC_LVDSC2_LVWV.
#define BS_PMC_LVDSC2_LVWV (2U) //!< Bit field size in bits for PMC_LVDSC2_LVWV.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC2_LVWV field.
#define BR_PMC_LVDSC2_LVWV (HW_PMC_LVDSC2.B.LVWV)
#endif
//! @brief Format value for bitfield PMC_LVDSC2_LVWV.
#define BF_PMC_LVDSC2_LVWV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWV), uint8_t) & BM_PMC_LVDSC2_LVWV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVWV field to a new value.
#define BW_PMC_LVDSC2_LVWV(v) (HW_PMC_LVDSC2_WR((HW_PMC_LVDSC2_RD() & ~BM_PMC_LVDSC2_LVWV) | BF_PMC_LVDSC2_LVWV(v)))
#endif
//@}
/*!
* @name Register PMC_LVDSC2, field LVWIE[5] (RW)
*
* Enables hardware interrupt requests for LVWF.
*
* Values:
* - 0 - Hardware interrupt disabled (use polling)
* - 1 - Request a hardware interrupt when LVWF = 1
*/
//@{
#define BP_PMC_LVDSC2_LVWIE (5U) //!< Bit position for PMC_LVDSC2_LVWIE.
#define BM_PMC_LVDSC2_LVWIE (0x20U) //!< Bit mask for PMC_LVDSC2_LVWIE.
#define BS_PMC_LVDSC2_LVWIE (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWIE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC2_LVWIE field.
#define BR_PMC_LVDSC2_LVWIE (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWIE))
#endif
//! @brief Format value for bitfield PMC_LVDSC2_LVWIE.
#define BF_PMC_LVDSC2_LVWIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWIE), uint8_t) & BM_PMC_LVDSC2_LVWIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVWIE field to a new value.
#define BW_PMC_LVDSC2_LVWIE(v) (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWIE) = (v))
#endif
//@}
/*!
* @name Register PMC_LVDSC2, field LVWACK[6] (WORZ)
*
* This write-only field is used to acknowledge low voltage warning errors.
* Write 1 to clear LVWF. Reads always return 0.
*/
//@{
#define BP_PMC_LVDSC2_LVWACK (6U) //!< Bit position for PMC_LVDSC2_LVWACK.
#define BM_PMC_LVDSC2_LVWACK (0x40U) //!< Bit mask for PMC_LVDSC2_LVWACK.
#define BS_PMC_LVDSC2_LVWACK (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWACK.
//! @brief Format value for bitfield PMC_LVDSC2_LVWACK.
#define BF_PMC_LVDSC2_LVWACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_LVDSC2_LVWACK), uint8_t) & BM_PMC_LVDSC2_LVWACK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LVWACK field to a new value.
#define BW_PMC_LVDSC2_LVWACK(v) (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWACK) = (v))
#endif
//@}
/*!
* @name Register PMC_LVDSC2, field LVWF[7] (RO)
*
* This read-only status field indicates a low-voltage warning event. LVWF is
* set when VSupply transitions below the trip point, or after reset and VSupply is
* already below VLVW. LVWF may be 1 after power-on reset, therefore, to use LVW
* interrupt function, before enabling LVWIE, LVWF must be cleared by writing
* LVWACK first.
*
* Values:
* - 0 - Low-voltage warning event not detected
* - 1 - Low-voltage warning event detected
*/
//@{
#define BP_PMC_LVDSC2_LVWF (7U) //!< Bit position for PMC_LVDSC2_LVWF.
#define BM_PMC_LVDSC2_LVWF (0x80U) //!< Bit mask for PMC_LVDSC2_LVWF.
#define BS_PMC_LVDSC2_LVWF (1U) //!< Bit field size in bits for PMC_LVDSC2_LVWF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_LVDSC2_LVWF field.
#define BR_PMC_LVDSC2_LVWF (BITBAND_ACCESS8(HW_PMC_LVDSC2_ADDR, BP_PMC_LVDSC2_LVWF))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PMC_REGSC - Regulator Status And Control register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PMC_REGSC - Regulator Status And Control register (RW)
*
* Reset value: 0x04U
*
* The PMC contains an internal voltage regulator. The voltage regulator design
* uses a bandgap reference that is also available through a buffer as input to
* certain internal peripherals, such as the CMP and ADC. The internal regulator
* provides a status bit (REGONS) indicating the regulator is in run regulation.
* This register is reset on Chip Reset Not VLLS and by reset types that trigger
* Chip Reset not VLLS. See the Reset section details for more information.
*/
typedef union _hw_pmc_regsc
{
uint8_t U;
struct _hw_pmc_regsc_bitfields
{
uint8_t BGBE : 1; //!< [0] Bandgap Buffer Enable
uint8_t RESERVED0 : 1; //!< [1]
uint8_t REGONS : 1; //!< [2] Regulator In Run Regulation Status
uint8_t ACKISO : 1; //!< [3] Acknowledge Isolation
uint8_t BGEN : 1; //!< [4] Bandgap Enable In VLPx Operation
uint8_t RESERVED1 : 3; //!< [7:5]
} B;
} hw_pmc_regsc_t;
#endif
/*!
* @name Constants and macros for entire PMC_REGSC register
*/
//@{
#define HW_PMC_REGSC_ADDR (REGS_PMC_BASE + 0x2U)
#ifndef __LANGUAGE_ASM__
#define HW_PMC_REGSC (*(__IO hw_pmc_regsc_t *) HW_PMC_REGSC_ADDR)
#define HW_PMC_REGSC_RD() (HW_PMC_REGSC.U)
#define HW_PMC_REGSC_WR(v) (HW_PMC_REGSC.U = (v))
#define HW_PMC_REGSC_SET(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() | (v)))
#define HW_PMC_REGSC_CLR(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() & ~(v)))
#define HW_PMC_REGSC_TOG(v) (HW_PMC_REGSC_WR(HW_PMC_REGSC_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PMC_REGSC bitfields
*/
/*!
* @name Register PMC_REGSC, field BGBE[0] (RW)
*
* Enables the bandgap buffer.
*
* Values:
* - 0 - Bandgap buffer not enabled
* - 1 - Bandgap buffer enabled
*/
//@{
#define BP_PMC_REGSC_BGBE (0U) //!< Bit position for PMC_REGSC_BGBE.
#define BM_PMC_REGSC_BGBE (0x01U) //!< Bit mask for PMC_REGSC_BGBE.
#define BS_PMC_REGSC_BGBE (1U) //!< Bit field size in bits for PMC_REGSC_BGBE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_REGSC_BGBE field.
#define BR_PMC_REGSC_BGBE (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGBE))
#endif
//! @brief Format value for bitfield PMC_REGSC_BGBE.
#define BF_PMC_REGSC_BGBE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_BGBE), uint8_t) & BM_PMC_REGSC_BGBE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BGBE field to a new value.
#define BW_PMC_REGSC_BGBE(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGBE) = (v))
#endif
//@}
/*!
* @name Register PMC_REGSC, field REGONS[2] (RO)
*
* This read-only field provides the current status of the internal voltage
* regulator.
*
* Values:
* - 0 - Regulator is in stop regulation or in transition to/from it
* - 1 - Regulator is in run regulation
*/
//@{
#define BP_PMC_REGSC_REGONS (2U) //!< Bit position for PMC_REGSC_REGONS.
#define BM_PMC_REGSC_REGONS (0x04U) //!< Bit mask for PMC_REGSC_REGONS.
#define BS_PMC_REGSC_REGONS (1U) //!< Bit field size in bits for PMC_REGSC_REGONS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_REGSC_REGONS field.
#define BR_PMC_REGSC_REGONS (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_REGONS))
#endif
//@}
/*!
* @name Register PMC_REGSC, field ACKISO[3] (W1C)
*
* Reading this field indicates whether certain peripherals and the I/O pads are
* in a latched state as a result of having been in a VLLS mode. Writing 1 to
* this field when it is set releases the I/O pads and certain peripherals to their
* normal run mode state. After recovering from a VLLS mode, user should restore
* chip configuration before clearing ACKISO. In particular, pin configuration
* for enabled LLWU wakeup pins should be restored to avoid any LLWU flag from
* being falsely set when ACKISO is cleared.
*
* Values:
* - 0 - Peripherals and I/O pads are in normal run state.
* - 1 - Certain peripherals and I/O pads are in an isolated and latched state.
*/
//@{
#define BP_PMC_REGSC_ACKISO (3U) //!< Bit position for PMC_REGSC_ACKISO.
#define BM_PMC_REGSC_ACKISO (0x08U) //!< Bit mask for PMC_REGSC_ACKISO.
#define BS_PMC_REGSC_ACKISO (1U) //!< Bit field size in bits for PMC_REGSC_ACKISO.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_REGSC_ACKISO field.
#define BR_PMC_REGSC_ACKISO (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_ACKISO))
#endif
//! @brief Format value for bitfield PMC_REGSC_ACKISO.
#define BF_PMC_REGSC_ACKISO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_ACKISO), uint8_t) & BM_PMC_REGSC_ACKISO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ACKISO field to a new value.
#define BW_PMC_REGSC_ACKISO(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_ACKISO) = (v))
#endif
//@}
/*!
* @name Register PMC_REGSC, field BGEN[4] (RW)
*
* BGEN controls whether the bandgap is enabled in lower power modes of
* operation (VLPx, LLS, and VLLSx). When on-chip peripherals require the bandgap voltage
* reference in low power modes of operation, set BGEN to continue to enable the
* bandgap operation. When the bandgap voltage reference is not needed in low
* power modes, clear BGEN to avoid excess power consumption.
*
* Values:
* - 0 - Bandgap voltage reference is disabled in VLPx , LLS , and VLLSx modes.
* - 1 - Bandgap voltage reference is enabled in VLPx , LLS , and VLLSx modes.
*/
//@{
#define BP_PMC_REGSC_BGEN (4U) //!< Bit position for PMC_REGSC_BGEN.
#define BM_PMC_REGSC_BGEN (0x10U) //!< Bit mask for PMC_REGSC_BGEN.
#define BS_PMC_REGSC_BGEN (1U) //!< Bit field size in bits for PMC_REGSC_BGEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PMC_REGSC_BGEN field.
#define BR_PMC_REGSC_BGEN (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGEN))
#endif
//! @brief Format value for bitfield PMC_REGSC_BGEN.
#define BF_PMC_REGSC_BGEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_PMC_REGSC_BGEN), uint8_t) & BM_PMC_REGSC_BGEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BGEN field to a new value.
#define BW_PMC_REGSC_BGEN(v) (BITBAND_ACCESS8(HW_PMC_REGSC_ADDR, BP_PMC_REGSC_BGEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_pmc_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All PMC module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_pmc
{
__IO hw_pmc_lvdsc1_t LVDSC1; //!< [0x0] Low Voltage Detect Status And Control 1 register
__IO hw_pmc_lvdsc2_t LVDSC2; //!< [0x1] Low Voltage Detect Status And Control 2 register
__IO hw_pmc_regsc_t REGSC; //!< [0x2] Regulator Status And Control register
} hw_pmc_t;
#pragma pack()
//! @brief Macro to access all PMC registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_PMC</code>.
#define HW_PMC (*(hw_pmc_t *) REGS_PMC_BASE)
#endif
#endif // __HW_PMC_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,957 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_PORT_REGISTERS_H__
#define __HW_PORT_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 PORT
*
* Pin Control and Interrupts
*
* Registers defined in this header file:
* - HW_PORT_PCRn - Pin Control Register n
* - HW_PORT_GPCLR - Global Pin Control Low Register
* - HW_PORT_GPCHR - Global Pin Control High Register
* - HW_PORT_ISFR - Interrupt Status Flag Register
* - HW_PORT_DFER - Digital Filter Enable Register
* - HW_PORT_DFCR - Digital Filter Clock Register
* - HW_PORT_DFWR - Digital Filter Width Register
*
* - hw_port_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_PORT_BASE
#define HW_PORT_INSTANCE_COUNT (5U) //!< Number of instances of the PORT module.
#define HW_PORTA (0U) //!< Instance number for PORTA.
#define HW_PORTB (1U) //!< Instance number for PORTB.
#define HW_PORTC (2U) //!< Instance number for PORTC.
#define HW_PORTD (3U) //!< Instance number for PORTD.
#define HW_PORTE (4U) //!< Instance number for PORTE.
#define REGS_PORTA_BASE (0x40049000U) //!< Base address for PORTA.
#define REGS_PORTB_BASE (0x4004A000U) //!< Base address for PORTB.
#define REGS_PORTC_BASE (0x4004B000U) //!< Base address for PORTC.
#define REGS_PORTD_BASE (0x4004C000U) //!< Base address for PORTD.
#define REGS_PORTE_BASE (0x4004D000U) //!< Base address for PORTE.
//! @brief Table of base addresses for PORT instances.
static const uint32_t __g_regs_PORT_base_addresses[] = {
REGS_PORTA_BASE,
REGS_PORTB_BASE,
REGS_PORTC_BASE,
REGS_PORTD_BASE,
REGS_PORTE_BASE,
};
//! @brief Get the base address of PORT by instance number.
//! @param x PORT instance number, from 0 through 4.
#define REGS_PORT_BASE(x) (__g_regs_PORT_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of PORT.
#define REGS_PORT_INSTANCE(b) ((b) == REGS_PORTA_BASE ? HW_PORTA : (b) == REGS_PORTB_BASE ? HW_PORTB : (b) == REGS_PORTC_BASE ? HW_PORTC : (b) == REGS_PORTD_BASE ? HW_PORTD : (b) == REGS_PORTE_BASE ? HW_PORTE : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_PCRn - Pin Control Register n
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_PCRn - Pin Control Register n (RW)
*
* Reset value: 0x00000742U
*
* See the Signal Multiplexing and Pin Assignment chapter for the reset value of
* this device. See the GPIO Configuration section for details on the available
* functions for each pin. Do not modify pin configuration registers associated
* with pins not available in your selected package. All unbonded pins not
* available in your package will default to DISABLE state for lowest power consumption.
*/
typedef union _hw_port_pcrn
{
uint32_t U;
struct _hw_port_pcrn_bitfields
{
uint32_t PS : 1; //!< [0] Pull Select
uint32_t PE : 1; //!< [1] Pull Enable
uint32_t SRE : 1; //!< [2] Slew Rate Enable
uint32_t RESERVED0 : 1; //!< [3]
uint32_t PFE : 1; //!< [4] Passive Filter Enable
uint32_t ODE : 1; //!< [5] Open Drain Enable
uint32_t DSE : 1; //!< [6] Drive Strength Enable
uint32_t RESERVED1 : 1; //!< [7]
uint32_t MUX : 3; //!< [10:8] Pin Mux Control
uint32_t RESERVED2 : 4; //!< [14:11]
uint32_t LK : 1; //!< [15] Lock Register
uint32_t IRQC : 4; //!< [19:16] Interrupt Configuration
uint32_t RESERVED3 : 4; //!< [23:20]
uint32_t ISF : 1; //!< [24] Interrupt Status Flag
uint32_t RESERVED4 : 7; //!< [31:25]
} B;
} hw_port_pcrn_t;
#endif
/*!
* @name Constants and macros for entire PORT_PCRn register
*/
//@{
#define HW_PORT_PCRn_COUNT (32U)
#define HW_PORT_PCRn_ADDR(x, n) (REGS_PORT_BASE(x) + 0x0U + (0x4U * n))
#ifndef __LANGUAGE_ASM__
#define HW_PORT_PCRn(x, n) (*(__IO hw_port_pcrn_t *) HW_PORT_PCRn_ADDR(x, n))
#define HW_PORT_PCRn_RD(x, n) (HW_PORT_PCRn(x, n).U)
#define HW_PORT_PCRn_WR(x, n, v) (HW_PORT_PCRn(x, n).U = (v))
#define HW_PORT_PCRn_SET(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) | (v)))
#define HW_PORT_PCRn_CLR(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) & ~(v)))
#define HW_PORT_PCRn_TOG(x, n, v) (HW_PORT_PCRn_WR(x, n, HW_PORT_PCRn_RD(x, n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PORT_PCRn bitfields
*/
/*!
* @name Register PORT_PCRn, field PS[0] (RW)
*
* Pull configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Internal pulldown resistor is enabled on the corresponding pin, if the
* corresponding PE field is set.
* - 1 - Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set.
*/
//@{
#define BP_PORT_PCRn_PS (0U) //!< Bit position for PORT_PCRn_PS.
#define BM_PORT_PCRn_PS (0x00000001U) //!< Bit mask for PORT_PCRn_PS.
#define BS_PORT_PCRn_PS (1U) //!< Bit field size in bits for PORT_PCRn_PS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_PS field.
#define BR_PORT_PCRn_PS(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS))
#endif
//! @brief Format value for bitfield PORT_PCRn_PS.
#define BF_PORT_PCRn_PS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PS), uint32_t) & BM_PORT_PCRn_PS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PS field to a new value.
#define BW_PORT_PCRn_PS(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PS) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field PE[1] (RW)
*
* Pull configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Internal pullup or pulldown resistor is not enabled on the
* corresponding pin.
* - 1 - Internal pullup or pulldown resistor is enabled on the corresponding
* pin, if the pin is configured as a digital input.
*/
//@{
#define BP_PORT_PCRn_PE (1U) //!< Bit position for PORT_PCRn_PE.
#define BM_PORT_PCRn_PE (0x00000002U) //!< Bit mask for PORT_PCRn_PE.
#define BS_PORT_PCRn_PE (1U) //!< Bit field size in bits for PORT_PCRn_PE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_PE field.
#define BR_PORT_PCRn_PE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE))
#endif
//! @brief Format value for bitfield PORT_PCRn_PE.
#define BF_PORT_PCRn_PE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PE), uint32_t) & BM_PORT_PCRn_PE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PE field to a new value.
#define BW_PORT_PCRn_PE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PE) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field SRE[2] (RW)
*
* Slew rate configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Fast slew rate is configured on the corresponding pin, if the pin is
* configured as a digital output.
* - 1 - Slow slew rate is configured on the corresponding pin, if the pin is
* configured as a digital output.
*/
//@{
#define BP_PORT_PCRn_SRE (2U) //!< Bit position for PORT_PCRn_SRE.
#define BM_PORT_PCRn_SRE (0x00000004U) //!< Bit mask for PORT_PCRn_SRE.
#define BS_PORT_PCRn_SRE (1U) //!< Bit field size in bits for PORT_PCRn_SRE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_SRE field.
#define BR_PORT_PCRn_SRE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE))
#endif
//! @brief Format value for bitfield PORT_PCRn_SRE.
#define BF_PORT_PCRn_SRE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_SRE), uint32_t) & BM_PORT_PCRn_SRE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SRE field to a new value.
#define BW_PORT_PCRn_SRE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_SRE) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field PFE[4] (RW)
*
* Passive filter configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Passive input filter is disabled on the corresponding pin.
* - 1 - Passive input filter is enabled on the corresponding pin, if the pin is
* configured as a digital input. Refer to the device data sheet for filter
* characteristics.
*/
//@{
#define BP_PORT_PCRn_PFE (4U) //!< Bit position for PORT_PCRn_PFE.
#define BM_PORT_PCRn_PFE (0x00000010U) //!< Bit mask for PORT_PCRn_PFE.
#define BS_PORT_PCRn_PFE (1U) //!< Bit field size in bits for PORT_PCRn_PFE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_PFE field.
#define BR_PORT_PCRn_PFE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE))
#endif
//! @brief Format value for bitfield PORT_PCRn_PFE.
#define BF_PORT_PCRn_PFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_PFE), uint32_t) & BM_PORT_PCRn_PFE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PFE field to a new value.
#define BW_PORT_PCRn_PFE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_PFE) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field ODE[5] (RW)
*
* Open drain configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Open drain output is disabled on the corresponding pin.
* - 1 - Open drain output is enabled on the corresponding pin, if the pin is
* configured as a digital output.
*/
//@{
#define BP_PORT_PCRn_ODE (5U) //!< Bit position for PORT_PCRn_ODE.
#define BM_PORT_PCRn_ODE (0x00000020U) //!< Bit mask for PORT_PCRn_ODE.
#define BS_PORT_PCRn_ODE (1U) //!< Bit field size in bits for PORT_PCRn_ODE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_ODE field.
#define BR_PORT_PCRn_ODE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE))
#endif
//! @brief Format value for bitfield PORT_PCRn_ODE.
#define BF_PORT_PCRn_ODE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_ODE), uint32_t) & BM_PORT_PCRn_ODE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ODE field to a new value.
#define BW_PORT_PCRn_ODE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ODE) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field DSE[6] (RW)
*
* Drive strength configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Low drive strength is configured on the corresponding pin, if pin is
* configured as a digital output.
* - 1 - High drive strength is configured on the corresponding pin, if pin is
* configured as a digital output.
*/
//@{
#define BP_PORT_PCRn_DSE (6U) //!< Bit position for PORT_PCRn_DSE.
#define BM_PORT_PCRn_DSE (0x00000040U) //!< Bit mask for PORT_PCRn_DSE.
#define BS_PORT_PCRn_DSE (1U) //!< Bit field size in bits for PORT_PCRn_DSE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_DSE field.
#define BR_PORT_PCRn_DSE(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE))
#endif
//! @brief Format value for bitfield PORT_PCRn_DSE.
#define BF_PORT_PCRn_DSE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_DSE), uint32_t) & BM_PORT_PCRn_DSE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DSE field to a new value.
#define BW_PORT_PCRn_DSE(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_DSE) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field MUX[10:8] (RW)
*
* Not all pins support all pin muxing slots. Unimplemented pin muxing slots are
* reserved and may result in configuring the pin for a different pin muxing
* slot. The corresponding pin is configured in the following pin muxing slot as
* follows:
*
* Values:
* - 000 - Pin disabled (analog).
* - 001 - Alternative 1 (GPIO).
* - 010 - Alternative 2 (chip-specific).
* - 011 - Alternative 3 (chip-specific).
* - 100 - Alternative 4 (chip-specific).
* - 101 - Alternative 5 (chip-specific).
* - 110 - Alternative 6 (chip-specific).
* - 111 - Alternative 7 (chip-specific).
*/
//@{
#define BP_PORT_PCRn_MUX (8U) //!< Bit position for PORT_PCRn_MUX.
#define BM_PORT_PCRn_MUX (0x00000700U) //!< Bit mask for PORT_PCRn_MUX.
#define BS_PORT_PCRn_MUX (3U) //!< Bit field size in bits for PORT_PCRn_MUX.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_MUX field.
#define BR_PORT_PCRn_MUX(x, n) (HW_PORT_PCRn(x, n).B.MUX)
#endif
//! @brief Format value for bitfield PORT_PCRn_MUX.
#define BF_PORT_PCRn_MUX(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_MUX), uint32_t) & BM_PORT_PCRn_MUX)
#ifndef __LANGUAGE_ASM__
//! @brief Set the MUX field to a new value.
#define BW_PORT_PCRn_MUX(x, n, v) (HW_PORT_PCRn_WR(x, n, (HW_PORT_PCRn_RD(x, n) & ~BM_PORT_PCRn_MUX) | BF_PORT_PCRn_MUX(v)))
#endif
//@}
/*!
* @name Register PORT_PCRn, field LK[15] (RW)
*
* Values:
* - 0 - Pin Control Register fields [15:0] are not locked.
* - 1 - Pin Control Register fields [15:0] are locked and cannot be updated
* until the next system reset.
*/
//@{
#define BP_PORT_PCRn_LK (15U) //!< Bit position for PORT_PCRn_LK.
#define BM_PORT_PCRn_LK (0x00008000U) //!< Bit mask for PORT_PCRn_LK.
#define BS_PORT_PCRn_LK (1U) //!< Bit field size in bits for PORT_PCRn_LK.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_LK field.
#define BR_PORT_PCRn_LK(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK))
#endif
//! @brief Format value for bitfield PORT_PCRn_LK.
#define BF_PORT_PCRn_LK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_LK), uint32_t) & BM_PORT_PCRn_LK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LK field to a new value.
#define BW_PORT_PCRn_LK(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_LK) = (v))
#endif
//@}
/*!
* @name Register PORT_PCRn, field IRQC[19:16] (RW)
*
* The pin interrupt configuration is valid in all digital pin muxing modes. The
* corresponding pin is configured to generate interrupt/DMA request as follows:
*
* Values:
* - 0000 - Interrupt/DMA request disabled.
* - 0001 - DMA request on rising edge.
* - 0010 - DMA request on falling edge.
* - 0011 - DMA request on either edge.
* - 1000 - Interrupt when logic 0.
* - 1001 - Interrupt on rising-edge.
* - 1010 - Interrupt on falling-edge.
* - 1011 - Interrupt on either edge.
* - 1100 - Interrupt when logic 1.
*/
//@{
#define BP_PORT_PCRn_IRQC (16U) //!< Bit position for PORT_PCRn_IRQC.
#define BM_PORT_PCRn_IRQC (0x000F0000U) //!< Bit mask for PORT_PCRn_IRQC.
#define BS_PORT_PCRn_IRQC (4U) //!< Bit field size in bits for PORT_PCRn_IRQC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_IRQC field.
#define BR_PORT_PCRn_IRQC(x, n) (HW_PORT_PCRn(x, n).B.IRQC)
#endif
//! @brief Format value for bitfield PORT_PCRn_IRQC.
#define BF_PORT_PCRn_IRQC(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_IRQC), uint32_t) & BM_PORT_PCRn_IRQC)
#ifndef __LANGUAGE_ASM__
//! @brief Set the IRQC field to a new value.
#define BW_PORT_PCRn_IRQC(x, n, v) (HW_PORT_PCRn_WR(x, n, (HW_PORT_PCRn_RD(x, n) & ~BM_PORT_PCRn_IRQC) | BF_PORT_PCRn_IRQC(v)))
#endif
//@}
/*!
* @name Register PORT_PCRn, field ISF[24] (W1C)
*
* The pin interrupt configuration is valid in all digital pin muxing modes.
*
* Values:
* - 0 - Configured interrupt is not detected.
* - 1 - Configured interrupt is detected. If the pin is configured to generate
* a DMA request, then the corresponding flag will be cleared automatically
* at the completion of the requested DMA transfer. Otherwise, the flag
* remains set until a logic 1 is written to the flag. If the pin is configured for
* a level sensitive interrupt and the pin remains asserted, then the flag
* is set again immediately after it is cleared.
*/
//@{
#define BP_PORT_PCRn_ISF (24U) //!< Bit position for PORT_PCRn_ISF.
#define BM_PORT_PCRn_ISF (0x01000000U) //!< Bit mask for PORT_PCRn_ISF.
#define BS_PORT_PCRn_ISF (1U) //!< Bit field size in bits for PORT_PCRn_ISF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_PCRn_ISF field.
#define BR_PORT_PCRn_ISF(x, n) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF))
#endif
//! @brief Format value for bitfield PORT_PCRn_ISF.
#define BF_PORT_PCRn_ISF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_PCRn_ISF), uint32_t) & BM_PORT_PCRn_ISF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ISF field to a new value.
#define BW_PORT_PCRn_ISF(x, n, v) (BITBAND_ACCESS32(HW_PORT_PCRn_ADDR(x, n), BP_PORT_PCRn_ISF) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_GPCLR - Global Pin Control Low Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_GPCLR - Global Pin Control Low Register (WORZ)
*
* Reset value: 0x00000000U
*
* Only 32-bit writes are supported to this register.
*/
typedef union _hw_port_gpclr
{
uint32_t U;
struct _hw_port_gpclr_bitfields
{
uint32_t GPWD : 16; //!< [15:0] Global Pin Write Data
uint32_t GPWE : 16; //!< [31:16] Global Pin Write Enable
} B;
} hw_port_gpclr_t;
#endif
/*!
* @name Constants and macros for entire PORT_GPCLR register
*/
//@{
#define HW_PORT_GPCLR_ADDR(x) (REGS_PORT_BASE(x) + 0x80U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_GPCLR(x) (*(__O hw_port_gpclr_t *) HW_PORT_GPCLR_ADDR(x))
#define HW_PORT_GPCLR_RD(x) (HW_PORT_GPCLR(x).U)
#define HW_PORT_GPCLR_WR(x, v) (HW_PORT_GPCLR(x).U = (v))
#endif
//@}
/*
* Constants & macros for individual PORT_GPCLR bitfields
*/
/*!
* @name Register PORT_GPCLR, field GPWD[15:0] (WORZ)
*
* Write value that is written to all Pin Control Registers bits [15:0] that are
* selected by GPWE.
*/
//@{
#define BP_PORT_GPCLR_GPWD (0U) //!< Bit position for PORT_GPCLR_GPWD.
#define BM_PORT_GPCLR_GPWD (0x0000FFFFU) //!< Bit mask for PORT_GPCLR_GPWD.
#define BS_PORT_GPCLR_GPWD (16U) //!< Bit field size in bits for PORT_GPCLR_GPWD.
//! @brief Format value for bitfield PORT_GPCLR_GPWD.
#define BF_PORT_GPCLR_GPWD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCLR_GPWD), uint32_t) & BM_PORT_GPCLR_GPWD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GPWD field to a new value.
#define BW_PORT_GPCLR_GPWD(x, v) (HW_PORT_GPCLR_WR(x, (HW_PORT_GPCLR_RD(x) & ~BM_PORT_GPCLR_GPWD) | BF_PORT_GPCLR_GPWD(v)))
#endif
//@}
/*!
* @name Register PORT_GPCLR, field GPWE[31:16] (WORZ)
*
* Selects which Pin Control Registers (15 through 0) bits [15:0] update with
* the value in GPWD. If a selected Pin Control Register is locked then the write
* to that register is ignored.
*
* Values:
* - 0 - Corresponding Pin Control Register is not updated with the value in
* GPWD.
* - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
*/
//@{
#define BP_PORT_GPCLR_GPWE (16U) //!< Bit position for PORT_GPCLR_GPWE.
#define BM_PORT_GPCLR_GPWE (0xFFFF0000U) //!< Bit mask for PORT_GPCLR_GPWE.
#define BS_PORT_GPCLR_GPWE (16U) //!< Bit field size in bits for PORT_GPCLR_GPWE.
//! @brief Format value for bitfield PORT_GPCLR_GPWE.
#define BF_PORT_GPCLR_GPWE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCLR_GPWE), uint32_t) & BM_PORT_GPCLR_GPWE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GPWE field to a new value.
#define BW_PORT_GPCLR_GPWE(x, v) (HW_PORT_GPCLR_WR(x, (HW_PORT_GPCLR_RD(x) & ~BM_PORT_GPCLR_GPWE) | BF_PORT_GPCLR_GPWE(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_GPCHR - Global Pin Control High Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_GPCHR - Global Pin Control High Register (WORZ)
*
* Reset value: 0x00000000U
*
* Only 32-bit writes are supported to this register.
*/
typedef union _hw_port_gpchr
{
uint32_t U;
struct _hw_port_gpchr_bitfields
{
uint32_t GPWD : 16; //!< [15:0] Global Pin Write Data
uint32_t GPWE : 16; //!< [31:16] Global Pin Write Enable
} B;
} hw_port_gpchr_t;
#endif
/*!
* @name Constants and macros for entire PORT_GPCHR register
*/
//@{
#define HW_PORT_GPCHR_ADDR(x) (REGS_PORT_BASE(x) + 0x84U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_GPCHR(x) (*(__O hw_port_gpchr_t *) HW_PORT_GPCHR_ADDR(x))
#define HW_PORT_GPCHR_RD(x) (HW_PORT_GPCHR(x).U)
#define HW_PORT_GPCHR_WR(x, v) (HW_PORT_GPCHR(x).U = (v))
#endif
//@}
/*
* Constants & macros for individual PORT_GPCHR bitfields
*/
/*!
* @name Register PORT_GPCHR, field GPWD[15:0] (WORZ)
*
* Write value that is written to all Pin Control Registers bits [15:0] that are
* selected by GPWE.
*/
//@{
#define BP_PORT_GPCHR_GPWD (0U) //!< Bit position for PORT_GPCHR_GPWD.
#define BM_PORT_GPCHR_GPWD (0x0000FFFFU) //!< Bit mask for PORT_GPCHR_GPWD.
#define BS_PORT_GPCHR_GPWD (16U) //!< Bit field size in bits for PORT_GPCHR_GPWD.
//! @brief Format value for bitfield PORT_GPCHR_GPWD.
#define BF_PORT_GPCHR_GPWD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCHR_GPWD), uint32_t) & BM_PORT_GPCHR_GPWD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GPWD field to a new value.
#define BW_PORT_GPCHR_GPWD(x, v) (HW_PORT_GPCHR_WR(x, (HW_PORT_GPCHR_RD(x) & ~BM_PORT_GPCHR_GPWD) | BF_PORT_GPCHR_GPWD(v)))
#endif
//@}
/*!
* @name Register PORT_GPCHR, field GPWE[31:16] (WORZ)
*
* Selects which Pin Control Registers (31 through 16) bits [15:0] update with
* the value in GPWD. If a selected Pin Control Register is locked then the write
* to that register is ignored.
*
* Values:
* - 0 - Corresponding Pin Control Register is not updated with the value in
* GPWD.
* - 1 - Corresponding Pin Control Register is updated with the value in GPWD.
*/
//@{
#define BP_PORT_GPCHR_GPWE (16U) //!< Bit position for PORT_GPCHR_GPWE.
#define BM_PORT_GPCHR_GPWE (0xFFFF0000U) //!< Bit mask for PORT_GPCHR_GPWE.
#define BS_PORT_GPCHR_GPWE (16U) //!< Bit field size in bits for PORT_GPCHR_GPWE.
//! @brief Format value for bitfield PORT_GPCHR_GPWE.
#define BF_PORT_GPCHR_GPWE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_GPCHR_GPWE), uint32_t) & BM_PORT_GPCHR_GPWE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GPWE field to a new value.
#define BW_PORT_GPCHR_GPWE(x, v) (HW_PORT_GPCHR_WR(x, (HW_PORT_GPCHR_RD(x) & ~BM_PORT_GPCHR_GPWE) | BF_PORT_GPCHR_GPWE(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_ISFR - Interrupt Status Flag Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_ISFR - Interrupt Status Flag Register (W1C)
*
* Reset value: 0x00000000U
*
* The pin interrupt configuration is valid in all digital pin muxing modes. The
* Interrupt Status Flag for each pin is also visible in the corresponding Pin
* Control Register, and each flag can be cleared in either location.
*/
typedef union _hw_port_isfr
{
uint32_t U;
struct _hw_port_isfr_bitfields
{
uint32_t ISF : 32; //!< [31:0] Interrupt Status Flag
} B;
} hw_port_isfr_t;
#endif
/*!
* @name Constants and macros for entire PORT_ISFR register
*/
//@{
#define HW_PORT_ISFR_ADDR(x) (REGS_PORT_BASE(x) + 0xA0U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_ISFR(x) (*(__IO hw_port_isfr_t *) HW_PORT_ISFR_ADDR(x))
#define HW_PORT_ISFR_RD(x) (HW_PORT_ISFR(x).U)
#define HW_PORT_ISFR_WR(x, v) (HW_PORT_ISFR(x).U = (v))
#define HW_PORT_ISFR_SET(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) | (v)))
#define HW_PORT_ISFR_CLR(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) & ~(v)))
#define HW_PORT_ISFR_TOG(x, v) (HW_PORT_ISFR_WR(x, HW_PORT_ISFR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PORT_ISFR bitfields
*/
/*!
* @name Register PORT_ISFR, field ISF[31:0] (W1C)
*
* Each bit in the field indicates the detection of the configured interrupt of
* the same number as the field.
*
* Values:
* - 0 - Configured interrupt is not detected.
* - 1 - Configured interrupt is detected. If the pin is configured to generate
* a DMA request, then the corresponding flag will be cleared automatically
* at the completion of the requested DMA transfer. Otherwise, the flag
* remains set until a logic 1 is written to the flag. If the pin is configured for
* a level sensitive interrupt and the pin remains asserted, then the flag
* is set again immediately after it is cleared.
*/
//@{
#define BP_PORT_ISFR_ISF (0U) //!< Bit position for PORT_ISFR_ISF.
#define BM_PORT_ISFR_ISF (0xFFFFFFFFU) //!< Bit mask for PORT_ISFR_ISF.
#define BS_PORT_ISFR_ISF (32U) //!< Bit field size in bits for PORT_ISFR_ISF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_ISFR_ISF field.
#define BR_PORT_ISFR_ISF(x) (HW_PORT_ISFR(x).U)
#endif
//! @brief Format value for bitfield PORT_ISFR_ISF.
#define BF_PORT_ISFR_ISF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_ISFR_ISF), uint32_t) & BM_PORT_ISFR_ISF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ISF field to a new value.
#define BW_PORT_ISFR_ISF(x, v) (HW_PORT_ISFR_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_DFER - Digital Filter Enable Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_DFER - Digital Filter Enable Register (RW)
*
* Reset value: 0x00000000U
*
* The corresponding bit is read only for pins that do not support a digital
* filter. Refer to the Chapter of Signal Multiplexing and Signal Descriptions for
* the pins that support digital filter. The digital filter configuration is valid
* in all digital pin muxing modes.
*/
typedef union _hw_port_dfer
{
uint32_t U;
struct _hw_port_dfer_bitfields
{
uint32_t DFE : 32; //!< [31:0] Digital Filter Enable
} B;
} hw_port_dfer_t;
#endif
/*!
* @name Constants and macros for entire PORT_DFER register
*/
//@{
#define HW_PORT_DFER_ADDR(x) (REGS_PORT_BASE(x) + 0xC0U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_DFER(x) (*(__IO hw_port_dfer_t *) HW_PORT_DFER_ADDR(x))
#define HW_PORT_DFER_RD(x) (HW_PORT_DFER(x).U)
#define HW_PORT_DFER_WR(x, v) (HW_PORT_DFER(x).U = (v))
#define HW_PORT_DFER_SET(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) | (v)))
#define HW_PORT_DFER_CLR(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) & ~(v)))
#define HW_PORT_DFER_TOG(x, v) (HW_PORT_DFER_WR(x, HW_PORT_DFER_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PORT_DFER bitfields
*/
/*!
* @name Register PORT_DFER, field DFE[31:0] (RW)
*
* The digital filter configuration is valid in all digital pin muxing modes.
* The output of each digital filter is reset to zero at system reset and whenever
* the digital filter is disabled. Each bit in the field enables the digital
* filter of the same number as the field.
*
* Values:
* - 0 - Digital filter is disabled on the corresponding pin and output of the
* digital filter is reset to zero.
* - 1 - Digital filter is enabled on the corresponding pin, if the pin is
* configured as a digital input.
*/
//@{
#define BP_PORT_DFER_DFE (0U) //!< Bit position for PORT_DFER_DFE.
#define BM_PORT_DFER_DFE (0xFFFFFFFFU) //!< Bit mask for PORT_DFER_DFE.
#define BS_PORT_DFER_DFE (32U) //!< Bit field size in bits for PORT_DFER_DFE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_DFER_DFE field.
#define BR_PORT_DFER_DFE(x) (HW_PORT_DFER(x).U)
#endif
//! @brief Format value for bitfield PORT_DFER_DFE.
#define BF_PORT_DFER_DFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFER_DFE), uint32_t) & BM_PORT_DFER_DFE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DFE field to a new value.
#define BW_PORT_DFER_DFE(x, v) (HW_PORT_DFER_WR(x, v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_DFCR - Digital Filter Clock Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_DFCR - Digital Filter Clock Register (RW)
*
* Reset value: 0x00000000U
*
* This register is read only for ports that do not support a digital filter.
* The digital filter configuration is valid in all digital pin muxing modes.
*/
typedef union _hw_port_dfcr
{
uint32_t U;
struct _hw_port_dfcr_bitfields
{
uint32_t CS : 1; //!< [0] Clock Source
uint32_t RESERVED0 : 31; //!< [31:1]
} B;
} hw_port_dfcr_t;
#endif
/*!
* @name Constants and macros for entire PORT_DFCR register
*/
//@{
#define HW_PORT_DFCR_ADDR(x) (REGS_PORT_BASE(x) + 0xC4U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_DFCR(x) (*(__IO hw_port_dfcr_t *) HW_PORT_DFCR_ADDR(x))
#define HW_PORT_DFCR_RD(x) (HW_PORT_DFCR(x).U)
#define HW_PORT_DFCR_WR(x, v) (HW_PORT_DFCR(x).U = (v))
#define HW_PORT_DFCR_SET(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) | (v)))
#define HW_PORT_DFCR_CLR(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) & ~(v)))
#define HW_PORT_DFCR_TOG(x, v) (HW_PORT_DFCR_WR(x, HW_PORT_DFCR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PORT_DFCR bitfields
*/
/*!
* @name Register PORT_DFCR, field CS[0] (RW)
*
* The digital filter configuration is valid in all digital pin muxing modes.
* Configures the clock source for the digital input filters. Changing the filter
* clock source must be done only when all digital filters are disabled.
*
* Values:
* - 0 - Digital filters are clocked by the bus clock.
* - 1 - Digital filters are clocked by the 1 kHz LPO clock.
*/
//@{
#define BP_PORT_DFCR_CS (0U) //!< Bit position for PORT_DFCR_CS.
#define BM_PORT_DFCR_CS (0x00000001U) //!< Bit mask for PORT_DFCR_CS.
#define BS_PORT_DFCR_CS (1U) //!< Bit field size in bits for PORT_DFCR_CS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_DFCR_CS field.
#define BR_PORT_DFCR_CS(x) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS))
#endif
//! @brief Format value for bitfield PORT_DFCR_CS.
#define BF_PORT_DFCR_CS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFCR_CS), uint32_t) & BM_PORT_DFCR_CS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CS field to a new value.
#define BW_PORT_DFCR_CS(x, v) (BITBAND_ACCESS32(HW_PORT_DFCR_ADDR(x), BP_PORT_DFCR_CS) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_PORT_DFWR - Digital Filter Width Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_PORT_DFWR - Digital Filter Width Register (RW)
*
* Reset value: 0x00000000U
*
* This register is read only for ports that do not support a digital filter.
* The digital filter configuration is valid in all digital pin muxing modes.
*/
typedef union _hw_port_dfwr
{
uint32_t U;
struct _hw_port_dfwr_bitfields
{
uint32_t FILT : 5; //!< [4:0] Filter Length
uint32_t RESERVED0 : 27; //!< [31:5]
} B;
} hw_port_dfwr_t;
#endif
/*!
* @name Constants and macros for entire PORT_DFWR register
*/
//@{
#define HW_PORT_DFWR_ADDR(x) (REGS_PORT_BASE(x) + 0xC8U)
#ifndef __LANGUAGE_ASM__
#define HW_PORT_DFWR(x) (*(__IO hw_port_dfwr_t *) HW_PORT_DFWR_ADDR(x))
#define HW_PORT_DFWR_RD(x) (HW_PORT_DFWR(x).U)
#define HW_PORT_DFWR_WR(x, v) (HW_PORT_DFWR(x).U = (v))
#define HW_PORT_DFWR_SET(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) | (v)))
#define HW_PORT_DFWR_CLR(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) & ~(v)))
#define HW_PORT_DFWR_TOG(x, v) (HW_PORT_DFWR_WR(x, HW_PORT_DFWR_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual PORT_DFWR bitfields
*/
/*!
* @name Register PORT_DFWR, field FILT[4:0] (RW)
*
* The digital filter configuration is valid in all digital pin muxing modes.
* Configures the maximum size of the glitches, in clock cycles, that the digital
* filter absorbs for the enabled digital filters. Glitches that are longer than
* this register setting will pass through the digital filter, and glitches that
* are equal to or less than this register setting are filtered. Changing the
* filter length must be done only after all filters are disabled.
*/
//@{
#define BP_PORT_DFWR_FILT (0U) //!< Bit position for PORT_DFWR_FILT.
#define BM_PORT_DFWR_FILT (0x0000001FU) //!< Bit mask for PORT_DFWR_FILT.
#define BS_PORT_DFWR_FILT (5U) //!< Bit field size in bits for PORT_DFWR_FILT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the PORT_DFWR_FILT field.
#define BR_PORT_DFWR_FILT(x) (HW_PORT_DFWR(x).B.FILT)
#endif
//! @brief Format value for bitfield PORT_DFWR_FILT.
#define BF_PORT_DFWR_FILT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_PORT_DFWR_FILT), uint32_t) & BM_PORT_DFWR_FILT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the FILT field to a new value.
#define BW_PORT_DFWR_FILT(x, v) (HW_PORT_DFWR_WR(x, (HW_PORT_DFWR_RD(x) & ~BM_PORT_DFWR_FILT) | BF_PORT_DFWR_FILT(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_port_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All PORT module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_port
{
__IO hw_port_pcrn_t PCRn[32]; //!< [0x0] Pin Control Register n
__O hw_port_gpclr_t GPCLR; //!< [0x80] Global Pin Control Low Register
__O hw_port_gpchr_t GPCHR; //!< [0x84] Global Pin Control High Register
uint8_t _reserved0[24];
__IO hw_port_isfr_t ISFR; //!< [0xA0] Interrupt Status Flag Register
uint8_t _reserved1[28];
__IO hw_port_dfer_t DFER; //!< [0xC0] Digital Filter Enable Register
__IO hw_port_dfcr_t DFCR; //!< [0xC4] Digital Filter Clock Register
__IO hw_port_dfwr_t DFWR; //!< [0xC8] Digital Filter Width Register
} hw_port_t;
#pragma pack()
//! @brief Macro to access all PORT registers.
//! @param x PORT instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_PORT(0)</code>.
#define HW_PORT(x) (*(hw_port_t *) REGS_PORT_BASE(x))
#endif
#endif // __HW_PORT_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,730 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_RCM_REGISTERS_H__
#define __HW_RCM_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 RCM
*
* Reset Control Module
*
* Registers defined in this header file:
* - HW_RCM_SRS0 - System Reset Status Register 0
* - HW_RCM_SRS1 - System Reset Status Register 1
* - HW_RCM_RPFC - Reset Pin Filter Control register
* - HW_RCM_RPFW - Reset Pin Filter Width register
* - HW_RCM_MR - Mode Register
*
* - hw_rcm_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_RCM_BASE
#define HW_RCM_INSTANCE_COUNT (1U) //!< Number of instances of the RCM module.
#define REGS_RCM_BASE (0x4007F000U) //!< Base address for RCM.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RCM_SRS0 - System Reset Status Register 0
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RCM_SRS0 - System Reset Status Register 0 (RO)
*
* Reset value: 0x82U
*
* This register includes read-only status flags to indicate the source of the
* most recent reset. The reset state of these bits depends on what caused the MCU
* to reset. The reset value of this register depends on the reset source: POR
* (including LVD) - 0x82 LVD (without POR) - 0x02 VLLS mode wakeup due to RESET
* pin assertion - 0x41 VLLS mode wakeup due to other wakeup sources - 0x01 Other
* reset - a bit is set if its corresponding reset source caused the reset
*/
typedef union _hw_rcm_srs0
{
uint8_t U;
struct _hw_rcm_srs0_bitfields
{
uint8_t WAKEUP : 1; //!< [0] Low Leakage Wakeup Reset
uint8_t LVD : 1; //!< [1] Low-Voltage Detect Reset
uint8_t LOC : 1; //!< [2] Loss-of-Clock Reset
uint8_t LOL : 1; //!< [3] Loss-of-Lock Reset
uint8_t RESERVED0 : 1; //!< [4]
uint8_t WDOGb : 1; //!< [5] Watchdog
uint8_t PIN : 1; //!< [6] External Reset Pin
uint8_t POR : 1; //!< [7] Power-On Reset
} B;
} hw_rcm_srs0_t;
#endif
/*!
* @name Constants and macros for entire RCM_SRS0 register
*/
//@{
#define HW_RCM_SRS0_ADDR (REGS_RCM_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_RCM_SRS0 (*(__I hw_rcm_srs0_t *) HW_RCM_SRS0_ADDR)
#define HW_RCM_SRS0_RD() (HW_RCM_SRS0.U)
#endif
//@}
/*
* Constants & macros for individual RCM_SRS0 bitfields
*/
/*!
* @name Register RCM_SRS0, field WAKEUP[0] (RO)
*
* Indicates a reset has been caused by an enabled LLWU module wakeup source
* while the chip was in a low leakage mode. In LLS mode, the RESET pin is the only
* wakeup source that can cause this reset. Any enabled wakeup source in a VLLSx
* mode causes a reset. This bit is cleared by any reset except WAKEUP.
*
* Values:
* - 0 - Reset not caused by LLWU module wakeup source
* - 1 - Reset caused by LLWU module wakeup source
*/
//@{
#define BP_RCM_SRS0_WAKEUP (0U) //!< Bit position for RCM_SRS0_WAKEUP.
#define BM_RCM_SRS0_WAKEUP (0x01U) //!< Bit mask for RCM_SRS0_WAKEUP.
#define BS_RCM_SRS0_WAKEUP (1U) //!< Bit field size in bits for RCM_SRS0_WAKEUP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_WAKEUP field.
#define BR_RCM_SRS0_WAKEUP (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_WAKEUP))
#endif
//@}
/*!
* @name Register RCM_SRS0, field LVD[1] (RO)
*
* If PMC_LVDSC1[LVDRE] is set and the supply drops below the LVD trip voltage,
* an LVD reset occurs. This field is also set by POR.
*
* Values:
* - 0 - Reset not caused by LVD trip or POR
* - 1 - Reset caused by LVD trip or POR
*/
//@{
#define BP_RCM_SRS0_LVD (1U) //!< Bit position for RCM_SRS0_LVD.
#define BM_RCM_SRS0_LVD (0x02U) //!< Bit mask for RCM_SRS0_LVD.
#define BS_RCM_SRS0_LVD (1U) //!< Bit field size in bits for RCM_SRS0_LVD.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_LVD field.
#define BR_RCM_SRS0_LVD (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_LVD))
#endif
//@}
/*!
* @name Register RCM_SRS0, field LOC[2] (RO)
*
* Indicates a reset has been caused by a loss of external clock. The MCG clock
* monitor must be enabled for a loss of clock to be detected. Refer to the
* detailed MCG description for information on enabling the clock monitor.
*
* Values:
* - 0 - Reset not caused by a loss of external clock.
* - 1 - Reset caused by a loss of external clock.
*/
//@{
#define BP_RCM_SRS0_LOC (2U) //!< Bit position for RCM_SRS0_LOC.
#define BM_RCM_SRS0_LOC (0x04U) //!< Bit mask for RCM_SRS0_LOC.
#define BS_RCM_SRS0_LOC (1U) //!< Bit field size in bits for RCM_SRS0_LOC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_LOC field.
#define BR_RCM_SRS0_LOC (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_LOC))
#endif
//@}
/*!
* @name Register RCM_SRS0, field LOL[3] (RO)
*
* Indicates a reset has been caused by a loss of lock in the MCG PLL. See the
* MCG description for information on the loss-of-clock event.
*
* Values:
* - 0 - Reset not caused by a loss of lock in the PLL
* - 1 - Reset caused by a loss of lock in the PLL
*/
//@{
#define BP_RCM_SRS0_LOL (3U) //!< Bit position for RCM_SRS0_LOL.
#define BM_RCM_SRS0_LOL (0x08U) //!< Bit mask for RCM_SRS0_LOL.
#define BS_RCM_SRS0_LOL (1U) //!< Bit field size in bits for RCM_SRS0_LOL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_LOL field.
#define BR_RCM_SRS0_LOL (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_LOL))
#endif
//@}
/*!
* @name Register RCM_SRS0, field WDOG[5] (RO)
*
* Indicates a reset has been caused by the watchdog timer Computer Operating
* Properly (COP) timing out. This reset source can be blocked by disabling the COP
* watchdog: write 00 to SIM_COPCTRL[COPT].
*
* Values:
* - 0 - Reset not caused by watchdog timeout
* - 1 - Reset caused by watchdog timeout
*/
//@{
#define BP_RCM_SRS0_WDOG (5U) //!< Bit position for RCM_SRS0_WDOG.
#define BM_RCM_SRS0_WDOG (0x20U) //!< Bit mask for RCM_SRS0_WDOG.
#define BS_RCM_SRS0_WDOG (1U) //!< Bit field size in bits for RCM_SRS0_WDOG.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_WDOG field.
#define BR_RCM_SRS0_WDOG (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_WDOG))
#endif
//@}
/*!
* @name Register RCM_SRS0, field PIN[6] (RO)
*
* Indicates a reset has been caused by an active-low level on the external
* RESET pin.
*
* Values:
* - 0 - Reset not caused by external reset pin
* - 1 - Reset caused by external reset pin
*/
//@{
#define BP_RCM_SRS0_PIN (6U) //!< Bit position for RCM_SRS0_PIN.
#define BM_RCM_SRS0_PIN (0x40U) //!< Bit mask for RCM_SRS0_PIN.
#define BS_RCM_SRS0_PIN (1U) //!< Bit field size in bits for RCM_SRS0_PIN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_PIN field.
#define BR_RCM_SRS0_PIN (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_PIN))
#endif
//@}
/*!
* @name Register RCM_SRS0, field POR[7] (RO)
*
* Indicates a reset has been caused by the power-on detection logic. Because
* the internal supply voltage was ramping up at the time, the low-voltage reset
* (LVD) status bit is also set to indicate that the reset occurred while the
* internal supply was below the LVD threshold.
*
* Values:
* - 0 - Reset not caused by POR
* - 1 - Reset caused by POR
*/
//@{
#define BP_RCM_SRS0_POR (7U) //!< Bit position for RCM_SRS0_POR.
#define BM_RCM_SRS0_POR (0x80U) //!< Bit mask for RCM_SRS0_POR.
#define BS_RCM_SRS0_POR (1U) //!< Bit field size in bits for RCM_SRS0_POR.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS0_POR field.
#define BR_RCM_SRS0_POR (BITBAND_ACCESS8(HW_RCM_SRS0_ADDR, BP_RCM_SRS0_POR))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RCM_SRS1 - System Reset Status Register 1
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RCM_SRS1 - System Reset Status Register 1 (RO)
*
* Reset value: 0x00U
*
* This register includes read-only status flags to indicate the source of the
* most recent reset. The reset state of these bits depends on what caused the MCU
* to reset. The reset value of this register depends on the reset source: POR
* (including LVD) - 0x00 LVD (without POR) - 0x00 VLLS mode wakeup - 0x00 Other
* reset - a bit is set if its corresponding reset source caused the reset
*/
typedef union _hw_rcm_srs1
{
uint8_t U;
struct _hw_rcm_srs1_bitfields
{
uint8_t JTAG : 1; //!< [0] JTAG Generated Reset
uint8_t LOCKUP : 1; //!< [1] Core Lockup
uint8_t SW : 1; //!< [2] Software
uint8_t MDM_AP : 1; //!< [3] MDM-AP System Reset Request
uint8_t EZPT : 1; //!< [4] EzPort Reset
uint8_t SACKERR : 1; //!< [5] Stop Mode Acknowledge Error Reset
uint8_t RESERVED0 : 2; //!< [7:6]
} B;
} hw_rcm_srs1_t;
#endif
/*!
* @name Constants and macros for entire RCM_SRS1 register
*/
//@{
#define HW_RCM_SRS1_ADDR (REGS_RCM_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_RCM_SRS1 (*(__I hw_rcm_srs1_t *) HW_RCM_SRS1_ADDR)
#define HW_RCM_SRS1_RD() (HW_RCM_SRS1.U)
#endif
//@}
/*
* Constants & macros for individual RCM_SRS1 bitfields
*/
/*!
* @name Register RCM_SRS1, field JTAG[0] (RO)
*
* Indicates a reset has been caused by JTAG selection of certain IR codes:
* EZPORT, EXTEST, HIGHZ, and CLAMP.
*
* Values:
* - 0 - Reset not caused by JTAG
* - 1 - Reset caused by JTAG
*/
//@{
#define BP_RCM_SRS1_JTAG (0U) //!< Bit position for RCM_SRS1_JTAG.
#define BM_RCM_SRS1_JTAG (0x01U) //!< Bit mask for RCM_SRS1_JTAG.
#define BS_RCM_SRS1_JTAG (1U) //!< Bit field size in bits for RCM_SRS1_JTAG.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_JTAG field.
#define BR_RCM_SRS1_JTAG (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_JTAG))
#endif
//@}
/*!
* @name Register RCM_SRS1, field LOCKUP[1] (RO)
*
* Indicates a reset has been caused by the ARM core indication of a LOCKUP
* event.
*
* Values:
* - 0 - Reset not caused by core LOCKUP event
* - 1 - Reset caused by core LOCKUP event
*/
//@{
#define BP_RCM_SRS1_LOCKUP (1U) //!< Bit position for RCM_SRS1_LOCKUP.
#define BM_RCM_SRS1_LOCKUP (0x02U) //!< Bit mask for RCM_SRS1_LOCKUP.
#define BS_RCM_SRS1_LOCKUP (1U) //!< Bit field size in bits for RCM_SRS1_LOCKUP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_LOCKUP field.
#define BR_RCM_SRS1_LOCKUP (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_LOCKUP))
#endif
//@}
/*!
* @name Register RCM_SRS1, field SW[2] (RO)
*
* Indicates a reset has been caused by software setting of SYSRESETREQ bit in
* Application Interrupt and Reset Control Register in the ARM core.
*
* Values:
* - 0 - Reset not caused by software setting of SYSRESETREQ bit
* - 1 - Reset caused by software setting of SYSRESETREQ bit
*/
//@{
#define BP_RCM_SRS1_SW (2U) //!< Bit position for RCM_SRS1_SW.
#define BM_RCM_SRS1_SW (0x04U) //!< Bit mask for RCM_SRS1_SW.
#define BS_RCM_SRS1_SW (1U) //!< Bit field size in bits for RCM_SRS1_SW.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_SW field.
#define BR_RCM_SRS1_SW (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_SW))
#endif
//@}
/*!
* @name Register RCM_SRS1, field MDM_AP[3] (RO)
*
* Indicates a reset has been caused by the host debugger system setting of the
* System Reset Request bit in the MDM-AP Control Register.
*
* Values:
* - 0 - Reset not caused by host debugger system setting of the System Reset
* Request bit
* - 1 - Reset caused by host debugger system setting of the System Reset
* Request bit
*/
//@{
#define BP_RCM_SRS1_MDM_AP (3U) //!< Bit position for RCM_SRS1_MDM_AP.
#define BM_RCM_SRS1_MDM_AP (0x08U) //!< Bit mask for RCM_SRS1_MDM_AP.
#define BS_RCM_SRS1_MDM_AP (1U) //!< Bit field size in bits for RCM_SRS1_MDM_AP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_MDM_AP field.
#define BR_RCM_SRS1_MDM_AP (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_MDM_AP))
#endif
//@}
/*!
* @name Register RCM_SRS1, field EZPT[4] (RO)
*
* Indicates a reset has been caused by EzPort receiving the RESET command while
* the device is in EzPort mode.
*
* Values:
* - 0 - Reset not caused by EzPort receiving the RESET command while the device
* is in EzPort mode
* - 1 - Reset caused by EzPort receiving the RESET command while the device is
* in EzPort mode
*/
//@{
#define BP_RCM_SRS1_EZPT (4U) //!< Bit position for RCM_SRS1_EZPT.
#define BM_RCM_SRS1_EZPT (0x10U) //!< Bit mask for RCM_SRS1_EZPT.
#define BS_RCM_SRS1_EZPT (1U) //!< Bit field size in bits for RCM_SRS1_EZPT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_EZPT field.
#define BR_RCM_SRS1_EZPT (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_EZPT))
#endif
//@}
/*!
* @name Register RCM_SRS1, field SACKERR[5] (RO)
*
* Indicates that after an attempt to enter Stop mode, a reset has been caused
* by a failure of one or more peripherals to acknowledge within approximately one
* second to enter stop mode.
*
* Values:
* - 0 - Reset not caused by peripheral failure to acknowledge attempt to enter
* stop mode
* - 1 - Reset caused by peripheral failure to acknowledge attempt to enter stop
* mode
*/
//@{
#define BP_RCM_SRS1_SACKERR (5U) //!< Bit position for RCM_SRS1_SACKERR.
#define BM_RCM_SRS1_SACKERR (0x20U) //!< Bit mask for RCM_SRS1_SACKERR.
#define BS_RCM_SRS1_SACKERR (1U) //!< Bit field size in bits for RCM_SRS1_SACKERR.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_SRS1_SACKERR field.
#define BR_RCM_SRS1_SACKERR (BITBAND_ACCESS8(HW_RCM_SRS1_ADDR, BP_RCM_SRS1_SACKERR))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RCM_RPFC - Reset Pin Filter Control register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RCM_RPFC - Reset Pin Filter Control register (RW)
*
* Reset value: 0x00U
*
* The reset values of bits 2-0 are for Chip POR only. They are unaffected by
* other reset types. The bus clock filter is reset when disabled or when entering
* stop mode. The LPO filter is reset when disabled or when entering any low
* leakage stop mode .
*/
typedef union _hw_rcm_rpfc
{
uint8_t U;
struct _hw_rcm_rpfc_bitfields
{
uint8_t RSTFLTSRW : 2; //!< [1:0] Reset Pin Filter Select in Run and
//! Wait Modes
uint8_t RSTFLTSS : 1; //!< [2] Reset Pin Filter Select in Stop Mode
uint8_t RESERVED0 : 5; //!< [7:3]
} B;
} hw_rcm_rpfc_t;
#endif
/*!
* @name Constants and macros for entire RCM_RPFC register
*/
//@{
#define HW_RCM_RPFC_ADDR (REGS_RCM_BASE + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_RCM_RPFC (*(__IO hw_rcm_rpfc_t *) HW_RCM_RPFC_ADDR)
#define HW_RCM_RPFC_RD() (HW_RCM_RPFC.U)
#define HW_RCM_RPFC_WR(v) (HW_RCM_RPFC.U = (v))
#define HW_RCM_RPFC_SET(v) (HW_RCM_RPFC_WR(HW_RCM_RPFC_RD() | (v)))
#define HW_RCM_RPFC_CLR(v) (HW_RCM_RPFC_WR(HW_RCM_RPFC_RD() & ~(v)))
#define HW_RCM_RPFC_TOG(v) (HW_RCM_RPFC_WR(HW_RCM_RPFC_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual RCM_RPFC bitfields
*/
/*!
* @name Register RCM_RPFC, field RSTFLTSRW[1:0] (RW)
*
* Selects how the reset pin filter is enabled in run and wait modes.
*
* Values:
* - 00 - All filtering disabled
* - 01 - Bus clock filter enabled for normal operation
* - 10 - LPO clock filter enabled for normal operation
* - 11 - Reserved
*/
//@{
#define BP_RCM_RPFC_RSTFLTSRW (0U) //!< Bit position for RCM_RPFC_RSTFLTSRW.
#define BM_RCM_RPFC_RSTFLTSRW (0x03U) //!< Bit mask for RCM_RPFC_RSTFLTSRW.
#define BS_RCM_RPFC_RSTFLTSRW (2U) //!< Bit field size in bits for RCM_RPFC_RSTFLTSRW.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_RPFC_RSTFLTSRW field.
#define BR_RCM_RPFC_RSTFLTSRW (HW_RCM_RPFC.B.RSTFLTSRW)
#endif
//! @brief Format value for bitfield RCM_RPFC_RSTFLTSRW.
#define BF_RCM_RPFC_RSTFLTSRW(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_RCM_RPFC_RSTFLTSRW), uint8_t) & BM_RCM_RPFC_RSTFLTSRW)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RSTFLTSRW field to a new value.
#define BW_RCM_RPFC_RSTFLTSRW(v) (HW_RCM_RPFC_WR((HW_RCM_RPFC_RD() & ~BM_RCM_RPFC_RSTFLTSRW) | BF_RCM_RPFC_RSTFLTSRW(v)))
#endif
//@}
/*!
* @name Register RCM_RPFC, field RSTFLTSS[2] (RW)
*
* Selects how the reset pin filter is enabled in Stop and VLPS modes
*
* Values:
* - 0 - All filtering disabled
* - 1 - LPO clock filter enabled
*/
//@{
#define BP_RCM_RPFC_RSTFLTSS (2U) //!< Bit position for RCM_RPFC_RSTFLTSS.
#define BM_RCM_RPFC_RSTFLTSS (0x04U) //!< Bit mask for RCM_RPFC_RSTFLTSS.
#define BS_RCM_RPFC_RSTFLTSS (1U) //!< Bit field size in bits for RCM_RPFC_RSTFLTSS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_RPFC_RSTFLTSS field.
#define BR_RCM_RPFC_RSTFLTSS (BITBAND_ACCESS8(HW_RCM_RPFC_ADDR, BP_RCM_RPFC_RSTFLTSS))
#endif
//! @brief Format value for bitfield RCM_RPFC_RSTFLTSS.
#define BF_RCM_RPFC_RSTFLTSS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_RCM_RPFC_RSTFLTSS), uint8_t) & BM_RCM_RPFC_RSTFLTSS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RSTFLTSS field to a new value.
#define BW_RCM_RPFC_RSTFLTSS(v) (BITBAND_ACCESS8(HW_RCM_RPFC_ADDR, BP_RCM_RPFC_RSTFLTSS) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RCM_RPFW - Reset Pin Filter Width register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RCM_RPFW - Reset Pin Filter Width register (RW)
*
* Reset value: 0x00U
*
* The reset values of the bits in the RSTFLTSEL field are for Chip POR only.
* They are unaffected by other reset types.
*/
typedef union _hw_rcm_rpfw
{
uint8_t U;
struct _hw_rcm_rpfw_bitfields
{
uint8_t RSTFLTSEL : 5; //!< [4:0] Reset Pin Filter Bus Clock Select
uint8_t RESERVED0 : 3; //!< [7:5]
} B;
} hw_rcm_rpfw_t;
#endif
/*!
* @name Constants and macros for entire RCM_RPFW register
*/
//@{
#define HW_RCM_RPFW_ADDR (REGS_RCM_BASE + 0x5U)
#ifndef __LANGUAGE_ASM__
#define HW_RCM_RPFW (*(__IO hw_rcm_rpfw_t *) HW_RCM_RPFW_ADDR)
#define HW_RCM_RPFW_RD() (HW_RCM_RPFW.U)
#define HW_RCM_RPFW_WR(v) (HW_RCM_RPFW.U = (v))
#define HW_RCM_RPFW_SET(v) (HW_RCM_RPFW_WR(HW_RCM_RPFW_RD() | (v)))
#define HW_RCM_RPFW_CLR(v) (HW_RCM_RPFW_WR(HW_RCM_RPFW_RD() & ~(v)))
#define HW_RCM_RPFW_TOG(v) (HW_RCM_RPFW_WR(HW_RCM_RPFW_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual RCM_RPFW bitfields
*/
/*!
* @name Register RCM_RPFW, field RSTFLTSEL[4:0] (RW)
*
* Selects the reset pin bus clock filter width.
*
* Values:
* - 00000 - Bus clock filter count is 1
* - 00001 - Bus clock filter count is 2
* - 00010 - Bus clock filter count is 3
* - 00011 - Bus clock filter count is 4
* - 00100 - Bus clock filter count is 5
* - 00101 - Bus clock filter count is 6
* - 00110 - Bus clock filter count is 7
* - 00111 - Bus clock filter count is 8
* - 01000 - Bus clock filter count is 9
* - 01001 - Bus clock filter count is 10
* - 01010 - Bus clock filter count is 11
* - 01011 - Bus clock filter count is 12
* - 01100 - Bus clock filter count is 13
* - 01101 - Bus clock filter count is 14
* - 01110 - Bus clock filter count is 15
* - 01111 - Bus clock filter count is 16
* - 10000 - Bus clock filter count is 17
* - 10001 - Bus clock filter count is 18
* - 10010 - Bus clock filter count is 19
* - 10011 - Bus clock filter count is 20
* - 10100 - Bus clock filter count is 21
* - 10101 - Bus clock filter count is 22
* - 10110 - Bus clock filter count is 23
* - 10111 - Bus clock filter count is 24
* - 11000 - Bus clock filter count is 25
* - 11001 - Bus clock filter count is 26
* - 11010 - Bus clock filter count is 27
* - 11011 - Bus clock filter count is 28
* - 11100 - Bus clock filter count is 29
* - 11101 - Bus clock filter count is 30
* - 11110 - Bus clock filter count is 31
* - 11111 - Bus clock filter count is 32
*/
//@{
#define BP_RCM_RPFW_RSTFLTSEL (0U) //!< Bit position for RCM_RPFW_RSTFLTSEL.
#define BM_RCM_RPFW_RSTFLTSEL (0x1FU) //!< Bit mask for RCM_RPFW_RSTFLTSEL.
#define BS_RCM_RPFW_RSTFLTSEL (5U) //!< Bit field size in bits for RCM_RPFW_RSTFLTSEL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_RPFW_RSTFLTSEL field.
#define BR_RCM_RPFW_RSTFLTSEL (HW_RCM_RPFW.B.RSTFLTSEL)
#endif
//! @brief Format value for bitfield RCM_RPFW_RSTFLTSEL.
#define BF_RCM_RPFW_RSTFLTSEL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_RCM_RPFW_RSTFLTSEL), uint8_t) & BM_RCM_RPFW_RSTFLTSEL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RSTFLTSEL field to a new value.
#define BW_RCM_RPFW_RSTFLTSEL(v) (HW_RCM_RPFW_WR((HW_RCM_RPFW_RD() & ~BM_RCM_RPFW_RSTFLTSEL) | BF_RCM_RPFW_RSTFLTSEL(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RCM_MR - Mode Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RCM_MR - Mode Register (RO)
*
* Reset value: 0x00U
*
* This register includes read-only status flags to indicate the state of the
* mode pins during the last Chip Reset.
*/
typedef union _hw_rcm_mr
{
uint8_t U;
struct _hw_rcm_mr_bitfields
{
uint8_t RESERVED0 : 1; //!< [0]
uint8_t EZP_MS : 1; //!< [1] EZP_MS_B pin state
uint8_t RESERVED1 : 6; //!< [7:2]
} B;
} hw_rcm_mr_t;
#endif
/*!
* @name Constants and macros for entire RCM_MR register
*/
//@{
#define HW_RCM_MR_ADDR (REGS_RCM_BASE + 0x7U)
#ifndef __LANGUAGE_ASM__
#define HW_RCM_MR (*(__I hw_rcm_mr_t *) HW_RCM_MR_ADDR)
#define HW_RCM_MR_RD() (HW_RCM_MR.U)
#endif
//@}
/*
* Constants & macros for individual RCM_MR bitfields
*/
/*!
* @name Register RCM_MR, field EZP_MS[1] (RO)
*
* Reflects the state of the EZP_MS pin during the last Chip Reset
*
* Values:
* - 0 - Pin deasserted (logic 1)
* - 1 - Pin asserted (logic 0)
*/
//@{
#define BP_RCM_MR_EZP_MS (1U) //!< Bit position for RCM_MR_EZP_MS.
#define BM_RCM_MR_EZP_MS (0x02U) //!< Bit mask for RCM_MR_EZP_MS.
#define BS_RCM_MR_EZP_MS (1U) //!< Bit field size in bits for RCM_MR_EZP_MS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RCM_MR_EZP_MS field.
#define BR_RCM_MR_EZP_MS (BITBAND_ACCESS8(HW_RCM_MR_ADDR, BP_RCM_MR_EZP_MS))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_rcm_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All RCM module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_rcm
{
__I hw_rcm_srs0_t SRS0; //!< [0x0] System Reset Status Register 0
__I hw_rcm_srs1_t SRS1; //!< [0x1] System Reset Status Register 1
uint8_t _reserved0[2];
__IO hw_rcm_rpfc_t RPFC; //!< [0x4] Reset Pin Filter Control register
__IO hw_rcm_rpfw_t RPFW; //!< [0x5] Reset Pin Filter Width register
uint8_t _reserved1[1];
__I hw_rcm_mr_t MR; //!< [0x7] Mode Register
} hw_rcm_t;
#pragma pack()
//! @brief Macro to access all RCM registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_RCM</code>.
#define HW_RCM (*(hw_rcm_t *) REGS_RCM_BASE)
#endif
#endif // __HW_RCM_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,210 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_RFSYS_REGISTERS_H__
#define __HW_RFSYS_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 RFSYS
*
* System register file
*
* Registers defined in this header file:
* - HW_RFSYS_REGn - Register file register
*
* - hw_rfsys_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_RFSYS_BASE
#define HW_RFSYS_INSTANCE_COUNT (1U) //!< Number of instances of the RFSYS module.
#define REGS_RFSYS_BASE (0x40041000U) //!< Base address for RFSYS.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RFSYS_REGn - Register file register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RFSYS_REGn - Register file register (RW)
*
* Reset value: 0x00000000U
*
* Each register can be accessed as 8-, 16-, or 32-bits.
*/
typedef union _hw_rfsys_regn
{
uint32_t U;
struct _hw_rfsys_regn_bitfields
{
uint32_t LL : 8; //!< [7:0]
uint32_t LH : 8; //!< [15:8]
uint32_t HL : 8; //!< [23:16]
uint32_t HH : 8; //!< [31:24]
} B;
} hw_rfsys_regn_t;
#endif
/*!
* @name Constants and macros for entire RFSYS_REGn register
*/
//@{
#define HW_RFSYS_REGn_COUNT (8U)
#define HW_RFSYS_REGn_ADDR(n) (REGS_RFSYS_BASE + 0x0U + (0x4U * n))
#ifndef __LANGUAGE_ASM__
#define HW_RFSYS_REGn(n) (*(__IO hw_rfsys_regn_t *) HW_RFSYS_REGn_ADDR(n))
#define HW_RFSYS_REGn_RD(n) (HW_RFSYS_REGn(n).U)
#define HW_RFSYS_REGn_WR(n, v) (HW_RFSYS_REGn(n).U = (v))
#define HW_RFSYS_REGn_SET(n, v) (HW_RFSYS_REGn_WR(n, HW_RFSYS_REGn_RD(n) | (v)))
#define HW_RFSYS_REGn_CLR(n, v) (HW_RFSYS_REGn_WR(n, HW_RFSYS_REGn_RD(n) & ~(v)))
#define HW_RFSYS_REGn_TOG(n, v) (HW_RFSYS_REGn_WR(n, HW_RFSYS_REGn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual RFSYS_REGn bitfields
*/
/*!
* @name Register RFSYS_REGn, field LL[7:0] (RW)
*
* Low lower byte
*/
//@{
#define BP_RFSYS_REGn_LL (0U) //!< Bit position for RFSYS_REGn_LL.
#define BM_RFSYS_REGn_LL (0x000000FFU) //!< Bit mask for RFSYS_REGn_LL.
#define BS_RFSYS_REGn_LL (8U) //!< Bit field size in bits for RFSYS_REGn_LL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFSYS_REGn_LL field.
#define BR_RFSYS_REGn_LL(n) (HW_RFSYS_REGn(n).B.LL)
#endif
//! @brief Format value for bitfield RFSYS_REGn_LL.
#define BF_RFSYS_REGn_LL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFSYS_REGn_LL), uint32_t) & BM_RFSYS_REGn_LL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LL field to a new value.
#define BW_RFSYS_REGn_LL(n, v) (HW_RFSYS_REGn_WR(n, (HW_RFSYS_REGn_RD(n) & ~BM_RFSYS_REGn_LL) | BF_RFSYS_REGn_LL(v)))
#endif
//@}
/*!
* @name Register RFSYS_REGn, field LH[15:8] (RW)
*
* Low higher byte
*/
//@{
#define BP_RFSYS_REGn_LH (8U) //!< Bit position for RFSYS_REGn_LH.
#define BM_RFSYS_REGn_LH (0x0000FF00U) //!< Bit mask for RFSYS_REGn_LH.
#define BS_RFSYS_REGn_LH (8U) //!< Bit field size in bits for RFSYS_REGn_LH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFSYS_REGn_LH field.
#define BR_RFSYS_REGn_LH(n) (HW_RFSYS_REGn(n).B.LH)
#endif
//! @brief Format value for bitfield RFSYS_REGn_LH.
#define BF_RFSYS_REGn_LH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFSYS_REGn_LH), uint32_t) & BM_RFSYS_REGn_LH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LH field to a new value.
#define BW_RFSYS_REGn_LH(n, v) (HW_RFSYS_REGn_WR(n, (HW_RFSYS_REGn_RD(n) & ~BM_RFSYS_REGn_LH) | BF_RFSYS_REGn_LH(v)))
#endif
//@}
/*!
* @name Register RFSYS_REGn, field HL[23:16] (RW)
*
* High lower byte
*/
//@{
#define BP_RFSYS_REGn_HL (16U) //!< Bit position for RFSYS_REGn_HL.
#define BM_RFSYS_REGn_HL (0x00FF0000U) //!< Bit mask for RFSYS_REGn_HL.
#define BS_RFSYS_REGn_HL (8U) //!< Bit field size in bits for RFSYS_REGn_HL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFSYS_REGn_HL field.
#define BR_RFSYS_REGn_HL(n) (HW_RFSYS_REGn(n).B.HL)
#endif
//! @brief Format value for bitfield RFSYS_REGn_HL.
#define BF_RFSYS_REGn_HL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFSYS_REGn_HL), uint32_t) & BM_RFSYS_REGn_HL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the HL field to a new value.
#define BW_RFSYS_REGn_HL(n, v) (HW_RFSYS_REGn_WR(n, (HW_RFSYS_REGn_RD(n) & ~BM_RFSYS_REGn_HL) | BF_RFSYS_REGn_HL(v)))
#endif
//@}
/*!
* @name Register RFSYS_REGn, field HH[31:24] (RW)
*
* High higher byte
*/
//@{
#define BP_RFSYS_REGn_HH (24U) //!< Bit position for RFSYS_REGn_HH.
#define BM_RFSYS_REGn_HH (0xFF000000U) //!< Bit mask for RFSYS_REGn_HH.
#define BS_RFSYS_REGn_HH (8U) //!< Bit field size in bits for RFSYS_REGn_HH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFSYS_REGn_HH field.
#define BR_RFSYS_REGn_HH(n) (HW_RFSYS_REGn(n).B.HH)
#endif
//! @brief Format value for bitfield RFSYS_REGn_HH.
#define BF_RFSYS_REGn_HH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFSYS_REGn_HH), uint32_t) & BM_RFSYS_REGn_HH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the HH field to a new value.
#define BW_RFSYS_REGn_HH(n, v) (HW_RFSYS_REGn_WR(n, (HW_RFSYS_REGn_RD(n) & ~BM_RFSYS_REGn_HH) | BF_RFSYS_REGn_HH(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_rfsys_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All RFSYS module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_rfsys
{
__IO hw_rfsys_regn_t REGn[8]; //!< [0x0] Register file register
} hw_rfsys_t;
#pragma pack()
//! @brief Macro to access all RFSYS registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_RFSYS</code>.
#define HW_RFSYS (*(hw_rfsys_t *) REGS_RFSYS_BASE)
#endif
#endif // __HW_RFSYS_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,210 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_RFVBAT_REGISTERS_H__
#define __HW_RFVBAT_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 RFVBAT
*
* VBAT register file
*
* Registers defined in this header file:
* - HW_RFVBAT_REGn - VBAT register file register
*
* - hw_rfvbat_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_RFVBAT_BASE
#define HW_RFVBAT_INSTANCE_COUNT (1U) //!< Number of instances of the RFVBAT module.
#define REGS_RFVBAT_BASE (0x4003E000U) //!< Base address for RFVBAT.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RFVBAT_REGn - VBAT register file register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RFVBAT_REGn - VBAT register file register (RW)
*
* Reset value: 0x00000000U
*
* Each register can be accessed as 8-, 16-, or 32-bits.
*/
typedef union _hw_rfvbat_regn
{
uint32_t U;
struct _hw_rfvbat_regn_bitfields
{
uint32_t LL : 8; //!< [7:0]
uint32_t LH : 8; //!< [15:8]
uint32_t HL : 8; //!< [23:16]
uint32_t HH : 8; //!< [31:24]
} B;
} hw_rfvbat_regn_t;
#endif
/*!
* @name Constants and macros for entire RFVBAT_REGn register
*/
//@{
#define HW_RFVBAT_REGn_COUNT (8U)
#define HW_RFVBAT_REGn_ADDR(n) (REGS_RFVBAT_BASE + 0x0U + (0x4U * n))
#ifndef __LANGUAGE_ASM__
#define HW_RFVBAT_REGn(n) (*(__IO hw_rfvbat_regn_t *) HW_RFVBAT_REGn_ADDR(n))
#define HW_RFVBAT_REGn_RD(n) (HW_RFVBAT_REGn(n).U)
#define HW_RFVBAT_REGn_WR(n, v) (HW_RFVBAT_REGn(n).U = (v))
#define HW_RFVBAT_REGn_SET(n, v) (HW_RFVBAT_REGn_WR(n, HW_RFVBAT_REGn_RD(n) | (v)))
#define HW_RFVBAT_REGn_CLR(n, v) (HW_RFVBAT_REGn_WR(n, HW_RFVBAT_REGn_RD(n) & ~(v)))
#define HW_RFVBAT_REGn_TOG(n, v) (HW_RFVBAT_REGn_WR(n, HW_RFVBAT_REGn_RD(n) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual RFVBAT_REGn bitfields
*/
/*!
* @name Register RFVBAT_REGn, field LL[7:0] (RW)
*
* Low lower byte
*/
//@{
#define BP_RFVBAT_REGn_LL (0U) //!< Bit position for RFVBAT_REGn_LL.
#define BM_RFVBAT_REGn_LL (0x000000FFU) //!< Bit mask for RFVBAT_REGn_LL.
#define BS_RFVBAT_REGn_LL (8U) //!< Bit field size in bits for RFVBAT_REGn_LL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFVBAT_REGn_LL field.
#define BR_RFVBAT_REGn_LL(n) (HW_RFVBAT_REGn(n).B.LL)
#endif
//! @brief Format value for bitfield RFVBAT_REGn_LL.
#define BF_RFVBAT_REGn_LL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFVBAT_REGn_LL), uint32_t) & BM_RFVBAT_REGn_LL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LL field to a new value.
#define BW_RFVBAT_REGn_LL(n, v) (HW_RFVBAT_REGn_WR(n, (HW_RFVBAT_REGn_RD(n) & ~BM_RFVBAT_REGn_LL) | BF_RFVBAT_REGn_LL(v)))
#endif
//@}
/*!
* @name Register RFVBAT_REGn, field LH[15:8] (RW)
*
* Low higher byte
*/
//@{
#define BP_RFVBAT_REGn_LH (8U) //!< Bit position for RFVBAT_REGn_LH.
#define BM_RFVBAT_REGn_LH (0x0000FF00U) //!< Bit mask for RFVBAT_REGn_LH.
#define BS_RFVBAT_REGn_LH (8U) //!< Bit field size in bits for RFVBAT_REGn_LH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFVBAT_REGn_LH field.
#define BR_RFVBAT_REGn_LH(n) (HW_RFVBAT_REGn(n).B.LH)
#endif
//! @brief Format value for bitfield RFVBAT_REGn_LH.
#define BF_RFVBAT_REGn_LH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFVBAT_REGn_LH), uint32_t) & BM_RFVBAT_REGn_LH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LH field to a new value.
#define BW_RFVBAT_REGn_LH(n, v) (HW_RFVBAT_REGn_WR(n, (HW_RFVBAT_REGn_RD(n) & ~BM_RFVBAT_REGn_LH) | BF_RFVBAT_REGn_LH(v)))
#endif
//@}
/*!
* @name Register RFVBAT_REGn, field HL[23:16] (RW)
*
* High lower byte
*/
//@{
#define BP_RFVBAT_REGn_HL (16U) //!< Bit position for RFVBAT_REGn_HL.
#define BM_RFVBAT_REGn_HL (0x00FF0000U) //!< Bit mask for RFVBAT_REGn_HL.
#define BS_RFVBAT_REGn_HL (8U) //!< Bit field size in bits for RFVBAT_REGn_HL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFVBAT_REGn_HL field.
#define BR_RFVBAT_REGn_HL(n) (HW_RFVBAT_REGn(n).B.HL)
#endif
//! @brief Format value for bitfield RFVBAT_REGn_HL.
#define BF_RFVBAT_REGn_HL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFVBAT_REGn_HL), uint32_t) & BM_RFVBAT_REGn_HL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the HL field to a new value.
#define BW_RFVBAT_REGn_HL(n, v) (HW_RFVBAT_REGn_WR(n, (HW_RFVBAT_REGn_RD(n) & ~BM_RFVBAT_REGn_HL) | BF_RFVBAT_REGn_HL(v)))
#endif
//@}
/*!
* @name Register RFVBAT_REGn, field HH[31:24] (RW)
*
* High higher byte
*/
//@{
#define BP_RFVBAT_REGn_HH (24U) //!< Bit position for RFVBAT_REGn_HH.
#define BM_RFVBAT_REGn_HH (0xFF000000U) //!< Bit mask for RFVBAT_REGn_HH.
#define BS_RFVBAT_REGn_HH (8U) //!< Bit field size in bits for RFVBAT_REGn_HH.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RFVBAT_REGn_HH field.
#define BR_RFVBAT_REGn_HH(n) (HW_RFVBAT_REGn(n).B.HH)
#endif
//! @brief Format value for bitfield RFVBAT_REGn_HH.
#define BF_RFVBAT_REGn_HH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RFVBAT_REGn_HH), uint32_t) & BM_RFVBAT_REGn_HH)
#ifndef __LANGUAGE_ASM__
//! @brief Set the HH field to a new value.
#define BW_RFVBAT_REGn_HH(n, v) (HW_RFVBAT_REGn_WR(n, (HW_RFVBAT_REGn_RD(n) & ~BM_RFVBAT_REGn_HH) | BF_RFVBAT_REGn_HH(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_rfvbat_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All RFVBAT module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_rfvbat
{
__IO hw_rfvbat_regn_t REGn[8]; //!< [0x0] VBAT register file register
} hw_rfvbat_t;
#pragma pack()
//! @brief Macro to access all RFVBAT registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_RFVBAT</code>.
#define HW_RFVBAT (*(hw_rfvbat_t *) REGS_RFVBAT_BASE)
#endif
#endif // __HW_RFVBAT_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,590 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_RNG_REGISTERS_H__
#define __HW_RNG_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 RNG
*
* Random Number Generator Accelerator
*
* Registers defined in this header file:
* - HW_RNG_CR - RNGA Control Register
* - HW_RNG_SR - RNGA Status Register
* - HW_RNG_ER - RNGA Entropy Register
* - HW_RNG_OR - RNGA Output Register
*
* - hw_rng_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_RNG_BASE
#define HW_RNG_INSTANCE_COUNT (1U) //!< Number of instances of the RNG module.
#define REGS_RNG_BASE (0x40029000U) //!< Base address for RNG.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RNG_CR - RNGA Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RNG_CR - RNGA Control Register (RW)
*
* Reset value: 0x00000000U
*
* Controls the operation of RNGA.
*/
typedef union _hw_rng_cr
{
uint32_t U;
struct _hw_rng_cr_bitfields
{
uint32_t GO : 1; //!< [0] Go
uint32_t HA : 1; //!< [1] High Assurance
uint32_t INTM : 1; //!< [2] Interrupt Mask
uint32_t CLRI : 1; //!< [3] Clear Interrupt
uint32_t SLP : 1; //!< [4] Sleep
uint32_t RESERVED0 : 27; //!< [31:5]
} B;
} hw_rng_cr_t;
#endif
/*!
* @name Constants and macros for entire RNG_CR register
*/
//@{
#define HW_RNG_CR_ADDR (REGS_RNG_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_RNG_CR (*(__IO hw_rng_cr_t *) HW_RNG_CR_ADDR)
#define HW_RNG_CR_RD() (HW_RNG_CR.U)
#define HW_RNG_CR_WR(v) (HW_RNG_CR.U = (v))
#define HW_RNG_CR_SET(v) (HW_RNG_CR_WR(HW_RNG_CR_RD() | (v)))
#define HW_RNG_CR_CLR(v) (HW_RNG_CR_WR(HW_RNG_CR_RD() & ~(v)))
#define HW_RNG_CR_TOG(v) (HW_RNG_CR_WR(HW_RNG_CR_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual RNG_CR bitfields
*/
/*!
* @name Register RNG_CR, field GO[0] (RW)
*
* Specifies whether random-data generation and loading (into OR[RANDOUT]) is
* enabled.This field is sticky. You must reset RNGA to stop RNGA from loading
* OR[RANDOUT] with data.
*
* Values:
* - 0 - Disabled
* - 1 - Enabled
*/
//@{
#define BP_RNG_CR_GO (0U) //!< Bit position for RNG_CR_GO.
#define BM_RNG_CR_GO (0x00000001U) //!< Bit mask for RNG_CR_GO.
#define BS_RNG_CR_GO (1U) //!< Bit field size in bits for RNG_CR_GO.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_CR_GO field.
#define BR_RNG_CR_GO (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_GO))
#endif
//! @brief Format value for bitfield RNG_CR_GO.
#define BF_RNG_CR_GO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_CR_GO), uint32_t) & BM_RNG_CR_GO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the GO field to a new value.
#define BW_RNG_CR_GO(v) (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_GO) = (v))
#endif
//@}
/*!
* @name Register RNG_CR, field HA[1] (RW)
*
* Enables notification of security violations (via SR[SECV]). A security
* violation occurs when you read OR[RANDOUT] and SR[OREG_LVL]=0. This field is sticky.
* After enabling notification of security violations, you must reset RNGA to
* disable them again.
*
* Values:
* - 0 - Disabled
* - 1 - Enabled
*/
//@{
#define BP_RNG_CR_HA (1U) //!< Bit position for RNG_CR_HA.
#define BM_RNG_CR_HA (0x00000002U) //!< Bit mask for RNG_CR_HA.
#define BS_RNG_CR_HA (1U) //!< Bit field size in bits for RNG_CR_HA.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_CR_HA field.
#define BR_RNG_CR_HA (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_HA))
#endif
//! @brief Format value for bitfield RNG_CR_HA.
#define BF_RNG_CR_HA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_CR_HA), uint32_t) & BM_RNG_CR_HA)
#ifndef __LANGUAGE_ASM__
//! @brief Set the HA field to a new value.
#define BW_RNG_CR_HA(v) (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_HA) = (v))
#endif
//@}
/*!
* @name Register RNG_CR, field INTM[2] (RW)
*
* Masks the triggering of an error interrupt to the interrupt controller when
* an OR underflow condition occurs. An OR underflow condition occurs when you
* read OR[RANDOUT] and SR[OREG_LVL]=0. See the Output Register (OR) description.
*
* Values:
* - 0 - Not masked
* - 1 - Masked
*/
//@{
#define BP_RNG_CR_INTM (2U) //!< Bit position for RNG_CR_INTM.
#define BM_RNG_CR_INTM (0x00000004U) //!< Bit mask for RNG_CR_INTM.
#define BS_RNG_CR_INTM (1U) //!< Bit field size in bits for RNG_CR_INTM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_CR_INTM field.
#define BR_RNG_CR_INTM (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_INTM))
#endif
//! @brief Format value for bitfield RNG_CR_INTM.
#define BF_RNG_CR_INTM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_CR_INTM), uint32_t) & BM_RNG_CR_INTM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the INTM field to a new value.
#define BW_RNG_CR_INTM(v) (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_INTM) = (v))
#endif
//@}
/*!
* @name Register RNG_CR, field CLRI[3] (WORZ)
*
* Clears the interrupt by resetting the error-interrupt indicator (SR[ERRI]).
*
* Values:
* - 0 - Do not clear the interrupt.
* - 1 - Clear the interrupt. When you write 1 to this field, RNGA then resets
* the error-interrupt indicator (SR[ERRI]). This bit always reads as 0.
*/
//@{
#define BP_RNG_CR_CLRI (3U) //!< Bit position for RNG_CR_CLRI.
#define BM_RNG_CR_CLRI (0x00000008U) //!< Bit mask for RNG_CR_CLRI.
#define BS_RNG_CR_CLRI (1U) //!< Bit field size in bits for RNG_CR_CLRI.
//! @brief Format value for bitfield RNG_CR_CLRI.
#define BF_RNG_CR_CLRI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_CR_CLRI), uint32_t) & BM_RNG_CR_CLRI)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CLRI field to a new value.
#define BW_RNG_CR_CLRI(v) (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_CLRI) = (v))
#endif
//@}
/*!
* @name Register RNG_CR, field SLP[4] (RW)
*
* Specifies whether RNGA is in Sleep or Normal mode. You can also enter Sleep
* mode by asserting the DOZE signal.
*
* Values:
* - 0 - Normal mode
* - 1 - Sleep (low-power) mode
*/
//@{
#define BP_RNG_CR_SLP (4U) //!< Bit position for RNG_CR_SLP.
#define BM_RNG_CR_SLP (0x00000010U) //!< Bit mask for RNG_CR_SLP.
#define BS_RNG_CR_SLP (1U) //!< Bit field size in bits for RNG_CR_SLP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_CR_SLP field.
#define BR_RNG_CR_SLP (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_SLP))
#endif
//! @brief Format value for bitfield RNG_CR_SLP.
#define BF_RNG_CR_SLP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_CR_SLP), uint32_t) & BM_RNG_CR_SLP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SLP field to a new value.
#define BW_RNG_CR_SLP(v) (BITBAND_ACCESS32(HW_RNG_CR_ADDR, BP_RNG_CR_SLP) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RNG_SR - RNGA Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RNG_SR - RNGA Status Register (RO)
*
* Reset value: 0x00010000U
*
* Indicates the status of RNGA. This register is read-only.
*/
typedef union _hw_rng_sr
{
uint32_t U;
struct _hw_rng_sr_bitfields
{
uint32_t SECV : 1; //!< [0] Security Violation
uint32_t LRS : 1; //!< [1] Last Read Status
uint32_t ORU : 1; //!< [2] Output Register Underflow
uint32_t ERRI : 1; //!< [3] Error Interrupt
uint32_t SLP : 1; //!< [4] Sleep
uint32_t RESERVED0 : 3; //!< [7:5]
uint32_t OREG_LVL : 8; //!< [15:8] Output Register Level
uint32_t OREG_SIZE : 8; //!< [23:16] Output Register Size
uint32_t RESERVED1 : 8; //!< [31:24]
} B;
} hw_rng_sr_t;
#endif
/*!
* @name Constants and macros for entire RNG_SR register
*/
//@{
#define HW_RNG_SR_ADDR (REGS_RNG_BASE + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_RNG_SR (*(__I hw_rng_sr_t *) HW_RNG_SR_ADDR)
#define HW_RNG_SR_RD() (HW_RNG_SR.U)
#endif
//@}
/*
* Constants & macros for individual RNG_SR bitfields
*/
/*!
* @name Register RNG_SR, field SECV[0] (RO)
*
* Used only when high assurance is enabled (CR[HA]). Indicates that a security
* violation has occurred.This field is sticky. To clear SR[SECV], you must reset
* RNGA.
*
* Values:
* - 0 - No security violation
* - 1 - Security violation
*/
//@{
#define BP_RNG_SR_SECV (0U) //!< Bit position for RNG_SR_SECV.
#define BM_RNG_SR_SECV (0x00000001U) //!< Bit mask for RNG_SR_SECV.
#define BS_RNG_SR_SECV (1U) //!< Bit field size in bits for RNG_SR_SECV.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_SECV field.
#define BR_RNG_SR_SECV (BITBAND_ACCESS32(HW_RNG_SR_ADDR, BP_RNG_SR_SECV))
#endif
//@}
/*!
* @name Register RNG_SR, field LRS[1] (RO)
*
* Indicates whether the most recent read of OR[RANDOUT] caused an OR underflow
* condition, regardless of whether the error interrupt is masked (CR[INTM]). An
* OR underflow condition occurs when you read OR[RANDOUT] and SR[OREG_LVL]=0.
* After you read this register, RNGA writes 0 to this field.
*
* Values:
* - 0 - No underflow
* - 1 - Underflow
*/
//@{
#define BP_RNG_SR_LRS (1U) //!< Bit position for RNG_SR_LRS.
#define BM_RNG_SR_LRS (0x00000002U) //!< Bit mask for RNG_SR_LRS.
#define BS_RNG_SR_LRS (1U) //!< Bit field size in bits for RNG_SR_LRS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_LRS field.
#define BR_RNG_SR_LRS (BITBAND_ACCESS32(HW_RNG_SR_ADDR, BP_RNG_SR_LRS))
#endif
//@}
/*!
* @name Register RNG_SR, field ORU[2] (RO)
*
* Indicates whether an OR underflow condition has occurred since you last read
* this register (SR) or RNGA was reset, regardless of whether the error
* interrupt is masked (CR[INTM]). An OR underflow condition occurs when you read
* OR[RANDOUT] and SR[OREG_LVL]=0. After you read this register, RNGA writes 0 to this
* field.
*
* Values:
* - 0 - No underflow
* - 1 - Underflow
*/
//@{
#define BP_RNG_SR_ORU (2U) //!< Bit position for RNG_SR_ORU.
#define BM_RNG_SR_ORU (0x00000004U) //!< Bit mask for RNG_SR_ORU.
#define BS_RNG_SR_ORU (1U) //!< Bit field size in bits for RNG_SR_ORU.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_ORU field.
#define BR_RNG_SR_ORU (BITBAND_ACCESS32(HW_RNG_SR_ADDR, BP_RNG_SR_ORU))
#endif
//@}
/*!
* @name Register RNG_SR, field ERRI[3] (RO)
*
* Indicates whether an OR underflow condition has occurred since you last
* cleared the error interrupt (CR[CLRI]) or RNGA was reset, regardless of whether the
* error interrupt is masked (CR[INTM]). An OR underflow condition occurs when
* you read OR[RANDOUT] and SR[OREG_LVL]=0. After you reset the error-interrupt
* indicator (via CR[CLRI]), RNGA writes 0 to this field.
*
* Values:
* - 0 - No underflow
* - 1 - Underflow
*/
//@{
#define BP_RNG_SR_ERRI (3U) //!< Bit position for RNG_SR_ERRI.
#define BM_RNG_SR_ERRI (0x00000008U) //!< Bit mask for RNG_SR_ERRI.
#define BS_RNG_SR_ERRI (1U) //!< Bit field size in bits for RNG_SR_ERRI.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_ERRI field.
#define BR_RNG_SR_ERRI (BITBAND_ACCESS32(HW_RNG_SR_ADDR, BP_RNG_SR_ERRI))
#endif
//@}
/*!
* @name Register RNG_SR, field SLP[4] (RO)
*
* Specifies whether RNGA is in Sleep or Normal mode. You can also enter Sleep
* mode by asserting the DOZE signal.
*
* Values:
* - 0 - Normal mode
* - 1 - Sleep (low-power) mode
*/
//@{
#define BP_RNG_SR_SLP (4U) //!< Bit position for RNG_SR_SLP.
#define BM_RNG_SR_SLP (0x00000010U) //!< Bit mask for RNG_SR_SLP.
#define BS_RNG_SR_SLP (1U) //!< Bit field size in bits for RNG_SR_SLP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_SLP field.
#define BR_RNG_SR_SLP (BITBAND_ACCESS32(HW_RNG_SR_ADDR, BP_RNG_SR_SLP))
#endif
//@}
/*!
* @name Register RNG_SR, field OREG_LVL[15:8] (RO)
*
* Indicates the number of random-data words that are in OR[RANDOUT], which
* indicates whether OR[RANDOUT] is valid.If you read OR[RANDOUT] when SR[OREG_LVL]
* is not 0, then the contents of a random number contained in OR[RANDOUT] are
* returned, and RNGA writes 0 to both OR[RANDOUT] and SR[OREG_LVL].
*
* Values:
* - 0 - No words (empty)
* - 1 - One word (valid)
*/
//@{
#define BP_RNG_SR_OREG_LVL (8U) //!< Bit position for RNG_SR_OREG_LVL.
#define BM_RNG_SR_OREG_LVL (0x0000FF00U) //!< Bit mask for RNG_SR_OREG_LVL.
#define BS_RNG_SR_OREG_LVL (8U) //!< Bit field size in bits for RNG_SR_OREG_LVL.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_OREG_LVL field.
#define BR_RNG_SR_OREG_LVL (HW_RNG_SR.B.OREG_LVL)
#endif
//@}
/*!
* @name Register RNG_SR, field OREG_SIZE[23:16] (RO)
*
* Indicates the size of the Output (OR) register in terms of the number of
* 32-bit random-data words it can hold.
*
* Values:
* - 1 - One word (this value is fixed)
*/
//@{
#define BP_RNG_SR_OREG_SIZE (16U) //!< Bit position for RNG_SR_OREG_SIZE.
#define BM_RNG_SR_OREG_SIZE (0x00FF0000U) //!< Bit mask for RNG_SR_OREG_SIZE.
#define BS_RNG_SR_OREG_SIZE (8U) //!< Bit field size in bits for RNG_SR_OREG_SIZE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_SR_OREG_SIZE field.
#define BR_RNG_SR_OREG_SIZE (HW_RNG_SR.B.OREG_SIZE)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RNG_ER - RNGA Entropy Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RNG_ER - RNGA Entropy Register (WORZ)
*
* Reset value: 0x00000000U
*
* Specifies an entropy value that RNGA uses in addition to its ring oscillators
* to seed its pseudorandom algorithm. This is a write-only register; reads
* return all zeros.
*/
typedef union _hw_rng_er
{
uint32_t U;
struct _hw_rng_er_bitfields
{
uint32_t EXT_ENT : 32; //!< [31:0] External Entropy
} B;
} hw_rng_er_t;
#endif
/*!
* @name Constants and macros for entire RNG_ER register
*/
//@{
#define HW_RNG_ER_ADDR (REGS_RNG_BASE + 0x8U)
#ifndef __LANGUAGE_ASM__
#define HW_RNG_ER (*(__O hw_rng_er_t *) HW_RNG_ER_ADDR)
#define HW_RNG_ER_RD() (HW_RNG_ER.U)
#define HW_RNG_ER_WR(v) (HW_RNG_ER.U = (v))
#endif
//@}
/*
* Constants & macros for individual RNG_ER bitfields
*/
/*!
* @name Register RNG_ER, field EXT_ENT[31:0] (WORZ)
*
* Specifies an entropy value that RNGA uses in addition to its ring oscillators
* to seed its pseudorandom algorithm.Specifying a value for this field is
* optional but recommended. You can write to this field at any time during operation.
*/
//@{
#define BP_RNG_ER_EXT_ENT (0U) //!< Bit position for RNG_ER_EXT_ENT.
#define BM_RNG_ER_EXT_ENT (0xFFFFFFFFU) //!< Bit mask for RNG_ER_EXT_ENT.
#define BS_RNG_ER_EXT_ENT (32U) //!< Bit field size in bits for RNG_ER_EXT_ENT.
//! @brief Format value for bitfield RNG_ER_EXT_ENT.
#define BF_RNG_ER_EXT_ENT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_RNG_ER_EXT_ENT), uint32_t) & BM_RNG_ER_EXT_ENT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the EXT_ENT field to a new value.
#define BW_RNG_ER_EXT_ENT(v) (HW_RNG_ER_WR(v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_RNG_OR - RNGA Output Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_RNG_OR - RNGA Output Register (RO)
*
* Reset value: 0x00000000U
*
* Stores a random-data word generated by RNGA.
*/
typedef union _hw_rng_or
{
uint32_t U;
struct _hw_rng_or_bitfields
{
uint32_t RANDOUT : 32; //!< [31:0] Random Output
} B;
} hw_rng_or_t;
#endif
/*!
* @name Constants and macros for entire RNG_OR register
*/
//@{
#define HW_RNG_OR_ADDR (REGS_RNG_BASE + 0xCU)
#ifndef __LANGUAGE_ASM__
#define HW_RNG_OR (*(__I hw_rng_or_t *) HW_RNG_OR_ADDR)
#define HW_RNG_OR_RD() (HW_RNG_OR.U)
#endif
//@}
/*
* Constants & macros for individual RNG_OR bitfields
*/
/*!
* @name Register RNG_OR, field RANDOUT[31:0] (RO)
*
* Stores a random-data word generated by RNGA. This is a read-only field.Before
* reading RANDOUT, be sure it is valid (SR[OREG_LVL]=1).
*
* Values:
* - 0 - Invalid data (if you read this field when it is 0 and SR[OREG_LVL] is
* 0, RNGA then writes 1 to SR[ERRI], SR[ORU], and SR[LRS]; when the error
* interrupt is not masked (CR[INTM]=0), RNGA also asserts an error interrupt
* request to the interrupt controller).
*/
//@{
#define BP_RNG_OR_RANDOUT (0U) //!< Bit position for RNG_OR_RANDOUT.
#define BM_RNG_OR_RANDOUT (0xFFFFFFFFU) //!< Bit mask for RNG_OR_RANDOUT.
#define BS_RNG_OR_RANDOUT (32U) //!< Bit field size in bits for RNG_OR_RANDOUT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the RNG_OR_RANDOUT field.
#define BR_RNG_OR_RANDOUT (HW_RNG_OR.U)
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_rng_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All RNG module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_rng
{
__IO hw_rng_cr_t CR; //!< [0x0] RNGA Control Register
__I hw_rng_sr_t SR; //!< [0x4] RNGA Status Register
__O hw_rng_er_t ER; //!< [0x8] RNGA Entropy Register
__I hw_rng_or_t OR; //!< [0xC] RNGA Output Register
} hw_rng_t;
#pragma pack()
//! @brief Macro to access all RNG registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_RNG</code>.
#define HW_RNG (*(hw_rng_t *) REGS_RNG_BASE)
#endif
#endif // __HW_RNG_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,566 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_SMC_REGISTERS_H__
#define __HW_SMC_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 SMC
*
* System Mode Controller
*
* Registers defined in this header file:
* - HW_SMC_PMPROT - Power Mode Protection register
* - HW_SMC_PMCTRL - Power Mode Control register
* - HW_SMC_VLLSCTRL - VLLS Control register
* - HW_SMC_PMSTAT - Power Mode Status register
*
* - hw_smc_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_SMC_BASE
#define HW_SMC_INSTANCE_COUNT (1U) //!< Number of instances of the SMC module.
#define REGS_SMC_BASE (0x4007E000U) //!< Base address for SMC.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SMC_PMPROT - Power Mode Protection register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SMC_PMPROT - Power Mode Protection register (RW)
*
* Reset value: 0x00U
*
* This register provides protection for entry into any low-power run or stop
* mode. The enabling of the low-power run or stop mode occurs by configuring the
* Power Mode Control register (PMCTRL). The PMPROT register can be written only
* once after any system reset. If the MCU is configured for a disallowed or
* reserved power mode, the MCU remains in its current power mode. For example, if the
* MCU is in normal RUN mode and AVLP is 0, an attempt to enter VLPR mode using
* PMCTRL[RUNM] is blocked and PMCTRL[RUNM] remains 00b, indicating the MCU is
* still in Normal Run mode. This register is reset on Chip Reset not VLLS and by
* reset types that trigger Chip Reset not VLLS. It is unaffected by reset types
* that do not trigger Chip Reset not VLLS. See the Reset section details for more
* information.
*/
typedef union _hw_smc_pmprot
{
uint8_t U;
struct _hw_smc_pmprot_bitfields
{
uint8_t RESERVED0 : 1; //!< [0]
uint8_t AVLLS : 1; //!< [1] Allow Very-Low-Leakage Stop Mode
uint8_t RESERVED1 : 1; //!< [2]
uint8_t ALLS : 1; //!< [3] Allow Low-Leakage Stop Mode
uint8_t RESERVED2 : 1; //!< [4]
uint8_t AVLP : 1; //!< [5] Allow Very-Low-Power Modes
uint8_t RESERVED3 : 2; //!< [7:6]
} B;
} hw_smc_pmprot_t;
#endif
/*!
* @name Constants and macros for entire SMC_PMPROT register
*/
//@{
#define HW_SMC_PMPROT_ADDR (REGS_SMC_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_SMC_PMPROT (*(__IO hw_smc_pmprot_t *) HW_SMC_PMPROT_ADDR)
#define HW_SMC_PMPROT_RD() (HW_SMC_PMPROT.U)
#define HW_SMC_PMPROT_WR(v) (HW_SMC_PMPROT.U = (v))
#define HW_SMC_PMPROT_SET(v) (HW_SMC_PMPROT_WR(HW_SMC_PMPROT_RD() | (v)))
#define HW_SMC_PMPROT_CLR(v) (HW_SMC_PMPROT_WR(HW_SMC_PMPROT_RD() & ~(v)))
#define HW_SMC_PMPROT_TOG(v) (HW_SMC_PMPROT_WR(HW_SMC_PMPROT_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual SMC_PMPROT bitfields
*/
/*!
* @name Register SMC_PMPROT, field AVLLS[1] (RW)
*
* Provided the appropriate control bits are set up in PMCTRL, this write once
* bit allows the MCU to enter any very-low-leakage stop mode (VLLSx).
*
* Values:
* - 0 - Any VLLSx mode is not allowed
* - 1 - Any VLLSx mode is allowed
*/
//@{
#define BP_SMC_PMPROT_AVLLS (1U) //!< Bit position for SMC_PMPROT_AVLLS.
#define BM_SMC_PMPROT_AVLLS (0x02U) //!< Bit mask for SMC_PMPROT_AVLLS.
#define BS_SMC_PMPROT_AVLLS (1U) //!< Bit field size in bits for SMC_PMPROT_AVLLS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMPROT_AVLLS field.
#define BR_SMC_PMPROT_AVLLS (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_AVLLS))
#endif
//! @brief Format value for bitfield SMC_PMPROT_AVLLS.
#define BF_SMC_PMPROT_AVLLS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMPROT_AVLLS), uint8_t) & BM_SMC_PMPROT_AVLLS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the AVLLS field to a new value.
#define BW_SMC_PMPROT_AVLLS(v) (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_AVLLS) = (v))
#endif
//@}
/*!
* @name Register SMC_PMPROT, field ALLS[3] (RW)
*
* Provided the appropriate control bits are set up in PMCTRL, this write-once
* field allows the MCU to enter any low-leakage stop mode (LLS).
*
* Values:
* - 0 - LLS is not allowed
* - 1 - LLS is allowed
*/
//@{
#define BP_SMC_PMPROT_ALLS (3U) //!< Bit position for SMC_PMPROT_ALLS.
#define BM_SMC_PMPROT_ALLS (0x08U) //!< Bit mask for SMC_PMPROT_ALLS.
#define BS_SMC_PMPROT_ALLS (1U) //!< Bit field size in bits for SMC_PMPROT_ALLS.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMPROT_ALLS field.
#define BR_SMC_PMPROT_ALLS (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_ALLS))
#endif
//! @brief Format value for bitfield SMC_PMPROT_ALLS.
#define BF_SMC_PMPROT_ALLS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMPROT_ALLS), uint8_t) & BM_SMC_PMPROT_ALLS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ALLS field to a new value.
#define BW_SMC_PMPROT_ALLS(v) (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_ALLS) = (v))
#endif
//@}
/*!
* @name Register SMC_PMPROT, field AVLP[5] (RW)
*
* Provided the appropriate control bits are set up in PMCTRL, this write-once
* field allows the MCU to enter any very-low-power mode (VLPR, VLPW, and VLPS).
*
* Values:
* - 0 - VLPR, VLPW, and VLPS are not allowed.
* - 1 - VLPR, VLPW, and VLPS are allowed.
*/
//@{
#define BP_SMC_PMPROT_AVLP (5U) //!< Bit position for SMC_PMPROT_AVLP.
#define BM_SMC_PMPROT_AVLP (0x20U) //!< Bit mask for SMC_PMPROT_AVLP.
#define BS_SMC_PMPROT_AVLP (1U) //!< Bit field size in bits for SMC_PMPROT_AVLP.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMPROT_AVLP field.
#define BR_SMC_PMPROT_AVLP (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_AVLP))
#endif
//! @brief Format value for bitfield SMC_PMPROT_AVLP.
#define BF_SMC_PMPROT_AVLP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMPROT_AVLP), uint8_t) & BM_SMC_PMPROT_AVLP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the AVLP field to a new value.
#define BW_SMC_PMPROT_AVLP(v) (BITBAND_ACCESS8(HW_SMC_PMPROT_ADDR, BP_SMC_PMPROT_AVLP) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SMC_PMCTRL - Power Mode Control register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SMC_PMCTRL - Power Mode Control register (RW)
*
* Reset value: 0x00U
*
* The PMCTRL register controls entry into low-power Run and Stop modes,
* provided that the selected power mode is allowed via an appropriate setting of the
* protection (PMPROT) register. This register is reset on Chip POR not VLLS and by
* reset types that trigger Chip POR not VLLS. It is unaffected by reset types
* that do not trigger Chip POR not VLLS. See the Reset section details for more
* information.
*/
typedef union _hw_smc_pmctrl
{
uint8_t U;
struct _hw_smc_pmctrl_bitfields
{
uint8_t STOPM : 3; //!< [2:0] Stop Mode Control
uint8_t STOPA : 1; //!< [3] Stop Aborted
uint8_t RESERVED0 : 1; //!< [4]
uint8_t RUNM : 2; //!< [6:5] Run Mode Control
uint8_t LPWUI : 1; //!< [7] Low-Power Wake Up On Interrupt
} B;
} hw_smc_pmctrl_t;
#endif
/*!
* @name Constants and macros for entire SMC_PMCTRL register
*/
//@{
#define HW_SMC_PMCTRL_ADDR (REGS_SMC_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_SMC_PMCTRL (*(__IO hw_smc_pmctrl_t *) HW_SMC_PMCTRL_ADDR)
#define HW_SMC_PMCTRL_RD() (HW_SMC_PMCTRL.U)
#define HW_SMC_PMCTRL_WR(v) (HW_SMC_PMCTRL.U = (v))
#define HW_SMC_PMCTRL_SET(v) (HW_SMC_PMCTRL_WR(HW_SMC_PMCTRL_RD() | (v)))
#define HW_SMC_PMCTRL_CLR(v) (HW_SMC_PMCTRL_WR(HW_SMC_PMCTRL_RD() & ~(v)))
#define HW_SMC_PMCTRL_TOG(v) (HW_SMC_PMCTRL_WR(HW_SMC_PMCTRL_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual SMC_PMCTRL bitfields
*/
/*!
* @name Register SMC_PMCTRL, field STOPM[2:0] (RW)
*
* When written, controls entry into the selected stop mode when Sleep-Now or
* Sleep-On-Exit mode is entered with SLEEPDEEP=1 . Writes to this field are
* blocked if the protection level has not been enabled using the PMPROT register.
* After any system reset, this field is cleared by hardware on any successful write
* to the PMPROT register. When set to VLLSx, the VLLSM field in the VLLSCTRL
* register is used to further select the particular VLLS submode which will be
* entered.
*
* Values:
* - 000 - Normal Stop (STOP)
* - 001 - Reserved
* - 010 - Very-Low-Power Stop (VLPS)
* - 011 - Low-Leakage Stop (LLS)
* - 100 - Very-Low-Leakage Stop (VLLSx)
* - 101 - Reserved
* - 110 - Reseved
* - 111 - Reserved
*/
//@{
#define BP_SMC_PMCTRL_STOPM (0U) //!< Bit position for SMC_PMCTRL_STOPM.
#define BM_SMC_PMCTRL_STOPM (0x07U) //!< Bit mask for SMC_PMCTRL_STOPM.
#define BS_SMC_PMCTRL_STOPM (3U) //!< Bit field size in bits for SMC_PMCTRL_STOPM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMCTRL_STOPM field.
#define BR_SMC_PMCTRL_STOPM (HW_SMC_PMCTRL.B.STOPM)
#endif
//! @brief Format value for bitfield SMC_PMCTRL_STOPM.
#define BF_SMC_PMCTRL_STOPM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMCTRL_STOPM), uint8_t) & BM_SMC_PMCTRL_STOPM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the STOPM field to a new value.
#define BW_SMC_PMCTRL_STOPM(v) (HW_SMC_PMCTRL_WR((HW_SMC_PMCTRL_RD() & ~BM_SMC_PMCTRL_STOPM) | BF_SMC_PMCTRL_STOPM(v)))
#endif
//@}
/*!
* @name Register SMC_PMCTRL, field STOPA[3] (RO)
*
* When set, this read-only status bit indicates an interrupt or reset occured
* during the previous stop mode entry sequence, preventing the system from
* entering that mode. This field is cleared by hardware at the beginning of any stop
* mode entry sequence and is set if the sequence was aborted.
*
* Values:
* - 0 - The previous stop mode entry was successsful.
* - 1 - The previous stop mode entry was aborted.
*/
//@{
#define BP_SMC_PMCTRL_STOPA (3U) //!< Bit position for SMC_PMCTRL_STOPA.
#define BM_SMC_PMCTRL_STOPA (0x08U) //!< Bit mask for SMC_PMCTRL_STOPA.
#define BS_SMC_PMCTRL_STOPA (1U) //!< Bit field size in bits for SMC_PMCTRL_STOPA.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMCTRL_STOPA field.
#define BR_SMC_PMCTRL_STOPA (BITBAND_ACCESS8(HW_SMC_PMCTRL_ADDR, BP_SMC_PMCTRL_STOPA))
#endif
//@}
/*!
* @name Register SMC_PMCTRL, field RUNM[6:5] (RW)
*
* When written, causes entry into the selected run mode. Writes to this field
* are blocked if the protection level has not been enabled using the PMPROT
* register. RUNM may be set to VLPR only when PMSTAT=RUN. After being written to
* VLPR, RUNM should not be written back to RUN until PMSTAT=VLPR.
*
* Values:
* - 00 - Normal Run mode (RUN)
* - 01 - Reserved
* - 10 - Very-Low-Power Run mode (VLPR)
* - 11 - Reserved
*/
//@{
#define BP_SMC_PMCTRL_RUNM (5U) //!< Bit position for SMC_PMCTRL_RUNM.
#define BM_SMC_PMCTRL_RUNM (0x60U) //!< Bit mask for SMC_PMCTRL_RUNM.
#define BS_SMC_PMCTRL_RUNM (2U) //!< Bit field size in bits for SMC_PMCTRL_RUNM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMCTRL_RUNM field.
#define BR_SMC_PMCTRL_RUNM (HW_SMC_PMCTRL.B.RUNM)
#endif
//! @brief Format value for bitfield SMC_PMCTRL_RUNM.
#define BF_SMC_PMCTRL_RUNM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMCTRL_RUNM), uint8_t) & BM_SMC_PMCTRL_RUNM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RUNM field to a new value.
#define BW_SMC_PMCTRL_RUNM(v) (HW_SMC_PMCTRL_WR((HW_SMC_PMCTRL_RD() & ~BM_SMC_PMCTRL_RUNM) | BF_SMC_PMCTRL_RUNM(v)))
#endif
//@}
/*!
* @name Register SMC_PMCTRL, field LPWUI[7] (RW)
*
* Causes the SMC to exit to normal RUN mode when any active MCU interrupt
* occurs while in a VLP mode (VLPR, VLPW or VLPS). If VLPS mode was entered directly
* from RUN mode, the SMC will always exit back to normal RUN mode regardless of
* the LPWUI setting. LPWUI must be modified only while the system is in RUN
* mode, that is, when PMSTAT=RUN.
*
* Values:
* - 0 - The system remains in a VLP mode on an interrupt
* - 1 - The system exits to Normal RUN mode on an interrupt
*/
//@{
#define BP_SMC_PMCTRL_LPWUI (7U) //!< Bit position for SMC_PMCTRL_LPWUI.
#define BM_SMC_PMCTRL_LPWUI (0x80U) //!< Bit mask for SMC_PMCTRL_LPWUI.
#define BS_SMC_PMCTRL_LPWUI (1U) //!< Bit field size in bits for SMC_PMCTRL_LPWUI.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMCTRL_LPWUI field.
#define BR_SMC_PMCTRL_LPWUI (BITBAND_ACCESS8(HW_SMC_PMCTRL_ADDR, BP_SMC_PMCTRL_LPWUI))
#endif
//! @brief Format value for bitfield SMC_PMCTRL_LPWUI.
#define BF_SMC_PMCTRL_LPWUI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_PMCTRL_LPWUI), uint8_t) & BM_SMC_PMCTRL_LPWUI)
#ifndef __LANGUAGE_ASM__
//! @brief Set the LPWUI field to a new value.
#define BW_SMC_PMCTRL_LPWUI(v) (BITBAND_ACCESS8(HW_SMC_PMCTRL_ADDR, BP_SMC_PMCTRL_LPWUI) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SMC_VLLSCTRL - VLLS Control register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SMC_VLLSCTRL - VLLS Control register (RW)
*
* Reset value: 0x03U
*
* The VLLSCTRL register controls features related to VLLS modes. This register
* is reset on Chip POR not VLLS and by reset types that trigger Chip POR not
* VLLS. It is unaffected by reset types that do not trigger Chip POR not VLLS. See
* the Reset section details for more information.
*/
typedef union _hw_smc_vllsctrl
{
uint8_t U;
struct _hw_smc_vllsctrl_bitfields
{
uint8_t VLLSM : 3; //!< [2:0] VLLS Mode Control
uint8_t RESERVED0 : 2; //!< [4:3]
uint8_t PORPO : 1; //!< [5] POR Power Option
uint8_t RESERVED1 : 2; //!< [7:6]
} B;
} hw_smc_vllsctrl_t;
#endif
/*!
* @name Constants and macros for entire SMC_VLLSCTRL register
*/
//@{
#define HW_SMC_VLLSCTRL_ADDR (REGS_SMC_BASE + 0x2U)
#ifndef __LANGUAGE_ASM__
#define HW_SMC_VLLSCTRL (*(__IO hw_smc_vllsctrl_t *) HW_SMC_VLLSCTRL_ADDR)
#define HW_SMC_VLLSCTRL_RD() (HW_SMC_VLLSCTRL.U)
#define HW_SMC_VLLSCTRL_WR(v) (HW_SMC_VLLSCTRL.U = (v))
#define HW_SMC_VLLSCTRL_SET(v) (HW_SMC_VLLSCTRL_WR(HW_SMC_VLLSCTRL_RD() | (v)))
#define HW_SMC_VLLSCTRL_CLR(v) (HW_SMC_VLLSCTRL_WR(HW_SMC_VLLSCTRL_RD() & ~(v)))
#define HW_SMC_VLLSCTRL_TOG(v) (HW_SMC_VLLSCTRL_WR(HW_SMC_VLLSCTRL_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual SMC_VLLSCTRL bitfields
*/
/*!
* @name Register SMC_VLLSCTRL, field VLLSM[2:0] (RW)
*
* Controls which VLLS sub-mode to enter if STOPM=VLLS.
*
* Values:
* - 000 - VLLS0
* - 001 - VLLS1
* - 010 - VLLS2
* - 011 - VLLS3
* - 100 - Reserved
* - 101 - Reserved
* - 110 - Reserved
* - 111 - Reserved
*/
//@{
#define BP_SMC_VLLSCTRL_VLLSM (0U) //!< Bit position for SMC_VLLSCTRL_VLLSM.
#define BM_SMC_VLLSCTRL_VLLSM (0x07U) //!< Bit mask for SMC_VLLSCTRL_VLLSM.
#define BS_SMC_VLLSCTRL_VLLSM (3U) //!< Bit field size in bits for SMC_VLLSCTRL_VLLSM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_VLLSCTRL_VLLSM field.
#define BR_SMC_VLLSCTRL_VLLSM (HW_SMC_VLLSCTRL.B.VLLSM)
#endif
//! @brief Format value for bitfield SMC_VLLSCTRL_VLLSM.
#define BF_SMC_VLLSCTRL_VLLSM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_VLLSCTRL_VLLSM), uint8_t) & BM_SMC_VLLSCTRL_VLLSM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the VLLSM field to a new value.
#define BW_SMC_VLLSCTRL_VLLSM(v) (HW_SMC_VLLSCTRL_WR((HW_SMC_VLLSCTRL_RD() & ~BM_SMC_VLLSCTRL_VLLSM) | BF_SMC_VLLSCTRL_VLLSM(v)))
#endif
//@}
/*!
* @name Register SMC_VLLSCTRL, field PORPO[5] (RW)
*
* Controls whether the POR detect circuit (for brown-out detection) is enabled
* in VLLS0 mode.
*
* Values:
* - 0 - POR detect circuit is enabled in VLLS0.
* - 1 - POR detect circuit is disabled in VLLS0.
*/
//@{
#define BP_SMC_VLLSCTRL_PORPO (5U) //!< Bit position for SMC_VLLSCTRL_PORPO.
#define BM_SMC_VLLSCTRL_PORPO (0x20U) //!< Bit mask for SMC_VLLSCTRL_PORPO.
#define BS_SMC_VLLSCTRL_PORPO (1U) //!< Bit field size in bits for SMC_VLLSCTRL_PORPO.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_VLLSCTRL_PORPO field.
#define BR_SMC_VLLSCTRL_PORPO (BITBAND_ACCESS8(HW_SMC_VLLSCTRL_ADDR, BP_SMC_VLLSCTRL_PORPO))
#endif
//! @brief Format value for bitfield SMC_VLLSCTRL_PORPO.
#define BF_SMC_VLLSCTRL_PORPO(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_SMC_VLLSCTRL_PORPO), uint8_t) & BM_SMC_VLLSCTRL_PORPO)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PORPO field to a new value.
#define BW_SMC_VLLSCTRL_PORPO(v) (BITBAND_ACCESS8(HW_SMC_VLLSCTRL_ADDR, BP_SMC_VLLSCTRL_PORPO) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SMC_PMSTAT - Power Mode Status register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SMC_PMSTAT - Power Mode Status register (RO)
*
* Reset value: 0x01U
*
* PMSTAT is a read-only, one-hot register which indicates the current power
* mode of the system. This register is reset on Chip POR not VLLS and by reset
* types that trigger Chip POR not VLLS. It is unaffected by reset types that do not
* trigger Chip POR not VLLS. See the Reset section details for more information.
*/
typedef union _hw_smc_pmstat
{
uint8_t U;
struct _hw_smc_pmstat_bitfields
{
uint8_t PMSTAT : 7; //!< [6:0]
uint8_t RESERVED0 : 1; //!< [7]
} B;
} hw_smc_pmstat_t;
#endif
/*!
* @name Constants and macros for entire SMC_PMSTAT register
*/
//@{
#define HW_SMC_PMSTAT_ADDR (REGS_SMC_BASE + 0x3U)
#ifndef __LANGUAGE_ASM__
#define HW_SMC_PMSTAT (*(__I hw_smc_pmstat_t *) HW_SMC_PMSTAT_ADDR)
#define HW_SMC_PMSTAT_RD() (HW_SMC_PMSTAT.U)
#endif
//@}
/*
* Constants & macros for individual SMC_PMSTAT bitfields
*/
/*!
* @name Register SMC_PMSTAT, field PMSTAT[6:0] (RO)
*
* When debug is enabled, the PMSTAT will not update to STOP or VLPS
*/
//@{
#define BP_SMC_PMSTAT_PMSTAT (0U) //!< Bit position for SMC_PMSTAT_PMSTAT.
#define BM_SMC_PMSTAT_PMSTAT (0x7FU) //!< Bit mask for SMC_PMSTAT_PMSTAT.
#define BS_SMC_PMSTAT_PMSTAT (7U) //!< Bit field size in bits for SMC_PMSTAT_PMSTAT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the SMC_PMSTAT_PMSTAT field.
#define BR_SMC_PMSTAT_PMSTAT (HW_SMC_PMSTAT.B.PMSTAT)
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_smc_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All SMC module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_smc
{
__IO hw_smc_pmprot_t PMPROT; //!< [0x0] Power Mode Protection register
__IO hw_smc_pmctrl_t PMCTRL; //!< [0x1] Power Mode Control register
__IO hw_smc_vllsctrl_t VLLSCTRL; //!< [0x2] VLLS Control register
__I hw_smc_pmstat_t PMSTAT; //!< [0x3] Power Mode Status register
} hw_smc_t;
#pragma pack()
//! @brief Macro to access all SMC registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_SMC</code>.
#define HW_SMC (*(hw_smc_t *) REGS_SMC_BASE)
#endif
#endif // __HW_SMC_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,957 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_USBDCD_REGISTERS_H__
#define __HW_USBDCD_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 USBDCD
*
* USB Device Charger Detection module
*
* Registers defined in this header file:
* - HW_USBDCD_CONTROL - Control register
* - HW_USBDCD_CLOCK - Clock register
* - HW_USBDCD_STATUS - Status register
* - HW_USBDCD_TIMER0 - TIMER0 register
* - HW_USBDCD_TIMER1 - TIMER1 register
* - HW_USBDCD_TIMER2_BC11 - TIMER2_BC11 register
* - HW_USBDCD_TIMER2_BC12 - TIMER2_BC12 register
*
* - hw_usbdcd_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_USBDCD_BASE
#define HW_USBDCD_INSTANCE_COUNT (1U) //!< Number of instances of the USBDCD module.
#define HW_USBDCD0 (0U) //!< Instance number for USBDCD.
#define REGS_USBDCD0_BASE (0x40035000U) //!< Base address for USBDCD.
//! @brief Table of base addresses for USBDCD instances.
static const uint32_t __g_regs_USBDCD_base_addresses[] = {
REGS_USBDCD0_BASE,
};
//! @brief Get the base address of USBDCD by instance number.
//! @param x USBDCD instance number, from 0 through 0.
#define REGS_USBDCD_BASE(x) (__g_regs_USBDCD_base_addresses[(x)])
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of USBDCD.
#define REGS_USBDCD_INSTANCE(b) ((b) == REGS_USBDCD0_BASE ? HW_USBDCD0 : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_CONTROL - Control register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_CONTROL - Control register (RW)
*
* Reset value: 0x00010000U
*
* Contains the control and interrupt bit fields.
*/
typedef union _hw_usbdcd_control
{
uint32_t U;
struct _hw_usbdcd_control_bitfields
{
uint32_t IACK : 1; //!< [0] Interrupt Acknowledge
uint32_t RESERVED0 : 7; //!< [7:1]
uint32_t IF : 1; //!< [8] Interrupt Flag
uint32_t RESERVED1 : 7; //!< [15:9]
uint32_t IE : 1; //!< [16] Interrupt Enable
uint32_t BC12 : 1; //!< [17]
uint32_t RESERVED2 : 6; //!< [23:18]
uint32_t START : 1; //!< [24] Start Change Detection Sequence
uint32_t SR : 1; //!< [25] Software Reset
uint32_t RESERVED3 : 6; //!< [31:26]
} B;
} hw_usbdcd_control_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_CONTROL register
*/
//@{
#define HW_USBDCD_CONTROL_ADDR(x) (REGS_USBDCD_BASE(x) + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_CONTROL(x) (*(__IO hw_usbdcd_control_t *) HW_USBDCD_CONTROL_ADDR(x))
#define HW_USBDCD_CONTROL_RD(x) (HW_USBDCD_CONTROL(x).U)
#define HW_USBDCD_CONTROL_WR(x, v) (HW_USBDCD_CONTROL(x).U = (v))
#define HW_USBDCD_CONTROL_SET(x, v) (HW_USBDCD_CONTROL_WR(x, HW_USBDCD_CONTROL_RD(x) | (v)))
#define HW_USBDCD_CONTROL_CLR(x, v) (HW_USBDCD_CONTROL_WR(x, HW_USBDCD_CONTROL_RD(x) & ~(v)))
#define HW_USBDCD_CONTROL_TOG(x, v) (HW_USBDCD_CONTROL_WR(x, HW_USBDCD_CONTROL_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_CONTROL bitfields
*/
/*!
* @name Register USBDCD_CONTROL, field IACK[0] (WORZ)
*
* Determines whether the interrupt is cleared.
*
* Values:
* - 0 - Do not clear the interrupt.
* - 1 - Clear the IF bit (interrupt flag).
*/
//@{
#define BP_USBDCD_CONTROL_IACK (0U) //!< Bit position for USBDCD_CONTROL_IACK.
#define BM_USBDCD_CONTROL_IACK (0x00000001U) //!< Bit mask for USBDCD_CONTROL_IACK.
#define BS_USBDCD_CONTROL_IACK (1U) //!< Bit field size in bits for USBDCD_CONTROL_IACK.
//! @brief Format value for bitfield USBDCD_CONTROL_IACK.
#define BF_USBDCD_CONTROL_IACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CONTROL_IACK), uint32_t) & BM_USBDCD_CONTROL_IACK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the IACK field to a new value.
#define BW_USBDCD_CONTROL_IACK(x, v) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_IACK) = (v))
#endif
//@}
/*!
* @name Register USBDCD_CONTROL, field IF[8] (RO)
*
* Determines whether an interrupt is pending.
*
* Values:
* - 0 - No interrupt is pending.
* - 1 - An interrupt is pending.
*/
//@{
#define BP_USBDCD_CONTROL_IF (8U) //!< Bit position for USBDCD_CONTROL_IF.
#define BM_USBDCD_CONTROL_IF (0x00000100U) //!< Bit mask for USBDCD_CONTROL_IF.
#define BS_USBDCD_CONTROL_IF (1U) //!< Bit field size in bits for USBDCD_CONTROL_IF.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_CONTROL_IF field.
#define BR_USBDCD_CONTROL_IF(x) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_IF))
#endif
//@}
/*!
* @name Register USBDCD_CONTROL, field IE[16] (RW)
*
* Enables/disables interrupts to the system.
*
* Values:
* - 0 - Disable interrupts to the system.
* - 1 - Enable interrupts to the system.
*/
//@{
#define BP_USBDCD_CONTROL_IE (16U) //!< Bit position for USBDCD_CONTROL_IE.
#define BM_USBDCD_CONTROL_IE (0x00010000U) //!< Bit mask for USBDCD_CONTROL_IE.
#define BS_USBDCD_CONTROL_IE (1U) //!< Bit field size in bits for USBDCD_CONTROL_IE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_CONTROL_IE field.
#define BR_USBDCD_CONTROL_IE(x) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_IE))
#endif
//! @brief Format value for bitfield USBDCD_CONTROL_IE.
#define BF_USBDCD_CONTROL_IE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CONTROL_IE), uint32_t) & BM_USBDCD_CONTROL_IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the IE field to a new value.
#define BW_USBDCD_CONTROL_IE(x, v) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_IE) = (v))
#endif
//@}
/*!
* @name Register USBDCD_CONTROL, field BC12[17] (RW)
*
* BC1.2 compatibility. This bit cannot be changed after start detection.
*
* Values:
* - 0 - Compatible with BC1.1 (default)
* - 1 - Compatible with BC1.2
*/
//@{
#define BP_USBDCD_CONTROL_BC12 (17U) //!< Bit position for USBDCD_CONTROL_BC12.
#define BM_USBDCD_CONTROL_BC12 (0x00020000U) //!< Bit mask for USBDCD_CONTROL_BC12.
#define BS_USBDCD_CONTROL_BC12 (1U) //!< Bit field size in bits for USBDCD_CONTROL_BC12.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_CONTROL_BC12 field.
#define BR_USBDCD_CONTROL_BC12(x) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_BC12))
#endif
//! @brief Format value for bitfield USBDCD_CONTROL_BC12.
#define BF_USBDCD_CONTROL_BC12(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CONTROL_BC12), uint32_t) & BM_USBDCD_CONTROL_BC12)
#ifndef __LANGUAGE_ASM__
//! @brief Set the BC12 field to a new value.
#define BW_USBDCD_CONTROL_BC12(x, v) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_BC12) = (v))
#endif
//@}
/*!
* @name Register USBDCD_CONTROL, field START[24] (WORZ)
*
* Determines whether the charger detection sequence is initiated.
*
* Values:
* - 0 - Do not start the sequence. Writes of this value have no effect.
* - 1 - Initiate the charger detection sequence. If the sequence is already
* running, writes of this value have no effect.
*/
//@{
#define BP_USBDCD_CONTROL_START (24U) //!< Bit position for USBDCD_CONTROL_START.
#define BM_USBDCD_CONTROL_START (0x01000000U) //!< Bit mask for USBDCD_CONTROL_START.
#define BS_USBDCD_CONTROL_START (1U) //!< Bit field size in bits for USBDCD_CONTROL_START.
//! @brief Format value for bitfield USBDCD_CONTROL_START.
#define BF_USBDCD_CONTROL_START(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CONTROL_START), uint32_t) & BM_USBDCD_CONTROL_START)
#ifndef __LANGUAGE_ASM__
//! @brief Set the START field to a new value.
#define BW_USBDCD_CONTROL_START(x, v) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_START) = (v))
#endif
//@}
/*!
* @name Register USBDCD_CONTROL, field SR[25] (WORZ)
*
* Determines whether a software reset is performed.
*
* Values:
* - 0 - Do not perform a software reset.
* - 1 - Perform a software reset.
*/
//@{
#define BP_USBDCD_CONTROL_SR (25U) //!< Bit position for USBDCD_CONTROL_SR.
#define BM_USBDCD_CONTROL_SR (0x02000000U) //!< Bit mask for USBDCD_CONTROL_SR.
#define BS_USBDCD_CONTROL_SR (1U) //!< Bit field size in bits for USBDCD_CONTROL_SR.
//! @brief Format value for bitfield USBDCD_CONTROL_SR.
#define BF_USBDCD_CONTROL_SR(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CONTROL_SR), uint32_t) & BM_USBDCD_CONTROL_SR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SR field to a new value.
#define BW_USBDCD_CONTROL_SR(x, v) (BITBAND_ACCESS32(HW_USBDCD_CONTROL_ADDR(x), BP_USBDCD_CONTROL_SR) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_CLOCK - Clock register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_CLOCK - Clock register (RW)
*
* Reset value: 0x000000C1U
*/
typedef union _hw_usbdcd_clock
{
uint32_t U;
struct _hw_usbdcd_clock_bitfields
{
uint32_t CLOCK_UNIT : 1; //!< [0] Unit of Measurement Encoding for
//! Clock Speed
uint32_t RESERVED0 : 1; //!< [1]
uint32_t CLOCK_SPEED : 10; //!< [11:2] Numerical Value of Clock Speed
//! in Binary
uint32_t RESERVED1 : 20; //!< [31:12]
} B;
} hw_usbdcd_clock_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_CLOCK register
*/
//@{
#define HW_USBDCD_CLOCK_ADDR(x) (REGS_USBDCD_BASE(x) + 0x4U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_CLOCK(x) (*(__IO hw_usbdcd_clock_t *) HW_USBDCD_CLOCK_ADDR(x))
#define HW_USBDCD_CLOCK_RD(x) (HW_USBDCD_CLOCK(x).U)
#define HW_USBDCD_CLOCK_WR(x, v) (HW_USBDCD_CLOCK(x).U = (v))
#define HW_USBDCD_CLOCK_SET(x, v) (HW_USBDCD_CLOCK_WR(x, HW_USBDCD_CLOCK_RD(x) | (v)))
#define HW_USBDCD_CLOCK_CLR(x, v) (HW_USBDCD_CLOCK_WR(x, HW_USBDCD_CLOCK_RD(x) & ~(v)))
#define HW_USBDCD_CLOCK_TOG(x, v) (HW_USBDCD_CLOCK_WR(x, HW_USBDCD_CLOCK_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_CLOCK bitfields
*/
/*!
* @name Register USBDCD_CLOCK, field CLOCK_UNIT[0] (RW)
*
* Specifies the unit of measure for the clock speed.
*
* Values:
* - 0 - kHz Speed (between 1 kHz and 1023 kHz)
* - 1 - MHz Speed (between 1 MHz and 1023 MHz)
*/
//@{
#define BP_USBDCD_CLOCK_CLOCK_UNIT (0U) //!< Bit position for USBDCD_CLOCK_CLOCK_UNIT.
#define BM_USBDCD_CLOCK_CLOCK_UNIT (0x00000001U) //!< Bit mask for USBDCD_CLOCK_CLOCK_UNIT.
#define BS_USBDCD_CLOCK_CLOCK_UNIT (1U) //!< Bit field size in bits for USBDCD_CLOCK_CLOCK_UNIT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_CLOCK_CLOCK_UNIT field.
#define BR_USBDCD_CLOCK_CLOCK_UNIT(x) (BITBAND_ACCESS32(HW_USBDCD_CLOCK_ADDR(x), BP_USBDCD_CLOCK_CLOCK_UNIT))
#endif
//! @brief Format value for bitfield USBDCD_CLOCK_CLOCK_UNIT.
#define BF_USBDCD_CLOCK_CLOCK_UNIT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CLOCK_CLOCK_UNIT), uint32_t) & BM_USBDCD_CLOCK_CLOCK_UNIT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CLOCK_UNIT field to a new value.
#define BW_USBDCD_CLOCK_CLOCK_UNIT(x, v) (BITBAND_ACCESS32(HW_USBDCD_CLOCK_ADDR(x), BP_USBDCD_CLOCK_CLOCK_UNIT) = (v))
#endif
//@}
/*!
* @name Register USBDCD_CLOCK, field CLOCK_SPEED[11:2] (RW)
*
* The unit of measure is programmed in CLOCK_UNIT. The valid range is from 1 to
* 1023 when clock unit is MHz and 4 to 1023 when clock unit is kHz. Examples
* with CLOCK_UNIT = 1: For 48 MHz: 0b00_0011_0000 (48) (Default) For 24 MHz:
* 0b00_0001_1000 (24) Examples with CLOCK_UNIT = 0: For 100 kHz: 0b00_0110_0100 (100)
* For 500 kHz: 0b01_1111_0100 (500)
*/
//@{
#define BP_USBDCD_CLOCK_CLOCK_SPEED (2U) //!< Bit position for USBDCD_CLOCK_CLOCK_SPEED.
#define BM_USBDCD_CLOCK_CLOCK_SPEED (0x00000FFCU) //!< Bit mask for USBDCD_CLOCK_CLOCK_SPEED.
#define BS_USBDCD_CLOCK_CLOCK_SPEED (10U) //!< Bit field size in bits for USBDCD_CLOCK_CLOCK_SPEED.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_CLOCK_CLOCK_SPEED field.
#define BR_USBDCD_CLOCK_CLOCK_SPEED(x) (HW_USBDCD_CLOCK(x).B.CLOCK_SPEED)
#endif
//! @brief Format value for bitfield USBDCD_CLOCK_CLOCK_SPEED.
#define BF_USBDCD_CLOCK_CLOCK_SPEED(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_CLOCK_CLOCK_SPEED), uint32_t) & BM_USBDCD_CLOCK_CLOCK_SPEED)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CLOCK_SPEED field to a new value.
#define BW_USBDCD_CLOCK_CLOCK_SPEED(x, v) (HW_USBDCD_CLOCK_WR(x, (HW_USBDCD_CLOCK_RD(x) & ~BM_USBDCD_CLOCK_CLOCK_SPEED) | BF_USBDCD_CLOCK_CLOCK_SPEED(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_STATUS - Status register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_STATUS - Status register (RO)
*
* Reset value: 0x00000000U
*
* Provides the current state of the module for system software monitoring.
*/
typedef union _hw_usbdcd_status
{
uint32_t U;
struct _hw_usbdcd_status_bitfields
{
uint32_t RESERVED0 : 16; //!< [15:0]
uint32_t SEQ_RES : 2; //!< [17:16] Charger Detection Sequence Results
uint32_t SEQ_STAT : 2; //!< [19:18] Charger Detection Sequence Status
uint32_t ERR : 1; //!< [20] Error Flag
uint32_t TO : 1; //!< [21] Timeout Flag
uint32_t ACTIVE : 1; //!< [22] Active Status Indicator
uint32_t RESERVED1 : 9; //!< [31:23]
} B;
} hw_usbdcd_status_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_STATUS register
*/
//@{
#define HW_USBDCD_STATUS_ADDR(x) (REGS_USBDCD_BASE(x) + 0x8U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_STATUS(x) (*(__I hw_usbdcd_status_t *) HW_USBDCD_STATUS_ADDR(x))
#define HW_USBDCD_STATUS_RD(x) (HW_USBDCD_STATUS(x).U)
#endif
//@}
/*
* Constants & macros for individual USBDCD_STATUS bitfields
*/
/*!
* @name Register USBDCD_STATUS, field SEQ_RES[17:16] (RO)
*
* Reports how the charger detection is attached.
*
* Values:
* - 00 - No results to report.
* - 01 - Attached to a standard host. Must comply with USB 2.0 by drawing only
* 2.5 mA (max) until connected.
* - 10 - Attached to a charging port. The exact meaning depends on bit 18: 0:
* Attached to either a charging host or a dedicated charger. The charger type
* detection has not completed. 1: Attached to a charging host. The charger
* type detection has completed.
* - 11 - Attached to a dedicated charger.
*/
//@{
#define BP_USBDCD_STATUS_SEQ_RES (16U) //!< Bit position for USBDCD_STATUS_SEQ_RES.
#define BM_USBDCD_STATUS_SEQ_RES (0x00030000U) //!< Bit mask for USBDCD_STATUS_SEQ_RES.
#define BS_USBDCD_STATUS_SEQ_RES (2U) //!< Bit field size in bits for USBDCD_STATUS_SEQ_RES.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_STATUS_SEQ_RES field.
#define BR_USBDCD_STATUS_SEQ_RES(x) (HW_USBDCD_STATUS(x).B.SEQ_RES)
#endif
//@}
/*!
* @name Register USBDCD_STATUS, field SEQ_STAT[19:18] (RO)
*
* Indicates the status of the charger detection sequence.
*
* Values:
* - 00 - The module is either not enabled, or the module is enabled but the
* data pins have not yet been detected.
* - 01 - Data pin contact detection is complete.
* - 10 - Charging port detection is complete.
* - 11 - Charger type detection is complete.
*/
//@{
#define BP_USBDCD_STATUS_SEQ_STAT (18U) //!< Bit position for USBDCD_STATUS_SEQ_STAT.
#define BM_USBDCD_STATUS_SEQ_STAT (0x000C0000U) //!< Bit mask for USBDCD_STATUS_SEQ_STAT.
#define BS_USBDCD_STATUS_SEQ_STAT (2U) //!< Bit field size in bits for USBDCD_STATUS_SEQ_STAT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_STATUS_SEQ_STAT field.
#define BR_USBDCD_STATUS_SEQ_STAT(x) (HW_USBDCD_STATUS(x).B.SEQ_STAT)
#endif
//@}
/*!
* @name Register USBDCD_STATUS, field ERR[20] (RO)
*
* Indicates whether there is an error in the detection sequence.
*
* Values:
* - 0 - No sequence errors.
* - 1 - Error in the detection sequence. See the SEQ_STAT field to determine
* the phase in which the error occurred.
*/
//@{
#define BP_USBDCD_STATUS_ERR (20U) //!< Bit position for USBDCD_STATUS_ERR.
#define BM_USBDCD_STATUS_ERR (0x00100000U) //!< Bit mask for USBDCD_STATUS_ERR.
#define BS_USBDCD_STATUS_ERR (1U) //!< Bit field size in bits for USBDCD_STATUS_ERR.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_STATUS_ERR field.
#define BR_USBDCD_STATUS_ERR(x) (BITBAND_ACCESS32(HW_USBDCD_STATUS_ADDR(x), BP_USBDCD_STATUS_ERR))
#endif
//@}
/*!
* @name Register USBDCD_STATUS, field TO[21] (RO)
*
* Indicates whether the detection sequence has passed the timeout threshhold.
*
* Values:
* - 0 - The detection sequence has not been running for over 1 s.
* - 1 - It has been over 1 s since the data pin contact was detected and
* debounced.
*/
//@{
#define BP_USBDCD_STATUS_TO (21U) //!< Bit position for USBDCD_STATUS_TO.
#define BM_USBDCD_STATUS_TO (0x00200000U) //!< Bit mask for USBDCD_STATUS_TO.
#define BS_USBDCD_STATUS_TO (1U) //!< Bit field size in bits for USBDCD_STATUS_TO.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_STATUS_TO field.
#define BR_USBDCD_STATUS_TO(x) (BITBAND_ACCESS32(HW_USBDCD_STATUS_ADDR(x), BP_USBDCD_STATUS_TO))
#endif
//@}
/*!
* @name Register USBDCD_STATUS, field ACTIVE[22] (RO)
*
* Indicates whether the sequence is running.
*
* Values:
* - 0 - The sequence is not running.
* - 1 - The sequence is running.
*/
//@{
#define BP_USBDCD_STATUS_ACTIVE (22U) //!< Bit position for USBDCD_STATUS_ACTIVE.
#define BM_USBDCD_STATUS_ACTIVE (0x00400000U) //!< Bit mask for USBDCD_STATUS_ACTIVE.
#define BS_USBDCD_STATUS_ACTIVE (1U) //!< Bit field size in bits for USBDCD_STATUS_ACTIVE.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_STATUS_ACTIVE field.
#define BR_USBDCD_STATUS_ACTIVE(x) (BITBAND_ACCESS32(HW_USBDCD_STATUS_ADDR(x), BP_USBDCD_STATUS_ACTIVE))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_TIMER0 - TIMER0 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_TIMER0 - TIMER0 register (RW)
*
* Reset value: 0x00100000U
*
* TIMER0 has an TSEQ_INIT field that represents the system latency in ms.
* Latency is measured from the time when VBUS goes active until the time system
* software initiates charger detection sequence in USBDCD module. When software sets
* the CONTROL[START] bit, the Unit Connection Timer (TUNITCON) is initialized
* with the value of TSEQ_INIT. Valid values are 0-1023, however the USB Battery
* Charging Specification requires the entire sequence, including TSEQ_INIT, to be
* completed in 1s or less.
*/
typedef union _hw_usbdcd_timer0
{
uint32_t U;
struct _hw_usbdcd_timer0_bitfields
{
uint32_t TUNITCON : 12; //!< [11:0] Unit Connection Timer Elapse (in
//! ms)
uint32_t RESERVED0 : 4; //!< [15:12]
uint32_t TSEQ_INIT : 10; //!< [25:16] Sequence Initiation Time
uint32_t RESERVED1 : 6; //!< [31:26]
} B;
} hw_usbdcd_timer0_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_TIMER0 register
*/
//@{
#define HW_USBDCD_TIMER0_ADDR(x) (REGS_USBDCD_BASE(x) + 0x10U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_TIMER0(x) (*(__IO hw_usbdcd_timer0_t *) HW_USBDCD_TIMER0_ADDR(x))
#define HW_USBDCD_TIMER0_RD(x) (HW_USBDCD_TIMER0(x).U)
#define HW_USBDCD_TIMER0_WR(x, v) (HW_USBDCD_TIMER0(x).U = (v))
#define HW_USBDCD_TIMER0_SET(x, v) (HW_USBDCD_TIMER0_WR(x, HW_USBDCD_TIMER0_RD(x) | (v)))
#define HW_USBDCD_TIMER0_CLR(x, v) (HW_USBDCD_TIMER0_WR(x, HW_USBDCD_TIMER0_RD(x) & ~(v)))
#define HW_USBDCD_TIMER0_TOG(x, v) (HW_USBDCD_TIMER0_WR(x, HW_USBDCD_TIMER0_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_TIMER0 bitfields
*/
/*!
* @name Register USBDCD_TIMER0, field TUNITCON[11:0] (RO)
*
* Displays the amount of elapsed time since the event of setting the START bit
* plus the value of TSEQ_INIT. The timer is automatically initialized with the
* value of TSEQ_INIT before starting to count. This timer enables compliance with
* the maximum time allowed to connect T UNIT_CON under the USB Battery Charging
* Specification. If the timer reaches the one second limit, the module triggers
* an interrupt and sets the error flag STATUS[ERR]. The timer continues
* counting throughout the charger detection sequence, even when control has been passed
* to software. As long as the module is active, the timer continues to count
* until it reaches the maximum value of 0xFFF (4095 ms). The timer does not
* rollover to zero. A software reset clears the timer.
*/
//@{
#define BP_USBDCD_TIMER0_TUNITCON (0U) //!< Bit position for USBDCD_TIMER0_TUNITCON.
#define BM_USBDCD_TIMER0_TUNITCON (0x00000FFFU) //!< Bit mask for USBDCD_TIMER0_TUNITCON.
#define BS_USBDCD_TIMER0_TUNITCON (12U) //!< Bit field size in bits for USBDCD_TIMER0_TUNITCON.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER0_TUNITCON field.
#define BR_USBDCD_TIMER0_TUNITCON(x) (HW_USBDCD_TIMER0(x).B.TUNITCON)
#endif
//@}
/*!
* @name Register USBDCD_TIMER0, field TSEQ_INIT[25:16] (RW)
*
* TSEQ_INIT represents the system latency (in ms) measured from the time VBUS
* goes active to the time system software initiates the charger detection
* sequence in the USBDCD module. When software sets the CONTROL[START] bit, the Unit
* Connection Timer (TUNITCON) is initialized with the value of TSEQ_INIT. Valid
* values are 0-1023, but the USB Battery Charging Specification requires the
* entire sequence, including TSEQ_INIT, to be completed in 1s or less.
*/
//@{
#define BP_USBDCD_TIMER0_TSEQ_INIT (16U) //!< Bit position for USBDCD_TIMER0_TSEQ_INIT.
#define BM_USBDCD_TIMER0_TSEQ_INIT (0x03FF0000U) //!< Bit mask for USBDCD_TIMER0_TSEQ_INIT.
#define BS_USBDCD_TIMER0_TSEQ_INIT (10U) //!< Bit field size in bits for USBDCD_TIMER0_TSEQ_INIT.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER0_TSEQ_INIT field.
#define BR_USBDCD_TIMER0_TSEQ_INIT(x) (HW_USBDCD_TIMER0(x).B.TSEQ_INIT)
#endif
//! @brief Format value for bitfield USBDCD_TIMER0_TSEQ_INIT.
#define BF_USBDCD_TIMER0_TSEQ_INIT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER0_TSEQ_INIT), uint32_t) & BM_USBDCD_TIMER0_TSEQ_INIT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TSEQ_INIT field to a new value.
#define BW_USBDCD_TIMER0_TSEQ_INIT(x, v) (HW_USBDCD_TIMER0_WR(x, (HW_USBDCD_TIMER0_RD(x) & ~BM_USBDCD_TIMER0_TSEQ_INIT) | BF_USBDCD_TIMER0_TSEQ_INIT(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_TIMER1 - TIMER1 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_TIMER1 - TIMER1 register (RW)
*
* Reset value: 0x000A0028U
*
* TIMER1 contains timing parameters. Note that register values can be written
* that are not compliant with the USB Battery Charging Specification, so care
* should be taken when overwriting the default values.
*/
typedef union _hw_usbdcd_timer1
{
uint32_t U;
struct _hw_usbdcd_timer1_bitfields
{
uint32_t TVDPSRC_ON : 10; //!< [9:0] Time Period Comparator Enabled
uint32_t RESERVED0 : 6; //!< [15:10]
uint32_t TDCD_DBNC : 10; //!< [25:16] Time Period to Debounce D+
//! Signal
uint32_t RESERVED1 : 6; //!< [31:26]
} B;
} hw_usbdcd_timer1_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_TIMER1 register
*/
//@{
#define HW_USBDCD_TIMER1_ADDR(x) (REGS_USBDCD_BASE(x) + 0x14U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_TIMER1(x) (*(__IO hw_usbdcd_timer1_t *) HW_USBDCD_TIMER1_ADDR(x))
#define HW_USBDCD_TIMER1_RD(x) (HW_USBDCD_TIMER1(x).U)
#define HW_USBDCD_TIMER1_WR(x, v) (HW_USBDCD_TIMER1(x).U = (v))
#define HW_USBDCD_TIMER1_SET(x, v) (HW_USBDCD_TIMER1_WR(x, HW_USBDCD_TIMER1_RD(x) | (v)))
#define HW_USBDCD_TIMER1_CLR(x, v) (HW_USBDCD_TIMER1_WR(x, HW_USBDCD_TIMER1_RD(x) & ~(v)))
#define HW_USBDCD_TIMER1_TOG(x, v) (HW_USBDCD_TIMER1_WR(x, HW_USBDCD_TIMER1_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_TIMER1 bitfields
*/
/*!
* @name Register USBDCD_TIMER1, field TVDPSRC_ON[9:0] (RW)
*
* This timing parameter is used after detection of the data pin. See "Charging
* Port Detection". Valid values are 1-1023, but the USB Battery Charging
* Specification requires a minimum value of 40 ms.
*/
//@{
#define BP_USBDCD_TIMER1_TVDPSRC_ON (0U) //!< Bit position for USBDCD_TIMER1_TVDPSRC_ON.
#define BM_USBDCD_TIMER1_TVDPSRC_ON (0x000003FFU) //!< Bit mask for USBDCD_TIMER1_TVDPSRC_ON.
#define BS_USBDCD_TIMER1_TVDPSRC_ON (10U) //!< Bit field size in bits for USBDCD_TIMER1_TVDPSRC_ON.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER1_TVDPSRC_ON field.
#define BR_USBDCD_TIMER1_TVDPSRC_ON(x) (HW_USBDCD_TIMER1(x).B.TVDPSRC_ON)
#endif
//! @brief Format value for bitfield USBDCD_TIMER1_TVDPSRC_ON.
#define BF_USBDCD_TIMER1_TVDPSRC_ON(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER1_TVDPSRC_ON), uint32_t) & BM_USBDCD_TIMER1_TVDPSRC_ON)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TVDPSRC_ON field to a new value.
#define BW_USBDCD_TIMER1_TVDPSRC_ON(x, v) (HW_USBDCD_TIMER1_WR(x, (HW_USBDCD_TIMER1_RD(x) & ~BM_USBDCD_TIMER1_TVDPSRC_ON) | BF_USBDCD_TIMER1_TVDPSRC_ON(v)))
#endif
//@}
/*!
* @name Register USBDCD_TIMER1, field TDCD_DBNC[25:16] (RW)
*
* Sets the time period (ms) to debounce the D+ signal during the data pin
* contact detection phase. See "Debouncing the data pin contact" Valid values are
* 1-1023, but the USB Battery Charging Specification requires a minimum value of 10
* ms.
*/
//@{
#define BP_USBDCD_TIMER1_TDCD_DBNC (16U) //!< Bit position for USBDCD_TIMER1_TDCD_DBNC.
#define BM_USBDCD_TIMER1_TDCD_DBNC (0x03FF0000U) //!< Bit mask for USBDCD_TIMER1_TDCD_DBNC.
#define BS_USBDCD_TIMER1_TDCD_DBNC (10U) //!< Bit field size in bits for USBDCD_TIMER1_TDCD_DBNC.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER1_TDCD_DBNC field.
#define BR_USBDCD_TIMER1_TDCD_DBNC(x) (HW_USBDCD_TIMER1(x).B.TDCD_DBNC)
#endif
//! @brief Format value for bitfield USBDCD_TIMER1_TDCD_DBNC.
#define BF_USBDCD_TIMER1_TDCD_DBNC(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER1_TDCD_DBNC), uint32_t) & BM_USBDCD_TIMER1_TDCD_DBNC)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TDCD_DBNC field to a new value.
#define BW_USBDCD_TIMER1_TDCD_DBNC(x, v) (HW_USBDCD_TIMER1_WR(x, (HW_USBDCD_TIMER1_RD(x) & ~BM_USBDCD_TIMER1_TDCD_DBNC) | BF_USBDCD_TIMER1_TDCD_DBNC(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_TIMER2_BC11 - TIMER2_BC11 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_TIMER2_BC11 - TIMER2_BC11 register (RW)
*
* Reset value: 0x00280001U
*
* TIMER2_BC11 contains timing parameters for USB Battery Charging
* Specification, v1.1. Register values can be written that are not compliant with the USB
* Battery Charging Specification, so care should be taken when overwriting the
* default values.
*/
typedef union _hw_usbdcd_timer2_bc11
{
uint32_t U;
struct _hw_usbdcd_timer2_bc11_bitfields
{
uint32_t CHECK_DM : 4; //!< [3:0] Time Before Check of D- Line
uint32_t RESERVED0 : 12; //!< [15:4]
uint32_t TVDPSRC_CON : 10; //!< [25:16] Time Period Before Enabling
//! D+ Pullup
uint32_t RESERVED1 : 6; //!< [31:26]
} B;
} hw_usbdcd_timer2_bc11_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_TIMER2_BC11 register
*/
//@{
#define HW_USBDCD_TIMER2_BC11_ADDR(x) (REGS_USBDCD_BASE(x) + 0x18U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_TIMER2_BC11(x) (*(__IO hw_usbdcd_timer2_bc11_t *) HW_USBDCD_TIMER2_BC11_ADDR(x))
#define HW_USBDCD_TIMER2_BC11_RD(x) (HW_USBDCD_TIMER2_BC11(x).U)
#define HW_USBDCD_TIMER2_BC11_WR(x, v) (HW_USBDCD_TIMER2_BC11(x).U = (v))
#define HW_USBDCD_TIMER2_BC11_SET(x, v) (HW_USBDCD_TIMER2_BC11_WR(x, HW_USBDCD_TIMER2_BC11_RD(x) | (v)))
#define HW_USBDCD_TIMER2_BC11_CLR(x, v) (HW_USBDCD_TIMER2_BC11_WR(x, HW_USBDCD_TIMER2_BC11_RD(x) & ~(v)))
#define HW_USBDCD_TIMER2_BC11_TOG(x, v) (HW_USBDCD_TIMER2_BC11_WR(x, HW_USBDCD_TIMER2_BC11_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_TIMER2_BC11 bitfields
*/
/*!
* @name Register USBDCD_TIMER2_BC11, field CHECK_DM[3:0] (RW)
*
* Sets the amount of time (in ms) that the module waits after the device
* connects to the USB bus until checking the state of the D- line to determine the
* type of charging port. See "Charger Type Detection." Valid values are 1-15ms.
*/
//@{
#define BP_USBDCD_TIMER2_BC11_CHECK_DM (0U) //!< Bit position for USBDCD_TIMER2_BC11_CHECK_DM.
#define BM_USBDCD_TIMER2_BC11_CHECK_DM (0x0000000FU) //!< Bit mask for USBDCD_TIMER2_BC11_CHECK_DM.
#define BS_USBDCD_TIMER2_BC11_CHECK_DM (4U) //!< Bit field size in bits for USBDCD_TIMER2_BC11_CHECK_DM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER2_BC11_CHECK_DM field.
#define BR_USBDCD_TIMER2_BC11_CHECK_DM(x) (HW_USBDCD_TIMER2_BC11(x).B.CHECK_DM)
#endif
//! @brief Format value for bitfield USBDCD_TIMER2_BC11_CHECK_DM.
#define BF_USBDCD_TIMER2_BC11_CHECK_DM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER2_BC11_CHECK_DM), uint32_t) & BM_USBDCD_TIMER2_BC11_CHECK_DM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CHECK_DM field to a new value.
#define BW_USBDCD_TIMER2_BC11_CHECK_DM(x, v) (HW_USBDCD_TIMER2_BC11_WR(x, (HW_USBDCD_TIMER2_BC11_RD(x) & ~BM_USBDCD_TIMER2_BC11_CHECK_DM) | BF_USBDCD_TIMER2_BC11_CHECK_DM(v)))
#endif
//@}
/*!
* @name Register USBDCD_TIMER2_BC11, field TVDPSRC_CON[25:16] (RW)
*
* Sets the time period (ms) that the module waits after charging port detection
* before system software must enable the D+ pullup to connect to the USB host.
* Valid values are 1-1023, but the USB Battery Charging Specification requires a
* minimum value of 40 ms.
*/
//@{
#define BP_USBDCD_TIMER2_BC11_TVDPSRC_CON (16U) //!< Bit position for USBDCD_TIMER2_BC11_TVDPSRC_CON.
#define BM_USBDCD_TIMER2_BC11_TVDPSRC_CON (0x03FF0000U) //!< Bit mask for USBDCD_TIMER2_BC11_TVDPSRC_CON.
#define BS_USBDCD_TIMER2_BC11_TVDPSRC_CON (10U) //!< Bit field size in bits for USBDCD_TIMER2_BC11_TVDPSRC_CON.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER2_BC11_TVDPSRC_CON field.
#define BR_USBDCD_TIMER2_BC11_TVDPSRC_CON(x) (HW_USBDCD_TIMER2_BC11(x).B.TVDPSRC_CON)
#endif
//! @brief Format value for bitfield USBDCD_TIMER2_BC11_TVDPSRC_CON.
#define BF_USBDCD_TIMER2_BC11_TVDPSRC_CON(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER2_BC11_TVDPSRC_CON), uint32_t) & BM_USBDCD_TIMER2_BC11_TVDPSRC_CON)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TVDPSRC_CON field to a new value.
#define BW_USBDCD_TIMER2_BC11_TVDPSRC_CON(x, v) (HW_USBDCD_TIMER2_BC11_WR(x, (HW_USBDCD_TIMER2_BC11_RD(x) & ~BM_USBDCD_TIMER2_BC11_TVDPSRC_CON) | BF_USBDCD_TIMER2_BC11_TVDPSRC_CON(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_USBDCD_TIMER2_BC12 - TIMER2_BC12 register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_USBDCD_TIMER2_BC12 - TIMER2_BC12 register (RW)
*
* Reset value: 0x00010028U
*
* TIMER2_BC12 contains timing parameters for USB Battery Charging
* Specification, v1.2. Register values can be written that are not compliant with the USB
* Battery Charging Specification, so care should be taken when overwriting the
* default values.
*/
typedef union _hw_usbdcd_timer2_bc12
{
uint32_t U;
struct _hw_usbdcd_timer2_bc12_bitfields
{
uint32_t TVDMSRC_ON : 10; //!< [9:0]
uint32_t RESERVED0 : 6; //!< [15:10]
uint32_t TWAIT_AFTER_PRD : 10; //!< [25:16]
uint32_t RESERVED1 : 6; //!< [31:26]
} B;
} hw_usbdcd_timer2_bc12_t;
#endif
/*!
* @name Constants and macros for entire USBDCD_TIMER2_BC12 register
*/
//@{
#define HW_USBDCD_TIMER2_BC12_ADDR(x) (REGS_USBDCD_BASE(x) + 0x18U)
#ifndef __LANGUAGE_ASM__
#define HW_USBDCD_TIMER2_BC12(x) (*(__IO hw_usbdcd_timer2_bc12_t *) HW_USBDCD_TIMER2_BC12_ADDR(x))
#define HW_USBDCD_TIMER2_BC12_RD(x) (HW_USBDCD_TIMER2_BC12(x).U)
#define HW_USBDCD_TIMER2_BC12_WR(x, v) (HW_USBDCD_TIMER2_BC12(x).U = (v))
#define HW_USBDCD_TIMER2_BC12_SET(x, v) (HW_USBDCD_TIMER2_BC12_WR(x, HW_USBDCD_TIMER2_BC12_RD(x) | (v)))
#define HW_USBDCD_TIMER2_BC12_CLR(x, v) (HW_USBDCD_TIMER2_BC12_WR(x, HW_USBDCD_TIMER2_BC12_RD(x) & ~(v)))
#define HW_USBDCD_TIMER2_BC12_TOG(x, v) (HW_USBDCD_TIMER2_BC12_WR(x, HW_USBDCD_TIMER2_BC12_RD(x) ^ (v)))
#endif
//@}
/*
* Constants & macros for individual USBDCD_TIMER2_BC12 bitfields
*/
/*!
* @name Register USBDCD_TIMER2_BC12, field TVDMSRC_ON[9:0] (RW)
*
* Sets the amount of time (in ms) that the module enables the VDM_SRC. Valid
* values are 0-40ms.
*/
//@{
#define BP_USBDCD_TIMER2_BC12_TVDMSRC_ON (0U) //!< Bit position for USBDCD_TIMER2_BC12_TVDMSRC_ON.
#define BM_USBDCD_TIMER2_BC12_TVDMSRC_ON (0x000003FFU) //!< Bit mask for USBDCD_TIMER2_BC12_TVDMSRC_ON.
#define BS_USBDCD_TIMER2_BC12_TVDMSRC_ON (10U) //!< Bit field size in bits for USBDCD_TIMER2_BC12_TVDMSRC_ON.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER2_BC12_TVDMSRC_ON field.
#define BR_USBDCD_TIMER2_BC12_TVDMSRC_ON(x) (HW_USBDCD_TIMER2_BC12(x).B.TVDMSRC_ON)
#endif
//! @brief Format value for bitfield USBDCD_TIMER2_BC12_TVDMSRC_ON.
#define BF_USBDCD_TIMER2_BC12_TVDMSRC_ON(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER2_BC12_TVDMSRC_ON), uint32_t) & BM_USBDCD_TIMER2_BC12_TVDMSRC_ON)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TVDMSRC_ON field to a new value.
#define BW_USBDCD_TIMER2_BC12_TVDMSRC_ON(x, v) (HW_USBDCD_TIMER2_BC12_WR(x, (HW_USBDCD_TIMER2_BC12_RD(x) & ~BM_USBDCD_TIMER2_BC12_TVDMSRC_ON) | BF_USBDCD_TIMER2_BC12_TVDMSRC_ON(v)))
#endif
//@}
/*!
* @name Register USBDCD_TIMER2_BC12, field TWAIT_AFTER_PRD[25:16] (RW)
*
* Sets the amount of time (in ms) that the module waits after primary detection
* before start to secondary detection. Valid values are 1-1023ms. Default is
* 1ms.
*/
//@{
#define BP_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD (16U) //!< Bit position for USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD.
#define BM_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD (0x03FF0000U) //!< Bit mask for USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD.
#define BS_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD (10U) //!< Bit field size in bits for USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD field.
#define BR_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD(x) (HW_USBDCD_TIMER2_BC12(x).B.TWAIT_AFTER_PRD)
#endif
//! @brief Format value for bitfield USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD.
#define BF_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint32_t) << BP_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD), uint32_t) & BM_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TWAIT_AFTER_PRD field to a new value.
#define BW_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD(x, v) (HW_USBDCD_TIMER2_BC12_WR(x, (HW_USBDCD_TIMER2_BC12_RD(x) & ~BM_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD) | BF_USBDCD_TIMER2_BC12_TWAIT_AFTER_PRD(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_usbdcd_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All USBDCD module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_usbdcd
{
__IO hw_usbdcd_control_t CONTROL; //!< [0x0] Control register
__IO hw_usbdcd_clock_t CLOCK; //!< [0x4] Clock register
__I hw_usbdcd_status_t STATUS; //!< [0x8] Status register
uint8_t _reserved0[4];
__IO hw_usbdcd_timer0_t TIMER0; //!< [0x10] TIMER0 register
__IO hw_usbdcd_timer1_t TIMER1; //!< [0x14] TIMER1 register
union {
__IO hw_usbdcd_timer2_bc11_t TIMER2_BC11; //!< [0x18] TIMER2_BC11 register
__IO hw_usbdcd_timer2_bc12_t TIMER2_BC12; //!< [0x18] TIMER2_BC12 register
};
} hw_usbdcd_t;
#pragma pack()
//! @brief Macro to access all USBDCD registers.
//! @param x USBDCD instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_USBDCD(0)</code>.
#define HW_USBDCD(x) (*(hw_usbdcd_t *) REGS_USBDCD_BASE(x))
#endif
#endif // __HW_USBDCD_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,369 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_VREF_REGISTERS_H__
#define __HW_VREF_REGISTERS_H__
#include "regs.h"
/*
* MK64F12 VREF
*
* Voltage Reference
*
* Registers defined in this header file:
* - HW_VREF_TRM - VREF Trim Register
* - HW_VREF_SC - VREF Status and Control Register
*
* - hw_vref_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_VREF_BASE
#define HW_VREF_INSTANCE_COUNT (1U) //!< Number of instances of the VREF module.
#define REGS_VREF_BASE (0x40074000U) //!< Base address for VREF.
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_VREF_TRM - VREF Trim Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_VREF_TRM - VREF Trim Register (RW)
*
* Reset value: 0x00U
*
* This register contains bits that contain the trim data for the Voltage
* Reference.
*/
typedef union _hw_vref_trm
{
uint8_t U;
struct _hw_vref_trm_bitfields
{
uint8_t TRIM : 6; //!< [5:0] Trim bits
uint8_t CHOPEN : 1; //!< [6] Chop oscillator enable. When set,
//! internal chopping operation is enabled and the internal analog offset will
//! be minimized.
uint8_t RESERVED0 : 1; //!< [7]
} B;
} hw_vref_trm_t;
#endif
/*!
* @name Constants and macros for entire VREF_TRM register
*/
//@{
#define HW_VREF_TRM_ADDR (REGS_VREF_BASE + 0x0U)
#ifndef __LANGUAGE_ASM__
#define HW_VREF_TRM (*(__IO hw_vref_trm_t *) HW_VREF_TRM_ADDR)
#define HW_VREF_TRM_RD() (HW_VREF_TRM.U)
#define HW_VREF_TRM_WR(v) (HW_VREF_TRM.U = (v))
#define HW_VREF_TRM_SET(v) (HW_VREF_TRM_WR(HW_VREF_TRM_RD() | (v)))
#define HW_VREF_TRM_CLR(v) (HW_VREF_TRM_WR(HW_VREF_TRM_RD() & ~(v)))
#define HW_VREF_TRM_TOG(v) (HW_VREF_TRM_WR(HW_VREF_TRM_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual VREF_TRM bitfields
*/
/*!
* @name Register VREF_TRM, field TRIM[5:0] (RW)
*
* These bits change the resulting VREF by approximately +/- 0.5 mV for each
* step. Min = minimum and max = maximum voltage reference output. For minimum and
* maximum voltage reference output values, refer to the Data Sheet for this chip.
*
* Values:
* - 000000 - Min
* - 111111 - Max
*/
//@{
#define BP_VREF_TRM_TRIM (0U) //!< Bit position for VREF_TRM_TRIM.
#define BM_VREF_TRM_TRIM (0x3FU) //!< Bit mask for VREF_TRM_TRIM.
#define BS_VREF_TRM_TRIM (6U) //!< Bit field size in bits for VREF_TRM_TRIM.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_TRM_TRIM field.
#define BR_VREF_TRM_TRIM (HW_VREF_TRM.B.TRIM)
#endif
//! @brief Format value for bitfield VREF_TRM_TRIM.
#define BF_VREF_TRM_TRIM(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_TRM_TRIM), uint8_t) & BM_VREF_TRM_TRIM)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TRIM field to a new value.
#define BW_VREF_TRM_TRIM(v) (HW_VREF_TRM_WR((HW_VREF_TRM_RD() & ~BM_VREF_TRM_TRIM) | BF_VREF_TRM_TRIM(v)))
#endif
//@}
/*!
* @name Register VREF_TRM, field CHOPEN[6] (RW)
*
* This bit is set during factory trimming of the VREF voltage. This bit should
* be written to 1 to achieve the performance stated in the data sheet.
*
* Values:
* - 0 - Chop oscillator is disabled.
* - 1 - Chop oscillator is enabled.
*/
//@{
#define BP_VREF_TRM_CHOPEN (6U) //!< Bit position for VREF_TRM_CHOPEN.
#define BM_VREF_TRM_CHOPEN (0x40U) //!< Bit mask for VREF_TRM_CHOPEN.
#define BS_VREF_TRM_CHOPEN (1U) //!< Bit field size in bits for VREF_TRM_CHOPEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_TRM_CHOPEN field.
#define BR_VREF_TRM_CHOPEN (BITBAND_ACCESS8(HW_VREF_TRM_ADDR, BP_VREF_TRM_CHOPEN))
#endif
//! @brief Format value for bitfield VREF_TRM_CHOPEN.
#define BF_VREF_TRM_CHOPEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_TRM_CHOPEN), uint8_t) & BM_VREF_TRM_CHOPEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CHOPEN field to a new value.
#define BW_VREF_TRM_CHOPEN(v) (BITBAND_ACCESS8(HW_VREF_TRM_ADDR, BP_VREF_TRM_CHOPEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_VREF_SC - VREF Status and Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_VREF_SC - VREF Status and Control Register (RW)
*
* Reset value: 0x00U
*
* This register contains the control bits used to enable the internal voltage
* reference and to select the buffer mode to be used.
*/
typedef union _hw_vref_sc
{
uint8_t U;
struct _hw_vref_sc_bitfields
{
uint8_t MODE_LV : 2; //!< [1:0] Buffer Mode selection
uint8_t VREFST : 1; //!< [2] Internal Voltage Reference stable
uint8_t RESERVED0 : 2; //!< [4:3]
uint8_t ICOMPEN : 1; //!< [5] Second order curvature compensation
//! enable
uint8_t REGEN : 1; //!< [6] Regulator enable
uint8_t VREFEN : 1; //!< [7] Internal Voltage Reference enable
} B;
} hw_vref_sc_t;
#endif
/*!
* @name Constants and macros for entire VREF_SC register
*/
//@{
#define HW_VREF_SC_ADDR (REGS_VREF_BASE + 0x1U)
#ifndef __LANGUAGE_ASM__
#define HW_VREF_SC (*(__IO hw_vref_sc_t *) HW_VREF_SC_ADDR)
#define HW_VREF_SC_RD() (HW_VREF_SC.U)
#define HW_VREF_SC_WR(v) (HW_VREF_SC.U = (v))
#define HW_VREF_SC_SET(v) (HW_VREF_SC_WR(HW_VREF_SC_RD() | (v)))
#define HW_VREF_SC_CLR(v) (HW_VREF_SC_WR(HW_VREF_SC_RD() & ~(v)))
#define HW_VREF_SC_TOG(v) (HW_VREF_SC_WR(HW_VREF_SC_RD() ^ (v)))
#endif
//@}
/*
* Constants & macros for individual VREF_SC bitfields
*/
/*!
* @name Register VREF_SC, field MODE_LV[1:0] (RW)
*
* These bits select the buffer modes for the Voltage Reference module.
*
* Values:
* - 00 - Bandgap on only, for stabilization and startup
* - 01 - High power buffer mode enabled
* - 10 - Low-power buffer mode enabled
* - 11 - Reserved
*/
//@{
#define BP_VREF_SC_MODE_LV (0U) //!< Bit position for VREF_SC_MODE_LV.
#define BM_VREF_SC_MODE_LV (0x03U) //!< Bit mask for VREF_SC_MODE_LV.
#define BS_VREF_SC_MODE_LV (2U) //!< Bit field size in bits for VREF_SC_MODE_LV.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_SC_MODE_LV field.
#define BR_VREF_SC_MODE_LV (HW_VREF_SC.B.MODE_LV)
#endif
//! @brief Format value for bitfield VREF_SC_MODE_LV.
#define BF_VREF_SC_MODE_LV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_SC_MODE_LV), uint8_t) & BM_VREF_SC_MODE_LV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the MODE_LV field to a new value.
#define BW_VREF_SC_MODE_LV(v) (HW_VREF_SC_WR((HW_VREF_SC_RD() & ~BM_VREF_SC_MODE_LV) | BF_VREF_SC_MODE_LV(v)))
#endif
//@}
/*!
* @name Register VREF_SC, field VREFST[2] (RO)
*
* This bit indicates that the bandgap reference within the Voltage Reference
* module has completed its startup and stabilization.
*
* Values:
* - 0 - The module is disabled or not stable.
* - 1 - The module is stable.
*/
//@{
#define BP_VREF_SC_VREFST (2U) //!< Bit position for VREF_SC_VREFST.
#define BM_VREF_SC_VREFST (0x04U) //!< Bit mask for VREF_SC_VREFST.
#define BS_VREF_SC_VREFST (1U) //!< Bit field size in bits for VREF_SC_VREFST.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_SC_VREFST field.
#define BR_VREF_SC_VREFST (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_VREFST))
#endif
//@}
/*!
* @name Register VREF_SC, field ICOMPEN[5] (RW)
*
* This bit is set during factory trimming of the VREF voltage. This bit should
* be written to 1 to achieve the performance stated in the data sheet.
*
* Values:
* - 0 - Disabled
* - 1 - Enabled
*/
//@{
#define BP_VREF_SC_ICOMPEN (5U) //!< Bit position for VREF_SC_ICOMPEN.
#define BM_VREF_SC_ICOMPEN (0x20U) //!< Bit mask for VREF_SC_ICOMPEN.
#define BS_VREF_SC_ICOMPEN (1U) //!< Bit field size in bits for VREF_SC_ICOMPEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_SC_ICOMPEN field.
#define BR_VREF_SC_ICOMPEN (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_ICOMPEN))
#endif
//! @brief Format value for bitfield VREF_SC_ICOMPEN.
#define BF_VREF_SC_ICOMPEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_SC_ICOMPEN), uint8_t) & BM_VREF_SC_ICOMPEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ICOMPEN field to a new value.
#define BW_VREF_SC_ICOMPEN(v) (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_ICOMPEN) = (v))
#endif
//@}
/*!
* @name Register VREF_SC, field REGEN[6] (RW)
*
* This bit is used to enable the internal 1.75 V regulator to produce a
* constant internal voltage supply in order to reduce the sensitivity to external
* supply noise and variation. If it is desired to keep the regulator enabled in very
* low power modes, refer to the Chip Configuration details for a description on
* how this can be achieved. This bit is set during factory trimming of the VREF
* voltage. This bit should be written to 1 to achieve the performance stated in
* the data sheet.
*
* Values:
* - 0 - Internal 1.75 V regulator is disabled.
* - 1 - Internal 1.75 V regulator is enabled.
*/
//@{
#define BP_VREF_SC_REGEN (6U) //!< Bit position for VREF_SC_REGEN.
#define BM_VREF_SC_REGEN (0x40U) //!< Bit mask for VREF_SC_REGEN.
#define BS_VREF_SC_REGEN (1U) //!< Bit field size in bits for VREF_SC_REGEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_SC_REGEN field.
#define BR_VREF_SC_REGEN (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_REGEN))
#endif
//! @brief Format value for bitfield VREF_SC_REGEN.
#define BF_VREF_SC_REGEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_SC_REGEN), uint8_t) & BM_VREF_SC_REGEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the REGEN field to a new value.
#define BW_VREF_SC_REGEN(v) (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_REGEN) = (v))
#endif
//@}
/*!
* @name Register VREF_SC, field VREFEN[7] (RW)
*
* This bit is used to enable the bandgap reference within the Voltage Reference
* module. After the VREF is enabled, turning off the clock to the VREF module
* via the corresponding clock gate register will not disable the VREF. VREF must
* be disabled via this VREFEN bit.
*
* Values:
* - 0 - The module is disabled.
* - 1 - The module is enabled.
*/
//@{
#define BP_VREF_SC_VREFEN (7U) //!< Bit position for VREF_SC_VREFEN.
#define BM_VREF_SC_VREFEN (0x80U) //!< Bit mask for VREF_SC_VREFEN.
#define BS_VREF_SC_VREFEN (1U) //!< Bit field size in bits for VREF_SC_VREFEN.
#ifndef __LANGUAGE_ASM__
//! @brief Read current value of the VREF_SC_VREFEN field.
#define BR_VREF_SC_VREFEN (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_VREFEN))
#endif
//! @brief Format value for bitfield VREF_SC_VREFEN.
#define BF_VREF_SC_VREFEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_VREF_SC_VREFEN), uint8_t) & BM_VREF_SC_VREFEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the VREFEN field to a new value.
#define BW_VREF_SC_VREFEN(v) (BITBAND_ACCESS8(HW_VREF_SC_ADDR, BP_VREF_SC_VREFEN) = (v))
#endif
//@}
//-------------------------------------------------------------------------------------------
// hw_vref_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All VREF module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_vref
{
__IO hw_vref_trm_t TRM; //!< [0x0] VREF Trim Register
__IO hw_vref_sc_t SC; //!< [0x1] VREF Status and Control Register
} hw_vref_t;
#pragma pack()
//! @brief Macro to access all VREF registers.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_VREF</code>.
#define HW_VREF (*(hw_vref_t *) REGS_VREF_BASE)
#endif
#endif // __HW_VREF_REGISTERS_H__
// v22/130726/0.9
// EOF

View File

@ -1,525 +0,0 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL FREESCALE 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.
*/
#ifndef _REGS_H
#define _REGS_H 1
#include <stdint.h>
#include <stdlib.h>
//
// define base address of the register block only if it is not already
// defined, which allows the compiler to override at build time for
// users who've mapped their registers to locations other than the
// physical location
//
#include <stdint.h>
#ifndef REGS_BASE
#define REGS_BASE 0x00000000
#endif
//
// common register types
//
#ifndef __LANGUAGE_ASM__
typedef unsigned char reg8_t;
typedef unsigned short reg16_t;
typedef unsigned int reg32_t;
#endif
#ifdef __cplusplus
#define __I volatile /*!< Defines 'read only' permissions */
#else
#define __I volatile const /*!< Defines 'read only' permissions */
#endif
#define __O volatile /*!< Defines 'write only' permissions */
#define __IO volatile /*!< Defines 'read / write' permissions */
#define BME_AND_MASK (1<<26)
#define BME_OR_MASK (1<<27)
#define BME_XOR_MASK (3<<26)
#define BME_BFI_MASK(BIT,WIDTH) (1<<28) | (BIT<<23) | ((WIDTH-1)<<19)
#define BME_UBFX_MASK(BIT,WIDTH) (1<<28) | (BIT<<23) | ((WIDTH-1)<<19)
/**
* @brief Macro to access a single bit of a 32-bit peripheral register (bit band region
* 0x40000000 to 0x400FFFFF) using the bit-band alias region access.
* @param Reg Register to access.
* @param Bit Bit number to access.
* @return Value of the targeted bit in the bit band region.
*/
#define BITBAND_ACCESS32(Reg,Bit) (*((uint32_t volatile*)(0x42000000u + (32u*((uint32_t)(Reg) - (uint32_t)0x40000000u)) + (4u*((uint32_t)(Bit))))))
/**
* @brief Macro to access a single bit of a 16-bit peripheral register (bit band region
* 0x40000000 to 0x400FFFFF) using the bit-band alias region access.
* @param Reg Register to access.
* @param Bit Bit number to access.
* @return Value of the targeted bit in the bit band region.
*/
#define BITBAND_ACCESS16(Reg,Bit) (*((uint16_t volatile*)(0x42000000u + (32u*((uint32_t)(Reg) - (uint32_t)0x40000000u)) + (4u*((uint32_t)(Bit))))))
/**
* @brief Macro to access a single bit of an 8-bit peripheral register (bit band region
* 0x40000000 to 0x400FFFFF) using the bit-band alias region access.
* @param Reg Register to access.
* @param Bit Bit number to access.
* @return Value of the targeted bit in the bit band region.
*/
#define BITBAND_ACCESS8(Reg,Bit) (*((uint8_t volatile*)(0x42000000u + (32u*((uint32_t)(Reg) - (uint32_t)0x40000000u)) + (4u*((uint32_t)(Bit))))))
//
// Typecast macro for C or asm. In C, the cast is applied, while in asm it is excluded. This is
// used to simplify macro definitions in the module register headers.
//
#ifndef __REG_VALUE_TYPE
#ifndef __LANGUAGE_ASM__
#define __REG_VALUE_TYPE(v, t) ((t)(v))
#else
#define __REG_VALUE_TYPE(v, t) (v)
#endif
#endif
//
// macros for single instance registers
//
#define BF_SET(reg, field) HW_##reg##_SET(BM_##reg##_##field)
#define BF_CLR(reg, field) HW_##reg##_CLR(BM_##reg##_##field)
#define BF_TOG(reg, field) HW_##reg##_TOG(BM_##reg##_##field)
#define BF_SETV(reg, field, v) HW_##reg##_SET(BF_##reg##_##field(v))
#define BF_CLRV(reg, field, v) HW_##reg##_CLR(BF_##reg##_##field(v))
#define BF_TOGV(reg, field, v) HW_##reg##_TOG(BF_##reg##_##field(v))
#define BV_FLD(reg, field, sym) BF_##reg##_##field(BV_##reg##_##field##__##sym)
#define BV_VAL(reg, field, sym) BV_##reg##_##field##__##sym
#define BF_RD(reg, field) HW_##reg.B.field
#define BF_WR(reg, field, v) BW_##reg##_##field(v)
#define BF_CS1(reg, f1, v1) \
(HW_##reg##_CLR(BM_##reg##_##f1), \
HW_##reg##_SET(BF_##reg##_##f1(v1)))
#define BF_CS2(reg, f1, v1, f2, v2) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2)))
#define BF_CS3(reg, f1, v1, f2, v2, f3, v3) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3)))
#define BF_CS4(reg, f1, v1, f2, v2, f3, v3, f4, v4) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4)))
#define BF_CS5(reg, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5)))
#define BF_CS6(reg, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6)))
#define BF_CS7(reg, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7)))
#define BF_CS8(reg, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) \
(HW_##reg##_CLR(BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7 | \
BM_##reg##_##f8), \
HW_##reg##_SET(BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7) | \
BF_##reg##_##f8(v8)))
//
// macros for multiple instance registers
//
#define BF_SETn(reg, n, field) HW_##reg##_SET(n, BM_##reg##_##field)
#define BF_CLRn(reg, n, field) HW_##reg##_CLR(n, BM_##reg##_##field)
#define BF_TOGn(reg, n, field) HW_##reg##_TOG(n, BM_##reg##_##field)
#define BF_SETVn(reg, n, field, v) HW_##reg##_SET(n, BF_##reg##_##field(v))
#define BF_CLRVn(reg, n, field, v) HW_##reg##_CLR(n, BF_##reg##_##field(v))
#define BF_TOGVn(reg, n, field, v) HW_##reg##_TOG(n, BF_##reg##_##field(v))
#define BV_FLDn(reg, n, field, sym) BF_##reg##_##field(BV_##reg##_##field##__##sym)
#define BV_VALn(reg, n, field, sym) BV_##reg##_##field##__##sym
#define BF_RDn(reg, n, field) HW_##reg(n).B.field
#define BF_WRn(reg, n, field, v) BW_##reg##_##field(n, v)
#define BF_CS1n(reg, n, f1, v1) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1))))
#define BF_CS2n(reg, n, f1, v1, f2, v2) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2))))
#define BF_CS3n(reg, n, f1, v1, f2, v2, f3, v3) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3))))
#define BF_CS4n(reg, n, f1, v1, f2, v2, f3, v3, f4, v4) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4))))
#define BF_CS5n(reg, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5))))
#define BF_CS6n(reg, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6))))
#define BF_CS7n(reg, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7))))
#define BF_CS8n(reg, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) \
(HW_##reg##_CLR(n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7 | \
BM_##reg##_##f8)), \
HW_##reg##_SET(n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7) | \
BF_##reg##_##f8(v8))))
//
// macros for single instance MULTI-BLOCK registers
//
#define BFn_SET(reg, blk, field) HW_##reg##_SET(blk, BM_##reg##_##field)
#define BFn_CLR(reg, blk, field) HW_##reg##_CLR(blk, BM_##reg##_##field)
#define BFn_TOG(reg, blk, field) HW_##reg##_TOG(blk, BM_##reg##_##field)
#define BFn_SETV(reg, blk, field, v) HW_##reg##_SET(blk, BF_##reg##_##field(v))
#define BFn_CLRV(reg, blk, field, v) HW_##reg##_CLR(blk, BF_##reg##_##field(v))
#define BFn_TOGV(reg, blk, field, v) HW_##reg##_TOG(blk, BF_##reg##_##field(v))
#define BVn_FLD(reg, field, sym) BF_##reg##_##field(BV_##reg##_##field##__##sym)
#define BVn_VAL(reg, field, sym) BV_##reg##_##field##__##sym
#define BFn_RD(reg, blk, field) HW_##reg(blk).B.field
#define BFn_WR(reg, blk, field, v) BW_##reg##_##field(blk, v)
#define BFn_CS1(reg, blk, f1, v1) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1)))
#define BFn_CS2(reg, blk, f1, v1, f2, v2) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2)))
#define BFn_CS3(reg, blk, f1, v1, f2, v2, f3, v3) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3)))
#define BFn_CS4(reg, blk, f1, v1, f2, v2, f3, v3, f4, v4) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4)))
#define BFn_CS5(reg, blk, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5)))
#define BFn_CS6(reg, blk, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6)))
#define BFn_CS7(reg, blk, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7)))
#define BFn_CS8(reg, blk, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) \
(HW_##reg##_CLR(blk, BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7 | \
BM_##reg##_##f8), \
HW_##reg##_SET(blk, BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7) | \
BF_##reg##_##f8(v8)))
//
// macros for MULTI-BLOCK multiple instance registers
//
#define BFn_SETn(reg, blk, n, field) HW_##reg##_SET(blk, n, BM_##reg##_##field)
#define BFn_CLRn(reg, blk, n, field) HW_##reg##_CLR(blk, n, BM_##reg##_##field)
#define BFn_TOGn(reg, blk, n, field) HW_##reg##_TOG(blk, n, BM_##reg##_##field)
#define BFn_SETVn(reg, blk, n, field, v) HW_##reg##_SET(blk, n, BF_##reg##_##field(v))
#define BFn_CLRVn(reg, blk, n, field, v) HW_##reg##_CLR(blk, n, BF_##reg##_##field(v))
#define BFn_TOGVn(reg, blk, n, field, v) HW_##reg##_TOG(blk, n, BF_##reg##_##field(v))
#define BVn_FLDn(reg, blk, n, field, sym) BF_##reg##_##field(BV_##reg##_##field##__##sym)
#define BVn_VALn(reg, blk, n, field, sym) BV_##reg##_##field##__##sym
#define BFn_RDn(reg, blk, n, field) HW_##reg(n).B.field
#define BFn_WRn(reg, blk, n, field, v) BW_##reg##_##field(n, v)
#define BFn_CS1n(reg, blk, n, f1, v1) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1))))
#define BFn_CS2n(reg, blk, n, f1, v1, f2, v2) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2))))
#define BFn_CS3n(reg, blk, n, f1, v1, f2, v2, f3, v3) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3))))
#define BFn_CS4n(reg, blk, n, f1, v1, f2, v2, f3, v3, f4, v4) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4))))
#define BFn_CS5n(reg, blk, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5))))
#define BFn_CS6n(reg, blk, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6))))
#define BFn_CS7n(reg, blk, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7))))
#define BFn_CS8n(reg, blk, n, f1, v1, f2, v2, f3, v3, f4, v4, f5, v5, f6, v6, f7, v7, f8, v8) \
(HW_##reg##_CLR(blk, n, (BM_##reg##_##f1 | \
BM_##reg##_##f2 | \
BM_##reg##_##f3 | \
BM_##reg##_##f4 | \
BM_##reg##_##f5 | \
BM_##reg##_##f6 | \
BM_##reg##_##f7 | \
BM_##reg##_##f8)), \
HW_##reg##_SET(blk, n, (BF_##reg##_##f1(v1) | \
BF_##reg##_##f2(v2) | \
BF_##reg##_##f3(v3) | \
BF_##reg##_##f4(v4) | \
BF_##reg##_##f5(v5) | \
BF_##reg##_##f6(v6) | \
BF_##reg##_##f7(v7) | \
BF_##reg##_##f8(v8))))
#endif // _REGS_H
////////////////////////////////////////////////////////////////////////////////

View File

@ -1,169 +0,0 @@
/*
** ###################################################################
** Processor: MK64FN1M0VMD12
** Compilers: ARM Compiler
** Freescale C/C++ for Embedded ARM
** GNU C Compiler
** GNU C Compiler - CodeSourcery Sourcery G++
** IAR ANSI C/C++ Compiler for ARM
**
** Reference manual: K64P144M120SF5RM, Rev.2, January 2014
** Version: rev. 2.3, 2014-01-24
**
** Abstract:
** Provides a system configuration function and a global variable that
** contains the system frequency. It configures the device and initializes
** the oscillator (PLL) that is part of the microcontroller device.
**
** Copyright: 2014 Freescale, Inc. All Rights Reserved.
**
** http: www.freescale.com
** mail: support@freescale.com
**
** Revisions:
** - rev. 1.0 (2013-08-12)
** Initial version.
** - rev. 2.0 (2013-10-29)
** Register accessor macros added to the memory map.
** Symbols for Processor Expert memory map compatibility added to the memory map.
** Startup file for gcc has been updated according to CMSIS 3.2.
** System initialization updated.
** MCG - registers updated.
** PORTA, PORTB, PORTC, PORTE - registers for digital filter removed.
** - rev. 2.1 (2013-10-29)
** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
** - rev. 2.2 (2013-12-09)
** DMA - EARS register removed.
** AIPS0, AIPS1 - MPRA register updated.
** - rev. 2.3 (2014-01-24)
** Update according to reference manual rev. 2
** ENET, MCG, MCM, SIM, USB - registers updated
**
** ###################################################################
*/
/*!
* @file MK64F12
* @version 2.3
* @date 2014-01-24
* @brief Device specific configuration file for MK64F12 (header file)
*
* Provides a system configuration function and a global variable that contains
* the system frequency. It configures the device and initializes the oscillator
* (PLL) that is part of the microcontroller device.
*/
#ifndef SYSTEM_MK64F12_H_
#define SYSTEM_MK64F12_H_ /**< Symbol preventing repeated inclusion */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#define DISABLE_WDOG 1
#ifndef CLOCK_SETUP
#define CLOCK_SETUP 4
#endif
/* Predefined clock setups
0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
Default part configuration.
Reference clock source for MCG module is the slow internal clock source 32.768kHz
Core clock = 20.97MHz, BusClock = 20.97MHz
1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Maximum achievable clock frequency configuration.
Reference clock source for MCG module is an external clock source 50MHz
Core clock = 120MHz, BusClock = 60MHz
2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power Internal (BLPI) mode
Core clock/Bus clock derived directly from an fast internal clock 4MHz with no multiplication
The clock settings is ready for Very Low Power Run mode.
Core clock = 4MHz, BusClock = 4MHz
3 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
Core clock/Bus clock derived directly from the RTC oscillator clock source 32.768kHz
The clock settings is ready for Very Low Power Run mode.
Core clock = 32.768kHz, BusClock = 32.768kHz
4 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
USB clock setup
USB clock divider is set for USB to receive 48MHz input clock.
Reference clock source for MCG module is an external clock source 50MHz
USB clock divider is set for USB to receive 48MHz input clock.
Core clock = 120MHz, BusClock = 60MHz
*/
/*----------------------------------------------------------------------------
Define clock source values
*----------------------------------------------------------------------------*/
#if (CLOCK_SETUP == 0)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 20485760u /* Default System clock value */
#elif (CLOCK_SETUP == 1)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */
#elif (CLOCK_SETUP == 2)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 4000000u /* Default System clock value */
#elif (CLOCK_SETUP == 3)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 32768u /* Default System clock value */
#elif (CLOCK_SETUP == 4)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */
#endif /* (CLOCK_SETUP == 4) */
/**
* @brief System clock frequency (core clock)
*
* The system clock frequency supplied to the SysTick timer and the processor
* core clock. This variable can be used by the user application to setup the
* SysTick timer or configure other parameters. It may also be used by debugger to
* query the frequency of the debug timer or configure the trace clock speed
* SystemCoreClock is initialized with a correct predefined value.
*/
extern uint32_t SystemCoreClock;
/**
* @brief Setup the microcontroller system.
*
* Typically this function configures the oscillator (PLL) that is part of the
* microcontroller device. For systems with variable clock speed it also updates
* the variable SystemCoreClock. SystemInit is called from startup_device file.
*/
void SystemInit (void);
/**
* @brief Updates the SystemCoreClock variable.
*
* It must be called whenever the core clock is changed during program
* execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
* the current core clock.
*/
void SystemCoreClockUpdate (void);
#ifdef __cplusplus
}
#endif
#endif /* #if !defined(SYSTEM_MK64F12_H_) */

View File

@ -1,228 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#if !defined(__FSL_CLOCK_CONFIGS_H__)
#define __FSL_CLOCK_CONFIGS_H__
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @addtogroup clock_manager*/
/*! @{*/
#if defined(CPU_MK70FN1M0VMJ12) || defined(CPU_MK70FN1M0VMJ15)
#define CLOCK_SETUP 1
/*! @brief Predefined clock setups for K70*/
/*
0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
Reference clock source for MCG module is the slow internal clock source 32.768kHz
Core clock = 41.94MHz, BusClock = 41.94MHz
1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Reference clock source for MCG module is an external reference clock source 50MHz
Core clock = 120MHz, BusClock = 60MHz
2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
Core clock/Bus clock derived directly from an external reference clock source 50MHz with no multiplication
Core clock = 50MHz, BusClock = 50MHz
*/
/*! @brief Define clock source values for K70*/
#if (CLOCK_SETUP == 0)
#define CPU_XTAL0_CLK_HZ 50000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 0*/
#define CPU_XTAL1_CLK_HZ 8000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 1*/
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 41943040u /* Default System clock value*/
#elif (CLOCK_SETUP == 1)
#define CPU_XTAL0_CLK_HZ 50000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 0*/
#define CPU_XTAL1_CLK_HZ 8000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 1*/
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value*/
#elif (CLOCK_SETUP == 2)
#define CPU_XTAL0_CLK_HZ 50000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 0*/
#define CPU_XTAL1_CLK_HZ 8000000u /* external crystal or osc clock frequency in Hz connected to System Oscillator 1*/
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value*/
#endif /* (CLOCK_SETUP == 2)*/
#elif defined(CPU_MKL25Z128VLK4)
#define CLOCK_SETUP 1
/*! @brief Predefined clock setups for KL25*/
/*
0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
Reference clock source for MCG module is the slow internal clock source 32.768kHz
Core clock = 41.94MHz, BusClock = 13.98MHz
1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Reference clock source for MCG module is an external crystal 8MHz
Core clock = 48MHz, BusClock = 24MHz
2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
Core clock/Bus clock derived directly from an external crystal 8MHz with no multiplication
Core clock = 8MHz, BusClock = 8MHz
*/
/*! @brief Define clock source values for KL25*/
#if (CLOCK_SETUP == 0)
#define CPU_XTAL_CLK_HZ 8000000u /* external crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 41943040u /* Default System clock value*/
#elif (CLOCK_SETUP == 1)
#define CPU_XTAL_CLK_HZ 8000000u /* external crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 48000000u /* Default System clock value*/
#elif (CLOCK_SETUP == 2)
#define CPU_XTAL_CLK_HZ 8000000u /* external crystal or oscillator clock frequency in Hz*/
#define CPU_INT_SLOW_CLK_HZ 32768u /* slow internal oscillator clock frequency in Hz*/
#define CPU_INT_FAST_CLK_HZ 4000000u /* fast internal oscillator clock frequency in Hz*/
#define DEFAULT_SYSTEM_CLOCK 8000000u /* Default System clock value*/
#endif /*(CLOCK_SETUP == 2)*/
#elif defined(CPU_MK64FN1M0VMD12)
#define DISABLE_WDOG 1
#define CLOCK_SETUP 1
/* Predefined clock setups
0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
Reference clock source for MCG module is the slow internal clock source 32.768kHz
Core clock = 20.97MHz, BusClock = 20.97MHz
1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Reference clock source for MCG module is an external clock source 50MHz
USB clock divider is set for USB to receive 48MHz input clock.
Core clock = 120MHz, BusClock = 60MHz
3 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power Internal (BLPI) mode
Core clock/Bus clock derived directly from an fast internal clock 4MHz with no multiplication
The clock settings is ready for Very Low Power Run mode.
Core clock = 4MHz, BusClock = 4MHz
*/
/*----------------------------------------------------------------------------
Define clock source values
*----------------------------------------------------------------------------*/
#if (CLOCK_SETUP == 0)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 20485760u /* Default System clock value */
#elif (CLOCK_SETUP == 1)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */
#elif (CLOCK_SETUP == 3)
#define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 4000000u /* Default System clock value */
#endif /* (CLOCK_SETUP == 3) */
#elif defined(CPU_MK22FN512VDC12)
#define DISABLE_WDOG 1
#define CLOCK_SETUP 1
/* Predefined clock setups
0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
Reference clock source for MCG module is the slow internal clock source 32.768kHz
Core clock = 41.94MHz, BusClock = 41.94MHz
1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Reference clock source for MCG module is an external crystal 8MHz
Core clock = 100MHz, BusClock = 50MHz
2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
Core clock/Bus clock derived directly from an external crystal 8MHz with no multiplication
Core clock = 8MHz, BusClock = 8MHz
3 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
Reference clock source for MCG module is an external crystal 8MHz
Core clock = 120MHz, BusClock = 60MHz
*/
/*----------------------------------------------------------------------------
Define clock source values
*----------------------------------------------------------------------------*/
#if (CLOCK_SETUP == 0)
#define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 41943040u /* Default System clock value */
#elif (CLOCK_SETUP == 1)
#define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 100000000u /* Default System clock value */
#elif (CLOCK_SETUP == 2)
#define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 8000000u /* Default System clock value */
#elif (CLOCK_SETUP == 3)
#define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
#define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
#define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
#define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
#define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
#define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */
#endif /* (CLOCK_SETUP == 3) */
#endif /* CPU types*/
/*! @}*/
#endif /* __FSL_CLOCK_CONFIGS_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,295 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#if !defined(__FSL_CLOCK_MANAGER_H__)
#define __FSL_CLOCK_MANAGER_H__
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
/*! @addtogroup clock_manager*/
/*! @{*/
/*! @file*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Clock names */
typedef enum _clock_names {
/* default system clocks*/
kCoreClock, /**/
kSystemClock, /**/
kPlatformClock, /**/
kBusClock, /**/
kFlexBusClock, /**/
kFlashClock, /**/
/* other internal clocks used by peripherals*/
/* osc clock*/
kOsc32kClock,
kOsc0ErClock,
kOsc1ErClock,
/* irc 48Mhz clock */
kIrc48mClock,
/* rtc clock*/
kRtc32kClock,
kRtc1hzClock,
/* lpo clcok*/
kLpoClock,
/* mcg clocks*/
kMcgFllClock,
kMcgPll0Clock,
kMcgPll1Clock,
kMcgOutClock,
kMcgIrClock,
/* constant clocks (provided in other header files?)*/
kSDHC0_CLKIN,
kENET_1588_CLKIN,
kEXTAL_Clock,
kEXTAL1_Clock,
kUSB_CLKIN,
/* reserved value*/
kReserved,
/* clock name max */
kClockNameCount
} clock_names_t;
/*! @brief Clock gate module names */
typedef enum _clock_gate_module_names {
/* System modules*/
kClockModuleDMA, /**/
kClockModuleDMAMUX, /* instance 0, 1*/
kClockModulePORT, /* instance 0 - 5 (A - F)*/
kClockModuleMPU, /**/
kClockModuleLLWU, /**/
kClockModuleEWM, /**/
/* Clocks*/
kClockModuleOSC1, /**/
/* Memory and memory interfaces*/
kClockModuleFTF, /* Flash memory control clock*/
kClockModuleNFC, /* NAND flash control clock*/
kClockModuleFLEXBUS, /**/
kClockModuleDDR, /**/
/* Security*/
kClockModuleCRC, /**/
kClockModuleRNGA, /**/
kClockModuleREGFILE, /**/
kClockModuleDRYICESECREG, /**/
kClockModuleDRYICE, /**/
/* Analog*/
kClockModuleADC, /* instance 0 - 3*/
kClockModuleCMP, /* */
kClockModuleDAC, /* instance 0, 1*/
kClockModuleVREF, /* */
kClockModuleSAI, /* instance 0, 1*/
/* Timers*/
kClockModuleTPM, /* TPM timers 0 - 2*/
kClockModulePDB, /* */
kClockModuleFTM, /* instance 0 - 3*/
kClockModulePIT, /**/
kClockModuleLPTIMER, /**/
kClockModuleCMT, /**/
kClockModuleRTC, /**/
/* Communication Interfaces*/
kClockModuleENET, /**/
kClockModuleUSBHS, /**/
kClockModuleUSBFS, /**/
kClockModuleUSBDCD, /**/
kClockModuleFLEXCAN, /* instance 0, 1*/
kClockModuleSPI, /* instance 0 - 2*/
kClockModuleI2C, /* instance 0, 1*/
kClockModuleUART, /* instance 0 - 5*/
kClockModuleESDHC, /**/
kClockModuleLPUART, /**/
/* Human-machine Interfaces*/
kClockModuleTSI, /**/
kClockModuleLCDC, /**/
kClockModuleMax
} clock_gate_module_names_t;
/*! @brief Clock source and SEL names */
typedef enum _clock_source_names {
kClockNfcSrc, /* NFCSRC*/
kClockEsdhcSrc, /* ESDHCSRC K70*/
kClockSdhcSrc, /* SDHCSRC K64*/
kClockLcdcSrc, /* LCDCSRC*/
kClockTimeSrc, /* TIMESRC*/
kClockRmiiSrc, /* RMIISRC*/
kClockUsbfSrc, /* USBFSRC K70*/
kClockUsbSrc, /* USBSRC K64, KL25, KV31, and K22*/
kClockUsbhSrc, /* USBHSRC*/
kClockUart0Src, /* UART0SRC*/
kClockTpmSrc, /* TPMSRC*/
kClockOsc32kSel, /* OSC32KSEL*/
kClockUsbfSel, /* USBF_CLKSEL*/
kClockPllfllSel, /* PLLFLLSEL*/
kClockNfcSel, /* NFC_CLKSEL*/
kClockLcdcSel, /* LCDC_CLKSEL*/
kClockTraceSel, /* TRACE_CLKSEL*/
kClockClkoutSel, /* CLKOUTSEL*/
kClockRtcClkoutSel, /* RTCCLKOUTSEL */
kClockSourceMax
} clock_source_names_t;
/*!
* @brief Error code definition for the clock manager APIs
*/
typedef enum _clock_manager_error_code {
kClockManagerSuccess, /*!< success */
kClockManagerNoSuchClockName, /*!< cannot find the clock name */
kClockManagerNoSuchClockModule, /*!< cannot find the clock module name */
kClockManagerNoSuchClockSource, /*!< cannot find the clock source name */
kClockManagerNoSuchDivider, /*!< cannot find the divider name */
kClockManagerUnknown /*!< unknown error*/
} clock_manager_error_code_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus*/
/*! @name Clock Gating*/
/*@{*/
/*!
* @brief Enables or disables the clock for a specific clock module.
*
* This function enables/disables the clock for a specified clock module and
* instance. See the clock_gate_module_names_t for supported clock module names
* for a specific function and see the Reference Manual for supported clock module
* name for a specific chip family. Most module drivers call this function
* to gate(disable)/ungate(enable) the clock for a module. However, the application
* can also call this function as needed. Disabling the clock causes the module
* to stop working. See the Reference Manual to properly enable
* and disable the clock for a device module.
*
* @param moduleName Gate control module name defined in clock_gate_module_names_t
* @param instance Instance of the module
* @param enable Enable or disable the clock for the module
* - true: Enable
* - false: Disable
* @return status Error code defined in clock_manager_error_code_t
*/
clock_manager_error_code_t clock_manager_set_gate(clock_gate_module_names_t moduleName,
uint8_t instance, bool enable);
/*!
* @brief Gets the current clock gate status for a specific clock module.
*
* This function returns the current clock gate status for a specific clock
* module. See clock_gate_module_names_t for supported clock module name.
*
* @param moduleName Gate control module name defined in clock_gate_module_names_t
* @param instance Instance of the module
* @param isEnabled Status of the module clock
* - true: Enabled
* - false: Disabled
* @return status Error code defined in clock_manager_error_code_t
*/
clock_manager_error_code_t clock_manager_get_gate(clock_gate_module_names_t moduleName,
uint8_t instance, bool *isEnabled);
/*@}*/
/*! @name Clock Frequencies*/
/*@{*/
/*!
* @brief Gets the clock frequency for a specific clock name.
*
* This function checks the current clock configurations and then calculates
* the clock frequency for a specific clock name defined in clock_names_t.
* The MCG must be properly configured before using this function. See
* the Reference Manual for supported clock names for different chip families.
* The returned value is in Hertz. If it cannot find the clock name
* or the name is not supported for a specific chip family, it returns an
* error.
*
* @param clockName Clock names defined in clock_names_t
* @param frequency Returned clock frequency value in Hertz
* @return status Error code defined in clock_manager_error_code_t
*/
clock_manager_error_code_t clock_manager_get_frequency(clock_names_t clockName,
uint32_t *frequency);
/*!
* @brief Gets the clock frequency for a specified clock source.
*
* This function gets the specified clock source setting and converts it
* into a clock name. It calls the internal function to get the value
* for that clock name. The returned value is in Hertz.
* If it cannot find the clock source or the source is not supported for the
* specific chip family, it returns an error.
*
* @param clockSource Clock source names defined in clock_source_names_t
* @param frequency Returned clock frequency value in Hertz
* @return status Error code defined in clock_manager_error_code_t
*/
clock_manager_error_code_t clock_manager_get_frequency_by_source(
clock_source_names_t clockSource, uint32_t *frequency);
/*@}*/
#if defined(__cplusplus)
}
#endif /* __cplusplus*/
/*! @}*/
#endif /* __FSL_CLOCK_MANAGER_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,476 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#include "fsl_device_registers.h"
#include "fsl_sim_hal.h"
#include "fsl_clock_manager.h"
#include "fsl_clock_manager_private.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* internal function for clock manager. see function header for details */
static clock_manager_error_code_t clock_manager_get_frequency_by_name(sim_clock_names_t clockName,
uint32_t *frequency);
/*******************************************************************************
* Code
******************************************************************************/
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_get_system_clock
* Description : Internal function to get the system clock frequency
* This function will check the clock name configuration table for specific
* chip family and find out the supported clock name for that chip family
* then it will call the mcg hal function to get the basic system clock,
* calculate the clock frequency for specified clock name.
*
*END**************************************************************************/
clock_manager_error_code_t clock_manager_get_system_clock(sim_clock_names_t clockName,
uint32_t *frequency)
{
/* system clock out divider*/
uint32_t divider;
uint32_t i = 0;
const sim_clock_name_config_t *table = NULL;
/* search through whole name table*/
while (kSimClockNameConfigTable[i].clockName != kSimClockNameCount)
{
/* find only the match with name*/
if (kSimClockNameConfigTable[i].clockName == clockName)
{
/* return the table pointer*/
table = &kSimClockNameConfigTable[i];
break;
}
i++;
}
/* if the configuration table doesn't exist, return error */
if (table == NULL)
{
return kClockManagerNoSuchClockName;
}
/* check if we need to use a reference clock*/
if (table->useOtherRefClock)
{
/* get other specified ref clock*/
if ( kClockManagerSuccess != clock_manager_get_frequency_by_name(table->otherRefClockName,
frequency) )
{
return kClockManagerNoSuchClockName;
}
}
else
{
/* get default ref clock */
*frequency = clock_hal_get_outclk();
}
/* get system clock divider*/
if ( clock_hal_get_clock_divider(table->dividerName, &divider) == kSimHalSuccess)
{
/* get the frequency for the specified clock*/
*frequency = (*frequency) / (divider + 1);
return kClockManagerSuccess;
}
else
{
return kClockManagerNoSuchDivider;
}
}
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_set_gate
* Description : Enable or disable the clock for specified clock module
* This function will enable/disable the clock for specified clock module and
* instance. Refer to clock_gate_module_names_t for supported clock module name
* by this function and refer to reference manual for supported clock moulde
* name for a specified chip family. Most module driver will call this function
* to gate(disable)/ungate(enable) the clock for that module, but application
* can also call this function as needed. Disable the clock will make the module
* stop working. Refer to the reference maunal for proper procedure of enalbing
* and disabling the clock for the device module.
*
*END**************************************************************************/
clock_manager_error_code_t clock_manager_set_gate(clock_gate_module_names_t moduleName,
uint8_t instance, bool enable)
{
/* calling hal api, to set(Enable/Disable) the clock module gate */
if (clock_hal_set_gate(kClockModuleNameSimMap[moduleName], instance, enable) == kSimHalSuccess)
{
return kClockManagerSuccess;
}
else
{
return kClockManagerNoSuchClockModule;
}
}
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_get_gate
* Description : Get the current clock gate status for specified clock module
* This function will return the current clock gate status for specified clock
* module. Refer to clock_gate_module_names_t for supported clock module name.
*
*END**************************************************************************/
clock_manager_error_code_t clock_manager_get_gate(clock_gate_module_names_t moduleName,
uint8_t instance, bool *isEnabled)
{
/* calling the hal function to get the clock module gate status */
if (clock_hal_get_gate(kClockModuleNameSimMap[moduleName], instance, isEnabled)
== kSimHalSuccess)
{
return kClockManagerSuccess;
}
else
{
return kClockManagerNoSuchClockModule;
}
}
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_get_frequency
* Description : Get the clock frequency for specified clock name
* This function will check the current clock configurations and then calculate
* the clock frequency for specified clock name defined in clock_names_t.
* The MCG must be properly configured before using this function. Also check
* the reference manual for supported clock names on different chip falmily.
* The returned value will be in herz. And if it cannot find the clock name
* or the name is not supported on specific chip family, it will return an
* error.
*
*END**************************************************************************/
clock_manager_error_code_t clock_manager_get_frequency(clock_names_t clockName,
uint32_t *frequency)
{
/* convert clock manager clock name to sim clock name */
sim_clock_names_t simClockName = kClockNameSimMap[clockName];
/* calling internal get frequency by name function */
return clock_manager_get_frequency_by_name(simClockName, frequency);
}
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_get_frequency_by_name
* Description : Internal function to get the frequency by clock name
* This function will get/calculate the clock frequency based on clock name
* and current configuration of clock generator.
*
*END**************************************************************************/
clock_manager_error_code_t static clock_manager_get_frequency_by_name(sim_clock_names_t clockName,
uint32_t *frequency)
{
/* branch according to clock name */
switch(clockName)
{
/* osc clock*/
case kSimOsc32kClock:
/* *frequency = CPU_XTAL32k_CLK_HZ; // or should provided by osc module??*/
*frequency = 32768;
break;
case kSimOsc0ErClock:
/* *frequency = CPU_XTAL_CLK_HZ; // or should provided by osc module??*/
*frequency = 80000; /* for testing purpose only*/
break;
case kSimOsc1ErClock:
/* *frequency = CPU_XTAL_CLK_HZ; // or should provided by osc module??*/
*frequency = 80001; /* for testing purpose only*/
break;
/* irc clock*/
case kSimIrc48mClock:
/* *frequency = CPU_INT_IRC_CLK_HZ; // or should provided by irc module??*/
*frequency = 48000;
break;
/* rtc clock*/
case kSimRtc32kClock:
/* *frequency = CPU_XTAL32k_CLK_HZ; // or should provided by rtc module??*/
*frequency = 32768;
break;
case kSimRtc1hzClock:
/* *frequency = CPU_XTAL1hz_CLK_HZ; // or should provided by rtc module??*/
*frequency = 1;
break;
/* lpo clcok*/
case kSimLpoClock:
/* *frequency = 1000; // where should we define this constant??*/
*frequency = 1000;
break;
/* mcg clocks, calling mcg clock functions */
case kSimMcgFllClock:
*frequency = clock_hal_get_fllclk();
break;
case kSimMcgPll0Clock:
*frequency = clock_hal_get_pll0clk();
break;
case kSimMcgOutClock:
*frequency = clock_hal_get_outclk();
break;
case kSimMcgIrClock:
*frequency = clock_hal_get_irclk();
break;
/* constant clocks (provided in other header files - TBD)*/
case kSimSDHC0_CLKIN:
*frequency = 11111; /* for testing use purpose*/
break;
case kSimENET_1588_CLKIN:
*frequency = 22222; /* for testing use purpose*/
break;
case kSimEXTAL_Clock:
/* *frequency = CPU_XTAL_CLK_HZ; // is this correct??*/
*frequency = 33333; /* for testing use purpose*/
break;
case kSimEXTAL1_Clock:
/* *frequency = CPU_XTAL_CLK_HZ; // is this correct??*/
*frequency = 33334; /* for testing use purpose*/
break;
case kSimUSB_CLKIN:
*frequency = 44444; /* for testing use purpose*/
break;
/* system clocks */
case kSimCoreClock:
case kSimSystemClock:
case kSimPlatformClock:
case kSimBusClock:
case kSimFlexBusClock:
case kSimFlashClock:
return clock_manager_get_system_clock(clockName, frequency);
/* reserved value*/
case kSimReserved:
default:
*frequency = 55555; /* for testing use purpose*/
return kClockManagerNoSuchClockName;
}
return kClockManagerSuccess;
}
/*FUNCTION**********************************************************************
*
* Function Name : clock_manager_get_frequency_by_source
* Description : Get the clock frequency for specified clock source
* This function will get the specified clock source setting and convert it
* into a clock name, then calling the internal function to find out the value
* for that clock name. Also the returned value is in herz.
* If it cannot find the clock source or the source is not supported on the
* specific chip family, it will return an error.
*
*END**************************************************************************/
clock_manager_error_code_t clock_manager_get_frequency_by_source(clock_source_names_t clockSource,
uint32_t *frequency)
{
uint8_t setting;
uint8_t subsetting1;
uint8_t subsetting2;
uint32_t frac = 0;
uint32_t divider = 0;
sim_clock_names_t simClockName;
sim_clock_source_names_t simClockSource;
sim_clock_divider_names_t dividerName;
const sim_clock_source_value_t *valueTable = NULL;
const sim_clock_source_value_t *subValueTable1 = NULL;
const sim_clock_source_value_t *subValueTable2 = NULL;
assert (clockSource < kClockSourceMax);
/* convert clock manager clock source to sim clock source*/
simClockSource = kClockSourceNameSimMap[clockSource];
/* check to see if we need to use clock sel for specified clock source (see if CLKSEL exists)*/
switch (simClockSource)
{
case kSimClockNfcSrc: /* NFCSRC*/
simClockSource = kSimClockNfcSel;
break;
case kSimClockLcdcSrc: /* LCDCSRC*/
simClockSource = kSimClockLcdcSel;
break;
case kSimClockUsbfSrc: /* USBFSRC K70*/
simClockSource = kSimClockUsbfSel;
break;
default:
break;
}
/* get the sim clock source setting*/
if (clock_hal_get_clock_source(simClockSource, &setting) != kSimHalSuccess)
{
return kClockManagerNoSuchClockSource;
}
/* get the value index table for the clock source*/
valueTable = kSimClockSourceValueTable[simClockSource];
/* if the source exists*/
if (valueTable == NULL)
{
return kClockManagerNoSuchClockSource;
}
/* check if it is a clock name or selection*/
if (valueTable[setting].isSel)
{
/* if it is a selection, then convert the selection into a clock name*/
/* get the config table for the clock source*/
if (clock_hal_get_clock_source(valueTable[setting].clockSelName, &subsetting1)
!= kSimHalSuccess)
{
return kClockManagerNoSuchClockSource;
}
/* get the value index table for the clock source*/
subValueTable1 = kSimClockSourceValueTable[valueTable[setting].clockSelName];
/* check if there's bad data*/
if (subValueTable1 == NULL)
{
return kClockManagerNoSuchClockSource;
}
/* check if there's further clock select*/
if (subValueTable1[subsetting1].isSel)
{
/* if it is a selection, then convert the selection into a clock name*/
/* get the config table for the clock source*/
if (clock_hal_get_clock_source(subValueTable1[subsetting1].clockSelName, &subsetting2)
!= kSimHalSuccess)
{
return kClockManagerNoSuchClockSource;
}
/* get the value index table for the clock source*/
subValueTable2 = kSimClockSourceValueTable[subValueTable1[subsetting1].clockSelName];
/* check if there's bad data*/
if (subValueTable2 == NULL)
{
return kClockManagerNoSuchClockSource;
}
/* further convert the subvalue to clock name */
simClockName = subValueTable2[subsetting2].clockName;
}
else
{
/* further convert the subvalue to clock name */
simClockName = subValueTable1[subsetting1].clockName;
}
}
else
{
/* convert the value to clock name */
simClockName = valueTable[setting].clockName;
}
/* get/calculate the frequency for the specified clock name*/
if ( clock_manager_get_frequency_by_name(simClockName, frequency) != kClockManagerSuccess)
{
return kClockManagerNoSuchClockName;
}
/* find the first available divider*/
if (valueTable[setting].hasDivider)
{
/* get the diviver name */
dividerName = valueTable[setting].dividerName;
}
else if ((subValueTable1 != NULL) && (subValueTable1[subsetting1].hasDivider))
{
/* get the diviver name */
dividerName = subValueTable1[subsetting1].dividerName;
}
else if ((subValueTable2 != NULL) && (subValueTable2[subsetting2].hasDivider))
{
/* get the diviver name */
dividerName = subValueTable2[subsetting2].dividerName;
}
else
{
return kClockManagerSuccess;
}
/* get the divider value*/
switch (dividerName)
{
case kSimClockDividerNfcDiv: /* NFCSRC*/
clock_hal_get_clock_divider(kSimClockDividerNfcDiv, &divider);
clock_hal_get_clock_divider(kSimClockDividerNfcFrac, &frac);
break;
case kSimClockDividerLcdcDiv: /* LCDCSRC*/
clock_hal_get_clock_divider(kSimClockDividerLcdcDiv, &divider);
clock_hal_get_clock_divider(kSimClockDividerLcdcFrac, &frac);
break;
case kSimClockDividerUsbfsDiv: /* USBFSRC K70*/
clock_hal_get_clock_divider(kSimClockDividerUsbfsDiv, &divider);
clock_hal_get_clock_divider(kSimClockDividerUsbfsFrac, &frac);
break;
case kSimClockDividerUsbDiv: /* USBSRC K64, KL25, KV31, and K22*/
clock_hal_get_clock_divider(kSimClockDividerUsbDiv, &divider);
clock_hal_get_clock_divider(kSimClockDividerUsbFrac, &frac);
break;
case kSimClockDividerUsbhsDiv: /* USBHSRC K70*/
clock_hal_get_clock_divider(kSimClockDividerUsbhsDiv, &divider);
clock_hal_get_clock_divider(kSimClockDividerUsbhsFrac, &frac);
break;
case kSimClockDividerSpecial1: /* Special KL25 divider 2*/
clock_hal_get_clock_divider(kSimClockDividerSpecial1, &divider);
break;
default:
break;
}
/* Divider output clock = Divider input clock × [ (USBFRAC+1) / (USBDIV+1) ]*/
*frequency = (*frequency) * (frac + 1) / (divider + 1);
return kClockManagerSuccess;
}
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,234 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#if !defined(__FSL_CLOCK_MANAGER_PRIVATE_H__)
#define __FSL_CLOCK_MANAGER_PRIVATE_H__
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
/*! @addtogroup clock_manager*/
/*! @{*/
/*! @file*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Clock manager clock names mapping into the SIM clock name*/
sim_clock_names_t kClockNameSimMap[kClockNameCount] = {
/* default clocks*/
kSimCoreClock, /**/
kSimSystemClock, /**/
kSimPlatformClock, /**/
kSimBusClock, /**/
kSimFlexBusClock, /**/
kSimFlashClock, /**/
/* other internal clocks used by peripherals*/
/* osc clock*/
kSimOsc32kClock,
kSimOsc0ErClock,
kSimOsc1ErClock,
/* irc 48Mhz clock */
kSimIrc48mClock,
/* rtc clock*/
kSimRtc32kClock,
kSimRtc1hzClock,
/* lpo clcok*/
kSimLpoClock,
/* mcg clocks*/
kSimMcgFllClock,
kSimMcgPll0Clock,
kSimMcgPll1Clock,
kSimMcgOutClock,
kSimMcgIrClock,
/* constant clocks (provided in other header files?)*/
kSimSDHC0_CLKIN,
kSimENET_1588_CLKIN,
kSimEXTAL_Clock,
kSimEXTAL1_Clock,
kSimUSB_CLKIN,
/* reserved value*/
kSimReserved
};
/*! @brief Clock manager clock source names mapping into the SIM clock source name*/
sim_clock_source_names_t kClockSourceNameSimMap[kClockSourceMax] = {
kSimClockNfcSrc, /* NFCSRC*/
kSimClockEsdhcSrc, /* ESDHCSRC K70*/
kSimClockSdhcSrc, /* SDHCSRC K64*/
kSimClockLcdcSrc, /* LCDCSRC*/
kSimClockTimeSrc, /* TIMESRC*/
kSimClockRmiiSrc, /* RMIISRC*/
kSimClockUsbfSrc, /* USBFSRC K70*/
kSimClockUsbSrc, /* USBSRC K64, KL25, KV31, and K22*/
kSimClockUsbhSrc, /* USBHSRC*/
kSimClockUart0Src, /* UART0SRC*/
kSimClockTpmSrc, /* TPMSRC*/
kSimClockOsc32kSel, /* OSC32KSEL*/
kSimClockUsbfSel, /* USBF_CLKSEL*/
kSimClockPllfllSel, /* PLLFLLSEL*/
kSimClockNfcSel, /* NFC_CLKSEL*/
kSimClockLcdcSel, /* LCDC_CLKSEL*/
kSimClockTraceSel, /* TRACE_CLKSEL*/
kSimClockClkoutSel, /* CLKOUTSEL*/
kSimClockRtcClkoutSel /* RTCCLKOUTSEL */
};
/*! @brief Clock manager clock module names mapping into the SIM clock module name*/
sim_clock_gate_module_names_t kClockModuleNameSimMap[kClockModuleMax] = {
/* System modules*/
kSimClockModuleDMA, /**/
kSimClockModuleDMAMUX, /* instance 0, 1*/
kSimClockModulePORT, /* instance 0 - 5 (A - F)*/
kSimClockModuleMPU, /**/
kSimClockModuleLLWU, /**/
kSimClockModuleEWM, /**/
/* Clocks*/
kSimClockModuleOSC1, /**/
/* Memory and memory interfaces*/
kSimClockModuleFTF, /* Flash memory control clock*/
kSimClockModuleNFC, /* NAND flash control clock*/
kSimClockModuleFLEXBUS, /**/
kSimClockModuleDDR, /**/
/* Security*/
kSimClockModuleCRC, /**/
kSimClockModuleRNGA, /**/
kSimClockModuleREGFILE, /**/
kSimClockModuleDRYICESECREG, /**/
kSimClockModuleDRYICE, /**/
/* Analog*/
kSimClockModuleADC, /* instance 0 - 3*/
kSimClockModuleCMP, /* */
kSimClockModuleDAC, /* instance 0, 1*/
kSimClockModuleVREF, /* */
kSimClockModuleSAI, /* instance 0, 1*/
/* Timers*/
kSimClockModuleTPM, /* TPM timers 0 - 2*/
kSimClockModulePDB, /* */
kSimClockModuleFTM, /* instance 0 - 3*/
kSimClockModulePIT, /**/
kSimClockModuleLPTIMER, /**/
kSimClockModuleCMT, /**/
kSimClockModuleRTC, /**/
/* Communication Interfaces*/
kSimClockModuleENET, /**/
kSimClockModuleUSBHS, /**/
kSimClockModuleUSBFS, /**/
kSimClockModuleUSBDCD, /**/
kSimClockModuleFLEXCAN, /* instance 0, 1*/
kSimClockModuleSPI, /* instance 0 - 2*/
kSimClockModuleI2C, /* instance 0, 1*/
kSimClockModuleUART, /* instance 0 - 5*/
kSimClockModuleESDHC, /**/
kSimClockModuleLPUART, /**/
/* Human-machine Interfaces*/
kSimClockModuleTSI, /**/
kSimClockModuleLCDC /**/
};
extern const sim_clock_source_value_t *kSimClockSourceValueTable[];
/*******************************************************************************
* API
******************************************************************************/
/*! @name System out clock access API*/
/*@{*/
/*!
* @brief Gets the current out clock.
*
* @param none
*
* @return frequency Out clock frequency for the clock system
*/
extern uint32_t clock_hal_get_outclk(void);
/*!
* @brief Gets the current FLL clock.
*
* @param none
*
* @return frequency FLL clock frequency for the clock system
*/
extern uint32_t clock_hal_get_fllclk(void);
/*!
* @brief Gets the current PLL0 clock.
*
* @param none
*
* @return frequency PLL0 clock frequency for the clock system
*/
extern uint32_t clock_hal_get_pll0clk(void);
/*!
* @brief Gets the current PLL1 clock.
*
* @param none
*
* @return frequency PLL1 clock frequency for the clock system
*/
extern uint32_t clock_hal_get_pll1clk(void);
/*!
* @brief Get the current IR (internal reference) clock.
*
* @param none
*
* @return frequency IR clock frequency for the clock system
*/
extern uint32_t clock_hal_get_irclk(void);
/*@}*/
/*! @}*/
#endif /* __FSL_CLOCK_MANAGER_PRIVATE_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,947 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#ifndef __FSL_ENET_DRIVER_H__
#define __FSL_ENET_DRIVER_H__
#include <stdint.h>
#include <stdbool.h>
#include "fsl_enet_hal.h"
#include "fsl_os_abstraction.h"
/*!
* @addtogroup enet_driver
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Defines the approach: ENET interrupt handler do receive */
#define ENET_RECEIVE_ALL_INTERRUPT 0
/*! @brief Defines the statistic enable macro.*/
#define ENET_ENABLE_DETAIL_STATS 0
/*! @brief Defines the alignment operation.*/
#define ENET_ALIGN(x,align) ((unsigned int)((x) + ((align)-1)) & (unsigned int)(~(unsigned int)((align)- 1)))
#if FSL_FEATURE_ENET_SUPPORT_PTP
/*! @brief Defines the PTP IOCTL macro.*/
typedef enum _enet_ptp_ioctl
{
kEnetPtpGetRxTimestamp = 0, /*!< ENET PTP gets receive timestamp*/
kEnetPtpGetTxTimestamp, /*!< ENET PTP gets transmit timestamp*/
kEnetPtpGetCurrentTime, /*!< ENET PTP gets current time*/
kEnetPtpSetCurrentTime, /*!< ENET PTP sets current time*/
kEnetPtpFlushTimestamp, /*!< ENET PTP flushes timestamp*/
kEnetPtpCorrectTime, /*!< ENET PTP time correction*/
kEnetPtpSendEthernetPtpV2, /*!< ENET PTPv2 sends Ethernet frame*/
kEnetPtpReceiveEthernetPtpV2 /*!< ENET PTPv2 receives with Ethernet frame*/
} enet_ptp_ioctl_t;
/*! @brief Defines the PTP message buffer number.*/
typedef enum _enet_ptp_buffer_number
{
kEnetPtpL2bufferNumber = 10, /*!< PTP layer2 frame buffer number*/
kEnetPtpRingNumber = 25 /*!< PTP Ring buffer number*/
} enet_ptp_buffer_number_t;
/*! @brief Defines the ENET PTP message related constant.*/
typedef enum _enet_ptp_event_type
{
kEnetPtpSourcePortIdLen = 10, /*!< PTP message sequence id length*/
kEnetPtpEventMsgType = 3, /*!< PTP event message type*/
kEnetPtpEventPort = 319, /*!< PTP event port number*/
kEnetPtpGnrlPort = 320 /*!< PTP general port number*/
} enet_ptp_event_type_t;
/*! @brief Defines all ENET PTP content offsets in the IPv4 PTP UDP/IP multicast message.*/
typedef enum _enet_ipv4_ptp_content_offset
{
kEnetPtpIpVersionOffset = 0xe, /*!< IPv4 PTP message IP version offset*/
kEnetPtpUdpProtocolOffset = 0x17,/*!< IPv4 PTP message UDP protocol offset*/
kEnetPtpUdpPortOffset = 0x24, /*!< IPv4 PTP message UDP port offset*/
kEnetPtpUdpMsgTypeOffset = 0x2a, /*!< IPv4 PTP message UDP message type offset*/
kEnetPtpUdpVersionoffset = 0x2b, /*!< IPv4 PTP message UDP version offset*/
kEnetPtpUdpClockIdOffset = 0x3e, /*!< IPv4 PTP message UDP clock id offset*/
kEnetPtpUdpSequenIdOffset = 0x48,/*!< IPv4 PTP message UDP sequence id offset*/
kEnetPtpUdpCtlOffset = 0x4a /*!< IPv4 PTP message UDP control offset*/
} enet_ipv4_ptp_content_offset_t;
/*! @brief Defines all ENET PTP content offset in THE IPv6 PTP UDP/IP multicast message.*/
typedef enum _enet_ipv6_ptp_content_offset
{
kEnetPtpIpv6UdpProtocolOffset = 0x14, /*!< IPv6 PTP message UDP protocol offset*/
kEnetPtpIpv6UdpPortOffset = 0x38, /*!< IPv6 PTP message UDP port offset*/
kEnetPtpIpv6UdpMsgTypeOffset = 0x3e, /*!< IPv6 PTP message UDP message type offset*/
kEnetPtpIpv6UdpVersionOffset = 0x3f, /*!< IPv6 PTP message UDP version offset*/
kEnetPtpIpv6UdpClockIdOffset = 0x52, /*!< IPv6 PTP message UDP clock id offset*/
kEnetPtpIpv6UdpSequenceIdOffset = 0x5c,/*!< IPv6 PTP message UDP sequence id offset*/
kEnetPtpIpv6UdpCtlOffset = 0x5e /*!< IPv6 PTP message UDP control offset*/
} enet_ipv6_ptp_content_offset_t;
/*! @brief Defines all ENET PTP content offset in the PTP Layer2 Ethernet message.*/
typedef enum _enet_ethernet_ptp_content_offset
{
kEnetPtpEtherPktTypeOffset = 0x0c, /*!< PTPv2 message Ethernet packet type offset*/
kEnetPtpEtherMsgTypeOffset = 0x0e, /*!< PTPv2 message Ethernet message type offset*/
kEnetPtpEtherVersionOffset = 0x0f, /*!< PTPv2 message Ethernet version type offset*/
kEnetPtpEtherClockIdOffset = 0x22, /*!< PTPv2 message Ethernet clock id offset*/
kEnetPtpEtherSequenceIdOffset = 0x2c,/*!< PTPv2 message Ethernet sequence id offset*/
kEnetPtpEtherCtlOffset = 0x2e /*!< PTPv2 message Ethernet control offset*/
} enet_ethernet_ptp_content_offset_t;
/*! @brief Defines the 1588 timer parameters.*/
typedef enum _enet_ptp_timer_wrap_period
{
kEnetPtpAtperVaule = 1000000000, /*!< PTP timer wrap around one second */
kEnetBaseIncreaseUnit = 2 /*!< PTP timer adjusts clock and increases value to 2*/
} enet_ptp_timer_wrap_period_t;
#endif
/*! @brief Defines the interrupt source index for the interrupt vector change table.*/
typedef enum _enet_interrupt_number
{
kEnetTstimerInt = 0, /*!< Timestamp interrupt*/
kEnetTsAvailInt, /*!< TS-avail interrupt*/
kEnetWakeUpInt, /*!< Wakeup interrupt*/
kEnetPlrInt, /*!< Plr interrupt*/
kEnetUnInt, /*!< Un interrupt*/
kEnetRlInt, /*!< RL interrupt*/
kEnetLcInt, /*!< LC interrupt*/
kEnetEberrInt, /*!< Eberr interrupt*/
kEnetMiiInt, /*!< MII interrupt*/
kEnetRxbInt , /*!< Receive byte interrupt*/
kEnetRxfInt, /*!< Receive frame interrupt*/
kEnetTxbInt, /*!< Transmit byte interrupt*/
kEnetTxfInt, /*!< Transmit frame interrupt*/
kEnetGraInt, /*!< Gra interrupt*/
kEnetBabtInt, /*!< Babt interrupt*/
kEnetBabrInt, /*!< Babr interrupt*/
kEnetIntNum /*!< Interrupt number*/
} enet_interrupt_number_t;
/*! @brief Defines the ENET main constant.*/
typedef enum _enet_frame_max
{
kEnetMaxTimeout = 0x10000, /*!< Maximum timeout*/
kEnetMaxFrameSize = 1518, /*!< Maximum frame size*/
kEnetMaxFrameVlanSize = 1522, /*!< Maximum VLAN frame size*/
kEnetMaxFrameDateSize = 1500, /*!< Maximum frame data size*/
kEnetMaxFrameBdNumbers = 7, /*!< Maximum buffer descriptor numbers of a frame*/
kEnetFrameFcsLen = 4, /*!< FCS length*/
kEnetEthernetHeadLen = 14 /*!< Ethernet Frame header length*/
} enet_frame_max_t;
/*! @brief Defines the CRC data for a hash value calculation.*/
typedef enum _enet_crc_parameter
{
kEnetCrcData = 0xFFFFFFFFU, /*!< CRC-32 maximum data */
kEnetCrcOffset = 8, /*!< CRC-32 offset2*/
kEnetCrcMask1 = 0x3F /*!< CRC-32 mask*/
} enet_crc_parameter_t;
/*! @brief Defines the ENET protocol type and main parameters.*/
typedef enum _enet_protocol_type
{
kEnetProtocolIeee8023 = 0x88F7, /*!< Packet type Ethernet ieee802.3*/
kEnetProtocolIpv4 = 0x0800, /*!< Packet type IPv4*/
kEnetProtocolIpv6 = 0x86dd, /*!< Packet type IPv6*/
kEnetProtocol8021QVlan = 0x8100, /*!< Packet type VLAN*/
kEnetPacketUdpVersion = 0x11, /*!< UDP protocol type*/
kEnetPacketIpv4Version = 0x4, /*!< Packet IP version IPv4*/
kEnetPacketIpv6Version = 0x6 /*!< Packet IP version IPv6*/
} enet_protocol_type_t;
/*! @brief Defines the ENET MAC control Configure*/
typedef enum _enet_mac_control_flag
{
kEnetSleepModeEnable = 0x1, /*!< ENET control sleep mode Enable*/
kEnetPayloadlenCheckEnable = 0x2, /*!< ENET receive payload length check Enable*/
kEnetRxFlowControlEnable = 0x4, /*!< ENET flow control, receiver detects PAUSE frames and stops transmitting data when a PAUSE frame is detected*/
kEnetRxCrcFwdEnable = 0x8, /*!< Received frame crc is stripped from the frame*/
kEnetRxPauseFwdEnable = 0x10,/*!< Pause frames are forwarded to the user application*/
kEnetRxPadRemoveEnable = 0x20, /*!< Padding is removed from received frames*/
kEnetRxBcRejectEnable = 0x40, /*!< Broadcast frame reject*/
kEnetRxPromiscuousEnable = 0x80, /*!< Promiscuous mode enabled*/
kEnetRxMiiLoopback = 0x100, /*!< MAC MII loopback mode*/
} enet_mac_control_flag_t;
/*! @brief Defines the multicast group structure for the ENET device. */
typedef struct ENETMulticastGroup
{
enetMacAddr groupAdddr; /*!< Multicast group address*/
uint32_t hash; /*!< Hash value of the multicast group address*/
struct ENETMulticastGroup *next; /*!< Pointer of the next group structure*/
struct ENETMulticastGroup *prv; /*!< Pointer of the previous structure*/
} enet_multicast_group_t;
/*! @brief Defines the receive buffer descriptor configure structure.*/
typedef struct ENETRxBdConfig
{
uint8_t *rxBdPtrAlign; /*!< Aligned receive buffer descriptor pointer */
uint8_t *rxBufferAlign; /*!< Aligned receive data buffer pointer */
uint8_t *rxLargeBufferAlign; /*!< Aligned receive large data buffer pointer*/
uint8_t rxBdNum; /*!< Aligned receive buffer descriptor pointer*/
uint8_t rxBufferNum; /*!< Receive buffer number*/
uint8_t rxLargeBufferNum; /*!< Large receive buffer number*/
uint32_t rxLargeBufferSizeAlign; /*!< Aligned large receive buffer size*/
}enet_rxbd_config_t;
/*! @brief Defines the transmit buffer descriptor configure structure.*/
typedef struct ENETTxBdConfig
{
uint8_t *txBdPtrAlign; /*!< Aligned transmit buffer descriptor pointer*/
uint8_t *txBufferAlign; /*!< Aligned transmit buffer descriptor pointer*/
uint8_t txBufferNum; /*!< Transmit buffer number*/
uint32_t txBufferSizeAlign; /*!< Aligned transmit buffer size*/
}enet_txbd_config_t;
/*! @brief Defines the basic configuration structure for the ENET device.*/
typedef struct ENETMacConfig
{
uint16_t rxBufferSize; /*!< Receive buffer size*/
uint16_t rxLargeBufferNumber; /*!< Receive large buffer number; Needed only when the BD size is smaller than the maximum frame length.*/
uint16_t rxBdNumber; /*!< Receive buffer descriptor number*/
uint16_t txBdNumber; /*!< Transmit buffer descriptor number*/
enetMacAddr macAddr; /*!< MAC hardware address*/
enet_config_rmii_t rmiiCfgMode;/*!< RMII configure mode*/
enet_config_speed_t speed; /*!< Speed configuration*/
enet_config_duplex_t duplex; /*!< Duplex configuration*/
/*!< Mac control configure, it is recommended to use enet_mac_control_flag_t
it is special control set for loop mode, sleep mode, crc forward/terminate etc*/
uint32_t macCtlConfigure;
bool isTxAccelEnabled;/*!< Switcher to enable transmit accelerator*/
bool isRxAccelEnabled;/*!< Switcher to enable receive accelerator*/
bool isStoreAndFwEnabled; /*!< Switcher to enable store and forward*/
enet_config_rx_accelerator_t rxAcceler; /*!< Receive accelerator configure*/
enet_config_tx_accelerator_t txAcceler; /*!< Transmit accelerator configure*/
bool isVlanEnabled; /*!< Switcher to enable VLAN frame*/
bool isPhyAutoDiscover;/*!< Switcher to use PHY auto discover*/
uint32_t miiClock; /*!< MII speed*/
#if FSL_FEATURE_ENET_SUPPORT_PTP
uint16_t ptpRingBufferNumber; /*!< PTP ring buffer number*/
bool isSlaveModeEnabled; /*!< PTP timer configuration*/
#endif
} enet_mac_config_t;
/*! @brief Defines the basic configuration for PHY.*/
typedef struct ENETPhyConfig
{
uint8_t phyAddr; /*!< PHY address*/
bool isLoopEnabled; /*!< Switcher to enable the HY loop mode*/
} enet_phy_config_t;
#if FSL_FEATURE_ENET_SUPPORT_PTP
/*! @brief Defines the ENET Mac PTP timestamp structure.*/
typedef struct ENETMacPtpTime
{
uint64_t second; /*!< Second*/
uint32_t nanosecond; /*!< Nanosecond*/
} enet_mac_ptp_time_t;
/*! @brief Defines the ENET PTP timer drift structure.*/
typedef struct ENETPtpDrift
{
int32_t drift; /*!< Drift for the PTP timer to adjust*/
} enet_ptp_drift_t;
/*! @brief Defines the ENET MAC PTP time parameter.*/
typedef struct ENETPtpMasterTimeData
{
uint8_t masterPtpInstance;/*!< PTP master timer instance*/
uint64_t second; /*!< PTP master timer second */
} enet_ptp_master_time_data_t;
/*! @brief Defines the structure for the ENET PTP message data and timestamp data.*/
typedef struct ENETMacPtpTsData
{
uint8_t version; /*!< PTP version*/
uint8_t sourcePortId[kEnetPtpSourcePortIdLen];/*!< PTP source port ID*/
uint16_t sequenceId; /*!< PTP sequence ID*/
uint8_t messageType; /*!< PTP message type*/
enet_mac_ptp_time_t timeStamp;/*!< PTP timestamp*/
} enet_mac_ptp_ts_data_t;
/*! @brief Defines the ENET PTP ring buffer structure for the PTP message timestamp store.*/
typedef struct ENETMacPtpTsRing
{
uint32_t front; /*!< The first index of the ring*/
uint32_t end; /*!< The end index of the ring*/
uint32_t size; /*!< The size of the ring*/
enet_mac_ptp_ts_data_t *ptpTsDataPtr;/*!< PTP message data structure*/
} enet_mac_ptp_ts_ring_t;
/*! @brief Defines the ENET packet for the PTP version2 message using the layer2 Ethernet frame.*/
typedef struct ENETPtpL2packet
{
uint8_t packet[kEnetMaxFrameDateSize]; /*!< Buffer for ptpv2 message*/
uint16_t length; /*!< PTP message length*/
} enet_ptp_l2packet_t;
/*! @brief Defines the ENET PTPv2 packet queue using the layer2 Ethernet frame.*/
typedef struct ENETPtpL2queue
{
enet_ptp_l2packet_t l2Packet[kEnetPtpL2bufferNumber]; /*!< PTP layer2 packet*/
uint16_t writeIdex; /*!< Queue write index*/
uint16_t readIdx; /*!< Queue read index*/
} enet_ptp_l2queue_t;
/*! @brief Defines the ENET PTP layer2 Ethernet frame structure.*/
typedef struct ENETPtpL2Ethernet
{
uint8_t *ptpMsg; /*!< PTP message*/
uint16_t length; /*!< Length of the PTP message*/
enetMacAddr hwAddr; /*!< Destination hardware address*/
} enet_ptp_l2_ethernet_t;
/*! @brief Defines the ENET PTP buffer structure for all 1588 data.*/
typedef struct ENETPrivatePtpBuffer
{
enet_mac_ptp_ts_ring_t rxTimeStamp;/*!< Data structure for receive message*/
enet_mac_ptp_ts_ring_t txTimeStamp;/*!< Data structure for transmit timestamp*/
enet_ptp_l2queue_t *l2QueuePtr; /*!< Data structure for layer2 Ethernet queue*/
uint64_t masterSecond; /*!< PTP time second when it's master time*/
} enet_private_ptp_buffer_t;
#endif
/*! @brief Defines the ENET header structure. */
typedef struct ENETEthernetHeader
{
enetMacAddr destAddr; /*!< Destination address */
enetMacAddr sourceAddr;/*!< Source address*/
uint16_t type; /*!< Protocol type*/
} enet_ethernet_header_t;
/*! @brief Defines the ENET VLAN frame header structure. */
typedef struct ENET8021vlanHeader
{
enetMacAddr destAddr; /*!< Destination address */
enetMacAddr sourceAddr;/*!< Source address*/
uint16_t tpidtag; /*!< ENET 8021tag header tag region*/
uint16_t othertag; /*!< ENET 8021tag header type region*/
uint16_t type; /*!< Protocol type*/
} enet_8021vlan_header_t;
/*! @brief Defines the ENET MAC context structure for the buffer address, buffer descriptor address, etc.*/
typedef struct ENETMacContext
{
uint8_t *rxBufferPtr; /*!< Receive buffer pointer*/
uint8_t *rxLargeBufferPtr; /*!< Receive large buffer descriptor*/
uint8_t *txBufferPtr; /*!< Transmit buffer pointer*/
uint8_t *rxBdBasePtr; /*!< Receive buffer descriptor base address pointer*/
uint8_t *rxBdCurPtr; /*!< Current receive buffer descriptor pointer*/
uint8_t *rxBdDirtyPtr; /*!< Receive dirty buffer descriptor*/
uint8_t *txBdBasePtr; /*!< Transmit buffer descriptor base address pointer*/
uint8_t *txBdCurPtr; /*!< Current transmit buffer descriptor pointer*/
uint8_t *txBdDirtyPtr; /*!< Last cleaned transmit buffer descriptor pointer*/
bool isTxFull; /*!< Transmit buffer descriptor full*/
bool isRxFull; /*!< Receive buffer descriptor full*/
uint32_t bufferdescSize; /*!< ENET buffer descriptor size*/
uint16_t rxBufferSizeAligned; /*!< Receive buffer alignment size*/
#if FSL_FEATURE_ENET_SUPPORT_PTP
enet_private_ptp_buffer_t privatePtp;/*!< PTP private buffer*/
#endif
} enet_mac_context_t;
/*! @brief Defines the ENET packets statistic structure.*/
typedef struct ENETMacStats
{
uint32_t statsRxTotal; /*!< Total number of receive packets*/
uint32_t statsRxMissed; /*!< Total number of receive packets*/
uint32_t statsRxDiscard; /*!< Receive discarded with error */
uint32_t statsRxError; /*!< Receive discarded with error packets*/
uint32_t statsTxTotal; /*!< Total number of transmit packets*/
uint32_t statsTxMissed; /*!< Transmit missed*/
uint32_t statsTxDiscard; /*!< Transmit discarded with error */
uint32_t statsTxError; /*!< Transmit error*/
uint32_t statsRxAlign; /*!< Receive non-octet alignment*/
uint32_t statsRxFcs; /*!< Receive CRC error*/
uint32_t statsRxTruncate;/*!< Receive truncate*/
uint32_t statsRxLengthGreater; /*!< Receive length greater than RCR[MAX_FL] */
uint32_t statsRxCollision; /*!< Receive collision*/
uint32_t statsRxOverRun; /*!< Receive over run*/
uint32_t statsTxOverFlow; /*!< Transmit overflow*/
uint32_t statsTxLateCollision; /*!< Transmit late collision*/
uint32_t statsTxExcessCollision;/*!< Transmit excess collision*/
uint32_t statsTxUnderFlow; /*!< Transmit under flow*/
uint32_t statsTxLarge; /*!< Transmit large packet*/
uint32_t statsTxSmall; /*!< Transmit small packet*/
} enet_stats_t;
/*! @brief Defines the ENET MAC packet buffer structure.*/
typedef struct ENETMacPacketBuffer
{
uint8_t *data;
uint16_t length;
} enet_mac_packet_buffer_t;
#if ENET_RECEIVE_ALL_INTERRUPT
typedef uint32_t (* enet_netif_callback_t)(void *enetPtr, enet_mac_packet_buffer_t *packetBuffer);
#endif
/*! @brief Defines the ENET device data structure for the ENET.*/
typedef struct ENETDevIf
{
struct ENETDevIf *next; /*!< Next device structure address*/
void *netIfPtr; /*!< Store the connected upper layer in the structure*/
#if ENET_RECEIVE_ALL_INTERRUPT
void *enetNetifService; /*!< Service function*/
#endif
enet_multicast_group_t *multiGroupPtr; /*!< Multicast group chain*/
uint32_t deviceNumber; /*!< Device number*/
bool isInitialized; /*!< Device initialized*/
uint16_t maxFrameSize; /*!< MAC maximum frame size*/
enet_mac_config_t *macCfgPtr;/*!< MAC configuration structure*/
enet_phy_config_t *phyCfgPtr;/*!< PHY configuration structure*/
const struct ENETMacApi *macApiPtr; /*!< MAC application interface structure*/
void *phyApiPtr; /*!< PHY application interface structure*/
enet_mac_context_t *macContextPtr; /*!< MAC context pointer*/
#if ENET_ENABLE_DETAIL_STATS
enet_stats_t stats; /*!< Packets statistic*/
#endif
#if ENET_RECEIVE_ALL_INTERRUPT
enet_netif_callback_t enetNetifcall; /*!< Receive callback function to the upper layer*/
#else
event_object_t enetReceiveSync; /*!< Receive sync signal*/
#endif
lock_object_t enetContextSync; /*!< Sync signal*/
} enet_dev_if_t;
/*! @brief Defines the basic application for the ENET device.*/
typedef struct ENETMacApi
{
uint32_t (* enet_mac_init)(enet_dev_if_t * enetIfPtr, enet_rxbd_config_t *rxbdCfg, enet_txbd_config_t *txbdCfg);/*!< MAC initialize interface*/
uint32_t (* enet_mac_deinit)(enet_dev_if_t * enetIfPtr);/*!< MAC close interface*/
uint32_t (* enet_mac_send)(enet_dev_if_t * enetIfPtr, uint8_t *packet, uint32_t size);/*!< MAC send packets*/
#if !ENET_RECEIVE_ALL_INTERRUPT
uint32_t (* enet_mac_receive)(enet_dev_if_t * enetIfPtr, enet_mac_packet_buffer_t *packBuffer);/*!< MAC receive interface*/
#endif
uint32_t (* enet_mii_read)(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t *dataPtr);/*!< MII reads PHY*/
uint32_t (* enet_mii_write)(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t data);/*!< MII writes PHY*/
uint32_t (* enet_add_multicast_group)(uint32_t instance, enet_multicast_group_t *multiGroupPtr, uint8_t *groupAddr);/*!< Add multicast group*/
uint32_t (* enet_leave_multicast_group)(uint32_t instance, enet_multicast_group_t *multiGroupPtr, uint8_t *groupAddr);/*!< Leave multicast group*/
} enet_mac_api_t;
/*******************************************************************
* Global variables
***********************************************************************/
extern const enet_mac_api_t g_enetMacApi;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @name ENET Driver
* @{
*/
#if FSL_FEATURE_ENET_SUPPORT_PTP
/*!
* @brief Initializes the ENET PTP context structure with the basic configuration.
*
* @param macContextPtr The pointer to the ENET MAC macContext structure.
* @return The execution status.
*/
uint32_t enet_ptp_init(enet_private_ptp_buffer_t *privatePtpPtr, uint32_t ptpRxBufferNum, enet_mac_ptp_ts_data_t *ptpTsRxDataPtr, uint32_t ptpTxBufferNum, enet_mac_ptp_ts_data_t *ptpTsTxDataPtr);
/*!
* @brief Initializes the ENET PTP timer with the basic configuration.
*
* After the PTP starts, the 1588 timer also starts running. If the user wants the 1588 timer
* as the slave, enable the isSlaveEnabled flag.
*
* @param instance The ENET instance number.
* @param ptpCfgPtr The pointer to the basic PTP timer configuration structure.
* @return The execution status.
*/
uint32_t enet_ptp_start(uint32_t instance, bool isSlaveEnabled);
/*!
* @brief Parses the ENET packet.
*
* Parses the ENET message and checks if it is a PTP message. If it is a PTP message,
* the message is stored in the PTP information structure. Message parsing
* decides whether timestamp processing is done after that.
*
* @param packet The ENET packet.
* @param ptpTsPtr The pointer to the PTP data structure.
* @param isPtpMsg The PTP message flag.
* @param isFastEnabled The fast operation flag. If set, only check if it is a ptp message
* and doesn't store any ptp message.
* @return The execution status.
*/
uint32_t enet_ptp_parse(uint8_t *packet, enet_mac_ptp_ts_data_t *ptpTsPtr, bool *isPtpMsg, bool isFastEnabled);
/*!
* @brief Gets the current value of the ENET PTP time.
*
* @param ptpTimerPtr The PTP timer structure.
* @return The execution status.
*/
uint32_t enet_ptp_get_time(enet_mac_ptp_time_t *ptpTimerPtr);
/*!
* @brief Sets the current value of the ENET PTP time.
*
* @param ptpTimerPtr The PTP timer structure.
* @return The execution status.
*/
uint32_t enet_ptp_set_time(enet_mac_ptp_time_t *ptpTimerPtr);
/*!
* @brief Adjusts the ENET PTP time.
*
* @param instance The ENET instance number.
* @param drift The PTP timer drift value.
* @return The execution status.
*/
uint32_t enet_ptp_correction_time(uint32_t instance, int32_t drift);
/*!
* @brief Stores the transmit timestamp.
*
* @param ptpBuffer The PTP buffer pointer.
* @param bdPtr The current transmit buffer descriptor.
* @return The execution status.
*/
uint32_t enet_ptp_store_tx_timestamp(enet_private_ptp_buffer_t *ptpBuffer,void *bdPtr);
/*!
* @brief Stores receive timestamp.
*
* @param ptpBuffer The PTP buffer pointer.
* @param packet The current receive packet.
* @param bdPtr The current receive buffer descriptor.
* @return The execution status.
*/
uint32_t enet_ptp_store_rx_timestamp(enet_private_ptp_buffer_t *ptpBuffer, uint8_t *packet, void *bdPtr);
/*!
* @brief Initializes the buffer queue for the PTP layer2 Ethernet packets.
*
* @param ptpBuffer The PTP buffer pointer.
* @return The execution status.
*/
uint32_t enet_ptp_l2queue_init(enet_private_ptp_buffer_t *ptpBuffer, enet_ptp_l2queue_t *ptpL2QuePtr);
/*!
* @brief Adds the PTP layer2 Ethernet packet to the PTP Ethernet packet queue.
*
* @param ptpQuePtr The ENET private ptp layer2 buffer queue structure pointer.
* @param packet The packet buffer pointer.
* @param length The packet length.
* @return The execution status.
*/
uint32_t enet_ptp_service_l2packet(enet_ptp_l2queue_t * ptpQuePtr, uint8_t *packet, uint16_t length);
/*!
* @brief Sends the PTP layer2 Ethernet packet to the Net.
*
* @param enetIfPtr The ENET context structure.
* @param paramPtr The buffer from upper layer.
* @return The execution status.
*/
uint32_t enet_ptp_send_l2packet(enet_dev_if_t * enetIfPtr, void *paramPtr);
/*!
* @brief Receives the PTP layer2 Ethernet packet from the Net.
*
* @param enetIfPtr The ENET context structure.
* @param paramPtr The buffer receive from net and will send to upper layer.
* @return The execution status.
*/
uint32_t enet_ptp_receive_l2packet(enet_dev_if_t * enetIfPtr,void *paramPtr);
/*!
* @brief Provides the handler for the 1588 stack to do PTP IOCTL.
*
* @param enetIfPtr The ENET context structure.
* @param commandId The command id.
* @param inOutPtr The data buffer.
* @return The execution status.
*/
uint32_t enet_ptp_ioctl(enet_dev_if_t * enetIfPtr, uint32_t commandId, void *inOutPtr);
/*!
* @brief Stops the ENET PTP timer.
*
* @param instance The ENET instance number.
* @return The execution status.
*/
uint32_t enet_ptp_stop(uint32_t instance);
/*!
* @brief Checks whether the PTP ring buffer is full.
*
* @param ptpTsRingPtr The ENET PTP timestamp ring.
* @return True if the PTP ring buffer is full. Otherwise, false.
*/
bool enet_ptp_ring_is_full(enet_mac_ptp_ts_ring_t *ptpTsRingPtr);
/*!
* @brief Updates the latest ring buffers.
*
* Adds the PTP message data to the PTP ring buffers and increases the
* PTP ring buffer index.
*
* @param ptpTsRingPtr The ENET PTP timestamp ring.
* @param data The PTP data buffer.
* @return The execution status.
*/
uint32_t enet_ptp_ring_update(enet_mac_ptp_ts_ring_t *ptpTsRingPtr, enet_mac_ptp_ts_data_t *data);
/*!
* @brief Searches the element in ring buffers with the message ID and Clock ID.
*
* @param ptpTsRingPtr The ENET PTP timestamp ring.
* @param data The PTP data buffer.
* @return The execution status.
*/
uint32_t enet_ptp_ring_search(enet_mac_ptp_ts_ring_t *ptpTsRingPtr, enet_mac_ptp_ts_data_t *data);
/*!
* @brief Calculates the ENET PTP ring buffer index.
*
* @param size The ring size.
* @param curIdx The current ring index.
* @param offset The offset index.
* @return The execution status.
*/
static inline uint32_t enet_ptp_ring_index(uint32_t size, uint32_t curIdx, uint32_t offset)
{
return ((curIdx + offset) % size);
}
/*!
* @brief Frees all ring buffers.
*
* @param enetContextPtr The ENET MAC context buffer.
* @return The execution status.
*/
uint32_t enet_ptp_deinit(enet_mac_context_t *enetContextPtr);
/*!
* @brief The ENET PTP time interrupt handler.
*
* @param enetIfPtr The ENET context structure pointer.
*/
void enet_mac_ts_isr(void *enetIfPtr);
#endif
/*!
* @brief(R)MII Read function.
*
* @param instance The ENET instance number.
* @param phyAddr The PHY address.
* @param phyReg The PHY register.
* @param dataPtr The data read from MII.
* @return The execution status.
*/
uint32_t enet_mii_read(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t *dataPtr);
/*!
* @brief(R)MII Read function.
*
* @param instance The ENET instance number.
* @param phyAddr The PHY address.
* @param phyReg The PHY register.
* @param data The data write to MII.
* @return The execution status.
*/
uint32_t enet_mii_write(uint32_t instance, uint32_t phyAddr, uint32_t phyReg, uint32_t data);
/*!
* @brief Initializes ENET buffer descriptors.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_bd_init(enet_dev_if_t * enetIfPtr);
/*!
* @brief Initializes the ENET MAC MII(MDC/MDIO) interface.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_mii_init(enet_dev_if_t * enetIfPtr);
/*!
* @brief Initialize the ENET receive buffer descriptors.
*
* If you open ENET_RECEIVE_ALL_INTERRUPT to do receive
* data buffer numbers can be the same as the receive descriptor numbers.
* But if you close ENET_RECEIVE_ALL_INTERRUPT and choose polling receive
* frames please make sure the receive data buffers are more than
* buffer descriptor numbers to guarantee a good performance.
*
* @param enetIfPtr The ENET context structure.
* @param rxbdCfg The receive buffer descriptor configuration.
* @return The execution status.
*/
uint32_t enet_mac_rxbd_init(enet_dev_if_t * enetIfPtr, enet_rxbd_config_t *rxbdCfg);
/*!
* @brief Deinitialize the ENET receive buffer descriptors.
*
* Deinitialize the ENET receive buffer descriptors.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_rxbd_deinit(enet_dev_if_t * enetIfPtr);
/*!
* @brief Initialize the ENET transmit buffer descriptors.
*
* @param enetIfPtr The ENET context structure.
* @param txbdCfg The transmit buffer descriptor configuration.
* @return The execution status.
*/
uint32_t enet_mac_txbd_init(enet_dev_if_t * enetIfPtr, enet_txbd_config_t *txbdCfg);
/*!
* @brief Deinitialize the ENET transmit buffer descriptors.
*
* Deinitialize the ENET transmit buffer descriptors.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_txbd_deinit(enet_dev_if_t * enetIfPtr);
/*!
* @brief Initializes ENET MAC FIFO and accelerator with the basic configuration.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_configure_fifo_accel(enet_dev_if_t * enetIfPtr);
/*!
* @brief the ENET controller with the basic configuration.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_configure_controller(enet_dev_if_t * enetIfPtr);
/*!
* @brief Deinit the ENET device.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_deinit(enet_dev_if_t * enetIfPtr);
#if !ENET_RECEIVE_ALL_INTERRUPT
/*!
* @brief Updates the receive buffer descriptor.
*
* This updates the used receive buffer descriptor ring to
* ensure that the used BDS is correctly used again. It cleans
* the status region and sets the control region of the used receive buffer
* descriptor. If the isBufferUpdate flag is set, the data buffer in the
* buffer descriptor is updated.
*
* @param enetIfPtr The ENET context structure.
* @param isBufferUpdate The data buffer update flag.
* @return The execution status.
*/
uint32_t enet_mac_update_rxbd(enet_dev_if_t * enetIfPtr, bool isBufferUpdate);
#else
/*!
* @brief Updates the receive buffer descriptor.
*
* Clears the status region and sets the control region of the current receive buffer
* descriptor to ensure that it is used correctly again. It increases the buffer
* descriptor index to the next buffer descriptor.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_update_rxbd(enet_dev_if_t * enetIfPtr);
#endif
/*!
* @brief Processes the ENET receive frame error statistics.
*
* This interface gets the error statistics of the received frame.
* Because the error information is in the last BD of a frame, this interface
* should be called when processing the last BD of a frame.
*
* @param enetIfPtr The ENET context structure.
* @param data The current control and status data of the buffer descriptor.
* @return The frame error status.
* - True if the frame has an error.
* - False if the frame does not have an error.
*/
bool enet_mac_rx_error_stats(enet_dev_if_t * enetIfPtr, uint32_t data);
/*!
* @brief Processes the ENET transmit frame statistics.
*
* This interface gets the error statistics of the transmit frame.
* Because the error information is in the last BD of a frame, this interface
* should be called when processing the last BD of a frame.
*
* @param enetIfPtr The ENET context structure.
* @param curBd The current buffer descriptor.
*/
void enet_mac_tx_error_stats(enet_dev_if_t * enetIfPtr,void *curBd);
/*!
* @brief ENET transmit buffer descriptor cleanup.
*
* First, store the transmit frame error statistic and PTP timestamp of the transmitted packets.
* Second, clean up the used transmit buffer descriptors.
* If the PTP 1588 feature is open, this interface captures the 1588 timestamp.
* It is called by the transmit interrupt handler.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_tx_cleanup(enet_dev_if_t * enetIfPtr);
#if !ENET_RECEIVE_ALL_INTERRUPT
/*!
* @brief Receives ENET packets.
*
* @param enetIfPtr The ENET context structure.
* @param packBuffer The received data buffer.
* @return The execution status.
*/
uint32_t enet_mac_receive(enet_dev_if_t * enetIfPtr, enet_mac_packet_buffer_t *packBuffer);
#else
/*!
* @brief Receives ENET packets.
*
* @param enetIfPtr The ENET context structure.
* @return The execution status.
*/
uint32_t enet_mac_receive(enet_dev_if_t * enetIfPtr);
#endif
/*!
* @brief Transmits ENET packets.
*
* @param enetIfPtr The ENET context structure.
* @param packet The frame to be transmitted.
* @param size The frame size.
* @return The execution status.
*/
uint32_t enet_mac_send(enet_dev_if_t * enetIfPtr, uint8_t *packet, uint32_t size);
/*!
* @brief The ENET receive interrupt handler.
*
* @param enetIfPtr The ENET context structure pointer.
*/
void enet_mac_rx_isr(void *enetIfPtr);
/*!
* @brief The ENET transmit interrupt handler.
*
* @param enetIfPtr The ENET context structure pointer.
*/
void enet_mac_tx_isr(void *enetIfPtr);
/*!
* @brief Calculates the CRC hash value.
*
* @param address The ENET MAC hardware address.
* @param crcVlaue The calculated CRC value of the Mac address.
*/
void enet_mac_calculate_crc32(enetMacAddr address, uint32_t *crcValue);
/*!
* @brief Adds the ENET device to a multicast group.
*
* @param instance The ENET instance number.
* @param multiGroupPtr The ENET multicast group structure.
* @param address The ENET MAC hardware address.
* @return The execution status.
*/
uint32_t enet_mac_add_multicast_group(uint32_t instance, enet_multicast_group_t *multiGroupPtr, enetMacAddr address);
/*!
* @brief Moves the ENET device from a multicast group.
*
* @param instance The ENET instance number.
* @param multiGroupPtr The ENET multicast group structure.
* @param address The ENET MAC hardware address.
* @return The execution status.
*/
uint32_t enet_mac_leave_multicast_group(uint32_t instance, enet_multicast_group_t *multiGroupPtr, enetMacAddr address);
/*!
* @brief Initializes the ENET with the basic configuration.
*
* @param enetIfPtr The pointer to the basic configuration structure.
* @return The execution status.
*/
uint32_t enet_mac_init(enet_dev_if_t * enetIfPtr, enet_rxbd_config_t *rxbdCfg,
enet_txbd_config_t *txbdCfg);
/*!
* @brief Enqueues a data buffer to the buffer queue.
*
* @param queue The buffer queue.
* @param buffer The buffer to add to the buffer queue.
*/
void enet_mac_enqueue_buffer( void **queue, void *buffer);
/*!
* @brief Dequeues a buffer from the buffer queue.
*
* @param queue The buffer queue.
* @return The dequeued data buffer.
*/
void *enet_mac_dequeue_buffer( void **queue);
/* @} */
#if defined(__cplusplus)
extern }
#endif
/*! @}*/
#endif /* __FSL_ENET_DRIVER_H__ */
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#include "fsl_enet_driver.h"
#include "fsl_clock_manager.h"
/*******************************************************************************
* Variables
******************************************************************************/
/* Internal irq number*/
typedef enum _enet_irq_number
{
kEnetTsTimerNumber = 0, /*!< ENET ts_timer irq number*/
kEnetReceiveNumber = 1, /*!< ENET receive irq number*/
kEnetTransmitNumber = 2, /*!< ENET transmit irq number*/
kEnetMiiErrorNumber = 3 /*!< ENET mii error irq number*/
}enet_irq_number_t;
#if FSL_FEATURE_ENET_SUPPORT_PTP
extern enet_ptp_master_time_data_t g_ptpMasterTime;
#if FSL_FEATURE_ENET_PTP_TIMER_CHANNEL_INTERRUPT
#define ENET_TIMER_CHANNEL_NUM 2
#endif
#endif
#if defined (K64F12_SERIES) || defined (K70F12_SERIES)
IRQn_Type enet_irq_ids[HW_ENET_INSTANCE_COUNT][FSL_FEATURE_ENET_INTERRUPT_COUNT] =
{
{ ENET_1588_Timer_IRQn, ENET_Receive_IRQn, ENET_Transmit_IRQn, ENET_Error_IRQn}
};
uint8_t enetIntMap[kEnetIntNum] =
{
kEnetTsTimerNumber,
kEnetTsTimerNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetReceiveNumber,
kEnetReceiveNumber,
kEnetTransmitNumber,
kEnetTransmitNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber,
kEnetMiiErrorNumber
};
#endif
/*******************************************************************************
* Code
******************************************************************************/
/* The code was moved to k64f mac file (eth) */
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,4 +0,0 @@
ENET_DRIVER_DIR := $(SDK_ROOT)/platform/drivers/enet
SOURCES += $(ENET_DRIVER_DIR)/src/fsl_enet_driver.c \
$(ENET_DRIVER_DIR)/src/fsl_enet_irq.c
INCLUDES += $(ENET_DRIVER_DIR)

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#ifndef __FSL_INTERRUPT_FEATURES_H__
#define __FSL_INTERRUPT_FEATURES_H__
#if (defined(CPU_MKL25Z32VFM4) || defined(CPU_MKL25Z64VFM4) || defined(CPU_MKL25Z128VFM4) || \
defined(CPU_MKL25Z32VFT4) || defined(CPU_MKL25Z64VFT4) || defined(CPU_MKL25Z128VFT4) || \
defined(CPU_MKL25Z32VLH4) || defined(CPU_MKL25Z64VLH4) || defined(CPU_MKL25Z128VLH4) || \
defined(CPU_MKL25Z32VLK4) || defined(CPU_MKL25Z64VLK4) || defined(CPU_MKL25Z128VLK4))
#define FSL_FEATURE_INTERRUPT_IRQ_MAX (31)
#define FSL_FEATURE_INTERRUPT_IRQ_MIN (-14)
#elif (defined(CPU_MK70FN1M0VMJ12) || defined(CPU_MK70FX512VMJ12) || \
defined(CPU_MK70FN1M0VMJ15) || defined(CPU_MK70FX512VMJ15))
#define FSL_FEATURE_INTERRUPT_IRQ_MAX (105)
#define FSL_FEATURE_INTERRUPT_IRQ_MIN (-14)
#elif (defined(CPU_MK64FX512VDC12) || defined(CPU_MK64FN1M0VDC12) || defined(CPU_MK64FX512VLL12) || \
defined(CPU_MK64FN1M0VLL12) || defined(CPU_MK64FX512VLQ12) || defined(CPU_MK64FN1M0VLQ12) || \
defined(CPU_MK64FX512VMD12) || defined(CPU_MK64FN1M0VMD12))
#define FSL_FEATURE_INTERRUPT_IRQ_MAX (85)
#define FSL_FEATURE_INTERRUPT_IRQ_MIN (-14)
#elif (defined(CPU_MK22FN512VDC12))
#define FSL_FEATURE_INTERRUPT_IRQ_MAX (85)
#define FSL_FEATURE_INTERRUPT_IRQ_MIN (-14)
#else
#error "No valid CPU defined"
#endif
#endif /* __FSL_INTERRUPT_FEATURES_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,142 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#if !defined(__FSL_INTERRUPT_MANAGER_H__)
#define __FSL_INTERRUPT_MANAGER_H__
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include "fsl_interrupt_features.h"
#include "device/fsl_device_registers.h"
/*! @addtogroup interrupt_manager*/
/*! @{*/
/*! @file*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus*/
/*! @name interrupt_manager APIs*/
/*@{*/
/*!
* @brief Installs an interrupt handler routine for a given IRQ number.
*
* This function lets the application register/replace the interrupt
* handler for a specified IRQ number. The IRQ number is different than the vector
* number. IRQ 0 starts from the vector 16 address. See a chip-specific reference
* manual for details and the startup_MKxxxx.s file for each chip
* family to find out the default interrupt handler for each device. This
* function converts the IRQ number to the vector number by adding 16 to
* it.
*
* @param irqNumber IRQ number
* @param handler Interrupt handler routine address pointer
*/
void interrupt_register_handler(IRQn_Type irqNumber, void (*handler)(void));
/*!
* @brief Enables an interrupt for a given IRQ number.
*
* This function enables the individual interrupt for a specified IRQ
* number. It calls the system NVIC API to access the interrupt control
* register. The input IRQ number does not include the core interrupt, only
* the peripheral interrupt, from 0 to a maximum supported IRQ.
*
* @param irqNumber IRQ number
*/
static inline void interrupt_enable(IRQn_Type irqNumber)
{
/* check IRQ number */
assert(0 <= irqNumber);
assert(irqNumber <= FSL_FEATURE_INTERRUPT_IRQ_MAX);
/* call core API to enable the IRQ*/
NVIC_EnableIRQ(irqNumber);
}
/*!
* @brief Disables an interrupt for a given IRQ number.
*
* This function enables the individual interrupt for a specified IRQ
* number. It calls the system NVIC API to access the interrupt control
* register.
*
* @param irqNumber IRQ number
*/
static inline void interrupt_disable(IRQn_Type irqNumber)
{
/* check IRQ number */
assert(0 <= irqNumber);
assert(irqNumber <= FSL_FEATURE_INTERRUPT_IRQ_MAX);
/* call core API to disable the IRQ*/
NVIC_DisableIRQ(irqNumber);
}
/*!
* @brief Enables system interrupt.
*
* This function enables the global interrupt by calling the core API.
*
*/
void interrupt_enable_global(void);
/*!
* @brief Disable system interrupt.
*
* This function disables the global interrupt by calling the core API.
*
*/
void interrupt_disable_global(void);
/*@}*/
#if defined(__cplusplus)
}
#endif /* __cplusplus*/
/*! @}*/
#endif /* __FSL_INTERRUPT_MANAGER_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,109 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#include <assert.h>
#include "fsl_interrupt_manager.h"
#include "cmsis_nvic.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*!
* @brief Counter to manage the nested callings of global disable/enable interrupt.
*/
uint32_t g_interrupt_disable_count = 0;
/*******************************************************************************
* Code
******************************************************************************/
/*FUNCTION**********************************************************************
*
* Function Name : interrupt_register_handler
* Description : Install an interrupt handler routine for a given IRQ number
* This function will let application to register/replace the interrupt
* handler for specified IRQ number. IRQ number is different with Vector
* number. IRQ 0 will start from Vector 16 address. Refer to reference
* manual for details. Also refer to startup_MKxxxx.s file for each chip
* family to find out the default interrut handler for each device. This
* function will convert the IRQ number to vector number by adding 16 to
* it.
*
*END**************************************************************************/
void interrupt_register_handler(IRQn_Type irqNumber, void (*handler)(void))
{
NVIC_SetVector(irqNumber, (uint32_t)handler);
}
/*FUNCTION**********************************************************************
*
* Function Name : interrupt_enable_global
* Description : Enable system interrupt
* This function will enable the global interrupt by calling the core API
*
*END**************************************************************************/
void interrupt_enable_global(void)
{
/* check and update */
if (g_interrupt_disable_count > 0)
{
g_interrupt_disable_count--;
if (g_interrupt_disable_count > 0)
{
return;
}
/* call core API to enable the global interrupt*/
__enable_irq();
}
}
/*FUNCTION**********************************************************************
*
* Function Name : interrupt_disable_global
* Description : Disnable system interrupt
* This function will disable the global interrupt by calling the core API
*
*END**************************************************************************/
void interrupt_disable_global(void)
{
/* call core API to disable the global interrupt*/
__disable_irq();
/* update counter*/
g_interrupt_disable_count++;
}
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,4 +0,0 @@
INTERRUPT_DRIVER_DIR := $(SDK_ROOT)/platform/drivers/interrupt
SOURCES += $(INTERRUPT_DRIVER_DIR)/src/fsl_interrupt_manager.c
INCLUDES += $(INTERRUPT_DRIVER_DIR)

View File

@ -1,240 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#ifndef __FSL_PIT_DRIVER_H__
#define __FSL_PIT_DRIVER_H__
#include <stdint.h>
#include <stdbool.h>
#include "fsl_pit_hal.h"
/*!
* @addtogroup pit_driver
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*!
* @brief PIT timer configuration structure
*
* Define structure PitConfig and use pit_init_channel() to make necessary
* initializations. You may also use remaining functions for PIT configuration.
*
* @note the timer chain feature is not valid in all devices, please check
* fsl_pit_features.h for accurate setting. If it's not valid, the value set here
* will be bypassed inside function pit_init_channel().
*/
typedef struct PitUserConfig {
bool isInterruptEnabled; /*!< Timer interrupt 0-disable/1-enable*/
bool isTimerChained; /*!< Chained with previous timer, 0-not/1-chained*/
uint32_t periodUs; /*!< Timer period in unit of microseconds*/
} pit_user_config_t;
/*! @brief PIT ISR callback function typedef */
typedef void (*pit_isr_callback_t)(void);
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @name Initialize and Shutdown
* @{
*/
/*!
* @brief Initialize PIT module.
*
* This function must be called before calling all the other PIT driver functions.
* This function un-gates the PIT clock and enables the PIT module. The isRunInDebug
* passed into function will affect all timer channels.
*
* @param isRunInDebug Timers run or stop in debug mode.
* - true: Timers continue to run in debug mode.
* - false: Timers stop in debug mode.
*/
void pit_init_module(bool isRunInDebug);
/*!
* @brief Initialize PIT channel.
*
* This function initialize PIT timers by channel. Pass in timer number and its
* config structure. Timers do not start counting by default after calling this
* function. Function pit_timer_start must be called to start timer counting.
* Call pit_set_timer_period_us to re-set the period.
*
* Here is an example demonstrating how to define a PIT channel config structure:
@code
pit_user_config_t pitTestInit = {
.isInterruptEnabled = true,
// Only takes effect when chain feature is available.
// Otherwise, pass in arbitrary value(true/false).
.isTimerChained = false,
// In unit of microseconds.
.periodUs = 1000,
};
@endcode
*
* @param timer Timer channel number.
* @param config PIT channel configuration structure.
*/
void pit_init_channel(uint32_t timer, const pit_user_config_t * config);
/*!
* @brief Disable PIT module and gate control.
*
* This function disables all PIT interrupts and PIT clock. It then gates the
* PIT clock control. pit_init_module must be called if you want to use PIT again.
*/
void pit_shutdown(void);
/* @} */
/*!
* @name Timer Start and Stop
* @{
*/
/*!
* @brief Start timer counting.
*
* After calling this function, timers load period value, count down to 0 and
* then load the respective start value again. Each time a timer reaches 0,
* it generates a trigger pulse and sets the timeout interrupt flag.
*
* @param timer Timer channel number.
*/
void pit_timer_start(uint32_t timer);
/*!
* @brief Stop timer counting.
*
* This function stops every timer counting. Timers reload their periods
* respectively after the next time they call pit_timer_start.
*
* @param timer Timer channel number.
*/
void pit_timer_stop(uint32_t timer);
/* @} */
/*!
* @name Timer Period
* @{
*/
/*!
* @brief Set timer period in microsecond units.
*
* The period range depends on the frequency of PIT source clock. If the required period
* is out of range, use the lifetime timer, if applicable.
*
* @param timer Timer channel number.
* @param us Timer period in microseconds.
*/
void pit_set_timer_period_us(uint32_t timer, uint32_t us);
/*!
* @brief Read current timer value in microsecond units.
*
* This function returns an absolute time stamp in microsecond units.
* One common use of this function is to measure the running time of a part of
* code. Call this function at both the beginning and end of code; the time
* difference between these two time stamps is the running time (Make sure the
* running time will not exceed the timer period). The time stamp returned is
* up-counting.
*
* @param timer Timer channel number.
* @return Current timer value in microseconds.
*/
uint32_t pit_read_timer_us(uint32_t timer);
#if FSL_FEATURE_PIT_HAS_LIFETIME_TIMER
/*!
* @brief Set lifetime timer period.
*
* Timer 1 must be chained with timer 0 before using the lifetime timer. The period
* range is restricted by "period * pitSourceClock < max of an uint64_t integer",
* or it may cause an overflow and be unable to set the correct period.
*
* @param period Lifetime timer period in microseconds.
*/
void pit_set_lifetime_timer_period_us(uint64_t us);
/*!
* @brief Read current lifetime value in microseconds.
*
* This feature returns an absolute time stamp in microsecond units. The time stamp
* value will not exceed the timer period. The timer is up-counting.
*
* @return Current lifetime timer value in microseconds.
*/
uint64_t pit_read_lifetime_timer_us(void);
#endif /*FSL_FEATURE_PIT_HAS_LIFETIME_TIMER*/
/* @} */
/*!
* @name ISR Callback Function
* @{
*/
/*!
* @brief Register pit isr callback function.
*
* System default ISR interfaces are already defined in fsl_pit_irq.c. Users
* can either edit these ISRs or use this function to register a callback
* function. The default ISR runs the callback function if there is one
* installed.
*
* @param timer Timer channel number.
* @param function Pointer to pit isr callback function.
*/
void pit_register_isr_callback_function(uint32_t timer, pit_isr_callback_t function);
/* @} */
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* __FSL_PIT_DRIVER_H__*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,242 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#include "fsl_pit_driver.h"
#include "fsl_clock_manager.h"
#include "fsl_interrupt_manager.h"
/*******************************************************************************
* Variables
******************************************************************************/
/* pit source clock variable which will be updated in pit_init_module. */
uint64_t pitSourceClock;
/* Table to save PIT IRQ enum numbers defined in CMSIS files. This table is
* defined in fsl_pit_irq.c */
extern IRQn_Type pit_irq_ids[FSL_FEATURE_PIT_TIMER_COUNT];
/*******************************************************************************
* Code
******************************************************************************/
/*FUNCTION**********************************************************************
*
* Function Name : pit_init_module
* Description : Initialize PIT module.
* This function must be called before calling all the other PIT driver functions.
* This function un-gates the PIT clock and enables the PIT module. The isRunInDebug
* passed into function will affect all timer channels.
*
*END**************************************************************************/
void pit_init_module(bool isRunInDebug)
{
uint32_t busClock;
/* Un-gate pit clock*/
clock_manager_set_gate(kClockModulePIT, 0U, true);
/* Enable PIT module clock*/
pit_hal_enable();
/* Set timer run or stop in debug mode*/
pit_hal_configure_timer_run_in_debug(isRunInDebug);
/* Finally, update pit source clock frequency.*/
clock_manager_get_frequency(kBusClock, &busClock);
pitSourceClock = (uint64_t)busClock;
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_init_channel
* Description : Initialize PIT channel.
* This function initialize PIT timers by channel. Pass in timer number and its
* config structure. Timers do not start counting by default after calling this
* function. Function pit_timer_start must be called to start timer counting.
* Call pit_set_timer_period_us to re-set the period.
*
*END**************************************************************************/
void pit_init_channel(uint32_t timer, const pit_user_config_t * config)
{
/* Set timer period.*/
pit_set_timer_period_us(timer, config->periodUs);
#if FSL_FEATURE_PIT_HAS_CHAIN_MODE
/* Configure timer chained or not.*/
pit_hal_configure_timer_chain(timer, config->isTimerChained);
#endif
/* Enable or disable interrupt.*/
pit_hal_configure_interrupt(timer, config->isInterruptEnabled);
/* Configure NVIC*/
if (config->isInterruptEnabled)
{
/* Enable PIT interrupt.*/
interrupt_enable(pit_irq_ids[timer]);
}
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_shutdown
* Description : Disable PIT module and gate control
* This function will disable all PIT interrupts and PIT clock. Then gate the
* PIT clock control. pit_init must be called in order to use PIT again.
*
*END**************************************************************************/
void pit_shutdown(void)
{
uint32_t i;
/* Disable all PIT interrupts. */
for (i=0; i < FSL_FEATURE_PIT_TIMER_COUNT; i++)
{
pit_hal_configure_interrupt(i, false);
interrupt_disable(pit_irq_ids[i]);
}
/* Disable PIT module clock*/
pit_hal_disable();
/* Gate PIT clock control*/
clock_manager_set_gate(kClockModulePIT, 0U, false);
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_timer_start
* Description : Start timer counting.
* After calling this function, timers load period value, count down to 0 and
* then load the respective start value again. Each time a timer reaches 0,
* it will generate a trigger pulse and set the timeout interrupt flag.
*
*END**************************************************************************/
void pit_timer_start(uint32_t timer)
{
pit_hal_timer_start(timer);
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_timer_stop
* Description : Stop timer counting.
* This function will stop every timer counting. Timers will reload their periods
* respectively after calling pit_timer_start next time.
*
*END**************************************************************************/
void pit_timer_stop(uint32_t timer)
{
pit_hal_timer_stop(timer);
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_set_timer_period_us
* Description : Set timer period in microseconds unit.
* The period range depends on the frequency of PIT source clock. If required
* period is out the range, try to use lifetime timer if applicable.
*
*END**************************************************************************/
void pit_set_timer_period_us(uint32_t timer, uint32_t us)
{
/* Calculate the count value, assign it to timer counter register.*/
uint32_t count = (uint32_t)(us * pitSourceClock / 1000000U - 1U);
pit_hal_set_timer_period_count(timer, count);
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_read_timer_us
* Description : Read current timer value in microseconds unit.
* This function will return an absolute time stamp in the unit of microseconds.
* One common use of this function is to measure the running time of part of
* code. Just call this function at both the beginning and end of code, the time
* difference between these two time stamp will be the running time (Need to
* make sure the running time will not exceed the timer period). Also, the time
* stamp returned is up-counting.
*
*END**************************************************************************/
uint32_t pit_read_timer_us(uint32_t timer)
{
/* Get current timer count, and reverse it to up-counting.*/
uint64_t currentTime = (~pit_hal_read_timer_count(timer));
/* Convert count numbers to microseconds unit.*/
currentTime = (currentTime * 1000000U) / pitSourceClock;
return (uint32_t)currentTime;
}
#if FSL_FEATURE_PIT_HAS_LIFETIME_TIMER
/*FUNCTION**********************************************************************
*
* Function Name : pit_set_lifetime_timer_period_us
* Description : Set lifetime timer period (Timers must be chained).
* Timer 1 must be chained with timer 0 before using lifetime timer. The period
* range is restricted by "period * pitSourceClock < max of an uint64_t integer",
* or it may cause a overflow and is not able to set correct period.
*
*END**************************************************************************/
void pit_set_lifetime_timer_period_us(uint64_t us)
{
uint64_t lifeTimeCount;
/* Calculate the counter value.*/
lifeTimeCount = us * pitSourceClock / 1000000U - 1U;
/* Assign to timers.*/
pit_hal_set_timer_period_count(0U, (uint32_t)lifeTimeCount);
pit_hal_set_timer_period_count(1U, (uint32_t)(lifeTimeCount >> 32U));
}
/*FUNCTION**********************************************************************
*
* Function Name : pit_read_lifetime_timer_us
* Description : Read current lifetime value in microseconds unit.
* Return an absolute time stamp in the unit of microseconds. The time stamp
* value will not exceed the timer period. Also, the timer is up-counting.
*
*END**************************************************************************/
uint64_t pit_read_lifetime_timer_us(void)
{
/* Get current lifetime timer count, and reverse it to up-counting.*/
uint64_t currentTime = (~pit_hal_read_lifetime_timer_count());
/* Convert count numbers to microseconds unit.*/
/* Note: using currentTime * 1000 rather than 1000000 to avoid short time overflow. */
return currentTime = (currentTime * 1000U) / (pitSourceClock / 1000U);
}
#endif /* FSL_FEATURE_PIT_HAS_LIFETIME_TIMER*/
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,169 +0,0 @@
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#include <stdlib.h>
#include <assert.h>
#include "fsl_pit_driver.h"
/*!
* @addtogroup pit_irq
* @{
*/
/*******************************************************************************
* Variables
******************************************************************************/
#if defined (KL25Z4_SERIES)
/*!
* @brief Table to save PIT IRQ enum numbers defined in CMSIS files.
*
* They are used by pit_init_channel to enable or disable PIT interrupts. This table is
* indexed by channel number which could return PIT IRQ numbers.
*/
const IRQn_Type pit_irq_ids[FSL_FEATURE_PIT_TIMER_COUNT] =
{
PIT_IRQn, PIT_IRQn
};
#elif defined (K64F12_SERIES) || defined (K70F12_SERIES) || defined (K22F51212_SERIES)
const IRQn_Type pit_irq_ids[FSL_FEATURE_PIT_TIMER_COUNT] =
{
PIT0_IRQn, PIT1_IRQn, PIT2_IRQn, PIT3_IRQn
};
#endif
/*!
* @brief Function table to save PIT isr callback function pointers.
*
* Call pit_register_isr_callback_function to install isr callback functions.
*/
pit_isr_callback_t pit_isr_callback_table[FSL_FEATURE_PIT_TIMER_COUNT] = {NULL};
/*******************************************************************************
* Code
******************************************************************************/
#if defined (KL25Z4_SERIES)
/*!
* @brief System default IRQ handler defined in startup code.
*
* Users can either edit this handler or define a callback function. Furthermore,
* interrupt manager could be used to re-map the IRQ handler to another function.
*/
void PIT_IRQHandler(void)
{
uint32_t i;
for(i=0; i < FSL_FEATURE_PIT_TIMER_COUNT; i++)
{
/* Run callback function if it exists.*/
if (pit_isr_callback_table[i])
{
(*pit_isr_callback_table[i])();
}
/* Clear interrupt flag.*/
pit_hal_clear_interrupt_flag(i);
}
}
#elif defined (K64F12_SERIES) || defined (K70F12_SERIES) || defined (K22F51212_SERIES)
void PIT0_IRQHandler(void)
{
/* Run callback function if it exists.*/
if (pit_isr_callback_table[0])
{
(*pit_isr_callback_table[0])();
}
/* Clear interrupt flag.*/
pit_hal_clear_interrupt_flag(0);
}
void PIT1_IRQHandler(void)
{
/* Run callback function if it exists.*/
if (pit_isr_callback_table[1])
{
(*pit_isr_callback_table[1])();
}
/* Clear interrupt flag.*/
pit_hal_clear_interrupt_flag(1);
}
void PIT2_IRQHandler(void)
{
/* Run callback function if it exists.*/
if (pit_isr_callback_table[2])
{
(*pit_isr_callback_table[2])();
}
/* Clear interrupt flag.*/
pit_hal_clear_interrupt_flag(2);
}
void PIT3_IRQHandler(void)
{
/* Run callback function if it exists.*/
if (pit_isr_callback_table[3])
{
(*pit_isr_callback_table[3])();
}
/* Clear interrupt flag.*/
pit_hal_clear_interrupt_flag(3);
}
#endif
/*! @} */
/*FUNCTION**********************************************************************
*
* Function Name : pit_register_isr_callback_function
* Description : Register pit isr callback function.
* System default ISR interfaces are already defined in fsl_pit_irq.c. Users
* can either edit these ISRs or use this function to register a callback
* function. The default ISR will run the callback function it there is one
* installed here.
*END**************************************************************************/
void pit_register_isr_callback_function(uint32_t timer, pit_isr_callback_t function)
{
assert(timer < FSL_FEATURE_PIT_TIMER_COUNT);
assert(function != NULL);
pit_isr_callback_table[timer] = function;
}
/*******************************************************************************
* EOF
******************************************************************************/

View File

@ -1,3 +0,0 @@
PIT_DRIVER_DIR := $(SDK_ROOT)/platform/drivers/pit
SOURCES += $(wildcard $(PIT_DRIVER_DIR)/src/*.c)
INCLUDES += $(PIT_DRIVER_DIR)