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, char *buf, int buf_size)
 
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, int first, 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, int first, 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 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 flashKeys [4]
 
static uint32_t keysSet
 
static int oscMHz = 12
 
static int plldis
 
static const struct
command_registration 
tms470_any_command_handlers []
 
static const struct
command_registration 
tms470_command_handlers []
 
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

#define TMS470R1A256_NUM_SECTORS   ARRAY_SIZE(TMS470R1A256_SECTORS)

Definition at line 59 of file tms470.c.

Referenced by tms470_read_part_info().

#define TMS470R1A288_BANK0_NUM_SECTORS   ARRAY_SIZE(TMS470R1A288_BANK0_SECTORS)

Definition at line 69 of file tms470.c.

Referenced by tms470_read_part_info().

#define TMS470R1A288_BANK1_NUM_SECTORS   ARRAY_SIZE(TMS470R1A288_BANK1_SECTORS)

Definition at line 79 of file tms470.c.

Referenced by tms470_read_part_info().

#define TMS470R1A384_BANK0_NUM_SECTORS   ARRAY_SIZE(TMS470R1A384_BANK0_SECTORS)

Definition at line 95 of file tms470.c.

Referenced by tms470_read_part_info().

#define TMS470R1A384_BANK1_NUM_SECTORS   ARRAY_SIZE(TMS470R1A384_BANK1_SECTORS)

Definition at line 105 of file tms470.c.

Referenced by tms470_read_part_info().

#define TMS470R1A384_BANK2_NUM_SECTORS   ARRAY_SIZE(TMS470R1A384_BANK2_SECTORS)

Definition at line 115 of file tms470.c.

Referenced by tms470_read_part_info().

Function Documentation

COMMAND_HANDLER ( tms470_handle_flash_keyset_command  )
COMMAND_HANDLER ( tms470_handle_osc_megahertz_command  )
COMMAND_HANDLER ( tms470_handle_plldis_command  )

Definition at line 367 of file tms470.c.

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

FLASH_BANK_COMMAND_HANDLER ( tms470_flash_bank_command  )

Definition at line 1164 of file tms470.c.

References ERROR_FLASH_OPERATION_FAILED, and ERROR_OK.

static int get_tms470_info ( struct flash_bank bank,
char *  buf,
int  buf_size 
)
static
static int tms470_auto_probe ( struct flash_bank bank)
static
static int tms470_check_flash_unlocked ( struct target target)
static

Definition at line 383 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().

static int tms470_flash_initialize_internal_state_machine ( struct flash_bank bank)
static
static int tms470_flash_status ( struct flash_bank bank)
static
static int tms470_probe ( struct flash_bank bank)
static
static int tms470_try_flash_keys ( struct target target,
const uint32_t *  key_set 
)
static
static int tms470_unlock_flash ( struct flash_bank bank)
static

Variable Documentation

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

Definition at line 328 of file tms470.c.

Referenced by tms470_unlock_flash().

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

Definition at line 331 of file tms470.c.

Referenced by tms470_unlock_flash().

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

Definition at line 334 of file tms470.c.

Referenced by tms470_unlock_flash().

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

Definition at line 337 of file tms470.c.

Referenced by tms470_unlock_flash().

uint32_t flashKeys[4]
static

Definition at line 289 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_unlock_flash().

uint32_t keysSet
static

Definition at line 288 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_unlock_flash().

int oscMHz = 12
static

Definition at line 342 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_flash_initialize_internal_state_machine().

int plldis
static

Definition at line 365 of file tms470.c.

Referenced by COMMAND_HANDLER(), and tms470_flash_initialize_internal_state_machine().

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:222

Definition at line 767 of file tms470.c.

const struct command_registration tms470_command_handlers[]
static
Initial value:
= {
{
.name = "tms470",
.mode = COMMAND_ANY,
.help = "TI tms470 flash command group",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:222
static const struct command_registration tms470_any_command_handlers[]
Definition: tms470.c:767

Definition at line 791 of file tms470.c.

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,
}
static int tms470_auto_probe(struct flash_bank *bank)
Definition: tms470.c:992
static int tms470_erase(struct flash_bank *bank, int first, int last)
Definition: tms470.c:804
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
static int tms470_erase_check(struct flash_bank *bank)
Definition: tms470.c:1003
static int get_tms470_info(struct flash_bank *bank, char *buf, int buf_size)
Definition: tms470.c:1132
static const struct command_registration tms470_command_handlers[]
Definition: tms470.c:791
static int tms470_protect_check(struct flash_bank *bank)
Definition: tms470.c:1088
static int tms470_probe(struct flash_bank *bank)
Definition: tms470.c:982
static int tms470_protect(struct flash_bank *bank, int set, int first, int last)
Definition: tms470.c:843
static int tms470_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: tms470.c:891

Definition at line 1176 of file tms470.c.

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 42 of file tms470.c.

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 62 of file tms470.c.

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 72 of file tms470.c.

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 82 of file tms470.c.

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 98 of file tms470.c.

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 108 of file tms470.c.