2011-02-08 06:40:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the libopencm3 project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
|
|
|
|
*
|
2012-03-02 10:23:11 +00:00
|
|
|
* This library is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
2011-02-08 06:40:16 +00:00
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2012-03-02 10:23:11 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2011-02-08 06:40:16 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2012-03-02 10:23:11 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2011-02-08 06:40:16 +00:00
|
|
|
*
|
2012-03-02 10:23:11 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2011-02-08 06:40:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBOPENCM3_CM3_FPB_H
|
|
|
|
#define LIBOPENCM3_CM3_FPB_H
|
|
|
|
|
2018-09-09 15:21:02 +00:00
|
|
|
/**
|
|
|
|
* @defgroup cm_fpb Cortex-M Flash Patch and Breakpoint (FPB) unit
|
|
|
|
* @ingroup CM3_defines
|
|
|
|
* @{
|
|
|
|
*/
|
2011-02-09 00:11:16 +00:00
|
|
|
|
2013-07-22 16:43:16 +00:00
|
|
|
/* Those defined only on ARMv7 and above */
|
2016-11-05 20:54:09 +00:00
|
|
|
#if !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__)
|
2013-07-22 16:43:16 +00:00
|
|
|
#error "Flash Patch and Breakpoint not available in CM0"
|
|
|
|
#endif
|
|
|
|
|
2011-02-09 00:11:16 +00:00
|
|
|
/* Note: We always use "FPB" as abbreviation, docs sometimes use only "FP". */
|
|
|
|
|
|
|
|
/* --- FPB registers ------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Flash Patch Control (FPB_CTRL) */
|
2011-02-09 00:31:16 +00:00
|
|
|
#define FPB_CTRL MMIO32(FPB_BASE + 0)
|
2011-02-09 00:11:16 +00:00
|
|
|
|
|
|
|
/* Flash Patch Remap (FPB_REMAP) */
|
2011-02-09 00:31:16 +00:00
|
|
|
#define FPB_REMAP MMIO32(FPB_BASE + 4)
|
2011-02-09 00:11:16 +00:00
|
|
|
|
|
|
|
/* Flash Patch Comparator (FPB_COMPx) */
|
2013-06-13 04:37:55 +00:00
|
|
|
#define FPB_COMP (&MMIO32(FPB_BASE + 8))
|
2011-02-08 06:40:16 +00:00
|
|
|
|
2013-11-18 17:48:29 +00:00
|
|
|
/* CoreSight Lock Status Register for this peripheral */
|
2019-10-18 22:29:13 +00:00
|
|
|
#define FPB_LSR MMIO32(FPB_BASE + CORESIGHT_LSR_OFFSET)
|
2013-11-18 17:48:29 +00:00
|
|
|
/* CoreSight Lock Access Register for this peripheral */
|
2019-10-18 22:29:13 +00:00
|
|
|
#define FPB_LAR MMIO32(FPB_BASE + CORESIGHT_LAR_OFFSET)
|
2013-11-18 17:48:29 +00:00
|
|
|
|
|
|
|
|
2011-02-09 00:11:16 +00:00
|
|
|
/* TODO: PID, CID */
|
|
|
|
|
|
|
|
/* --- FPB_CTRL values ----------------------------------------------------- */
|
|
|
|
|
2011-02-09 00:31:16 +00:00
|
|
|
/* Bits [31:15]: Reserved, read as zero, writes ignored */
|
|
|
|
|
|
|
|
#define FPB_CTRL_NUM_CODE2_MASK (0x7 << 12)
|
|
|
|
|
|
|
|
#define FPB_CTRL_NUM_LIT_MASK (0xf << 8)
|
|
|
|
|
|
|
|
#define FPB_CTRL_NUM_CODE1_MASK (0xf << 4)
|
|
|
|
|
|
|
|
/* Bits [3:2]: Reserved */
|
|
|
|
|
|
|
|
#define FPB_CTRL_KEY (1 << 1)
|
|
|
|
|
|
|
|
#define FPB_CTRL_ENABLE (1 << 0)
|
2011-02-08 06:40:16 +00:00
|
|
|
|
2011-02-09 00:11:16 +00:00
|
|
|
/* --- FPB_REMAP values ---------------------------------------------------- */
|
|
|
|
|
|
|
|
/* TODO */
|
|
|
|
|
|
|
|
/* --- FPB_COMPx values ---------------------------------------------------- */
|
|
|
|
|
2011-02-09 00:31:16 +00:00
|
|
|
#define FPB_COMP_REPLACE_REMAP (0x0 << 30)
|
|
|
|
#define FPB_COMP_REPLACE_BREAK_LOWER (0x1 << 30)
|
|
|
|
#define FPB_COMP_REPLACE_BREAK_UPPER (0x2 << 30)
|
|
|
|
#define FPB_COMP_REPLACE_BREAK_BOTH (0x3 << 30)
|
|
|
|
#define FPB_COMP_REPLACE_MASK (0x3 << 30)
|
|
|
|
|
|
|
|
/* Bit 29: Reserved */
|
|
|
|
|
|
|
|
/* TODO */
|
|
|
|
|
|
|
|
/* Bit 1: Reserved */
|
|
|
|
|
|
|
|
#define FPB_COMP_ENABLE (1 << 0)
|
2011-02-08 06:40:16 +00:00
|
|
|
|
2018-09-09 15:21:02 +00:00
|
|
|
/**@}*/
|
|
|
|
|
2011-02-08 06:40:16 +00:00
|
|
|
#endif
|