/******************************************************************************
*
* Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 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.
*
* Neither the name of Texas Instruments Incorporated 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
* OWNER 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 OPENOCD_LOADERS_FLASH_CC26XX_HW_REGS_H
#define OPENOCD_LOADERS_FLASH_CC26XX_HW_REGS_H
/******************************************************************************
*
* Macros for direct hardware access.
*
* If using these macros the programmer should be aware of any limitations to
* the address accessed i.e. if it supports word and/or byte access.
*
******************************************************************************/
/* Word (32 bit) access to address x */
/* Read example : my32BitVar = HWREG(base_addr + offset) ; */
/* Write example : HWREG(base_addr + offset) = my32BitVar ; */
#define HWREG(x) (*((volatile unsigned long *)(x)))
/* Half word (16 bit) access to address x */
/* Read example : my16BitVar = HWREGH(base_addr + offset) ; */
/* Write example : HWREGH(base_addr + offset) = my16BitVar ; */
#define HWREGH(x) (*((volatile unsigned short *)(x)))
/* Byte (8 bit) access to address x */
/* Read example : my8BitVar = HWREGB(base_addr + offset) ; */
/* Write example : HWREGB(base_addr + offset) = my8BitVar ; */
#define HWREGB(x) (*((volatile unsigned char *)(x)))
/******************************************************************************
*
* Macro for access to bit-band supported addresses via the bit-band region.
*
* Macro calculates the corresponding address to access in the bit-band region
* based on the actual address of the memory/register and the bit number.
*
* Do NOT use this macro to access the bit-band region directly!
*
******************************************************************************/
/* Bit-band access to address x bit number b using word access (32 bit) */
#define HWREGBITW(x, b) \
HWREG(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \
(((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2))
/******************************************************************************
*
* Memory mapped components base address definitions
*
******************************************************************************/
#define FLASH_BASE 0x40030000
#define FLASH_CFG_BASE 0x50000000
#define AON_PMCTL_BASE 0x40090000
/******************************************************************************
*
* This section defines the register offsets of FLASH component
*
******************************************************************************/
/* FMC and Efuse Status */
#define FLASH_O_STAT 0x0000001C
/* Configuration */
#define FLASH_O_CFG 0x00000024
/* Flash Size Configuration */
#define FLASH_O_FLASH_SIZE 0x0000002C
/* Firmware Lock */
#define FLASH_O_FWLOCK 0x0000003C
/* Firmware Flags */
#define FLASH_O_FWFLAG 0x00000040
/* FMC Read Control */
#define FLASH_O_FRDCTL 0x00002000
/* FMC Bank Protection */
#define FLASH_O_FBPROT 0x00002030
/* FMC Bank Sector Enable */
#define FLASH_O_FBSE 0x00002034
/* FMC Module Access Control */
#define FLASH_O_FMAC 0x00002050
/* FMC Module Status */
#define FLASH_O_FMSTAT 0x00002054
/* FMC Flash Lock */
#define FLASH_O_FLOCK 0x00002064
/* FMC VREADCT Trim */
#define FLASH_O_FVREADCT 0x00002080
/* FMC VHVCT1 Trim */
#define FLASH_O_FVHVCT1 0x00002084
/* FMC VHVCT2 Trim */
#define FLASH_O_FVHVCT2 0x00002088
/* FMC VNVCT Trim */
#define FLASH_O_FVNVCT 0x00002090
/* FMC VSL_P Trim */
#define FLASH_O_FVSLP 0x00002094
/* FMC VWLCT Trim */
#define FLASH_O_FVWLCT 0x00002098
/* FMC Sequential Pump Information */
#define FLASH_O_FSEQPMP 0x000020A8
/* FMC FSM Command */
#define FLASH_O_FSM_CMD 0x0000220C
/* FMC FSM Program/Erase Operation Setup */
#define FLASH_O_FSM_PE_OSU 0x00002210
/* FMC FSM Voltage Status Setup */
#define FLASH_O_FSM_VSTAT 0x00002214
/* FMC FSM Program/Era