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

Go to the source code of this file.

Data Structures

struct  tms470_flash_bank
 

Macros

#define TMS470R1A256_NUM_SECTORS    ARRAY_SIZE(tms470r1a256_sectors)
 
#define TMS470R1A288_BANK0_NUM_SECTORS    ARRAY_SIZE(tms470r1a288_bank0_sectors)
 
#define TMS470R1A288_BANK1_NUM_SECTORS    ARRAY_SIZE(tms470r1a288_bank1_sectors)
 
#define TMS470R1A384_BANK0_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank0_sectors)
 
#define TMS470R1A384_BANK1_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank1_sectors)
 
#define TMS470R1A384_BANK2_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank2_sectors)
 

Functions

 COMMAND_HANDLER (tms470_handle_flash_keyset_command)
 
 COMMAND_HANDLER (tms470_handle_osc_megahertz_command)
 
 COMMAND_HANDLER (tms470_handle_plldis_command)
 
 FLASH_BANK_COMMAND_HANDLER (tms470_flash_bank_command)
 
static int get_tms470_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int tms470_auto_probe (struct flash_bank *bank)
 
static int tms470_check_flash_unlocked (struct target *target)
 
static int tms470_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int tms470_erase_check (struct flash_bank *bank)
 
static int tms470_erase_sector (struct flash_bank *bank, int sector)
 
static int tms470_flash_initialize_internal_state_machine (struct flash_bank *bank)
 
static int tms470_flash_status (struct flash_bank *bank)
 
static int tms470_probe (struct flash_bank *bank)
 
static int tms470_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int tms470_protect_check (struct flash_bank *bank)
 
static int tms470_read_part_info (struct flash_bank *bank)
 
static int tms470_try_flash_keys (struct target *target, const uint32_t *key_set)
 
static int tms470_unlock_flash (struct flash_bank *bank)
 
static int tms470_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

static uint32_t flash_keys [4]
 
static const uint32_t flash_keys_all_ones []
 
static const uint32_t flash_keys_all_zeros []
 
static const uint32_t flash_keys_mix1 []
 
static const uint32_t flash_keys_mix2 []
 
static uint32_t keys_set
 
static int osc_mhz = 12
 
static int plldis
 
static const struct command_registration tms470_any_command_handlers []
 
static const struct command_registration tms470_command_handlers []
 
const struct flash_driver tms470_flash
 
static const struct flash_sector tms470r1a256_sectors []
 
static const struct flash_sector tms470r1a288_bank0_sectors []
 
static const struct flash_sector tms470r1a288_bank1_sectors []
 
static const struct flash_sector tms470r1a384_bank0_sectors []
 
static const struct flash_sector tms470r1a384_bank1_sectors []
 
static const struct flash_sector tms470r1a384_bank2_sectors []
 

Macro Definition Documentation

◆ TMS470R1A256_NUM_SECTORS

#define TMS470R1A256_NUM_SECTORS    ARRAY_SIZE(tms470r1a256_sectors)

Definition at line 48 of file tms470.c.

◆ TMS470R1A288_BANK0_NUM_SECTORS

#define TMS470R1A288_BANK0_NUM_SECTORS    ARRAY_SIZE(tms470r1a288_bank0_sectors)

Definition at line 58 of file tms470.c.

◆ TMS470R1A288_BANK1_NUM_SECTORS

#define TMS470R1A288_BANK1_NUM_SECTORS    ARRAY_SIZE(tms470r1a288_bank1_sectors)

Definition at line 68 of file tms470.c.

◆ TMS470R1A384_BANK0_NUM_SECTORS

#define TMS470R1A384_BANK0_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank0_sectors)

Definition at line 84 of file tms470.c.

◆ TMS470R1A384_BANK1_NUM_SECTORS

#define TMS470R1A384_BANK1_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank1_sectors)

Definition at line 94 of file tms470.c.

◆ TMS470R1A384_BANK2_NUM_SECTORS

#define TMS470R1A384_BANK2_NUM_SECTORS    ARRAY_SIZE(tms470r1a384_bank2_sectors)

Definition at line 104 of file tms470.c.

Function Documentation

◆ COMMAND_HANDLER() [1/3]

COMMAND_HANDLER ( tms470_handle_flash_keyset_command  )

◆ COMMAND_HANDLER() [2/3]

COMMAND_HANDLER ( tms470_handle_osc_megahertz_command  )

◆ COMMAND_HANDLER() [3/3]

