summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-16 02:53:57 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 09:58:11 -0800
commita94748ec6da9bdc6e25a7f73bbea723b8b55fa33 (patch)
treec6aebc5e8f39d0918f9a88dd43e373ea9d28e210 /src/flash
parentf0ce88b3af9a6090ac986160950d66317de5087e (diff)
downloadopenocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.gz
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.bz2
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.xz
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.zip
rename CEIL as DIV_ROUND_UP
Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/at91sam7.c4
-rw-r--r--src/flash/lpc2000.c2
-rw-r--r--src/flash/str9xpec.c10
3 files changed, 8 insertions, 8 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c
index e0b83d57..9d05d7b5 100644
--- a/src/flash/at91sam7.c
+++ b/src/flash/at91sam7.c
@@ -979,7 +979,7 @@ static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
return ERROR_FLASH_BANK_NOT_PROBED;
first_page = offset/dst_min_alignment;
- last_page = CEIL(offset + count, dst_min_alignment);
+ last_page = DIV_ROUND_UP(offset + count, dst_min_alignment);
LOG_DEBUG("first_page: %i, last_page: %i, count %i", (int)first_page, (int)last_page, (int)count);
@@ -997,7 +997,7 @@ static int at91sam7_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
/* Write one block to the PageWriteBuffer */
buffer_pos = (pagen-first_page)*dst_min_alignment;
- wcount = CEIL(count,4);
+ wcount = DIV_ROUND_UP(count,4);
if ((retval = target_write_memory(target, bank->base + pagen*dst_min_alignment, 4, wcount, buffer + buffer_pos)) != ERROR_OK)
{
return retval;
diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c
index 79f58045..a3f97180 100644
--- a/src/flash/lpc2000.c
+++ b/src/flash/lpc2000.c
@@ -573,7 +573,7 @@ static int lpc2000_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs
{
if (offset >= bank->sectors[i].offset)
first_sector = i;
- if (offset + CEIL(count, dst_min_alignment) * dst_min_alignment > bank->sectors[i].offset)
+ if (offset + DIV_ROUND_UP(count, dst_min_alignment) * dst_min_alignment > bank->sectors[i].offset)
last_sector = i;
}
diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c
index 4bf5bcae..7f6d8bed 100644
--- a/src/flash/str9xpec.c
+++ b/src/flash/str9xpec.c
@@ -44,7 +44,7 @@ int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end
field.tap = tap;
field.num_bits = tap->ir_length;
- field.out_value = calloc(CEIL(field.num_bits, 8), 1);
+ field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
@@ -289,7 +289,7 @@ static int str9xpec_blank_check(struct flash_bank *bank, int first, int last)
return ERROR_FLASH_OPERATION_FAILED;
}
- buffer = calloc(CEIL(64, 8), 1);
+ buffer = calloc(DIV_ROUND_UP(64, 8), 1);
LOG_DEBUG("blank check: first_bank: %i, last_bank: %i", first, last);
@@ -378,7 +378,7 @@ static int str9xpec_erase_area(struct flash_bank *bank, int first, int last)
return ISC_STATUS_ERROR;
}
- buffer = calloc(CEIL(64, 8), 1);
+ buffer = calloc(DIV_ROUND_UP(64, 8), 1);
LOG_DEBUG("erase: first_bank: %i, last_bank: %i", first, last);
@@ -618,7 +618,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
LOG_DEBUG("first_sector: %i, last_sector: %i", first_sector, last_sector);
- scanbuf = calloc(CEIL(64, 8), 1);
+ scanbuf = calloc(DIV_ROUND_UP(64, 8), 1);
LOG_DEBUG("ISC_PROGRAM");
@@ -745,7 +745,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
str9xpec_info = bank->driver_priv;
tap = str9xpec_info->tap;
- buffer = calloc(CEIL(32, 8), 1);
+ buffer = calloc(DIV_ROUND_UP(32, 8), 1);
str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE);