/* ---------------------------------------------------------------------- */
-static int tms470_erase(struct flash_bank *bank, int first, int last)
+static int tms470_erase(struct flash_bank *bank, unsigned int first,
+ unsigned int last)
{
struct tms470_flash_bank *tms470_info = bank->driver_priv;
- int sector, result = ERROR_OK;
+ int result = ERROR_OK;
if (bank->target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
tms470_read_part_info(bank);
- if ((first < 0) || (first >= bank->num_sectors) || (last < 0) ||
- (last >= bank->num_sectors) || (first > last)) {
- LOG_ERROR("Sector range %d to %d invalid.", first, last);
+ if ((first >= bank->num_sectors) || (last >= bank->num_sectors) ||
+ (first > last)) {
+ LOG_ERROR("Sector range %u to %u invalid.", first, last);
return ERROR_FLASH_SECTOR_INVALID;
}
if (result != ERROR_OK)
return result;
- for (sector = first; sector <= last; sector++) {
- LOG_INFO("Erasing tms470 bank %d sector %d...", tms470_info->ordinal, sector);
+ for (unsigned int sector = first; sector <= last; sector++) {
+ LOG_INFO("Erasing tms470 bank %u sector %u...", tms470_info->ordinal, sector);
result = tms470_erase_sector(bank, sector);
/* ---------------------------------------------------------------------- */
-static int tms470_protect(struct flash_bank *bank, int set, int first, int last)
+static int tms470_protect(struct flash_bank *bank, int set, unsigned int first,
+ unsigned int last)
{
struct tms470_flash_bank *tms470_info = bank->driver_priv;
struct target *target = bank->target;
uint32_t fmmac2, fmbsea, fmbseb;
- int sector;
if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
tms470_read_part_info(bank);
- if ((first < 0) || (first >= bank->num_sectors) || (last < 0) ||
- (last >= bank->num_sectors) || (first > last)) {
- LOG_ERROR("Sector range %d to %d invalid.", first, last);
+ if ((first >= bank->num_sectors) || (last >= bank->num_sectors) ||
+ (first > last)) {
+ LOG_ERROR("Sector range %u to %u invalid.", first, last);
return ERROR_FLASH_SECTOR_INVALID;
}
target_read_u32(target, 0xFFE88008, &fmbsea);
target_read_u32(target, 0xFFE8800C, &fmbseb);
- for (sector = 0; sector < bank->num_sectors; sector++) {
+ for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
if (sector < 16) {
fmbsea = set ? fmbsea & ~(1 << sector) : fmbsea | (1 << sector);
bank->sectors[sector].is_protected = set ? 1 : 0;
{
struct target *target = bank->target;
struct tms470_flash_bank *tms470_info = bank->driver_priv;
- int sector, result = ERROR_OK;
+ int result = ERROR_OK;
uint32_t fmmac2, fmbac2, glbctrl, orig_fmregopt;
static uint8_t buffer[64 * 1024];
* word at a time. Here we read an entire sector and inspect it in
* an attempt to reduce the JTAG overhead.
*/
- for (sector = 0; sector < bank->num_sectors; sector++) {
+ for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
uint32_t i, addr = bank->base + bank->sectors[sector].offset;
- LOG_INFO("checking flash bank %d sector %d", tms470_info->ordinal, sector);
+ LOG_INFO("checking flash bank %u sector %u", tms470_info->ordinal, sector);
target_read_buffer(target, addr, bank->sectors[sector].size, buffer);
{
struct target *target = bank->target;
struct tms470_flash_bank *tms470_info = bank->driver_priv;
- int sector, result = ERROR_OK;
+ int result = ERROR_OK;
uint32_t fmmac2, fmbsea, fmbseb;
if (target->state != TARGET_HALTED) {
target_read_u32(target, 0xFFE88008, &fmbsea);
target_read_u32(target, 0xFFE8800C, &fmbseb);
- for (sector = 0; sector < bank->num_sectors; sector++) {
+ for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
int protected;
if (sector < 16) {
bank->sectors[sector].is_protected = protected;
}
- LOG_DEBUG("bank %d sector %d is %s",
+ LOG_DEBUG("bank %u sector %u is %s",
tms470_info->ordinal,
sector,
protected ? "protected" : "not protected");