COMMAND_HANDLER ( tms470_handle_plldis_command  )

Definition at line 353 of file tms470.c.

References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and plldis.

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( tms470_flash_bank_command  )

Definition at line 1133 of file tms470.c.

References bank, ERROR_FLASH_OPERATION_FAILED, and ERROR_OK.

◆ get_tms470_info()

◆ tms470_auto_probe()

static int tms470_auto_probe ( struct flash_bank bank)
static

Definition at line 977 of file tms470.c.

References bank, tms470_flash_bank::device_ident_reg, ERROR_OK, and tms470_probe().

◆ tms470_check_flash_unlocked()

static int tms470_check_flash_unlocked ( struct target target)
static

Definition at line 369 of file tms470.c.

References ERROR_FLASH_OPERATION_FAILED, ERROR_OK, LOG_INFO, and target_read_u32().

Referenced by get_tms470_info(), and tms470_try_flash_keys().

◆ tms470_erase()

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

◆ tms470_erase_check()

◆ tms470_erase_sector()

static int tms470_erase_sector ( struct flash_bank bank,
int  sector 
)
static

Definition at line 670 of file tms470.c.

Referenced by tms470_erase().

◆ tms470_flash_initialize_internal_state_machine()

static int tms470_flash_initialize_internal_state_machine ( struct flash_bank bank)
static

◆ tms470_flash_status()

static int tms470_flash_status ( struct flash_bank bank)
static

◆ tms470_probe()

static int tms470_probe ( struct flash_bank bank)
static

Definition at line 967 of file tms470.c.

References bank, ERROR_TARGET_NOT_HALTED, LOG_WARNING, TARGET_HALTED, and tms470_read_part_info().

Referenced by tms470_auto_probe().

◆ tms470_protect()

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

◆ tms470_protect_check()

◆ tms470_read_part_info()

◆ tms470_try_flash_keys()

static int tms470_try_flash_keys ( struct target target,
const uint32_t *  key_set 
)
static

◆ tms470_unlock_flash()

static int tms470_unlock_flash ( struct flash_bank bank)
static

◆ tms470_write()

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

Variable Documentation

◆ flash_keys

uint32_t flash_keys[4]
static

Definition at line 275 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_unlock_flash().

◆ flash_keys_all_ones

const uint32_t flash_keys_all_ones[]
static
Initial value:
= { 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF,}

Definition at line 314 of file tms470.c.

Referenced by tms470_unlock_flash().

◆ flash_keys_all_zeros

const uint32_t flash_keys_all_zeros[]
static
Initial value:
= { 0x00000000, 0x00000000,
0x00000000, 0x00000000,}

Definition at line 317 of file tms470.c.

Referenced by tms470_unlock_flash().

◆ flash_keys_mix1

const uint32_t flash_keys_mix1[]
static
Initial value:
= { 0xf0fff0ff, 0xf0fff0ff,
0xf0fff0ff, 0xf0fff0ff}

Definition at line 320 of file tms470.c.

Referenced by tms470_unlock_flash().

◆ flash_keys_mix2

const uint32_t flash_keys_mix2[]
static
Initial value:
= { 0x0000ffff, 0x0000ffff,
0x0000ffff, 0x0000ffff}

Definition at line 323 of file tms470.c.

Referenced by tms470_unlock_flash().

◆ keys_set

uint32_t keys_set
static

Definition at line 274 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_unlock_flash().

◆ osc_mhz

int osc_mhz = 12
static

Definition at line 328 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_flash_initialize_internal_state_machine().

◆ plldis

int plldis
static

Definition at line 351 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_flash_initialize_internal_state_machine().

◆ tms470_any_command_handlers

const struct command_registration tms470_any_command_handlers[]
static
Initial value:
= {
{
.name = "flash_keyset",
.usage = "<key0> <key1> <key2> <key3>",
.handler = tms470_handle_flash_keyset_command,
.mode = COMMAND_ANY,
.help = "tms470 flash_keyset <key0> <key1> <key2> <key3>",
},
{
.name = "osc_megahertz",
.usage = "<MHz>",
.handler = tms470_handle_osc_megahertz_command,
.mode = COMMAND_ANY,
.help = "tms470 osc_megahertz <MHz>",
},
{
.name = "plldis",
.usage = "<0 | 1>",
.handler = tms470_handle_plldis_command,
.mode = COMMAND_ANY,
.help = "tms470 plldis <0/1>",
},
}
#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

Definition at line 670 of file tms470.c.

◆ tms470_command_handlers

