Commit 3e22dbf5 authored by Tristan Gingold's avatar Tristan Gingold

libwr2rf: add api and command for vtu output reset

parent 144caedf
......@@ -581,6 +581,27 @@ int libwr2rf_vtu_output_shaper(struct libwr2rf_dev *dev, unsigned id,
return 0;
}
int libwr2rf_vtu_output_reset(struct libwr2rf_dev *dev, unsigned id,
unsigned rst)
{
unsigned csr_addr;
unsigned v;
csr_addr = libwr2rf_vtu_csr(id);
if (csr_addr == 0)
return -1;
v = libwr2rf_read16(dev, csr_addr);
if (rst)
v |= WR2RF_INIT_RF_CH_REGS_CH_CSR_TRIG_RST;
else
v &= ~WR2RF_INIT_RF_CH_REGS_CH_CSR_TRIG_RST;
libwr2rf_write16(dev, csr_addr, v);
return 0;
}
static unsigned trig_id_to_addr(unsigned id)
{
switch (id) {
......
......@@ -142,6 +142,10 @@ int libwr2rf_vtu_output_enable(struct libwr2rf_dev *dev, unsigned id,
int libwr2rf_vtu_output_shaper(struct libwr2rf_dev *dev, unsigned id,
unsigned en);
/* Hold trigger output in reset or not. */
int libwr2rf_vtu_output_reset(struct libwr2rf_dev *dev, unsigned id,
unsigned rst);
/* Program a single pulse on TU ID after B clock cycles. */
int libwr2rf_vtu_program_pulse (struct libwr2rf_dev *dev, unsigned id,
uint64_t b);
......
......@@ -3190,6 +3190,25 @@ api_vtu_output_shaper (struct libwr2rf_dev *dev, int argc, char **argv)
printf ("failed (status=%d)\n", res);
}
static void
api_vtu_output_reset (struct libwr2rf_dev *dev, int argc, char **argv)
{
int res;
unsigned long id;
unsigned long enable;
if (argc != 3) {
printf ("usage: %s VTU-ID RST\n", argv[0]);
return;
}
id = strtoul (argv[1], NULL, 0);
enable = strtoul (argv[2], NULL, 0);
res = libwr2rf_vtu_output_reset(dev, id, enable);
if (res != 0)
printf ("failed (status=%d)\n", res);
}
static void cmd_help (struct libwr2rf_dev *dev, int argc, char **argv);
struct cmds {
......@@ -3211,6 +3230,7 @@ static struct cmds cmds[] =
{ "api-vtu-output-delay", api_vtu_output_delay, "set vtu output delay"},
{ "api-vtu-output-enable", api_vtu_output_enable, "enable vtu output delay"},
{ "api-vtu-output-shaper", api_vtu_output_shaper, "enable vtu output shaper"},
{ "api-vtu-output-reset", api_vtu_output_reset, "force reset vtu output"},
{ "api-vtu-softstart", api_vtu_softstart, "software start of a vtu"},
{ "api-vtu-softstop", api_vtu_softstop, "software stop of a vtu"},
{ "api-vtu-reset", api_vtu_reset, "control vtu reset"},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment