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

Go to the source code of this file.

Data Structures

struct  fm4_flash_bank
 

Macros

#define DFCTRLR   (FLASH_BASE + 0x030)
 
#define DFCTRLR_DFE   (1UL << 0)
 
#define FASZR   (FLASH_BASE + 0x000)
 
#define FLASH_BASE   0x40000000
 
#define WDG_BASE   0x40011000
 
#define WDG_CTL   (WDG_BASE + 0x008)
 
#define WDG_LCK   (WDG_BASE + 0xC00)
 

Enumerations

enum  fm4_variant {
  MB9BFX64 , MB9BFX65 , MB9BFX66 , MB9BFX67 ,
  MB9BFX68 , S6E2CX8 , S6E2CX9 , S6E2CXA ,
  S6E2DX
}
 

Functions

 FLASH_BANK_COMMAND_HANDLER (fm4_flash_bank_command)
 
static int fm4_auto_probe (struct flash_bank *bank)
 
static int fm4_disable_hw_watchdog (struct target *target)
 
static int fm4_enter_flash_cpu_programming_mode (struct target *target)
 
static int fm4_enter_flash_cpu_rom_mode (struct target *target)
 
static int fm4_flash_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int fm4_flash_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t byte_count)
 
static int fm4_get_info_command (struct flash_bank *bank, struct command_invocation *cmd)
 
static bool fm4_name_match (const char *s, const char *pattern)
 
static int fm4_probe (struct flash_bank *bank)
 
static int mb9bf_bank_setup (struct flash_bank *bank, const char *variant)
 
static int mb9bf_probe (struct flash_bank *bank)
 
static int s6e2cc_bank_setup (struct flash_bank *bank, const char *variant)
 
static void s6e2cc_init_sector (struct flash_sector *sector, int sa)
 
static int s6e2cc_probe (struct flash_bank *bank)
 
static int s6e2dh_probe (struct flash_bank *bank)
 

Variables

const struct flash_driver fm4_flash
 

Macro Definition Documentation

◆ DFCTRLR

#define DFCTRLR   (FLASH_BASE + 0x030)

Definition at line 25 of file fm4.c.

◆ DFCTRLR_DFE

#define DFCTRLR_DFE   (1UL << 0)

Definition at line 26 of file fm4.c.

◆ FASZR

#define FASZR   (FLASH_BASE + 0x000)

Definition at line 24 of file fm4.c.

◆ FLASH_BASE

#define FLASH_BASE   0x40000000

Definition at line 23 of file fm4.c.

◆ WDG_BASE

#define WDG_BASE   0x40011000

Definition at line 28 of file fm4.c.

◆ WDG_CTL

#define WDG_CTL   (WDG_BASE + 0x008)

Definition at line 29 of file fm4.c.

◆ WDG_LCK

#define WDG_LCK   (WDG_BASE + 0xC00)

Definition at line 30 of file fm4.c.

Enumeration Type Documentation

◆ fm4_variant

Enumerator
MB9BFX64 
MB9BFX65 
MB9BFX66 
MB9BFX67 
MB9BFX68 
S6E2CX8 
S6E2CX9 
S6E2CXA 
S6E2DX 

Definition at line 32 of file fm4.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( fm4_flash_bank_command  )

Definition at line 655 of file fm4.c.

◆ fm4_auto_probe()

static int fm4_auto_probe ( struct flash_bank bank)
static

Definition at line 532 of file fm4.c.

References bank, ERROR_OK, fm4_probe(), and fm4_flash_bank::probed.

◆ fm4_disable_hw_watchdog()

static int fm4_disable_hw_watchdog ( struct target target)
static

Definition at line 52 of file fm4.c.

References ERROR_OK, target_write_u32(), WDG_CTL, and WDG_LCK.

Referenced by fm4_flash_erase(), and fm4_flash_write().

◆ fm4_enter_flash_cpu_programming_mode()

static int fm4_enter_flash_cpu_programming_mode ( struct target target)
static

Definition at line 71 of file fm4.c.

References ERROR_OK, FASZR, target_read_u32(), and target_write_u32().

Referenced by fm4_flash_erase(), and fm4_flash_write().

◆ fm4_enter_flash_cpu_rom_mode()

static int fm4_enter_flash_cpu_rom_mode ( struct target target)
static

Definition at line 87 of file fm4.c.

References ERROR_OK, FASZR, target_read_u32(), and target_write_u32().

Referenced by fm4_flash_erase(), and fm4_flash_write().

◆ fm4_flash_erase()

◆ fm4_flash_write()

◆ fm4_get_info_command()

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

◆ fm4_name_match()

static bool fm4_name_match ( const char *  s,
const char *  pattern 
)
static

Definition at line 599 of file fm4.c.

Referenced by mb9bf_bank_setup(), and s6e2cc_bank_setup().

◆ fm4_probe()

◆ mb9bf_bank_setup()

static int mb9bf_bank_setup ( struct flash_bank bank,
const char *  variant 
)
static

◆ mb9bf_probe()

static int mb9bf_probe ( struct flash_bank bank)
static

◆ s6e2cc_bank_setup()

static int s6e2cc_bank_setup ( struct flash_bank bank,
const char *  variant 
)
static

◆ s6e2cc_init_sector()

static void s6e2cc_init_sector ( struct flash_sector sector,
int  sa 
)
static

Definition at line 393 of file fm4.c.

References flash_sector::is_erased, flash_sector::is_protected, and flash_sector::size.

Referenced by s6e2cc_probe().

◆ s6e2cc_probe()

◆ s6e2dh_probe()

static int s6e2dh_probe ( struct flash_bank bank)
static

Definition at line 467 of file fm4.c.

References bank, and ERROR_OK.

Referenced by fm4_probe().

Variable Documentation

◆ fm4_flash

const struct flash_driver fm4_flash
Initial value:
= {
.name = "fm4",
.flash_bank_command = fm4_flash_bank_command,
.probe = fm4_probe,
.auto_probe = fm4_auto_probe,
.erase = fm4_flash_erase,
.erase_check = default_flash_blank_check,
.write = fm4_flash_write,
.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 fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t byte_count)
Definition: fm4.c:201
static int fm4_probe(struct flash_bank *bank)
Definition: fm4.c:492
static int fm4_flash_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: fm4.c:103
static int fm4_auto_probe(struct flash_bank *bank)
Definition: fm4.c:532
static int fm4_get_info_command(struct flash_bank *bank, struct command_invocation *cmd)
Definition: fm4.c:542

Definition at line 655 of file fm4.c.