From 1953ce25df3ce42154fd0a63af468144a57dd481 Mon Sep 17 00:00:00 2001
From: Lucas Russo <lerwys@gmail.com>
Date: Fri, 20 May 2016 13:54:05 -0300
Subject: [PATCH] libs/libbpmclient/*: add direction polarity functions

---
 src/libs/libbpmclient/include/bpm_client_core.h | 12 ++++++++++++
 src/libs/libbpmclient/src/bpm_client_core.c     | 13 +++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/src/libs/libbpmclient/include/bpm_client_core.h b/src/libs/libbpmclient/include/bpm_client_core.h
index 61647cfa..f4d78579 100644
--- a/src/libs/libbpmclient/include/bpm_client_core.h
+++ b/src/libs/libbpmclient/include/bpm_client_core.h
@@ -924,6 +924,18 @@ bpm_client_err_e bpm_set_trigger_dir (bpm_client_t *self, char *service,
 bpm_client_err_e bpm_get_trigger_dir (bpm_client_t *self, char *service,
         uint32_t chan, uint32_t *dir);
 
+/* Trigger Direction Polarity functions */
+/* These set of functions write (set) or read (get) the trigger direction
+ * polarity of a specified channel "chan". When set to 0, the output
+ * direction signal is kept the same as the FPGA internal. When set to
+ * 1, the output direction signal is reversed.
+ * All of the functions returns BPM_CLIENT_SUCCESS if the parameter was
+ * correctly set or error (see bpm_client_err.h for all possible errors)*/
+bpm_client_err_e bpm_set_trigger_dir_pol (bpm_client_t *self, char *service,
+        uint32_t chan, uint32_t dir_pol);
+bpm_client_err_e bpm_get_trigger_dir_pol (bpm_client_t *self, char *service,
+        uint32_t chan, uint32_t *dir_pol);
+
 /* Trigger Receive/Transmit Counter Reset functions */
 /* These set of functions write (set) or read (get) the reset of the
  * receiver or transmitter trigger counters of a specified channel "chan".
diff --git a/src/libs/libbpmclient/src/bpm_client_core.c b/src/libs/libbpmclient/src/bpm_client_core.c
index f98675b0..ce112abc 100644
--- a/src/libs/libbpmclient/src/bpm_client_core.c
+++ b/src/libs/libbpmclient/src/bpm_client_core.c
@@ -1912,6 +1912,19 @@ PARAM_FUNC_CLIENT_WRITE_READ(trigger_dir, chan, dir)
             chan, dir);
 }
 
+/* Trigger direction */
+PARAM_FUNC_CLIENT_WRITE2(trigger_dir_pol, chan, dir_pol)
+{
+    return param_client_write2 (self, service, TRIGGER_IFACE_OPCODE_DIR_POL,
+            chan, dir_pol);
+}
+
+PARAM_FUNC_CLIENT_WRITE_READ(trigger_dir_pol, chan, dir_pol)
+{
+    return param_client_write_read (self, service, TRIGGER_IFACE_OPCODE_DIR_POL,
+                chan, dir_pol);
+}
+
 /* Trigger receive counter reset */
 PARAM_FUNC_CLIENT_WRITE2(trigger_rcv_count_rst, chan, rcv_count_rst)
 {
-- 
GitLab