OpenOCD
xmc4xxx.c File Reference
Include dependency graph for xmc4xxx.c:

Go to the source code of this file.

Data Structures

struct  xmc4xxx_command_seq
 
struct  xmc4xxx_flash_bank
 

Macros

#define FCON_DCF   (17)
 
#define FCON_DCF_MASK   (0x01 << FCON_DCF)
 
#define FCON_DDF   (18)
 
#define FCON_DDF_MASK   (0x01 << FCON_DDF)
 
#define FCON_EOBM   (31)
 
#define FCON_EOBM_MASK   (0x01 << FCON_EOBM)
 
#define FCON_ESLDIS   (14)
 
#define FCON_ESLDIS_MASK   (0x01 << FCON_ESLDIS)
 
#define FCON_IDLE   (13)
 
#define FCON_IDLE_MASK   (0x01 << FCON_IDLE)
 
#define FCON_PFDBERM   (29)
 
#define FCON_PFDBERM_MASK   (0x01 << FCON_PFDBERM)
 
#define FCON_PFSBERM   (27)
 
#define FCON_PFSBERM_MASK   (0x01 << FCON_PFSBERM)
 
#define FCON_PROERM   (26)
 
#define FCON_PROERM_MASK   (0x01 << FCON_PROERM)
 
#define FCON_RPA   (16)
 
#define FCON_RPA_MASK   (0x01 << FCON_RPA)
 
#define FCON_SLEEP   (15)
 
#define FCON_SLEEP_MASK   (0x01 << FCON_SLEEP)
 
#define FCON_SQERM   (25)
 
#define FCON_SQERM_MASK   (0x01 << FCON_SQERM)
 
#define FCON_VOPERM   (24)
 
#define FCON_VOPERM_MASK   (0x01 << FCON_VOPERM)
 
#define FCON_WSECPF   (4)
 
#define FCON_WSECPF_MASK   (0x01 << FCON_WSECPF)
 
#define FCON_WSPFLASH   (0)
 
#define FCON_WSPFLASH_MASK   (0x0f << FCON_WSPFLASH)
 
#define FLASH_CMD_CLEAR_STATUS   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_ENTER_PAGEMODE   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_ERASE_1   0x0C005554
 
#define FLASH_CMD_ERASE_2   0x0C00AAA8
 
#define FLASH_CMD_ERASE_3   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_ERASE_4   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_ERASE_5   FLASH_CMD_ERASE_2
 
#define FLASH_CMD_LOAD_PAGE_1   0x0C0055F0
 
#define FLASH_CMD_LOAD_PAGE_2   0x0C0055F4
 
#define FLASH_CMD_TEMP_UNPROT_1   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_TEMP_UNPROT_2   FLASH_CMD_ERASE_2
 
#define FLASH_CMD_TEMP_UNPROT_3   0x0C00553C
 
#define FLASH_CMD_TEMP_UNPROT_4   FLASH_CMD_ERASE_2
 
#define FLASH_CMD_TEMP_UNPROT_5   FLASH_CMD_ERASE_2
 
#define FLASH_CMD_TEMP_UNPROT_6   0x0C005558
 
#define FLASH_CMD_WRITE_PAGE_1   FLASH_CMD_ERASE_1
 
#define FLASH_CMD_WRITE_PAGE_2   FLASH_CMD_ERASE_2
 
#define FLASH_CMD_WRITE_PAGE_3   FLASH_CMD_ERASE_1
 
#define FLASH_ID_XMC4100_4200   0x9C
 
#define FLASH_ID_XMC4300_XMC4700_4800   0x92
 
#define FLASH_ID_XMC4400   0x9F
 
#define FLASH_ID_XMC4500   0xA2
 
#define FLASH_OP_TIMEOUT   5000
 
#define FLASH_PROTECT_CONFIRMATION_CODE   0x8AFE15C3
 
#define FLASH_REG_BASE   0x58000000
 
#define FLASH_REG_FLASH0_FCON   (FLASH_REG_BASE | 0x2014)
 
#define FLASH_REG_FLASH0_FSR   (FLASH_REG_BASE | 0x2010)
 
#define FLASH_REG_FLASH0_ID   (FLASH_REG_BASE | 0x2008)
 
#define FLASH_REG_FLASH0_MARP   (FLASH_REG_BASE | 0x2018)
 
#define FLASH_REG_FLASH0_PROCON0   (FLASH_REG_BASE | 0x2020)
 
#define FLASH_REG_FLASH0_PROCON1   (FLASH_REG_BASE | 0x2024)
 
#define FLASH_REG_FLASH0_PROCON2   (FLASH_REG_BASE | 0x2028)
 
#define FLASH_REG_PMU_ID   (FLASH_REG_BASE | 0x0508)
 
#define FLASH_REG_PREF_PCON   (FLASH_REG_BASE | 0x4000)
 
#define FSR_ERASE   (5)
 
#define FSR_ERASE_MASK   (0x01 << FSR_ERASE)
 
#define FSR_FABUSY   (1)
 
#define FSR_FABUSY_MASK   (0x01 << FSR_FABUSY)
 
#define FSR_PBUSY   (0)
 
