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

Go to the source code of this file.

Macros

#define FLASH_ERASE_TIMEOUT   500
 
#define FLASH_MASS_ERASE_TIMEOUT   2400
 
#define FLASH_WRITE_TIMEOUT   5
 
#define HICK_STABLE_TIMEOUT   1000
 

Functions

static int artery_auto_probe (struct flash_bank *bank)
 
static int artery_deinit_flash (struct flash_bank *bank)
 
static int artery_disable_fap (struct flash_bank *bank)
 
static int artery_enable_hiclk (struct flash_bank *bank)
 
static int artery_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int artery_get_fap (struct flash_bank *bank, enum artery_fap_level *fap_level)
 
static int artery_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int artery_init_flash (struct flash_bank *bank)
 
static int artery_mass_erase (struct flash_bank *bank)
 
static int artery_probe (struct flash_bank *bank)
 
static int artery_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int artery_protect_check (struct flash_bank *bank)
 
static int artery_read_flash_register (struct flash_bank *bank, enum artery_flash_reg_index reg, uint32_t *value)
 
static int artery_read_protection (struct flash_bank *bank, uint64_t *protection)
 
static int artery_usd_erase (struct flash_bank *bank)
 
static int artery_usd_init (struct flash_bank *bank, uint8_t **buffer)
 
static int artery_usd_load (const struct artery_part_info *part_info, const uint8_t *buffer, struct artery_usd *usd)
 
static int artery_usd_lock (struct flash_bank *bank)
 
static int artery_usd_read (struct flash_bank *bank, uint8_t *buffer)
 
static uint8_t artery_usd_read_buffer (const uint8_t *buffer, uint32_t base, uint32_t offset)
 
static int artery_usd_unlock (struct flash_bank *bank)
 
static void artery_usd_update (const struct artery_part_info *part_info, uint8_t *buffer, const struct artery_usd *usd)
 
static int artery_usd_write (struct flash_bank *bank, const uint8_t *buffer)
 
static void artery_usd_write_buffer (uint8_t *buffer, uint32_t base, uint32_t offset, uint8_t data)
 
static int artery_wait_flash_busy (struct flash_bank *bank, unsigned int timeout)
 
static int artery_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int artery_write_flash_register (struct flash_bank *bank, enum artery_flash_reg_index reg, uint32_t value)
 
