From a26376d4262419f675c21d7c56dfe1a16742e6ed Mon Sep 17 00:00:00 2001 From: Dhaval Khandla Date: Tue, 9 Jan 2024 18:31:30 +0530 Subject: [PATCH] am243x: hdsl: Fix example initialization when channel 0 is disabled Fixes: PINDSW-5516 Signed-off-by: Dhaval Khandla --- .../hdsl_diagnostic/hdsl_diagnostic.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c b/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c index 5f2ae8b..a534c81 100644 --- a/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c +++ b/examples/position_sense/hdsl_diagnostic/hdsl_diagnostic.c @@ -976,7 +976,19 @@ void hdsl_init_300m(void) HwiP_construct(&gPRUHwiObject, &hwiPrms); #endif - HDSL_iep_init(gHdslHandleCh[0]); + if(CONFIG_HDSL0_CHANNEL0==1) + { + HDSL_iep_init(gHdslHandleCh[0]); + } + else if(CONFIG_HDSL0_CHANNEL1==1) + { + HDSL_iep_init(gHdslHandleCh[1]); + } + else if(CONFIG_HDSL0_CHANNEL2==1) + { + HDSL_iep_init(gHdslHandleCh[2]); + } + ClockP_usleep(5000); if(CONFIG_HDSL0_MODE == 1) @@ -1575,7 +1587,14 @@ void hdsl_diagnostic_main(void *arg) #if (CONFIG_HDSL0_CHANNEL2==1) HDSL_config_channel_mask(gHdslHandleCh[2], chMask); #endif - hdsl_pruss_load_run_fw_300m(gHdslHandleCh[0]); + + #if (CONFIG_HDSL0_CHANNEL0==1) + hdsl_pruss_load_run_fw_300m(gHdslHandleCh[0]); + #elif (CONFIG_HDSL0_CHANNEL1==1) + hdsl_pruss_load_run_fw_300m(gHdslHandleCh[1]); + #elif (CONFIG_HDSL0_CHANNEL2==1) + hdsl_pruss_load_run_fw_300m(gHdslHandleCh[2]); + #endif #endif DebugP_log( "\r\n HDSL setup finished\n");