From 674d80662bb098b208b3ef701d5a3a7d8e12db9e Mon Sep 17 00:00:00 2001
From: Adam Wujek <dev_public@wujek.eu>
Date: Wed, 16 Oct 2024 17:08:13 +0200
Subject: [PATCH] [BUG: #336] userspace/wrsw_hal: use for LPDC printouts port
 numbers 1-12

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
 userspace/wrsw_hal/hal_port_fsm_tx.c | 12 ++++++------
 userspace/wrsw_hal/hal_ports.c       |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/userspace/wrsw_hal/hal_port_fsm_tx.c b/userspace/wrsw_hal/hal_port_fsm_tx.c
index 2fd3541f0..acb58f65c 100644
--- a/userspace/wrsw_hal/hal_port_fsm_tx.c
+++ b/userspace/wrsw_hal/hal_port_fsm_tx.c
@@ -273,8 +273,8 @@ static int port_tx_setup_fsm_state_measure_phase(fsm_t *fsm, int eventMsk, int i
 //			txSetup->attempts, txSetup->expected_phase, txSetup->tolerance);
 
 	if(_within_range(phase, phase_min, phase_max, 16000)) {
-		pr_info("FIX port %d phase %d after %d attempts "
-				"(temp = %.3f degC)\n", ps->hw_index, txSetup->measured_phase,
+		pr_info("FIX port wri%d phase %d after %d attempts "
+				"(temp = %.3f degC)\n", ps->hw_index + 1, txSetup->measured_phase,
 				txSetup->attempts, hal_get_fpga_temperature() / 256.0);
 		rts_enable_ptracker(ps->hw_index, 0);
 		rts_enable_ptracker(ps->hw_index, 1);
@@ -426,10 +426,10 @@ void hal_port_tx_setup_init_all(struct hal_port_state * ports, halGlobalLPDC_t *
 		globalLpdc->firstLpdcPort = firstLpdcPort;
 		globalLpdc->lastLpdcPort = lastLpdcPort;
 		pr_info("WR switch supports LPDC on %d ports ("
-		        "first port is %d, last port is %d)\n",
+		        "first port is wri%d, last port is wri%d)\n",
 		        globalLpdc->numberOfLpdcPorts,
-		        globalLpdc->firstLpdcPort,
-		        globalLpdc->lastLpdcPort);
+		        globalLpdc->firstLpdcPort + 1,
+		        globalLpdc->lastLpdcPort + 1);
 
 		/* load the calib file*/
 		_load_tx_calibration_file(ports);
@@ -527,7 +527,7 @@ static void _load_tx_calibration_file(struct hal_port_state * ports) {
 	}
 
 
-	pr_info("Loading LPCD config data from %s\n", _calibrationFileName);
+	pr_info("Loading LPDC config data from %s\n", _calibrationFileName);
 
 	for (i = 0; i < HAL_MAX_PORTS; i++){
 		struct hal_port_state *ps = &ports[i];
diff --git a/userspace/wrsw_hal/hal_ports.c b/userspace/wrsw_hal/hal_ports.c
index 2ff34bfde..166a4f7b5 100644
--- a/userspace/wrsw_hal/hal_ports.c
+++ b/userspace/wrsw_hal/hal_ports.c
@@ -193,20 +193,20 @@ static int hal_port_init(struct hal_port_state *ps, int index)
 	sprintf(key,"PORT%02i_INST%02i_MONITOR",port_i,1);
 	if ((retValue = libwr_cfg_get(key)) == NULL ) {
 		ps->monitor = HAL_PORT_MONITOR_DISABLE;
-		pr_info("port %i (%s): monitor=n (%i)\n", port_i,
+		pr_info("Port %i (%s): monitor=n (%i)\n", port_i,
 			ps->name, ps->monitor);
 	} else {
 		if (!strcasecmp(retValue, "n")) {
 			ps->monitor = HAL_PORT_MONITOR_DISABLE;
-			pr_info("port %i (%s): monitor=n (%i)\n", port_i,
+			pr_info("Port %i (%s): monitor=n (%i)\n", port_i,
 				ps->name, ps->monitor);
 		} else if (!strcasecmp(retValue, "y")) {
 			ps->monitor = HAL_PORT_MONITOR_ENABLE;
-			pr_info("port %i (%s): monitor=y (%i)\n", port_i,
+			pr_info("Port %i (%s): monitor=y (%i)\n", port_i,
 				ps->name, ps->monitor);
 		} else {
 			/* error */
-			pr_error("port %i (%s): not supported \"monitor\" "
+			pr_error("Port %i (%s): not supported \"monitor\" "
 				 "value, default to y\n",
 				 port_i, ps->name);
 		}
-- 
GitLab