#define FSR_PBUSY_MASK   (0x01 << FSR_PBUSY)
 
#define FSR_PFDBER   (14)
 
#define FSR_PFDBER_MASK   (0x01 << FSR_PFDBER)
 
#define FSR_PFOPER   (8)
 
#define FSR_PFOPER_MASK   (0x01 << FSR_PFOPER)
 
#define FSR_PFPAGE   (6)
 
#define FSR_PFPAGE_MASK   (0x01 << FSR_PFPAGE)
 
#define FSR_PFSBER   (12)
 
#define FSR_PFSBER_MASK   (0x01 << FSR_PFSBER)
 
#define FSR_PROER   (11)
 
#define FSR_PROER_MASK   (0x01 << FSR_PROER)
 
#define FSR_PROG   (4)
 
#define FSR_PROG_MASK   (0x01 << FSR_PROG)
 
#define FSR_PROIN   (16)
 
#define FSR_PROIN_MASK   (0x01 << FSR_PROIN)
 
#define FSR_RPRODIS   (19)
 
#define FSR_RPRODIS_MASK   (0x01 << FSR_RPRODIS)
 
#define FSR_RPROIN   (18)
 
#define FSR_RPROIN_MASK   (0x01 << FSR_RPROIN)
 
#define FSR_SLM   (28)
 
#define FSR_SLM_MASK   (0x01 << FSR_SLM)
 
#define FSR_SQER   (10)
 
#define FSR_SQER_MASK   (0x01 << FSR_SQER)
 
#define FSR_VER   (31)
 
#define FSR_VER_MASK   (0x01 << FSR_VER)
 
#define FSR_WPRODIS0   (25)
 
#define FSR_WPRODIS0_MASK   (0x01 << FSR_WPRODIS0)
 
#define FSR_WPRODIS1   (26)
 
#define FSR_WPRODIS1_MASK   (0x01 << FSR_WPRODIS1)
 
#define FSR_WPROIN0   (21)
 
#define FSR_WPROIN0_MASK   (0x01 << FSR_WPROIN0)
 
#define FSR_WPROIN1   (22)
 
#define FSR_WPROIN1_MASK   (0x01 << FSR_WPROIN1)
 
#define FSR_WPROIN2   (23)
 
#define FSR_WPROIN2_MASK   (0x01 << FSR_WPROIN2)
 
#define MARP_MARGIN   (0)
 
#define MARP_MARGIN_MASK   (0x0f << MARP_MARGIN)
 
#define MARP_TRAPDIS   (15)
 
#define MARP_TRAPDIS_MASK   (0x01 << MARP_TRAPDIS)
 
#define MAX_XMC_SECTORS   12
 
#define PCON_IBYP   (1 << 0)
 
#define PCON_IINV   (1 << 1)
 
#define PFLASH_BASE   0x0C000000
 
#define PMU_MOD_NO_MASK   0xFFFF0000
 
#define PMU_MOD_REV_MASK   0xFF
 
#define PMU_MOD_TYPE_MASK   0xFF00
 
#define PROCON_RPRO   (15)
 
#define PROCON_RPRO_MASK   (0x01 << PROCON_RPRO)
 
#define PROCON_S0L   (0)
 
#define PROCON_S0L_MASK   (0x01 << PROCON_S0L)
 
#define PROCON_S10_S11L   (10)
 
#define PROCON_S10_S11L_MASK   (0x01 << PROCON_S10_S11L)
 
#define PROCON_S1L   (1)
 
#define PROCON_S1L_MASK   (0x01 << PROCON_S1L)
 
#define PROCON_S2L   (2)
 
#define PROCON_S2L_MASK   (0x01 << PROCON_S2L)
 
#define PROCON_S3L   (3)
 
#define PROCON_S3L_MASK   (0x01 << PROCON_S3L)
 
#define PROCON_S4L   (4)
 
#define PROCON_S4L_MASK   (0x01 << PROCON_S4L)
 
#define PROCON_S5L   (5)
 
#define PROCON_S5L_MASK   (0x01 << PROCON_S5L)
 
#define PROCON_S6L   (6)
 
#define PROCON_S6L_MASK   (0x01 << PROCON_S6L)
 
#define PROCON_S7L   (7)
 
#define PROCON_S7L_MASK   (0x01 << PROCON_S7L)
 
#define PROCON_S8L   (8)
 
#define PROCON_S8L_MASK   (0x01 << PROCON_S8L)
 
#define PROCON_S9L   (9)
 
#define PROCON_S9L_MASK   (0x01 << PROCON_S9L)
 
#define SCU_ID_CHIP   0x04
 
#define SCU_REG_BASE   0x50004000
 
#define UCB0_BASE   0x00000000
 
#define UCB1_BASE   0x00000400
 
#define UCB2_BASE   0x00000800
 

Functions

 COMMAND_HANDLER (xmc4xxx_handle_flash_password_command)
 
 COMMAND_HANDLER (xmc4xxx_handle_flash_unprotect_command)
 
 FLASH_BANK_COMMAND_HANDLER (xmc4xxx_flash_bank_command)
 
static int xmc4xxx_clear_flash_status (struct flash_bank *bank)
 
