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

Go to the source code of this file.

Data Structures

struct  str9x_flash_bank
 

Macros

#define FLASH_BBADR   0x5400000C /* Boot Bank Base Address Register */
 
#define FLASH_BBSR   0x54000000 /* Boot Bank Size Register */
 
#define FLASH_BCE5ADDR   0x54000020 /* BC Fifth Entry Target Address Register */
 
#define FLASH_CR   0x54000018 /* Control Register */
 
#define FLASH_NBBADR   0x54000010 /* Non-Boot Bank Base Address Register */
 
#define FLASH_NBBSR   0x54000004 /* Non-Boot Bank Size Register */
 
#define FLASH_SR   0x5400001C /* Status Register */
 

Enumerations

enum  str9x_status_codes {
  STR9X_CMD_SUCCESS = 0 , STR9X_INVALID_COMMAND = 1 , STR9X_SRC_ADDR_ERROR = 2 , STR9X_DST_ADDR_ERROR = 3 ,
  STR9X_SRC_ADDR_NOT_MAPPED = 4 , STR9X_DST_ADDR_NOT_MAPPED = 5 , STR9X_COUNT_ERROR = 6 , STR9X_INVALID_SECTOR = 7 ,
  STR9X_SECTOR_NOT_BLANK = 8 , STR9X_SECTOR_NOT_PREPARED = 9 , STR9X_COMPARE_ERROR = 10 , STR9X_BUSY = 11
}
 

Functions

 COMMAND_HANDLER (str9x_handle_flash_config_command)
 
 FLASH_BANK_COMMAND_HANDLER (str9x_flash_bank_command)
 
static int str9x_build_block_list (struct flash_bank *bank)
 
static int str9x_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int str9x_probe (struct flash_bank *bank)
 
static int str9x_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int str9x_protect_check (struct flash_bank *bank)
 
static int str9x_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int str9x_write_block (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

static uint32_t bank1start = 0x00080000
 
static const struct command_registration str9x_command_handlers []
 
static const struct command_registration str9x_config_command_handlers []
 
const struct flash_driver str9x_flash
 

Macro Definition Documentation

◆ FLASH_BBADR

#define FLASH_BBADR   0x5400000C /* Boot Bank Base Address Register */

Definition at line 26 of file str9x.c.

◆ FLASH_BBSR

#define FLASH_BBSR   0x54000000 /* Boot Bank Size Register */

Definition at line 24 of file str9x.c.

◆ FLASH_BCE5ADDR

#define FLASH_BCE5ADDR   0x54000020 /* BC Fifth Entry Target Address Register */

Definition at line 30 of file str9x.c.

◆ FLASH_CR

#define FLASH_CR   0x54000018 /* Control Register */

Definition at line 28 of file str9x.c.

◆ FLASH_NBBADR

#define FLASH_NBBADR   0x54000010 /* Non-Boot Bank Base Address Register */

Definition at line 27 of file str9x.c.

◆ FLASH_NBBSR

#define FLASH_NBBSR   0x54000004 /* Non-Boot Bank Size Register */

Definition at line 25 of file str9x.c.

◆ FLASH_SR

#define FLASH_SR   0x5400001C /* Status Register */

Definition at line 29 of file str9x.c.

Enumeration Type Documentation

◆ str9x_status_codes

Enumerator
STR9X_CMD_SUCCESS 
STR9X_INVALID_COMMAND 
STR9X_SRC_ADDR_ERROR 
STR9X_DST_ADDR_ERROR 
STR9X_SRC_ADDR_NOT_MAPPED 
STR9X_DST_ADDR_NOT_MAPPED 
STR9X_COUNT_ERROR 
STR9X_INVALID_SECTOR 
STR9X_SECTOR_NOT_BLANK 
STR9X_SECTOR_NOT_PREPARED 
STR9X_COMPARE_ERROR 
STR9X_BUSY 

Definition at line 38 of file str9x.c.

Function Documentation

◆ COMMAND_HANDLER()

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( str9x_flash_bank_command  )

Definition at line 135 of file str9x.c.

References bank, CMD_ARGC, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and str9x_build_block_list().

◆ str9x_build_block_list()

static int str9x_build_block_list ( struct flash_bank bank)
static

◆ str9x_erase()

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

◆ str9x_probe()

static int str9x_probe ( struct flash_bank bank)
static

Definition at line 579 of file str9x.c.

References ERROR_OK.

◆ str9x_protect()

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

◆ str9x_protect_check()

◆ str9x_write()

◆ str9x_write_block()

Variable Documentation

◆ bank1start

uint32_t bank1start = 0x00080000
static

Definition at line 53 of file str9x.c.

Referenced by str9x_build_block_list(), and str9x_protect_check().

◆ str9x_command_handlers

const struct command_registration str9x_command_handlers[]
static
Initial value:
= {
{
.name = "str9x",
.mode = COMMAND_ANY,
.help = "str9x 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_ANY
Definition: command.h:42
static const struct command_registration str9x_config_command_handlers[]
Definition: str9x.c:630

Definition at line 591 of file str9x.c.

◆ str9x_config_command_handlers

const struct command_registration str9x_config_command_handlers[]
static
Initial value:
= {
{
.name = "flash_config",
.handler = str9x_handle_flash_config_command,
.mode = COMMAND_EXEC,
.help = "Configure str9x flash controller, prior to "
"programming the flash.",
.usage = "bank_id BBSR NBBSR BBADR NBBADR",
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 591 of file str9x.c.

◆ str9x_flash

const struct flash_driver str9x_flash
Initial value:
= {
.name = "str9x",
.flash_bank_command = str9x_flash_bank_command,
.erase = str9x_erase,
.protect = str9x_protect,
.write = str9x_write,
.probe = str9x_probe,
.auto_probe = str9x_probe,
.erase_check = default_flash_blank_check,
.protect_check = str9x_protect_check,
.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 str9x_command_handlers[]
Definition: str9x.c:642
static int str9x_probe(struct flash_bank *bank)
Definition: str9x.c:579
static int str9x_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: str9x.c:212
static int str9x_protect_check(struct flash_bank *bank)
Definition: str9x.c:150
static int str9x_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: str9x.c:443
static int str9x_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: str9x.c:295

Definition at line 591 of file str9x.c.