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

Go to the source code of this file.

Data Structures

struct  mdr_flash_bank
 

Macros

#define FLASH_ADR   (FLASH_REG_BASE + 0x04)
 
#define FLASH_CMD   (FLASH_REG_BASE + 0x00)
 
#define FLASH_CON   (1 << 0)
 
#define FLASH_DELAY_MASK   (7 << 3)
 
#define FLASH_DI   (FLASH_REG_BASE + 0x08)
 
#define FLASH_DO   (FLASH_REG_BASE + 0x0C)
 
#define FLASH_ERASE   (1 << 10)
 
#define FLASH_IFREN   (1 << 9)
 
#define FLASH_KEY   (FLASH_REG_BASE + 0x10)
 
#define FLASH_MAS1   (1 << 11)
 
#define FLASH_NVSTR   (1 << 13)
 
#define FLASH_PROG   (1 << 12)
 
#define FLASH_RD   (1 << 2)
 
#define FLASH_REG_BASE   0x40018000
 
#define FLASH_SE   (1 << 8)
 
#define FLASH_WR   (1 << 1)
 
#define FLASH_XE   (1 << 6)
 
#define FLASH_YE   (1 << 7)
 
#define KEY   0x8AAA5551
 
#define MD_PER_CLOCK   (MD_RST_CLK + 0x1C)
 
#define MD_PER_CLOCK_EEPROM   (1 << 3)
 
#define MD_PER_CLOCK_RST_CLK   (1 << 4)
 
#define MD_RST_CLK   0x40020000
 

Functions

 FLASH_BANK_COMMAND_HANDLER (mdr_flash_bank_command)
 
static int get_mdr_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int mdr_auto_probe (struct flash_bank *bank)
 
static int mdr_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int mdr_mass_erase (struct flash_bank *bank)
 
static int mdr_probe (struct flash_bank *bank)
 
static int mdr_read (struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int mdr_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int mdr_write_block (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

const struct flash_driver mdr_flash
 

Macro Definition Documentation

◆ FLASH_ADR

#define FLASH_ADR   (FLASH_REG_BASE + 0x04)

Definition at line 33 of file mdr.c.

◆ FLASH_CMD

#define FLASH_CMD   (FLASH_REG_BASE + 0x00)

Definition at line 32 of file mdr.c.

◆ FLASH_CON

#define FLASH_CON   (1 << 0)

Definition at line 48 of file mdr.c.

◆ FLASH_DELAY_MASK

#define FLASH_DELAY_MASK   (7 << 3)

Definition at line 49 of file mdr.c.

◆ FLASH_DI

#define FLASH_DI   (FLASH_REG_BASE + 0x08)

Definition at line 34 of file mdr.c.

◆ FLASH_DO

#define FLASH_DO   (FLASH_REG_BASE + 0x0C)

Definition at line 35 of file mdr.c.

◆ FLASH_ERASE

#define FLASH_ERASE   (1 << 10)

Definition at line 41 of file mdr.c.

◆ FLASH_IFREN

#define FLASH_IFREN   (1 << 9)

Definition at line 42 of file mdr.c.

◆ FLASH_KEY

#define FLASH_KEY   (FLASH_REG_BASE + 0x10)

Definition at line 36 of file mdr.c.

◆ FLASH_MAS1

#define FLASH_MAS1   (1 << 11)

Definition at line 40 of file mdr.c.

◆ FLASH_NVSTR

#define FLASH_NVSTR   (1 << 13)

Definition at line 38 of file mdr.c.

◆ FLASH_PROG

#define FLASH_PROG   (1 << 12)

Definition at line 39 of file mdr.c.

◆ FLASH_RD

#define FLASH_RD   (1 << 2)

Definition at line 46 of file mdr.c.

◆ FLASH_REG_BASE

#define FLASH_REG_BASE   0x40018000

Definition at line 31 of file mdr.c.

◆ FLASH_SE

#define FLASH_SE   (1 << 8)

Definition at line 43 of file mdr.c.

◆ FLASH_WR

#define FLASH_WR   (1 << 1)

Definition at line 47 of file mdr.c.

◆ FLASH_XE

#define FLASH_XE   (1 << 6)

Definition at line 45 of file mdr.c.

◆ FLASH_YE

#define FLASH_YE   (1 << 7)

Definition at line 44 of file mdr.c.

◆ KEY

#define KEY   0x8AAA5551

Definition at line 51 of file mdr.c.

◆ MD_PER_CLOCK

#define MD_PER_CLOCK   (MD_RST_CLK + 0x1C)

Definition at line 27 of file mdr.c.

◆ MD_PER_CLOCK_EEPROM

#define MD_PER_CLOCK_EEPROM   (1 << 3)

Definition at line 28 of file mdr.c.

◆ MD_PER_CLOCK_RST_CLK

#define MD_PER_CLOCK_RST_CLK   (1 << 4)

Definition at line 29 of file mdr.c.

◆ MD_RST_CLK

#define MD_RST_CLK   0x40020000

Definition at line 26 of file mdr.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( mdr_flash_bank_command  )

◆ get_mdr_info()

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

Definition at line 588 of file mdr.c.

References bank, cmd, command_print_sameline(), ERROR_OK, and mdr_flash_bank::mem_type.

◆ mdr_auto_probe()

static int mdr_auto_probe ( struct flash_bank bank)
static

Definition at line 580 of file mdr.c.

References bank, ERROR_OK, mdr_probe(), and mdr_flash_bank::probed.

◆ mdr_erase()

◆ mdr_mass_erase()

static int mdr_mass_erase ( struct flash_bank bank)
static

◆ mdr_probe()

static int mdr_probe ( struct flash_bank bank)
static

Definition at line 555 of file mdr.c.

References bank, ERROR_OK, mdr_flash_bank::page_count, and mdr_flash_bank::probed.

Referenced by mdr_auto_probe().

◆ mdr_read()

◆ mdr_write()

◆ mdr_write_block()

Variable Documentation

◆ mdr_flash

const struct flash_driver mdr_flash
Initial value:
= {
.name = "mdr",
.usage = "flash bank <name> mdr <base> <size> 0 0 <target#> <type> <page_count> <sec_count>\n"
"<type>: 0 for main memory, 1 for info memory",
.flash_bank_command = mdr_flash_bank_command,
.erase = mdr_erase,
.write = mdr_write,
.read = mdr_read,
.probe = mdr_probe,
.auto_probe = mdr_auto_probe,
.erase_check = default_flash_blank_check,
.info = get_mdr_info,
.free_driver_priv = default_flash_free_driver_priv,
}
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
static int mdr_probe(struct flash_bank *bank)
Definition: mdr.c:555
static int mdr_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: mdr.c:116
static int mdr_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: mdr.c:461
static int mdr_auto_probe(struct flash_bank *bank)
Definition: mdr.c:580
static int mdr_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: mdr.c:295
static int get_mdr_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: mdr.c:588

Definition at line 588 of file mdr.c.