static int xmc4xxx_enter_page_mode (struct flash_bank *bank)
 
static int xmc4xxx_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int xmc4xxx_erase_sector (struct flash_bank *bank, uint32_t address, bool user_config)
 
static int xmc4xxx_flash_protect (struct flash_bank *bank, int level, bool read_protect, unsigned int first, unsigned int last)
 
static int xmc4xxx_flash_unprotect (struct flash_bank *bank, int32_t level)
 
static int xmc4xxx_get_flash_status (struct flash_bank *bank, uint32_t *status)
 
static int xmc4xxx_get_info_command (struct flash_bank *bank, struct command_invocation *cmd)
 
static int xmc4xxx_get_sector_start_addr (struct flash_bank *bank, unsigned int sector, uint32_t *ret_addr)
 
static int xmc4xxx_load_bank_layout (struct flash_bank *bank)
 
static int xmc4xxx_probe (struct flash_bank *bank)
 
static int xmc4xxx_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int xmc4xxx_protect_check (struct flash_bank *bank)
 
static int xmc4xxx_temp_unprotect (struct flash_bank *bank, int user_level)
 
static int xmc4xxx_wait_status_busy (struct flash_bank *bank, int timeout)
 
static int xmc4xxx_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int xmc4xxx_write_command_sequence (struct flash_bank *bank, struct xmc4xxx_command_seq *seq, int seq_len)
 
static int xmc4xxx_write_page (struct flash_bank *bank, const uint8_t *pg_buf, uint32_t offset, bool user_config)
 

Variables

static const unsigned int sector_capacity_12 [12]
 
static const unsigned int sector_capacity_16 [16]
 
static const unsigned int sector_capacity_8 [8]
 
static const unsigned int sector_capacity_9 [9]
 
static const struct command_registration xmc4xxx_command_handlers []
 
static const struct command_registration xmc4xxx_exec_command_handlers []
 
const struct flash_driver xmc4xxx_flash
 

Macro Definition Documentation

◆ FCON_DCF

#define FCON_DCF   (17)

Definition at line 107 of file xmc4xxx.c.

◆ FCON_DCF_MASK

#define FCON_DCF_MASK   (0x01 << FCON_DCF)

Definition at line 122 of file xmc4xxx.c.

◆ FCON_DDF

#define FCON_DDF   (18)

Definition at line 108 of file xmc4xxx.c.

◆ FCON_DDF_MASK

#define FCON_DDF_MASK   (0x01 << FCON_DDF)

Definition at line 123 of file xmc4xxx.c.

◆ FCON_EOBM

#define FCON_EOBM   (31)

Definition at line 114 of file xmc4xxx.c.

◆ FCON_EOBM_MASK

#define FCON_EOBM_MASK   (0x01 << FCON_EOBM)

Definition at line 129 of file xmc4xxx.c.

◆ FCON_ESLDIS

#define FCON_ESLDIS   (14)

Definition at line 104 of file xmc4xxx.c.

◆ FCON_ESLDIS_MASK

#define FCON_ESLDIS_MASK   (0x01 << FCON_ESLDIS)

Definition at line 119 of file xmc4xxx.c.

◆ FCON_IDLE

#define FCON_IDLE   (13)

Definition at line 103 of file xmc4xxx.c.

◆ FCON_IDLE_MASK

#define FCON_IDLE_MASK   (0x01 << FCON_IDLE)

Definition at line 118 of file xmc4xxx.c.

◆ FCON_PFDBERM

#define FCON_PFDBERM   (29)

Definition at line 113 of file xmc4xxx.c.

◆ FCON_PFDBERM_MASK

#define FCON_PFDBERM_MASK   (0x01 << FCON_PFDBERM)

Definition at line 128 of file xmc4xxx.c.

◆ FCON_PFSBERM

#define FCON_PFSBERM   (27)

Definition at line 112 of file xmc4xxx.c.

◆ FCON_PFSBERM_MASK

#define FCON_PFSBERM_MASK   (0x01 << FCON_PFSBERM)

Definition at line 127 of file xmc4xxx.c.

◆ FCON_PROERM

#define FCON_PROERM   (26)

Definition at line 111 of file xmc4xxx.c.

◆ FCON_PROERM_MASK

#define FCON_PROERM_MASK   (0x01 << FCON_PROERM)

Definition at line 126 of file xmc4xxx.c.

◆ FCON_RPA

#define FCON_RPA   (16)

Definition at line 106 of file xmc4xxx.c.

◆ FCON_RPA_MASK

#define FCON_RPA_MASK   (0x01 << FCON_RPA)

Definition at line 121 of file xmc4xxx.c.

◆ FCON_SLEEP

#define FCON_SLEEP   (15)

Definition at line 105 of file xmc4xxx.c.

◆ FCON_SLEEP_MASK

#define FCON_SLEEP_MASK   (0x01 << FCON_SLEEP)

Definition at line 120 of file xmc4xxx.c.

◆ FCON_SQERM

#define FCON_SQERM   (25)

Definition at line 110 of file xmc4xxx.c.

◆ FCON_SQERM_MASK

