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

Go to the source code of this file.

Data Structures

struct  str7x_flash_bank
 
struct  str7x_mem_layout
 

Macros

#define FLASH_10ER   0x00000008
 
#define FLASH_AR   0x00000010
 
#define FLASH_B0F0   0x00000001
 
#define FLASH_B0F1   0x00000002
 
#define FLASH_B0F2   0x00000004
 
#define FLASH_B0F3   0x00000008
 
#define FLASH_B0F4   0x00000010
 
#define FLASH_B0F5   0x00000020
 
#define FLASH_B0F6   0x00000040
 
#define FLASH_B0F7   0x00000080
 
#define FLASH_B0S   0x01000000
 
#define FLASH_B1F0   0x00010000
 
#define FLASH_B1F1   0x00020000
 
#define FLASH_B1S   0x02000000
 
#define FLASH_BER   0x04000000
 
#define FLASH_BSYA0   0x00000002
 
#define FLASH_BSYA1   0x00000004
 
#define FLASH_CR0   0x00000000
 
#define FLASH_CR1   0x00000004
 
#define FLASH_DR0   0x00000008
 
#define FLASH_DR1   0x0000000C
 
#define FLASH_DWPG   0x10000000
 
#define FLASH_ER   0x00000014
 
#define FLASH_ERER   0x00000002
 
#define FLASH_ERR   0x00000001
 
#define FLASH_LOCK   0x00000010
 
#define FLASH_MER   0x02000000
 
#define FLASH_NVAPR0   0x0000DFB8
 
#define FLASH_NVAPR1   0x0000DFBC
 
#define FLASH_NVWPAR   0x0000DFB0
 
#define FLASH_PGER   0x00000004
 
#define FLASH_RESER   0x00000080
 
#define FLASH_SEQER   0x00000040
 
#define FLASH_SER   0x08000000
 
#define FLASH_SPR   0x01000000
 
#define FLASH_SUSP   0x40000000
 
#define FLASH_WMS   0x80000000
 
#define FLASH_WPF   0x00000100
 
#define FLASH_WPG   0x20000000
 

Enumerations

enum  str7x_status_codes {
  STR7X_CMD_SUCCESS = 0 , STR7X_INVALID_COMMAND = 1 , STR7X_SRC_ADDR_ERROR = 2 , STR7X_DST_ADDR_ERROR = 3 ,
  STR7X_SRC_ADDR_NOT_MAPPED = 4 , STR7X_DST_ADDR_NOT_MAPPED = 5 , STR7X_COUNT_ERROR = 6 , STR7X_INVALID_SECTOR = 7 ,
  STR7X_SECTOR_NOT_BLANK = 8 , STR7X_SECTOR_NOT_PREPARED = 9 , STR7X_COMPARE_ERROR = 10 , STR7X_BUSY = 11
}
 

Functions

 COMMAND_HANDLER (str7x_handle_disable_jtag_command)
 
 FLASH_BANK_COMMAND_HANDLER (str7x_flash_bank_command)
 
static int get_str7x_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int str7x_build_block_list (struct flash_bank *bank)
 
static int str7x_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int str7x_get_flash_adr (struct flash_bank *bank, uint32_t reg)
 
static int str7x_probe (struct flash_bank *bank)
 
static int str7x_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int str7x_protect_check (struct flash_bank *bank)
 
static int str7x_result (struct flash_bank *bank)
 
static int str7x_waitbusy (struct flash_bank *bank)
 
