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

Go to the source code of this file.

Data Structures

struct  max32xxx_flash_bank
 

Macros

#define ARM_PID_DEFAULT_CM3   0xB4C3
 
#define ARM_PID_DEFAULT_CM4   0xB4C4
 
#define ARM_PID_REG   0xE00FFFE0
 
#define FLASH_BL_CTRL_23   0x00020000
 
#define FLASH_BL_CTRL_IFREN   0x00000001
 
#define FLSH_ADDR   0x000
 
#define FLSH_BL_CTRL   0x170
 
#define FLSH_CLKDIV   0x004
 
#define FLSH_CN   0x008
 
#define FLSH_CN_ERASE_CODE_MASK   0x0000FF00
 
#define FLSH_CN_ERASE_CODE_ME   0x0000AA00
 
#define FLSH_CN_ERASE_CODE_PGE   0x00005500
 
#define FLSH_CN_ME   0x00000002
 
#define FLSH_CN_PEND   0x01000000
 
#define FLSH_CN_PGE   0x00000004
 
#define FLSH_CN_UNLOCK_MASK   0xF0000000
 
#define FLSH_CN_UNLOCK_VALUE   0x20000000
 
#define FLSH_CN_WR   0x00000001
 
#define FLSH_DATA0   0x030
 
#define FLSH_DATA1   0x034
 
#define FLSH_DATA2   0x038
 
#define FLSH_DATA3   0x03C
 
#define FLSH_INT   0x024
 
#define FLSH_INT_AF   0x00000002
 
#define FLSH_MD   0x020
 
#define FLSH_PROT   0x300
 
#define MAX326XX_ID   0x4D
 
#define MAX326XX_ID_REG   0x40000838
 
#define PR1E_ADDR   0x00C
 
#define PR2E_ADDR   0x014
 
#define PR2S_ADDR   0x010
 
#define PR3E_ADDR   0x01C
 
#define PR3S_ADDR   0x018
 

Functions

 COMMAND_HANDLER (max32xxx_handle_mass_erase_command)
 
 COMMAND_HANDLER (max32xxx_handle_protection_check_command)
 
 COMMAND_HANDLER (max32xxx_handle_protection_clr_command)
 
 COMMAND_HANDLER (max32xxx_handle_protection_set_command)
 
 FLASH_BANK_COMMAND_HANDLER (max32xxx_flash_bank_command)
 
static int get_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int max32xxx_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int max32xxx_flash_op_post (struct flash_bank *bank)
 
static int max32xxx_flash_op_pre (struct flash_bank *bank)
 
static int max32xxx_mass_erase (struct flash_bank *bank)
 
static int max32xxx_probe (struct flash_bank *bank)
 
static int max32xxx_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int max32xxx_protect_check (struct flash_bank *bank)
 
static int max32xxx_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int max32xxx_write_block (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t wcount)
 

Variables

static const struct command_registration max32xxx_command_handlers []
 
static const struct command_registration max32xxx_exec_command_handlers []
 
const struct flash_driver max32xxx_flash
 
static const uint8_t write_code []
 

Macro Definition Documentation

◆ ARM_PID_DEFAULT_CM3

#define ARM_PID_DEFAULT_CM3   0xB4C3

Definition at line 56 of file max32xxx.c.

◆ ARM_PID_DEFAULT_CM4

#define ARM_PID_DEFAULT_CM4   0xB4C4

Definition at line 57 of file max32xxx.c.

◆ ARM_PID_REG

#define ARM_PID_REG   0xE00FFFE0

Definition at line 35 of file max32xxx.c.

◆ FLASH_BL_CTRL_23

#define FLASH_BL_CTRL_23   0x00020000

Definition at line 53 of file max32xxx.c.

◆ FLASH_BL_CTRL_IFREN

#define FLASH_BL_CTRL_IFREN   0x00000001

Definition at line 54 of file max32xxx.c.

◆ FLSH_ADDR

#define FLSH_ADDR   0x000

Definition at line 18 of file max32xxx.c.

◆ FLSH_BL_CTRL

#define FLSH_BL_CTRL   0x170

Definition at line 32 of file max32xxx.c.

◆ FLSH_CLKDIV

#define FLSH_CLKDIV   0x004

Definition at line 19 of file max32xxx.c.

◆ FLSH_CN

#define FLSH_CN   0x008

Definition at line 20 of file max32xxx.c.

◆ FLSH_CN_ERASE_CODE_MASK

#define FLSH_CN_ERASE_CODE_MASK   0x0000FF00

Definition at line 46 of file max32xxx.c.

◆ FLSH_CN_ERASE_CODE_ME

#define FLSH_CN_ERASE_CODE_ME   0x0000AA00

Definition at line 48 of file max32xxx.c.

◆ FLSH_CN_ERASE_CODE_PGE

#define FLSH_CN_ERASE_CODE_PGE   0x00005500

Definition at line 47 of file max32xxx.c.

◆ FLSH_CN_ME

#define FLSH_CN_ME   0x00000002

Definition at line 51 of file max32xxx.c.

◆ FLSH_CN_PEND

#define FLSH_CN_PEND   0x01000000

Definition at line 44 of file max32xxx.c.

◆ FLSH_CN_PGE

#define FLSH_CN_PGE   0x00000004

Definition at line 50 of file max32xxx.c.

◆ FLSH_CN_UNLOCK_MASK