#define FCON_SQERM_MASK   (0x01 << FCON_SQERM)

Definition at line 125 of file xmc4xxx.c.

◆ FCON_VOPERM

#define FCON_VOPERM   (24)

Definition at line 109 of file xmc4xxx.c.

◆ FCON_VOPERM_MASK

#define FCON_VOPERM_MASK   (0x01 << FCON_VOPERM)

Definition at line 124 of file xmc4xxx.c.

◆ FCON_WSECPF

#define FCON_WSECPF   (4)

Definition at line 102 of file xmc4xxx.c.

◆ FCON_WSECPF_MASK

#define FCON_WSECPF_MASK   (0x01 << FCON_WSECPF)

Definition at line 117 of file xmc4xxx.c.

◆ FCON_WSPFLASH

#define FCON_WSPFLASH   (0)

Definition at line 101 of file xmc4xxx.c.

◆ FCON_WSPFLASH_MASK

#define FCON_WSPFLASH_MASK   (0x0f << FCON_WSPFLASH)

Definition at line 116 of file xmc4xxx.c.

◆ FLASH_CMD_CLEAR_STATUS

#define FLASH_CMD_CLEAR_STATUS   FLASH_CMD_ERASE_1

Definition at line 192 of file xmc4xxx.c.

◆ FLASH_CMD_ENTER_PAGEMODE

#define FLASH_CMD_ENTER_PAGEMODE   FLASH_CMD_ERASE_1

Definition at line 194 of file xmc4xxx.c.

◆ FLASH_CMD_ERASE_1

#define FLASH_CMD_ERASE_1   0x0C005554

Definition at line 185 of file xmc4xxx.c.

◆ FLASH_CMD_ERASE_2

#define FLASH_CMD_ERASE_2   0x0C00AAA8

Definition at line 186 of file xmc4xxx.c.

◆ FLASH_CMD_ERASE_3

#define FLASH_CMD_ERASE_3   FLASH_CMD_ERASE_1

Definition at line 187 of file xmc4xxx.c.

◆ FLASH_CMD_ERASE_4

#define FLASH_CMD_ERASE_4   FLASH_CMD_ERASE_1

Definition at line 188 of file xmc4xxx.c.

◆ FLASH_CMD_ERASE_5

#define FLASH_CMD_ERASE_5   FLASH_CMD_ERASE_2

Definition at line 189 of file xmc4xxx.c.

◆ FLASH_CMD_LOAD_PAGE_1

#define FLASH_CMD_LOAD_PAGE_1   0x0C0055F0

Definition at line 196 of file xmc4xxx.c.

◆ FLASH_CMD_LOAD_PAGE_2

#define FLASH_CMD_LOAD_PAGE_2   0x0C0055F4

Definition at line 197 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_1

#define FLASH_CMD_TEMP_UNPROT_1   FLASH_CMD_ERASE_1

Definition at line 204 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_2

#define FLASH_CMD_TEMP_UNPROT_2   FLASH_CMD_ERASE_2

Definition at line 205 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_3

#define FLASH_CMD_TEMP_UNPROT_3   0x0C00553C

Definition at line 206 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_4

#define FLASH_CMD_TEMP_UNPROT_4   FLASH_CMD_ERASE_2

Definition at line 207 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_5

#define FLASH_CMD_TEMP_UNPROT_5   FLASH_CMD_ERASE_2

Definition at line 208 of file xmc4xxx.c.

◆ FLASH_CMD_TEMP_UNPROT_6

#define FLASH_CMD_TEMP_UNPROT_6   0x0C005558

Definition at line 209 of file xmc4xxx.c.

◆ FLASH_CMD_WRITE_PAGE_1

#define FLASH_CMD_WRITE_PAGE_1   FLASH_CMD_ERASE_1

Definition at line 199 of file xmc4xxx.c.

◆ FLASH_CMD_WRITE_PAGE_2

#define FLASH_CMD_WRITE_PAGE_2   FLASH_CMD_ERASE_2

Definition at line 200 of file xmc4xxx.c.

◆ FLASH_CMD_WRITE_PAGE_3

#define FLASH_CMD_WRITE_PAGE_3   FLASH_CMD_ERASE_1

Definition at line 201 of file xmc4xxx.c.

◆ FLASH_ID_XMC4100_4200

#define FLASH_ID_XMC4100_4200   0x9C

Definition at line 176 of file xmc4xxx.c.

◆ FLASH_ID_XMC4300_XMC4700_4800

#define FLASH_ID_XMC4300_XMC4700_4800   0x92

Definition at line 175 of file xmc4xxx.c.

◆ FLASH_ID_XMC4400

#define FLASH_ID_XMC4400   0x9F

Definition at line 177 of file xmc4xxx.c.

◆ FLASH_ID_XMC4500

#define FLASH_ID_XMC4500   0xA2

Definition at line 174 of file xmc4xxx.c.

◆ FLASH_OP_TIMEOUT

#define FLASH_OP_TIMEOUT   5000

Definition at line 180 of file xmc4xxx.c.

◆ FLASH_PROTECT_CONFIRMATION_CODE

#define FLASH_PROTECT_CONFIRMATION_CODE   0x8AFE15C3

