mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-17 23:00:38 +02:00
tools/: new libatrf function atrf_slp_tr to control SLP_TR (for now only atben)
- include/atrf.h, lib/atrf.c (atrf_slp_tr): new function to set the SLP_TR line - lib/driver.h (struct atrf_driver): added driver function slp_tr - lib/atusb.c (atusb_driver): we dont support slp_tr yet - lib/atben.c (atben_slp_tr, atben_driver): implement SLP_TR control
This commit is contained in:
parent
84f2d276ab
commit
fe2720e63a
@ -40,6 +40,7 @@ void atrf_reset_rf(struct atrf_dsc *dsc);
|
|||||||
enum atrf_chip_id atrf_identify(struct atrf_dsc *dsc);
|
enum atrf_chip_id atrf_identify(struct atrf_dsc *dsc);
|
||||||
|
|
||||||
int atrf_test_mode(struct atrf_dsc *dsc);
|
int atrf_test_mode(struct atrf_dsc *dsc);
|
||||||
|
int atrf_slp_tr(struct atrf_dsc *dsc, int on);
|
||||||
int atrf_set_clkm(struct atrf_dsc *dsc, int mhz);
|
int atrf_set_clkm(struct atrf_dsc *dsc, int mhz);
|
||||||
|
|
||||||
void atrf_reg_write(struct atrf_dsc *dsc, uint8_t reg, uint8_t value);
|
void atrf_reg_write(struct atrf_dsc *dsc, uint8_t reg, uint8_t value);
|
||||||
|
@ -326,6 +326,20 @@ static int atben_buf_read(void *handle, void *buf, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- SLP_TR ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
static void atben_slp_tr(void *handle, int on)
|
||||||
|
{
|
||||||
|
struct atben_dsc *dsc = handle;
|
||||||
|
|
||||||
|
if (on)
|
||||||
|
PDDATS = SLP_TR;
|
||||||
|
else
|
||||||
|
PDDATC = SLP_TR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- RF interrupt ------------------------------------------------------ */
|
/* ----- RF interrupt ------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
@ -347,6 +361,7 @@ struct atrf_driver atben_driver = {
|
|||||||
.reset = NULL,
|
.reset = NULL,
|
||||||
.reset_rf = atben_reset_rf,
|
.reset_rf = atben_reset_rf,
|
||||||
.test_mode = NULL,
|
.test_mode = NULL,
|
||||||
|
.slp_tr = atben_slp_tr,
|
||||||
.reg_write = atben_reg_write,
|
.reg_write = atben_reg_write,
|
||||||
.reg_read = atben_reg_read,
|
.reg_read = atben_reg_read,
|
||||||
.buf_write = atben_buf_write,
|
.buf_write = atben_buf_write,
|
||||||
|
@ -149,6 +149,15 @@ int atrf_test_mode(struct atrf_dsc *dsc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int atrf_slp_tr(struct atrf_dsc *dsc, int on)
|
||||||
|
{
|
||||||
|
if (!dsc->driver->slp_tr)
|
||||||
|
return 0;
|
||||||
|
dsc->driver->slp_tr(dsc->handle, on);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int atrf_set_clkm_generic(
|
int atrf_set_clkm_generic(
|
||||||
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value),
|
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value),
|
||||||
void *handle, int mhz)
|
void *handle, int mhz)
|
||||||
|
@ -281,6 +281,7 @@ struct atrf_driver atusb_driver = {
|
|||||||
.reset = atusb_reset,
|
.reset = atusb_reset,
|
||||||
.reset_rf = atusb_reset_rf,
|
.reset_rf = atusb_reset_rf,
|
||||||
.test_mode = atusb_test_mode,
|
.test_mode = atusb_test_mode,
|
||||||
|
.slp_tr = NULL, /* @@@ not yet *
|
||||||
.set_clkm = atusb_set_clkm,
|
.set_clkm = atusb_set_clkm,
|
||||||
.reg_write = atusb_reg_write,
|
.reg_write = atusb_reg_write,
|
||||||
.reg_read = atusb_reg_read,
|
.reg_read = atusb_reg_read,
|
||||||
|
@ -26,6 +26,7 @@ struct atrf_driver {
|
|||||||
void (*reset)(void *dsc);
|
void (*reset)(void *dsc);
|
||||||
void (*reset_rf)(void *dsc);
|
void (*reset_rf)(void *dsc);
|
||||||
void (*test_mode)(void *dsc);
|
void (*test_mode)(void *dsc);
|
||||||
|
void (*slp_tr)(void *dsc, int on);
|
||||||
int (*set_clkm)(void *dsc, int mhz);
|
int (*set_clkm)(void *dsc, int mhz);
|
||||||
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
|
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
|
||||||
uint8_t (*reg_read)(void *dsc, uint8_t reg);
|
uint8_t (*reg_read)(void *dsc, uint8_t reg);
|
||||||
|
Loading…
Reference in New Issue
Block a user