summaryrefslogtreecommitdiffstats
path: root/dummyflasher.c
diff options
context:
space:
mode:
Diffstat (limited to 'dummyflasher.c')
-rw-r--r--dummyflasher.c59
1 files changed, 20 insertions, 39 deletions
diff --git a/dummyflasher.c b/dummyflasher.c
index e4dbef8..f0095d1 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -96,28 +96,18 @@ static const uint8_t sfdp_table[] = {
static unsigned int spi_write_256_chunksize = 256;
-static int dummy_spi_send_command(struct flashctx *flash, unsigned int writecnt,
- unsigned int readcnt,
- const unsigned char *writearr,
- unsigned char *readarr);
-static int dummy_spi_write_256(struct flashctx *flash, uint8_t *buf,
+static int dummy_spi_send_command(struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
+ const unsigned char *writearr, unsigned char *readarr);
+static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf,
unsigned int start, unsigned int len);
-static void dummy_chip_writeb(const struct flashctx *flash, uint8_t val,
- chipaddr addr);
-static void dummy_chip_writew(const struct flashctx *flash, uint16_t val,
- chipaddr addr);
-static void dummy_chip_writel(const struct flashctx *flash, uint32_t val,
- chipaddr addr);
-static void dummy_chip_writen(const struct flashctx *flash, uint8_t *buf,
- chipaddr addr, size_t len);
-static uint8_t dummy_chip_readb(const struct flashctx *flash,
- const chipaddr addr);
-static uint16_t dummy_chip_readw(const struct flashctx *flash,
- const chipaddr addr);
-static uint32_t dummy_chip_readl(const struct flashctx *flash,
- const chipaddr addr);
-static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf,
- const chipaddr addr, size_t len);
+static void dummy_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr);
+static void dummy_chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr);
+static void dummy_chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr);
+static void dummy_chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len);
+static uint8_t dummy_chip_readb(const struct flashctx *flash, const chipaddr addr);
+static uint16_t dummy_chip_readw(const struct flashctx *flash, const chipaddr addr);
+static uint32_t dummy_chip_readl(const struct flashctx *flash, const chipaddr addr);
+static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len);
static const struct spi_programmer spi_programmer_dummyflasher = {
.type = SPI_CONTROLLER_DUMMY,
@@ -427,26 +417,22 @@ void dummy_unmap(void *virt_addr, size_t len)
msg_pspew("%s: Unmapping 0x%zx bytes at %p\n", __func__, len, virt_addr);
}
-static void dummy_chip_writeb(const struct flashctx *flash, uint8_t val,
- chipaddr addr)
+static void dummy_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%02x\n", __func__, addr, val);
}
-static void dummy_chip_writew(const struct flashctx *flash, uint16_t val,
- chipaddr addr)
+static void dummy_chip_writew(const struct flashctx *flash, uint16_t val, chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%04x\n", __func__, addr, val);
}
-static void dummy_chip_writel(const struct flashctx *flash, uint32_t val,
- chipaddr addr)
+static void dummy_chip_writel(const struct flashctx *flash, uint32_t val, chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", val=0x%08x\n", __func__, addr, val);
}
-static void dummy_chip_writen(const struct flashctx *flash, uint8_t *buf,
- chipaddr addr, size_t len)
+static void dummy_chip_writen(const struct flashctx *flash, const uint8_t *buf, chipaddr addr, size_t len)
{
size_t i;
msg_pspew("%s: addr=0x%" PRIxPTR ", len=0x%zx, writing data (hex):", __func__, addr, len);
@@ -457,29 +443,25 @@ static void dummy_chip_writen(const struct flashctx *flash, uint8_t *buf,
}
}
-static uint8_t dummy_chip_readb(const struct flashctx *flash,
- const chipaddr addr)
+static uint8_t dummy_chip_readb(const struct flashctx *flash, const chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xff\n", __func__, addr);
return 0xff;
}
-static uint16_t dummy_chip_readw(const struct flashctx *flash,
- const chipaddr addr)
+static uint16_t dummy_chip_readw(const struct flashctx *flash, const chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xffff\n", __func__, addr);
return 0xffff;
}
-static uint32_t dummy_chip_readl(const struct flashctx *flash,
- const chipaddr addr)
+static uint32_t dummy_chip_readl(const struct flashctx *flash, const chipaddr addr)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", returning 0xffffffff\n", __func__, addr);
return 0xffffffff;
}
-static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf,
- const chipaddr addr, size_t len)
+static void dummy_chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len)
{
msg_pspew("%s: addr=0x%" PRIxPTR ", len=0x%zx, returning array of 0xff\n", __func__, addr, len);
memset(buf, 0xff, len);
@@ -846,8 +828,7 @@ static int dummy_spi_send_command(struct flashctx *flash, unsigned int writecnt,
return 0;
}
-static int dummy_spi_write_256(struct flashctx *flash, uint8_t *buf,
- unsigned int start, unsigned int len)
+static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
{
return spi_write_chunked(flash, buf, start, len,
spi_write_256_chunksize);
OpenPOWER on IntegriCloud