const struct command_registration tms470_command_handlers[]
static
Initial value:
= {
{
.name = "tms470",
.mode = COMMAND_ANY,
.help = "TI tms470 flash command group",
.usage = "",
},
}
static const struct command_registration tms470_any_command_handlers[]
Definition: tms470.c:751

Definition at line 670 of file tms470.c.

◆ tms470_flash

const struct flash_driver tms470_flash
Initial value:
= {
.name = "tms470",
.flash_bank_command = tms470_flash_bank_command,
.erase = tms470_erase,
.protect = tms470_protect,
.write = tms470_write,
.probe = tms470_probe,
.auto_probe = tms470_auto_probe,
.erase_check = tms470_erase_check,
.protect_check = tms470_protect_check,
.info = get_tms470_info,
.free_driver_priv = default_flash_free_driver_priv,
}
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 tms470_probe(struct flash_bank *bank)
Definition: tms470.c:967
static int tms470_protect_check(struct flash_bank *bank)
Definition: tms470.c:1063
static int tms470_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: tms470.c:828
static int tms470_auto_probe(struct flash_bank *bank)
Definition: tms470.c:977
static int get_tms470_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: tms470.c:1107
static int tms470_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: tms470.c:788
static int tms470_erase_check(struct flash_bank *bank)
Definition: tms470.c:988
static int tms470_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: tms470.c:876
static const struct command_registration tms470_command_handlers[]
Definition: tms470.c:775

Definition at line 1133 of file tms470.c.

◆ tms470r1a256_sectors

const struct flash_sector tms470r1a256_sectors[]
static
Initial value:
= {
{0x00000000, 0x00002000, -1, -1},
{0x00002000, 0x00002000, -1, -1},
{0x00004000, 0x00002000, -1, -1},
{0x00006000, 0x00002000, -1, -1},
{0x00008000, 0x00008000, -1, -1},
{0x00010000, 0x00008000, -1, -1},
{0x00018000, 0x00008000, -1, -1},
{0x00020000, 0x00008000, -1, -1},
{0x00028000, 0x00008000, -1, -1},
{0x00030000, 0x00008000, -1, -1},
{0x00038000, 0x00002000, -1, -1},
{0x0003A000, 0x00002000, -1, -1},
{0x0003C000, 0x00002000, -1, -1},
{0x0003E000, 0x00002000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().

◆ tms470r1a288_bank0_sectors

const struct flash_sector tms470r1a288_bank0_sectors[]
static
Initial value:
= {
{0x00000000, 0x00002000, -1, -1},
{0x00002000, 0x00002000, -1, -1},
{0x00004000, 0x00002000, -1, -1},
{0x00006000, 0x00002000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().

◆ tms470r1a288_bank1_sectors

const struct flash_sector tms470r1a288_bank1_sectors[]
static
Initial value:
= {
{0x00040000, 0x00010000, -1, -1},
{0x00050000, 0x00010000, -1, -1},
{0x00060000, 0x00010000, -1, -1},
{0x00070000, 0x00010000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().

◆ tms470r1a384_bank0_sectors

const struct flash_sector tms470r1a384_bank0_sectors[]
static
Initial value:
= {
{0x00000000, 0x00002000, -1, -1},
{0x00002000, 0x00002000, -1, -1},
{0x00004000, 0x00004000, -1, -1},
{0x00008000, 0x00004000, -1, -1},
{0x0000C000, 0x00004000, -1, -1},
{0x00010000, 0x00004000, -1, -1},
{0x00014000, 0x00004000, -1, -1},
{0x00018000, 0x00002000, -1, -1},
{0x0001C000, 0x00002000, -1, -1},
{0x0001E000, 0x00002000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().

◆ tms470r1a384_bank1_sectors

const struct flash_sector tms470r1a384_bank1_sectors[]
static
Initial value:
= {
{0x00020000, 0x00008000, -1, -1},
{0x00028000, 0x00008000, -1, -1},
{0x00030000, 0x00008000, -1, -1},
{0x00038000, 0x00008000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().

◆ tms470r1a384_bank2_sectors

const struct flash_sector tms470r1a384_bank2_sectors[]
static
Initial value:
= {
{0x00040000, 0x00008000, -1, -1},
{0x00048000, 0x00008000, -1, -1},
{0x00050000, 0x00008000, -1, -1},
{0x00058000, 0x00008000, -1, -1},
}

Definition at line 1 of file tms470.c.

Referenced by tms470_read_part_info().