Definition at line 171 of file xmc4xxx.c.

◆ FLASH_REG_BASE

#define FLASH_REG_BASE   0x58000000

Definition at line 33 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_FCON

#define FLASH_REG_FLASH0_FCON   (FLASH_REG_BASE | 0x2014)

Definition at line 99 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_FSR

#define FLASH_REG_FLASH0_FSR   (FLASH_REG_BASE | 0x2010)

Definition at line 54 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_ID

#define FLASH_REG_FLASH0_ID   (FLASH_REG_BASE | 0x2008)

Definition at line 51 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_MARP

#define FLASH_REG_FLASH0_MARP   (FLASH_REG_BASE | 0x2018)

Definition at line 132 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_PROCON0

#define FLASH_REG_FLASH0_PROCON0   (FLASH_REG_BASE | 0x2020)

Definition at line 141 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_PROCON1

#define FLASH_REG_FLASH0_PROCON1   (FLASH_REG_BASE | 0x2024)

Definition at line 142 of file xmc4xxx.c.

◆ FLASH_REG_FLASH0_PROCON2

#define FLASH_REG_FLASH0_PROCON2   (FLASH_REG_BASE | 0x2028)

Definition at line 143 of file xmc4xxx.c.

◆ FLASH_REG_PMU_ID

#define FLASH_REG_PMU_ID   (FLASH_REG_BASE | 0x0508)

Definition at line 36 of file xmc4xxx.c.

◆ FLASH_REG_PREF_PCON

#define FLASH_REG_PREF_PCON   (FLASH_REG_BASE | 0x4000)

Definition at line 44 of file xmc4xxx.c.

◆ FSR_ERASE

#define FSR_ERASE   (5)

Definition at line 59 of file xmc4xxx.c.

◆ FSR_ERASE_MASK

#define FSR_ERASE_MASK   (0x01 << FSR_ERASE)

Definition at line 80 of file xmc4xxx.c.

◆ FSR_FABUSY

#define FSR_FABUSY   (1)

Definition at line 57 of file xmc4xxx.c.

◆ FSR_FABUSY_MASK

#define FSR_FABUSY_MASK   (0x01 << FSR_FABUSY)

Definition at line 78 of file xmc4xxx.c.

◆ FSR_PBUSY

#define FSR_PBUSY   (0)

Definition at line 56 of file xmc4xxx.c.

◆ FSR_PBUSY_MASK

#define FSR_PBUSY_MASK   (0x01 << FSR_PBUSY)

Definition at line 77 of file xmc4xxx.c.

◆ FSR_PFDBER

#define FSR_PFDBER   (14)

Definition at line 65 of file xmc4xxx.c.

◆ FSR_PFDBER_MASK

#define FSR_PFDBER_MASK   (0x01 << FSR_PFDBER)

Definition at line 86 of file xmc4xxx.c.

◆ FSR_PFOPER

#define FSR_PFOPER   (8)

Definition at line 61 of file xmc4xxx.c.

◆ FSR_PFOPER_MASK

#define FSR_PFOPER_MASK   (0x01 << FSR_PFOPER)

Definition at line 82 of file xmc4xxx.c.

◆ FSR_PFPAGE

#define FSR_PFPAGE   (6)

Definition at line 60 of file xmc4xxx.c.

◆ FSR_PFPAGE_MASK

#define FSR_PFPAGE_MASK   (0x01 << FSR_PFPAGE)

Definition at line 81 of file xmc4xxx.c.

◆ FSR_PFSBER

#define FSR_PFSBER   (12)

Definition at line 64 of file xmc4xxx.c.

◆ FSR_PFSBER_MASK

#define FSR_PFSBER_MASK   (0x01 << FSR_PFSBER)

Definition at line 85 of file xmc4xxx.c.

◆ FSR_PROER

#define FSR_PROER   (11)

Definition at line 63 of file xmc4xxx.c.

◆ FSR_PROER_MASK

#define FSR_PROER_MASK   (0x01 << FSR_PROER)

Definition at line 84 of file xmc4xxx.c.

◆ FSR_PROG

#define FSR_PROG   (4)

Definition at line 58 of file xmc4xxx.c.

◆ FSR_PROG_MASK

#define FSR_PROG_MASK   (0x01 << FSR_PROG)

Definition at line 79 of file xmc4xxx.c.

◆ FSR_PROIN

#define FSR_PROIN   (16)

Definition at line 66 of file xmc4xxx.c.

◆ FSR_PROIN_MASK

#define FSR_PROIN_MASK   (0x01 << FSR_PROIN)

Definition at line 87 of file xmc4xxx.c.

◆ FSR_RPRODIS

#define FSR_RPRODIS   (19)

Definition at line 68 of file xmc4xxx.c.

◆ FSR_RPRODIS_MASK

#define FSR_RPRODIS_MASK   (0x01 << FSR_RPRODIS)

Definition at line 89 of file xmc4xxx.c.

◆ FSR_RPROIN

#define FSR_RPROIN   (18)

Definition at line 67 of file xmc4xxx.c.

◆ FSR_RPROIN_MASK

#define FSR_RPROIN_MASK   (0x01 << FSR_RPROIN)

