Commit be8bd87e authored by Grzegorz Daniluk's avatar Grzegorz Daniluk Committed by Adam Wujek

userspace/libwr: function to enable/disable PPS-in termination

Requires gateware synthesized with wr-switch-hdl commit:
b1b621b add bit to control WRS 1-PPS in termination
parent 09f7e0b5
......@@ -84,6 +84,9 @@
/* definitions for field: Set nanoseconds counter in reg: External sync control register */
#define PPSG_ESCR_NSEC_SET WBGEN2_GEN_MASK(4, 1)
/* definitions for field: Enable PPS_IN 50Ohm termination in reg: External sync control register */
#define PPSG_ESCR_PPS_IN_TERM WBGEN2_GEN_MASK(5, 1)
PACKED struct PPSG_WB {
/* [0x0]: REG Control Register */
uint32_t CR;
......
......@@ -210,6 +210,18 @@ peripheral {
clock = "refclk_i";
};
field {
name = "Enable PPS_IN 50Ohm termination";
description = "write 1: enable 50ohm termination for 1-PPS input \
write 0: disable 50ohm termination for 1-PPS input \
read 1: 50ohm termination for 1-PPS input enabled \
read 0: 50ohm termination for 1-PPS input disabled";
prefix = "PPS_IN_TERM";
type = BIT;
access_bus = READ_WRITE;
access_dev = READ_ONLY;
};
};
};
......@@ -105,3 +105,12 @@ void shw_pps_gen_read_time(uint64_t * seconds, uint32_t * nanoseconds)
if (nanoseconds)
*nanoseconds = ns_cnt;
}
void shw_pps_gen_in_term_enable(int enable)
{
uint32_t escr = ppsg_read(ESCR);
if (enable)
ppsg_write(ESCR, escr | PPSG_ESCR_PPS_IN_TERM);
else
ppsg_write(ESCR, escr & ~PPSG_ESCR_PPS_IN_TERM);
}
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