static int str7x_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int str7x_write_block (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

static const struct str7x_mem_layout mem_layout_str7bank0 []
 
static const struct str7x_mem_layout mem_layout_str7bank1 []
 
static const struct command_registration str7x_command_handlers []
 
static const struct command_registration str7x_exec_command_handlers []
 
const struct flash_driver str7x_flash
 

Macro Definition Documentation

◆ FLASH_10ER

#define FLASH_10ER   0x00000008

Definition at line 69 of file str7x.c.

◆ FLASH_AR

#define FLASH_AR   0x00000010

Definition at line 29 of file str7x.c.

◆ FLASH_B0F0

#define FLASH_B0F0   0x00000001

Definition at line 62 of file str7x.c.

◆ FLASH_B0F1

#define FLASH_B0F1   0x00000002

Definition at line 61 of file str7x.c.

◆ FLASH_B0F2

#define FLASH_B0F2   0x00000004

Definition at line 60 of file str7x.c.

◆ FLASH_B0F3

#define FLASH_B0F3   0x00000008

Definition at line 59 of file str7x.c.

◆ FLASH_B0F4

#define FLASH_B0F4   0x00000010

Definition at line 58 of file str7x.c.

◆ FLASH_B0F5

#define FLASH_B0F5   0x00000020

Definition at line 57 of file str7x.c.

◆ FLASH_B0F6

#define FLASH_B0F6   0x00000040

Definition at line 56 of file str7x.c.

◆ FLASH_B0F7

#define FLASH_B0F7   0x00000080

Definition at line 55 of file str7x.c.

◆ FLASH_B0S

#define FLASH_B0S   0x01000000

Definition at line 52 of file str7x.c.

◆ FLASH_B1F0

#define FLASH_B1F0   0x00010000

Definition at line 54 of file str7x.c.

◆ FLASH_B1F1

#define FLASH_B1F1   0x00020000

Definition at line 53 of file str7x.c.

◆ FLASH_B1S

#define FLASH_B1S   0x02000000

Definition at line 51 of file str7x.c.

◆ FLASH_BER

#define FLASH_BER   0x04000000

Definition at line 43 of file str7x.c.

◆ FLASH_BSYA0

#define FLASH_BSYA0   0x00000002

Definition at line 47 of file str7x.c.

◆ FLASH_BSYA1

#define FLASH_BSYA1   0x00000004

Definition at line 46 of file str7x.c.

◆ FLASH_CR0

#define FLASH_CR0   0x00000000

Definition at line 25 of file str7x.c.

◆ FLASH_CR1

#define FLASH_CR1   0x00000004

Definition at line 26 of file str7x.c.

◆ FLASH_DR0

#define FLASH_DR0   0x00000008

Definition at line 27 of file str7x.c.

◆ FLASH_DR1

#define FLASH_DR1   0x0000000C

Definition at line 28 of file str7x.c.

◆ FLASH_DWPG

#define FLASH_DWPG   0x10000000

Definition at line 40 of file str7x.c.

◆ FLASH_ER

#define FLASH_ER   0x00000014

Definition at line 30 of file str7x.c.

◆ FLASH_ERER

#define FLASH_ERER   0x00000002

Definition at line 71 of file str7x.c.

◆ FLASH_ERR

#define FLASH_ERR   0x00000001

Definition at line 72 of file str7x.c.

◆ FLASH_LOCK

#define FLASH_LOCK   0x00000010

Definition at line 45 of file str7x.c.

◆ FLASH_MER

#define FLASH_MER   0x02000000

Definition at line 44 of file str7x.c.

◆ FLASH_NVAPR0

#define FLASH_NVAPR0   0x0000DFB8

Definition at line 32 of file str7x.c.

◆ FLASH_NVAPR1

#define FLASH_NVAPR1   0x0000DFBC

Definition at line 33 of file str7x.c.

◆ FLASH_NVWPAR

#define FLASH_NVWPAR   0x0000DFB0

Definition at line 31 of file str7x.c.

◆ FLASH_PGER

#define FLASH_PGER   0x00000004

Definition at line 70 of file str7x.c.

◆ FLASH_RESER

#define FLASH_RESER   0x00000080

Definition at line 67 of file str7x.c.

◆ FLASH_SEQER

#define FLASH_SEQER   0x00000040

Definition at line 68 of file str7x.c.

◆ FLASH_SER

#define FLASH_SER   0x08000000

Definition at line 41 of file str7x.c.

◆ FLASH_SPR

#define FLASH_SPR   0x01000000

Definition at line 42 of file str7x.c.

◆ FLASH_SUSP

#define FLASH_SUSP   0x40000000

Definition at line 38 of file str7x.c.

◆ FLASH_WMS

#define FLASH_WMS   0x80000000

Definition at line 37 of file str7x.c.

◆ FLASH_WPF

#define FLASH_WPF   0x00000100

Definition at line 66 of file str7x.c.

◆ FLASH_WPG

#define FLASH_WPG   0x20000000

Definition at line 39 of file str7x.c.

Enumeration Type Documentation

◆ str7x_status_codes

Enumerator
STR7X_CMD_SUCCESS 
STR7X_INVALID_COMMAND 
STR7X_SRC_ADDR_ERROR 
STR7X_DST_ADDR_ERROR 
STR7X_SRC_ADDR_NOT_MAPPED 
STR7X_DST_ADDR_NOT_MAPPED 
STR7X_COUNT_ERROR 
STR7X_INVALID_SECTOR 
STR7X_SECTOR_NOT_BLANK 
STR7X_SECTOR_NOT_PREPARED 
STR7X_COMPARE_ERROR 
STR7X_BUSY 

Definition at line 88 of file str7x.c.

Function Documentation

◆ COMMAND_HANDLER()

◆ FLASH_BANK_COMMAND_HANDLER()

◆ get_str7x_info()

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

Definition at line 691 of file str7x.c.

References cmd, command_print_sameline(), and ERROR_OK.

◆ str7x_build_block_list()

◆ str7x_erase()

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

◆ str7x_get_flash_adr()

static int str7x_get_flash_adr ( struct flash_bank bank,
uint32_t  reg 
)
static

◆ str7x_probe()

static int str7x_probe ( struct flash_bank bank)
static

Definition at line 679 of file str7x.c.

References ERROR_OK.

◆ str7x_protect()

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

◆ str7x_protect_check()

static int str7x_protect_check ( struct flash_bank bank)
static

◆ str7x_result()

static int str7x_result ( struct flash_bank bank)
static

◆ str7x_waitbusy()

static int str7x_waitbusy ( struct flash_bank bank)
static

◆ str7x_write()

◆ str7x_write_block()

Variable Documentation

◆ mem_layout_str7bank0

const struct str7x_mem_layout mem_layout_str7bank0[]
static
Initial value:
= {
{0x00000000, 0x02000, 0x01},
{0x00002000, 0x02000, 0x02},
{0x00004000, 0x02000, 0x04},
{0x00006000, 0x02000, 0x08},
{0x00008000, 0x08000, 0x10},
{0x00010000, 0x10000, 0x20},
{0x00020000, 0x10000, 0x40},
{0x00030000, 0x10000, 0x80}
}

Definition at line 1 of file str7x.c.

Referenced by str7x_build_block_list().

◆ mem_layout_str7bank1

const struct str7x_mem_layout mem_layout_str7bank1[]
static
Initial value:
= {
{0x00000000, 0x02000, 0x10000},
{0x00002000, 0x02000, 0x20000}
}

Definition at line 1 of file str7x.c.

Referenced by str7x_build_block_list().

◆ str7x_command_handlers

const struct command_registration str7x_command_handlers[]
static
Initial value:
= {
{
.name = "str7x",
.mode = COMMAND_ANY,
.help = "str7x 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 str7x_exec_command_handlers[]
Definition: str7x.c:764

Definition at line 703 of file str7x.c.

◆ str7x_exec_command_handlers

const struct command_registration str7x_exec_command_handlers[]
static
Initial value:
= {
{
.name = "disable_jtag",
.usage = "<bank>",
.handler = str7x_handle_disable_jtag_command,
.mode = COMMAND_EXEC,
.help = "disable jtag access",
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 703 of file str7x.c.

◆ str7x_flash

const struct flash_driver str7x_flash
Initial value:
= {
.name = "str7x",
.flash_bank_command = str7x_flash_bank_command,
.erase = str7x_erase,
.protect = str7x_protect,
.write = str7x_write,
.probe = str7x_probe,
.auto_probe = str7x_probe,
.erase_check = default_flash_blank_check,
.protect_check = str7x_protect_check,
.info = get_str7x_info,
.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 int str7x_protect_check(struct flash_bank *bank)
Definition: str7x.c:293
static int str7x_probe(struct flash_bank *bank)
Definition: str7x.c:679
static int str7x_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: str7x.c:320
static const struct command_registration str7x_command_handlers[]
Definition: str7x.c:775
static int get_str7x_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: str7x.c:691
static int str7x_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: str7x.c:371
static int str7x_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: str7x.c:545

Definition at line 703 of file str7x.c.