Definition at line 88 of file xmc4xxx.c.

◆ FSR_SLM

#define FSR_SLM   (28)

Definition at line 74 of file xmc4xxx.c.

◆ FSR_SLM_MASK

#define FSR_SLM_MASK   (0x01 << FSR_SLM)

Definition at line 95 of file xmc4xxx.c.

◆ FSR_SQER

#define FSR_SQER   (10)

Definition at line 62 of file xmc4xxx.c.

◆ FSR_SQER_MASK

#define FSR_SQER_MASK   (0x01 << FSR_SQER)

Definition at line 83 of file xmc4xxx.c.

◆ FSR_VER

#define FSR_VER   (31)

Definition at line 75 of file xmc4xxx.c.

◆ FSR_VER_MASK

#define FSR_VER_MASK   (0x01 << FSR_VER)

Definition at line 96 of file xmc4xxx.c.

◆ FSR_WPRODIS0

#define FSR_WPRODIS0   (25)

Definition at line 72 of file xmc4xxx.c.

◆ FSR_WPRODIS0_MASK

#define FSR_WPRODIS0_MASK   (0x01 << FSR_WPRODIS0)

Definition at line 93 of file xmc4xxx.c.

◆ FSR_WPRODIS1

#define FSR_WPRODIS1   (26)

Definition at line 73 of file xmc4xxx.c.

◆ FSR_WPRODIS1_MASK

#define FSR_WPRODIS1_MASK   (0x01 << FSR_WPRODIS1)

Definition at line 94 of file xmc4xxx.c.

◆ FSR_WPROIN0

#define FSR_WPROIN0   (21)

Definition at line 69 of file xmc4xxx.c.

◆ FSR_WPROIN0_MASK

#define FSR_WPROIN0_MASK   (0x01 << FSR_WPROIN0)

Definition at line 90 of file xmc4xxx.c.

◆ FSR_WPROIN1

#define FSR_WPROIN1   (22)

Definition at line 70 of file xmc4xxx.c.

◆ FSR_WPROIN1_MASK

#define FSR_WPROIN1_MASK   (0x01 << FSR_WPROIN1)

Definition at line 91 of file xmc4xxx.c.

◆ FSR_WPROIN2

#define FSR_WPROIN2   (23)

Definition at line 71 of file xmc4xxx.c.

◆ FSR_WPROIN2_MASK

#define FSR_WPROIN2_MASK   (0x01 << FSR_WPROIN2)

Definition at line 92 of file xmc4xxx.c.

◆ MARP_MARGIN

#define MARP_MARGIN   (0)

Definition at line 134 of file xmc4xxx.c.

◆ MARP_MARGIN_MASK

#define MARP_MARGIN_MASK   (0x0f << MARP_MARGIN)

Definition at line 137 of file xmc4xxx.c.

◆ MARP_TRAPDIS

#define MARP_TRAPDIS   (15)

Definition at line 135 of file xmc4xxx.c.

◆ MARP_TRAPDIS_MASK

#define MARP_TRAPDIS_MASK   (0x01 << MARP_TRAPDIS)

Definition at line 138 of file xmc4xxx.c.

◆ MAX_XMC_SECTORS

#define MAX_XMC_SECTORS   12

Definition at line 17 of file xmc4xxx.c.

◆ PCON_IBYP

#define PCON_IBYP   (1 << 0)

Definition at line 47 of file xmc4xxx.c.

◆ PCON_IINV

#define PCON_IINV   (1 << 1)

Definition at line 48 of file xmc4xxx.c.

◆ PFLASH_BASE

#define PFLASH_BASE   0x0C000000

Definition at line 25 of file xmc4xxx.c.

◆ PMU_MOD_NO_MASK

#define PMU_MOD_NO_MASK   0xFFFF0000

Definition at line 41 of file xmc4xxx.c.

◆ PMU_MOD_REV_MASK

#define PMU_MOD_REV_MASK   0xFF

Definition at line 39 of file xmc4xxx.c.

◆ PMU_MOD_TYPE_MASK

#define PMU_MOD_TYPE_MASK   0xFF00

Definition at line 40 of file xmc4xxx.c.

◆ PROCON_RPRO

#define PROCON_RPRO   (15)

Definition at line 156 of file xmc4xxx.c.

◆ PROCON_RPRO_MASK

#define PROCON_RPRO_MASK   (0x01 << PROCON_RPRO)

Definition at line 169 of file xmc4xxx.c.

◆ PROCON_S0L

#define PROCON_S0L   (0)

Definition at line 145 of file xmc4xxx.c.

◆ PROCON_S0L_MASK

#define PROCON_S0L_MASK   (0x01 << PROCON_S0L)

Definition at line 158 of file xmc4xxx.c.

◆ PROCON_S10_S11L

#define PROCON_S10_S11L   (10)

Definition at line 155 of file xmc4xxx.c.

◆ PROCON_S10_S11L_MASK

#define PROCON_S10_S11L_MASK   (0x01 << PROCON_S10_S11L)

Definition at line 168 of file xmc4xxx.c.

◆ PROCON_S1L

#define PROCON_S1L   (1)

