Reformat spacing/comments in src/updi_readwrite.c

This commit is contained in:
Stefan Rueger
2024-08-18 01:54:32 +01:00
parent baeb1c00b7
commit 1798e82f72

View File

@@ -146,18 +146,18 @@ int updi_read_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, uin
*/
pmsg_debug("reading %d bytes from 0x%06X\n", size, address);
if (size > UPDI_MAX_REPEAT_SIZE) {
if(size > UPDI_MAX_REPEAT_SIZE) {
pmsg_debug("cannot read that many bytes in one go\n");
return -1;
}
if (updi_link_st_ptr(pgm, address) < 0) {
if(updi_link_st_ptr(pgm, address) < 0) {
pmsg_debug("ST_PTR operation failed\n");
return -1;
}
if (size > 1) {
if (updi_link_repeat(pgm, size) < 0) {
if(size > 1) {
if(updi_link_repeat(pgm, size) < 0) {
pmsg_debug("repeat operation failed\n");
return -1;
}
@@ -193,25 +193,25 @@ int updi_write_data(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffer, ui
self.datalink.repeat(len(data))
return self.datalink.st_ptr_inc(data)
*/
if (size == 1) {
if(size == 1) {
return updi_link_st(pgm, address, buffer[0]);
}
if (size == 2) {
if (updi_link_st(pgm, address, buffer[0]) < 0) {
if(size == 2) {
if(updi_link_st(pgm, address, buffer[0]) < 0) {
pmsg_debug("ST operation failed\n");
return -1;
}
return updi_link_st(pgm, address+1, buffer[1]);
return updi_link_st(pgm, address + 1, buffer[1]);
}
if (size > UPDI_MAX_REPEAT_SIZE) {
if(size > UPDI_MAX_REPEAT_SIZE) {
pmsg_debug("invalid length\n");
return -1;
}
if (updi_link_st_ptr(pgm, address) < 0) {
if(updi_link_st_ptr(pgm, address) < 0) {
pmsg_debug("ST_PTR operation failed\n");
return -1;
}
if (updi_link_repeat(pgm, size) < 0) {
if(updi_link_repeat(pgm, size) < 0) {
pmsg_debug("repeat operation failed\n");
return -1;
}
@@ -245,18 +245,18 @@ int updi_read_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buffe
*/
pmsg_debug("reading %d words from 0x%06X", size, address);
if (size > (UPDI_MAX_REPEAT_SIZE >> 1)) {
if(size > (UPDI_MAX_REPEAT_SIZE >> 1)) {
pmsg_debug("cannot read that many words in one go\n");
return -1;
}
if (updi_link_st_ptr(pgm, address) < 0) {
if(updi_link_st_ptr(pgm, address) < 0) {
pmsg_debug("ST_PTR operation failed\n");
return -1;
}
if (size > 1) {
if (updi_link_repeat(pgm, size) < 0) {
if(size > 1) {
if(updi_link_repeat(pgm, size) < 0) {
pmsg_debug("repeat operation failed\n");
return -1;
}
@@ -289,14 +289,14 @@ int updi_write_data_words(const PROGRAMMER *pgm, uint32_t address, uint8_t *buff
self.datalink.repeat(len(data) >> 1)
return self.datalink.st_ptr_inc16(data)
*/
if (size == 2) {
if(size == 2) {
return updi_link_st16(pgm, address, buffer[0] + (buffer[1] << 8));
}
if (size > UPDI_MAX_REPEAT_SIZE << 1) {
if(size > UPDI_MAX_REPEAT_SIZE << 1) {
pmsg_debug("invalid length\n");
return -1;
}
if (updi_link_st_ptr(pgm, address) < 0) {
if(updi_link_st_ptr(pgm, address) < 0) {
pmsg_debug("ST_PTR operation failed\n");
return -1;
}