summaryrefslogtreecommitdiffstats
path: root/pcilib/register.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-10-22 15:57:59 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-10-22 15:57:59 +0200
commita0fe5cdea15bca52d3b101a88c11cb160ef08b2f (patch)
treee40e5d90ed013e33617931b049c5039e37a1f51f /pcilib/register.c
parentee18798c64c6e40433413b73bf07bbe027a9cc6e (diff)
downloadpcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.gz
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.bz2
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.tar.xz
pcitool-a0fe5cdea15bca52d3b101a88c11cb160ef08b2f.zip
Documentation update
Diffstat (limited to 'pcilib/register.c')
-rw-r--r--pcilib/register.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pcilib/register.c b/pcilib/register.c
index a166bbd..1f1cf9e 100644
--- a/pcilib/register.c
+++ b/pcilib/register.c
@@ -174,14 +174,14 @@ static int pcilib_read_register_space_internal(pcilib_t *ctx, pcilib_register_ba
return PCILIB_ERROR_NOTSUPPORTED;
}
- if (b->protocol == PCILIB_REGISTER_PROTOCOL_PROPERTY) space_size = ctx->num_views;
+ if (b->protocol == PCILIB_REGISTER_PROTOCOL_PROPERTY) space_size = ctx->num_views * access;
else space_size = b->size;
- if (((addr + n) > space_size)||(((addr + n) == space_size)&&(bits))) {
+ if (((addr + n * access) > space_size)||(((addr + n * access) == space_size)&&(bits))) {
if ((b->format)&&(strchr(b->format, 'x')))
- pcilib_error("Accessing register (%u regs at addr 0x%x) out of register space (%u registers total)", bits?(n+1):n, addr, space_size);
+ pcilib_error("Accessing register (%u regs at addr 0x%x) out of register space (%u %u-bit registers total)", bits?(n+1):n, addr, space_size / access, access * 8);
else
- pcilib_error("Accessing register (%u regs at addr %u) out of register space (%u registers total)", bits?(n+1):n, addr, space_size);
+ pcilib_error("Accessing register (%u regs at addr %u) out of register space (%u %u-bit registers total)", bits?(n+1):n, addr, space_size / access, access * 8);
return PCILIB_ERROR_OUTOFRANGE;
}
@@ -285,7 +285,7 @@ int pcilib_read_register(pcilib_t *ctx, const char *bank, const char *regname, p
}
-static int pcilib_write_register_space_internal(pcilib_t *ctx, pcilib_register_bank_t bank, pcilib_register_addr_t addr, size_t n, pcilib_register_size_t offset, pcilib_register_size_t bits, pcilib_register_value_t rwmask, pcilib_register_value_t *buf) {
+static int pcilib_write_register_space_internal(pcilib_t *ctx, pcilib_register_bank_t bank, pcilib_register_addr_t addr, size_t n, pcilib_register_size_t offset, pcilib_register_size_t bits, pcilib_register_value_t rwmask, const pcilib_register_value_t *buf) {
int err;
size_t i;
@@ -304,14 +304,14 @@ static int pcilib_write_register_space_internal(pcilib_t *ctx, pcilib_register_b
return PCILIB_ERROR_NOTSUPPORTED;
}
- if (b->protocol == PCILIB_REGISTER_PROTOCOL_PROPERTY) space_size = ctx->num_views;
+ if (b->protocol == PCILIB_REGISTER_PROTOCOL_PROPERTY) space_size = ctx->num_views * access;
else space_size = b->size;
- if (((addr + n) > space_size)||(((addr + n) == space_size)&&(bits))) {
+ if (((addr + n * access) > space_size)||(((addr + n * access) == space_size)&&(bits))) {
if ((b->format)&&(strchr(b->format, 'x')))
- pcilib_error("Accessing register (%u regs at addr 0x%x) out of register space (%u registers total)", bits?(n+1):n, addr, space_size);
+ pcilib_error("Accessing register (%u regs at addr 0x%x) out of register space (%u %u-bit registers total)", bits?(n+1):n, addr, space_size / access, access * 8);
else
- pcilib_error("Accessing register (%u regs at addr %u) out of register space (%u registers total)", bits?(n+1):n, addr, space_size);
+ pcilib_error("Accessing register (%u regs at addr %u) out of register space (%u %u-bit registers total)", bits?(n+1):n, addr, space_size / access, access * 8);
return PCILIB_ERROR_OUTOFRANGE;
}
@@ -364,7 +364,7 @@ static int pcilib_write_register_space_internal(pcilib_t *ctx, pcilib_register_b
return err;
}
-int pcilib_write_register_space(pcilib_t *ctx, const char *bank, pcilib_register_addr_t addr, size_t n, pcilib_register_value_t *buf) {
+int pcilib_write_register_space(pcilib_t *ctx, const char *bank, pcilib_register_addr_t addr, size_t n, const pcilib_register_value_t *buf) {
pcilib_register_bank_t bank_id = pcilib_find_register_bank(ctx, bank);
if (bank_id == PCILIB_REGISTER_BANK_INVALID) {
if (bank) pcilib_error("Invalid register bank is specified (%s)", bank);