summaryrefslogtreecommitdiff
path: root/src/server
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/server
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/server')
-rw-r--r--src/server/gdb_server.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index f6b44cd2..55ec7d4e 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -871,7 +871,7 @@ void gdb_str_to_target(struct target *target, char *tstr, struct reg *reg)
uint8_t *buf;
int buf_len;
buf = reg->value;
- buf_len = CEIL(reg->size, 8);
+ buf_len = DIV_ROUND_UP(reg->size, 8);
for (i = 0; i < buf_len; i++)
{
@@ -940,25 +940,25 @@ int gdb_get_registers_packet(struct connection *connection, struct target *targe
reg_packet_size += reg_list[i]->size;
}
- reg_packet = malloc(CEIL(reg_packet_size, 8) * 2);
+ reg_packet = malloc(DIV_ROUND_UP(reg_packet_size, 8) * 2);
reg_packet_p = reg_packet;
for (i = 0; i < reg_list_size; i++)
{
gdb_str_to_target(target, reg_packet_p, reg_list[i]);
- reg_packet_p += CEIL(reg_list[i]->size, 8) * 2;
+ reg_packet_p += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
}
#ifdef _DEBUG_GDB_IO_
{
char *reg_packet_p;
- reg_packet_p = strndup(reg_packet, CEIL(reg_packet_size, 8) * 2);
+ reg_packet_p = strndup(reg_packet, DIV_ROUND_UP(reg_packet_size, 8) * 2);
LOG_DEBUG("reg_packet: %s", reg_packet_p);
free(reg_packet_p);
}
#endif
- gdb_put_packet(connection, reg_packet, CEIL(reg_packet_size, 8) * 2);
+ gdb_put_packet(connection, reg_packet, DIV_ROUND_UP(reg_packet_size, 8) * 2);
free(reg_packet);
free(reg_list);
@@ -997,7 +997,7 @@ int gdb_set_registers_packet(struct connection *connection, struct target *targe
for (i = 0; i < reg_list_size; i++)
{
uint8_t *bin_buf;
- int chars = (CEIL(reg_list[i]->size, 8) * 2);
+ int chars = (DIV_ROUND_UP(reg_list[i]->size, 8) * 2);
if (packet_p + chars > packet + packet_size)
{
@@ -1005,7 +1005,7 @@ int gdb_set_registers_packet(struct connection *connection, struct target *targe
}
struct reg_arch_type *arch_type;
- bin_buf = malloc(CEIL(reg_list[i]->size, 8));
+ bin_buf = malloc(DIV_ROUND_UP(reg_list[i]->size, 8));
gdb_target_to_reg(target, packet_p, chars, bin_buf);
/* get register arch_type, and call set method */
@@ -1051,11 +1051,11 @@ int gdb_get_register_packet(struct connection *connection, struct target *target
exit(-1);
}
- reg_packet = malloc(CEIL(reg_list[reg_num]->size, 8) * 2);
+ reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
gdb_str_to_target(target, reg_packet, reg_list[reg_num]);
- gdb_put_packet(connection, reg_packet, CEIL(reg_list[reg_num]->size, 8) * 2);
+ gdb_put_packet(connection, reg_packet, DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
free(reg_list);
free(reg_packet);
@@ -1093,8 +1093,8 @@ int gdb_set_register_packet(struct connection *connection, struct target *target
}
/* convert from GDB-string (target-endian) to hex-string (big-endian) */
- bin_buf = malloc(CEIL(reg_list[reg_num]->size, 8));
- int chars = (CEIL(reg_list[reg_num]->size, 8) * 2);
+ bin_buf = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8));
+ int chars = (DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
/* fix!!! add some sanity checks on packet size here */