1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 09:43:00 +02:00

tools/lib/atben.c: added SRAM access to atben driver

- atben.c (atben_sram_write, atben_sram_read): SRAM access functions
- atben.c (atben_driver): added new functions to driver operations
This commit is contained in:
Werner Almesberger 2011-06-03 14:24:00 -03:00
parent 472e18294c
commit 6b447f805c

View File

@ -326,6 +326,32 @@ static int atben_buf_read(void *handle, void *buf, int size)
} }
static void atben_sram_write(void *handle, uint8_t addr, uint8_t v)
{
struct atben_dsc *dsc = handle;
spi_begin(dsc);
spi_send(dsc, AT86RF230_SRAM_WRITE);
spi_send(dsc, addr);
spi_send(dsc, v);
spi_end(dsc);
}
static uint8_t atben_sram_read(void *handle, uint8_t addr)
{
struct atben_dsc *dsc = handle;
uint8_t res;
spi_begin(dsc);
spi_send(dsc, AT86RF230_SRAM_READ);
spi_send(dsc, addr);
res = spi_recv(dsc);
spi_end(dsc);
return res;
}
/* ----- SLP_TR ------------------------------------------------------------ */ /* ----- SLP_TR ------------------------------------------------------------ */
@ -377,5 +403,7 @@ struct atrf_driver atben_driver = {
.reg_read = atben_reg_read, .reg_read = atben_reg_read,
.buf_write = atben_buf_write, .buf_write = atben_buf_write,
.buf_read = atben_buf_read, .buf_read = atben_buf_read,
.sram_write = atben_sram_write,
.sram_read = atben_sram_read,
.interrupt = atben_interrupt, .interrupt = atben_interrupt,
}; };