#define FLSH_CN_UNLOCK_MASK   0xF0000000

Definition at line 41 of file max32xxx.c.

◆ FLSH_CN_UNLOCK_VALUE

#define FLSH_CN_UNLOCK_VALUE   0x20000000

Definition at line 42 of file max32xxx.c.

◆ FLSH_CN_WR

#define FLSH_CN_WR   0x00000001

Definition at line 52 of file max32xxx.c.

◆ FLSH_DATA0

#define FLSH_DATA0   0x030

Definition at line 28 of file max32xxx.c.

◆ FLSH_DATA1

#define FLSH_DATA1   0x034

Definition at line 29 of file max32xxx.c.

◆ FLSH_DATA2

#define FLSH_DATA2   0x038

Definition at line 30 of file max32xxx.c.

◆ FLSH_DATA3

#define FLSH_DATA3   0x03C

Definition at line 31 of file max32xxx.c.

◆ FLSH_INT

#define FLSH_INT   0x024

Definition at line 27 of file max32xxx.c.

◆ FLSH_INT_AF

#define FLSH_INT_AF   0x00000002

Definition at line 39 of file max32xxx.c.

◆ FLSH_MD

#define FLSH_MD   0x020

Definition at line 26 of file max32xxx.c.

◆ FLSH_PROT

#define FLSH_PROT   0x300

Definition at line 33 of file max32xxx.c.

◆ MAX326XX_ID

#define MAX326XX_ID   0x4D

Definition at line 58 of file max32xxx.c.

◆ MAX326XX_ID_REG

#define MAX326XX_ID_REG   0x40000838

Definition at line 36 of file max32xxx.c.

◆ PR1E_ADDR

#define PR1E_ADDR   0x00C

Definition at line 21 of file max32xxx.c.

◆ PR2E_ADDR

#define PR2E_ADDR   0x014

Definition at line 23 of file max32xxx.c.

◆ PR2S_ADDR

#define PR2S_ADDR   0x010

Definition at line 22 of file max32xxx.c.

◆ PR3E_ADDR

#define PR3E_ADDR   0x01C

Definition at line 25 of file max32xxx.c.

◆ PR3S_ADDR

#define PR3S_ADDR   0x018

Definition at line 24 of file max32xxx.c.

Function Documentation

◆ COMMAND_HANDLER() [1/4]

COMMAND_HANDLER ( max32xxx_handle_mass_erase_command  )

◆ COMMAND_HANDLER() [2/4]

COMMAND_HANDLER ( max32xxx_handle_protection_check_command  )

◆ COMMAND_HANDLER() [3/4]

COMMAND_HANDLER ( max32xxx_handle_protection_clr_command  )

◆ COMMAND_HANDLER() [4/4]

COMMAND_HANDLER ( max32xxx_handle_protection_set_command  )

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( max32xxx_flash_bank_command  )

◆ get_info()

static int get_info ( struct flash_bank bank,
struct command_invocation cmd 
)
static

Definition at line 106 of file max32xxx.c.

References bank, cmd, command_print_sameline(), ERROR_FLASH_BANK_NOT_PROBED, ERROR_OK, and info.

◆ max32xxx_erase()

◆ max32xxx_flash_op_post()

static int max32xxx_flash_op_post ( struct flash_bank bank)
static

◆ max32xxx_flash_op_pre()

◆ max32xxx_mass_erase()

◆ max32xxx_probe()

◆ max32xxx_protect()

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

◆ max32xxx_protect_check()

static int max32xxx_protect_check ( struct flash_bank bank)
static

◆ max32xxx_write()

◆ max32xxx_write_block()

Variable Documentation

◆ max32xxx_command_handlers

const struct command_registration max32xxx_command_handlers[]
static
Initial value:
= {
{
.name = "max32xxx",
.mode = COMMAND_EXEC,
.help = "max32xxx flash command group",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_EXEC
Definition: command.h:40
static const struct command_registration max32xxx_exec_command_handlers[]
Definition: max32xxx.c:917
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:241

Definition at line 882 of file max32xxx.c.

◆ max32xxx_exec_command_handlers

const struct command_registration max32xxx_exec_command_handlers[]
static

Definition at line 882 of file max32xxx.c.

◆ max32xxx_flash

const struct flash_driver max32xxx_flash
Initial value:
= {
.name = "max32xxx",
.flash_bank_command = max32xxx_flash_bank_command,
.erase = max32xxx_erase,
.protect = max32xxx_protect,
.write = max32xxx_write,
.probe = max32xxx_probe,
.auto_probe = max32xxx_probe,
.erase_check = default_flash_blank_check,
.protect_check = max32xxx_protect_check,
.info = get_info,
}
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.
static int max32xxx_probe(struct flash_bank *bank)
Definition: max32xxx.c:632
static int max32xxx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: max32xxx.c:427
static const struct command_registration max32xxx_command_handlers[]
Definition: max32xxx.c:949
static int max32xxx_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: max32xxx.c:309
static int max32xxx_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: max32xxx.c:224
static int get_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: max32xxx.c:106
static int max32xxx_protect_check(struct flash_bank *bank)
Definition: max32xxx.c:195

Definition at line 882 of file max32xxx.c.

◆ write_code

const uint8_t write_code[]
static
Initial value:
= {
}

Definition at line 74 of file max32xxx.c.

Referenced by max32xxx_write_block(), and xmc1xxx_write().