[PATCH 20/26] leon, grspw_router: added router_port_link_div()

Daniel Hellstrom daniel at gaisler.com
Mon Jun 29 11:28:07 UTC 2020


From: Martin Aberg <maberg at gaisler.com>

Allows user to set SpaceWire run clock divisor for an individual port.
---
 bsps/include/grlib/grspw_router.h    | 1 +
 bsps/shared/grlib/spw/grspw_router.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/bsps/include/grlib/grspw_router.h b/bsps/include/grlib/grspw_router.h
index 2fab8d5..8547f19 100644
--- a/bsps/include/grlib/grspw_router.h
+++ b/bsps/include/grlib/grspw_router.h
@@ -343,6 +343,7 @@ extern int router_port_enable(void *d, int port);
 extern int router_port_disable(void *d, int port);
 extern int router_port_link_stop(void *d, int port);
 extern int router_port_link_start(void *d, int port);
+extern int router_port_link_div(void *d, int port, int rundiv);
 extern int router_port_link_receive_spill(void *d, int port);
 extern int router_port_link_transmit_reset(void *d, int port);
 
diff --git a/bsps/shared/grlib/spw/grspw_router.c b/bsps/shared/grlib/spw/grspw_router.c
index d8ba8fe..9a31c3b 100644
--- a/bsps/shared/grlib/spw/grspw_router.c
+++ b/bsps/shared/grlib/spw/grspw_router.c
@@ -1431,6 +1431,11 @@ int router_port_link_start(void *d, int port)
 	return router_port_ctrl_rmw(d, port, NULL, PCTRL_LD | PCTRL_LS, PCTRL_LS);
 }
 
+int router_port_link_div(void *d, int port, int rundiv)
+{
+	return router_port_ctrl_rmw(d, port, NULL, PCTRL_RD, (rundiv << PCTRL_RD_BIT) & PCTRL_RD);
+}
+
 int router_port_link_receive_spill(void *d, int port)
 {
 	struct router_priv *priv = d;
-- 
2.7.4



More information about the devel mailing list