Definition at line 146 of file xmc4xxx.c.

◆ PROCON_S1L_MASK

#define PROCON_S1L_MASK   (0x01 << PROCON_S1L)

Definition at line 159 of file xmc4xxx.c.

◆ PROCON_S2L

#define PROCON_S2L   (2)

Definition at line 147 of file xmc4xxx.c.

◆ PROCON_S2L_MASK

#define PROCON_S2L_MASK   (0x01 << PROCON_S2L)

Definition at line 160 of file xmc4xxx.c.

◆ PROCON_S3L

#define PROCON_S3L   (3)

Definition at line 148 of file xmc4xxx.c.

◆ PROCON_S3L_MASK

#define PROCON_S3L_MASK   (0x01 << PROCON_S3L)

Definition at line 161 of file xmc4xxx.c.

◆ PROCON_S4L

#define PROCON_S4L   (4)

Definition at line 149 of file xmc4xxx.c.

◆ PROCON_S4L_MASK

#define PROCON_S4L_MASK   (0x01 << PROCON_S4L)

Definition at line 162 of file xmc4xxx.c.

◆ PROCON_S5L

#define PROCON_S5L   (5)

Definition at line 150 of file xmc4xxx.c.

◆ PROCON_S5L_MASK

#define PROCON_S5L_MASK   (0x01 << PROCON_S5L)

Definition at line 163 of file xmc4xxx.c.

◆ PROCON_S6L

#define PROCON_S6L   (6)

Definition at line 151 of file xmc4xxx.c.

◆ PROCON_S6L_MASK

#define PROCON_S6L_MASK   (0x01 << PROCON_S6L)

Definition at line 164 of file xmc4xxx.c.

◆ PROCON_S7L

#define PROCON_S7L   (7)

Definition at line 152 of file xmc4xxx.c.

◆ PROCON_S7L_MASK

#define PROCON_S7L_MASK   (0x01 << PROCON_S7L)

Definition at line 165 of file xmc4xxx.c.

◆ PROCON_S8L

#define PROCON_S8L   (8)

Definition at line 153 of file xmc4xxx.c.

◆ PROCON_S8L_MASK

#define PROCON_S8L_MASK   (0x01 << PROCON_S8L)

Definition at line 166 of file xmc4xxx.c.

◆ PROCON_S9L

#define PROCON_S9L   (9)

Definition at line 154 of file xmc4xxx.c.

◆ PROCON_S9L_MASK

#define PROCON_S9L_MASK   (0x01 << PROCON_S9L)

Definition at line 167 of file xmc4xxx.c.

◆ SCU_ID_CHIP

#define SCU_ID_CHIP   0x04

Definition at line 22 of file xmc4xxx.c.

◆ SCU_REG_BASE

#define SCU_REG_BASE   0x50004000

Definition at line 20 of file xmc4xxx.c.

◆ UCB0_BASE

#define UCB0_BASE   0x00000000

Definition at line 28 of file xmc4xxx.c.

◆ UCB1_BASE

#define UCB1_BASE   0x00000400

Definition at line 29 of file xmc4xxx.c.

◆ UCB2_BASE

#define UCB2_BASE   0x00000800

Definition at line 30 of file xmc4xxx.c.

Function Documentation

◆ COMMAND_HANDLER() [1/2]

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( xmc4xxx_handle_flash_unprotect_command  )

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( xmc4xxx_flash_bank_command  )

Definition at line 1231 of file xmc4xxx.c.

References bank, ERROR_FLASH_OPERATION_FAILED, and ERROR_OK.

◆ xmc4xxx_clear_flash_status()

static int xmc4xxx_clear_flash_status ( struct flash_bank bank)
static

Definition at line 412 of file xmc4xxx.c.

References bank, ERROR_OK, FLASH_CMD_CLEAR_STATUS, LOG_ERROR, LOG_INFO, and target_write_u32().

Referenced by xmc4xxx_erase(), and xmc4xxx_write().

◆ xmc4xxx_enter_page_mode()

static int xmc4xxx_enter_page_mode ( struct flash_bank bank)
static

◆ xmc4xxx_erase()

static int xmc4xxx_erase ( struct flash_bank bank,
unsigned int  first,
unsigned int  last 
)
static

◆ xmc4xxx_erase_sector()

◆ xmc4xxx_flash_protect()

static int xmc4xxx_flash_protect ( struct flash_bank bank,
int  level,
bool  read_protect,
unsigned int  first,
unsigned int  last 
)
static

◆ xmc4xxx_flash_unprotect()

static int xmc4xxx_flash_unprotect ( struct flash_bank bank,
int32_t  level 
)
static

Definition at line 988 of file xmc4xxx.c.

References addr, bank, ERROR_FAIL, ERROR_OK, LOG_ERROR, UCB0_BASE, UCB1_BASE, and xmc4xxx_erase_sector().

Referenced by COMMAND_HANDLER().

◆ xmc4xxx_get_flash_status()

static int xmc4xxx_get_flash_status ( struct flash_bank bank,
uint32_t *  status 
)
static

◆ xmc4xxx_get_info_command()

◆ xmc4xxx_get_sector_start_addr()