static int artery_write_without_loader (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
 COMMAND_HANDLER (artery_handle_fap_disable_command)
 
 COMMAND_HANDLER (artery_handle_fap_enable_command)
 
 COMMAND_HANDLER (artery_handle_fap_state_command)
 
 COMMAND_HANDLER (artery_handle_mass_erase_command)
 
 FLASH_BANK_COMMAND_HANDLER (artery_flash_bank_command)
 

Variables

static const struct command_registration artery_command_handlers []
 
static const struct command_registration artery_exec_command_handlers []
 
static const struct command_registration artery_fap_command_handlers []
 
const struct flash_driver artery_flash
 
static const struct artery_part_info artery_parts []
 
static const struct artery_series_info artery_series []
 
static const uint32_t flash_regs_f435_f437 [ARTERY_FLASH_REG_INDEX_NUM]
 
static const uint32_t flash_regs_f4xx_wb415 [ARTERY_FLASH_REG_INDEX_NUM]
 
static const uint32_t usd_offsets_f403a_f407_f413 [ARTERY_USD_INDEX_NUM]
 
static const uint32_t usd_offsets_f435_f437 [ARTERY_USD_INDEX_NUM]
 
static const uint32_t usd_offsets_f4xx_wb415 [ARTERY_USD_INDEX_NUM]
 

Macro Definition Documentation

◆ FLASH_ERASE_TIMEOUT

#define FLASH_ERASE_TIMEOUT   500

Definition at line 22 of file artery.c.

◆ FLASH_MASS_ERASE_TIMEOUT

#define FLASH_MASS_ERASE_TIMEOUT   2400

Definition at line 21 of file artery.c.

◆ FLASH_WRITE_TIMEOUT

#define FLASH_WRITE_TIMEOUT   5

Definition at line 23 of file artery.c.

◆ HICK_STABLE_TIMEOUT

#define HICK_STABLE_TIMEOUT   1000

Definition at line 24 of file artery.c.

Function Documentation

◆ artery_auto_probe()

static int artery_auto_probe ( struct flash_bank bank)
static

Definition at line 2206 of file artery.c.

References artery_info(), artery_probe(), bank, and ERROR_OK.

◆ artery_deinit_flash()

◆ artery_disable_fap()

◆ artery_enable_hiclk()

◆ artery_erase()

◆ artery_get_fap()

◆ artery_info()

◆ artery_init_flash()

◆ artery_mass_erase()

◆ artery_probe()

◆ artery_protect()

◆ artery_protect_check()

static int artery_protect_check ( struct flash_bank bank)
static

Definition at line 1437 of file artery.c.

References artery_read_protection(), bank, ERROR_OK, and LOG_ERROR.

◆ artery_read_flash_register()

◆ artery_read_protection()

static int artery_read_protection ( struct flash_bank bank,
uint64_t *  protection 
)
static

◆ artery_usd_erase()

◆ artery_usd_init()

static int artery_usd_init ( struct flash_bank bank,
uint8_t **  buffer 
)
static

Definition at line 1533 of file artery.c.

References artery_info(), bank, buffer, ERROR_FAIL, ERROR_OK, LOG_ERROR, and artery_part_info::usd_size.

Referenced by artery_protect(), and COMMAND_HANDLER().

◆ artery_usd_load()

◆ artery_usd_lock()

static int artery_usd_lock ( struct flash_bank bank)
static

◆ artery_usd_read()

static int artery_usd_read ( struct flash_bank bank,
uint8_t *  buffer 
)
static

◆ artery_usd_read_buffer()

static uint8_t artery_usd_read_buffer ( const uint8_t *  buffer,
uint32_t  base,
uint32_t  offset 
)
static

Definition at line 1561 of file artery.c.

References buffer, and offset.

Referenced by artery_usd_load().

◆ artery_usd_unlock()

static int artery_usd_unlock ( struct flash_bank bank)
static

◆ artery_usd_update()

◆ artery_usd_write()

◆ artery_usd_write_buffer()

static void artery_usd_write_buffer ( uint8_t *  buffer,
uint32_t  base,
uint32_t  offset,
uint8_t  data 
)
static

Definition at line 1617 of file artery.c.

References buffer, and offset.

Referenced by artery_disable_fap(), and artery_usd_update().

◆ artery_wait_flash_busy()

static int artery_wait_flash_busy ( struct flash_bank bank,
unsigned int  timeout 
)
static

◆ artery_write()

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

◆ artery_write_flash_register()

◆ artery_write_without_loader()

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

◆ COMMAND_HANDLER() [1/4]

COMMAND_HANDLER ( artery_handle_fap_disable_command  )

◆ COMMAND_HANDLER() [2/4]

◆ COMMAND_HANDLER() [3/4]

COMMAND_HANDLER ( artery_handle_fap_state_command  )

◆ COMMAND_HANDLER() [4/4]

COMMAND_HANDLER ( artery_handle_mass_erase_command  )

Definition at line 2518 of file artery.c.

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( artery_flash_bank_command  )

Definition at line 1149 of file artery.c.

References artery_info(), bank, CMD_ARGC, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, and ERROR_OK.

Variable Documentation

◆ artery_command_handlers

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

Definition at line 2518 of file artery.c.

◆ artery_exec_command_handlers

const struct command_registration artery_exec_command_handlers[]
static
Initial value:
= {
{
.name = "fap",
.mode = COMMAND_ANY,
.help = "flash access protection (FAP) command group",
.usage = "",
},
{
.name = "mass_erase",
.handler = artery_handle_mass_erase_command,
.mode = COMMAND_EXEC,
.usage = "<bank_id>",
.help = "Erase entire flash memory",
},
}
static const struct command_registration artery_fap_command_handlers[]
Definition: artery.c:2539
@ COMMAND_EXEC
Definition: command.h:40
const char * name
Definition: command.h:234

Definition at line 2518 of file artery.c.

◆ artery_fap_command_handlers

const struct command_registration artery_fap_command_handlers[]
static
Initial value:
= {
{
.name = "enable",
.handler = artery_handle_fap_enable_command,
.mode = COMMAND_EXEC,
.usage = "<bank_id>",
.help = "Enable flash access protection (FAP)",
},
{
.name = "disable",
.handler = artery_handle_fap_disable_command,
.mode = COMMAND_EXEC,
.usage = "<bank_id>",
.help = "Disable flash access protection (FAP)",
},
{
.name = "state",
.handler = artery_handle_fap_state_command,
.mode = COMMAND_EXEC,
.usage = "<bank_id>",
.help = "Get the flash access protection (FAP) state",
},
}

Definition at line 2518 of file artery.c.

◆ artery_flash

const struct flash_driver artery_flash
Initial value:
= {
.name = "artery",
.flash_bank_command = artery_flash_bank_command,
.erase = artery_erase,
.protect = artery_protect,
.write = artery_write,
.probe = artery_probe,
.auto_probe = artery_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = artery_protect_check,
.info = artery_info,
.free_driver_priv = default_flash_free_driver_priv,
}
static const struct command_registration artery_command_handlers[]
Definition: artery.c:2583
static int artery_probe(struct flash_bank *bank)
Definition: artery.c:1980
static int artery_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: artery.c:1455
static int artery_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: artery.c:2216
static int artery_auto_probe(struct flash_bank *bank)
Definition: artery.c:2206
static int artery_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: artery.c:1801
static int artery_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: artery.c:1947
static int artery_protect_check(struct flash_bank *bank)
Definition: artery.c:1437
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.

Definition at line 2518 of file artery.c.

◆ artery_parts

const struct artery_part_info artery_parts[]
static

Definition at line 89 of file artery.c.

Referenced by artery_probe().

◆ artery_series

const struct artery_series_info artery_series[]
static

Definition at line 89 of file artery.c.

◆ flash_regs_f435_f437

const uint32_t flash_regs_f435_f437[ARTERY_FLASH_REG_INDEX_NUM]
static
Initial value:
= {
}
@ ARTERY_FLASH_REG_USD
Definition: artery.h:32
@ ARTERY_FLASH_REG_USD_UNLOCK
Definition: artery.h:28
@ ARTERY_FLASH_REG_PSR
Definition: artery.h:26
@ ARTERY_FLASH_REG_ADDR
Definition: artery.h:31
@ ARTERY_FLASH_REG_EPPS1
Definition: artery.h:34
@ ARTERY_FLASH_REG_CTRL
Definition: artery.h:30
@ ARTERY_FLASH_REG_UNLOCK
Definition: artery.h:27
@ ARTERY_FLASH_REG_STS
Definition: artery.h:29
@ ARTERY_FLASH_REG_EPPS0
Definition: artery.h:33

Definition at line 49 of file artery.c.

◆ flash_regs_f4xx_wb415

const uint32_t flash_regs_f4xx_wb415[ARTERY_FLASH_REG_INDEX_NUM]
static
Initial value:

Definition at line 36 of file artery.c.

◆ usd_offsets_f403a_f407_f413

const uint32_t usd_offsets_f403a_f407_f413[ARTERY_USD_INDEX_NUM]
static
Initial value:
= {
}
@ ARTERY_USD_FAP_INDEX
Definition: artery.h:39
@ ARTERY_USD_DATA_INDEX
Definition: artery.h:41
@ ARTERY_USD_DATA_EXT_INDEX
Definition: artery.h:44
@ ARTERY_USD_EPP_INDEX
Definition: artery.h:42
@ ARTERY_USD_SSB_INDEX
Definition: artery.h:40

Definition at line 79 of file artery.c.

◆ usd_offsets_f435_f437

const uint32_t usd_offsets_f435_f437[ARTERY_USD_INDEX_NUM]
static
Initial value:
= {
}
@ ARTERY_USD_EPP_EXT_INDEX
Definition: artery.h:43

Definition at line 89 of file artery.c.

◆ usd_offsets_f4xx_wb415

const uint32_t usd_offsets_f4xx_wb415[ARTERY_USD_INDEX_NUM]
static
Initial value:

Definition at line 69 of file artery.c.