#define DID0_VER(did0) ((did0 >> 28)&0x07)
-static int stellaris_read_part_info(struct flash_bank_s *bank);
-static uint32_t stellaris_get_flash_status(flash_bank_t *bank);
-static void stellaris_set_flash_mode(flash_bank_t *bank,int mode);
-//static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
+static int stellaris_read_part_info(struct flash_bank *bank);
+static uint32_t stellaris_get_flash_status(struct flash_bank *bank);
+static void stellaris_set_flash_mode(struct flash_bank *bank,int mode);
+//static uint32_t stellaris_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
-static int stellaris_mass_erase(struct flash_bank_s *bank);
+static int stellaris_mass_erase(struct flash_bank *bank);
static struct {
uint32_t partno;
return ERROR_OK;
}
-static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size)
+static int stellaris_info(struct flash_bank *bank, char *buf, int buf_size)
{
int printed, device_class;
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
* chip identification and status *
***************************************************************************/
-static uint32_t stellaris_get_flash_status(flash_bank_t *bank)
+static uint32_t stellaris_get_flash_status(struct flash_bank *bank)
{
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t fmc;
target_read_u32(target, FLASH_CONTROL_BASE | FLASH_FMC, &fmc);
[0x16] = 16384000,
};
-static void stellaris_read_clock_info(flash_bank_t *bank)
+static void stellaris_read_clock_info(struct flash_bank *bank)
{
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc;
unsigned xtal;
unsigned long mainfreq;
}
/* Setup the timimg registers */
-static void stellaris_set_flash_mode(flash_bank_t *bank,int mode)
+static void stellaris_set_flash_mode(struct flash_bank *bank,int mode)
{
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t usecrl = (stellaris_info->mck_freq/1000000ul-1);
LOG_DEBUG("usecrl = %i",(int)(usecrl));
}
#if 0
-static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout)
+static uint32_t stellaris_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout)
{
uint32_t status;
}
/* Send one command to the flash controller */
-static int stellaris_flash_command(struct flash_bank_s *bank,uint8_t cmd,uint16_t pagen)
+static int stellaris_flash_command(struct flash_bank *bank,uint8_t cmd,uint16_t pagen)
{
uint32_t fmc;
- target_t *target = bank->target;
+ struct target *target = bank->target;
fmc = FMC_WRKEY | cmd;
target_write_u32(target, FLASH_CONTROL_BASE | FLASH_FMC, fmc);
#endif
/* Read device id register, main clock frequency register and fill in driver info structure */
-static int stellaris_read_part_info(struct flash_bank_s *bank)
+static int stellaris_read_part_info(struct flash_bank *bank)
{
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t did0, did1, ver, fam, status;
int i;
* flash operations *
***************************************************************************/
-static int stellaris_protect_check(struct flash_bank_s *bank)
+static int stellaris_protect_check(struct flash_bank *bank)
{
uint32_t status;
return ERROR_OK;
}
-static int stellaris_erase(struct flash_bank_s *bank, int first, int last)
+static int stellaris_erase(struct flash_bank *bank, int first, int last)
{
int banknr;
uint32_t flash_fmc, flash_cris;
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
if (bank->target->state != TARGET_HALTED)
{
return ERROR_OK;
}
-static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int last)
+static int stellaris_protect(struct flash_bank *bank, int set, int first, int last)
{
uint32_t fmppe, flash_fmc, flash_cris;
int lockregion;
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
if (bank->target->state != TARGET_HALTED)
{
0x01,0x00,0x42,0xA4 /* .word 0xA4420001 */
};
-static int stellaris_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t wcount)
+static int stellaris_write_block(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t wcount)
{
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t buffer_size = 8192;
struct working_area *source;
struct working_area *write_algorithm;
return retval;
}
-static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
+static int stellaris_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
- target_t *target = bank->target;
+ struct target *target = bank->target;
uint32_t address = offset;
uint32_t flash_cris, flash_fmc;
uint32_t words_remaining = (count / 4);
return ERROR_OK;
}
-static int stellaris_probe(struct flash_bank_s *bank)
+static int stellaris_probe(struct flash_bank *bank)
{
/* we can't probe on an stellaris
* if this is an stellaris, it has the configured flash
return stellaris_read_part_info(bank);
}
-static int stellaris_auto_probe(struct flash_bank_s *bank)
+static int stellaris_auto_probe(struct flash_bank *bank)
{
struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
if (stellaris_info->did1)
return stellaris_probe(bank);
}
-static int stellaris_mass_erase(struct flash_bank_s *bank)
+static int stellaris_mass_erase(struct flash_bank *bank)
{
- target_t *target = NULL;
+ struct target *target = NULL;
struct stellaris_flash_bank *stellaris_info = NULL;
uint32_t flash_fmc;
return ERROR_OK;
}
- flash_bank_t *bank;
+ struct flash_bank *bank;
int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
if (ERROR_OK != retval)
return retval;