static int xmc4xxx_get_sector_start_addr ( struct flash_bank bank,
unsigned int  sector,
uint32_t *  ret_addr 
)
static

Definition at line 399 of file xmc4xxx.c.

References bank, ERROR_FAIL, and ERROR_OK.

Referenced by xmc4xxx_erase().

◆ xmc4xxx_load_bank_layout()

static int xmc4xxx_load_bank_layout ( struct flash_bank bank)
static

◆ xmc4xxx_probe()

◆ xmc4xxx_protect()

static int xmc4xxx_protect ( struct flash_bank bank,
int  set,
unsigned int  first,
unsigned int  last 
)
static

◆ xmc4xxx_protect_check()

◆ xmc4xxx_temp_unprotect()

◆ xmc4xxx_wait_status_busy()

static int xmc4xxx_wait_status_busy ( struct flash_bank bank,
int  timeout 
)
static

◆ xmc4xxx_write()

static int xmc4xxx_write ( struct flash_bank bank,
const uint8_t *  buffer,
uint32_t  offset,
uint32_t  count 
)
static

◆ xmc4xxx_write_command_sequence()

static int xmc4xxx_write_command_sequence ( struct flash_bank bank,
struct xmc4xxx_command_seq seq,
int  seq_len 
)
static

◆ xmc4xxx_write_page()

Variable Documentation

◆ sector_capacity_12

const unsigned int sector_capacity_12[12]
static
Initial value:
= {
16, 16, 16, 16, 16, 16, 16, 16, 128, 256, 256, 256
}

Definition at line 242 of file xmc4xxx.c.

Referenced by xmc4xxx_load_bank_layout().

◆ sector_capacity_16

const unsigned int sector_capacity_16[16]
static
Initial value:
= {
16, 16, 16, 16, 16, 16, 16, 16, 128, 256, 256, 256, 256, 256, 256, 256
}

Definition at line 246 of file xmc4xxx.c.

Referenced by xmc4xxx_load_bank_layout().

◆ sector_capacity_8

const unsigned int sector_capacity_8[8]
static
Initial value:
= {
16, 16, 16, 16, 16, 16, 16, 128
}

Definition at line 234 of file xmc4xxx.c.

Referenced by xmc4xxx_load_bank_layout().

◆ sector_capacity_9

const unsigned int sector_capacity_9[9]
static
Initial value:
= {
16, 16, 16, 16, 16, 16, 16, 128, 256
}

Definition at line 238 of file xmc4xxx.c.

Referenced by xmc4xxx_load_bank_layout().

◆ xmc4xxx_command_handlers

const struct command_registration xmc4xxx_command_handlers[]
static
Initial value:
= {
{
.name = "xmc4xxx",
.mode = COMMAND_ANY,
.help = "xmc4xxx flash command group",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_ANY
Definition: command.h:42
static const struct command_registration xmc4xxx_exec_command_handlers[]
Definition: xmc4xxx.c:1298

Definition at line 1278 of file xmc4xxx.c.

◆ xmc4xxx_exec_command_handlers

const struct command_registration xmc4xxx_exec_command_handlers[]
static
Initial value:
= {
{
.name = "flash_password",
.handler = xmc4xxx_handle_flash_password_command,
.mode = COMMAND_EXEC,
.usage = "bank_id password1 password2",
.help = "Set the flash passwords used for protect operations. "
"Passwords should be in standard hex form (0x00000000). "
"(You must call this before any other protect commands) "
"NOTE: The xmc4xxx's UCB area only allows for FOUR cycles. "
"Please use protection carefully!",
},
{
.name = "flash_unprotect",
.handler = xmc4xxx_handle_flash_unprotect_command,
.mode = COMMAND_EXEC,
.usage = "bank_id user_level[0-1]",
.help = "Permanently Removes flash protection (read and write) "
"for the specified user level",
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 1278 of file xmc4xxx.c.

◆ xmc4xxx_flash

const struct flash_driver xmc4xxx_flash
Initial value:
= {
.name = "xmc4xxx",
.flash_bank_command = xmc4xxx_flash_bank_command,
.erase = xmc4xxx_erase,
.write = xmc4xxx_write,
.probe = xmc4xxx_probe,
.auto_probe = xmc4xxx_probe,
.erase_check = default_flash_blank_check,
.protect_check = xmc4xxx_protect_check,
.protect = xmc4xxx_protect,
.free_driver_priv = default_flash_free_driver_priv,
}
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
static const struct command_registration xmc4xxx_command_handlers[]
Definition: xmc4xxx.c:1321
static int xmc4xxx_probe(struct flash_bank *bank)
Definition: xmc4xxx.c:317
static int xmc4xxx_protect_check(struct flash_bank *bank)
Definition: xmc4xxx.c:1157
static int xmc4xxx_get_info_command(struct flash_bank *bank, struct command_invocation *cmd)
Definition: xmc4xxx.c:795
static int xmc4xxx_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: xmc4xxx.c:1131
static int xmc4xxx_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: xmc4xxx.c:530
static int xmc4xxx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: xmc4xxx.c:712

Definition at line 1278 of file xmc4xxx.c.