From 6e8bf921e2cdab42a5c00276e9d3b6a903e3df85 Mon Sep 17 00:00:00 2001 From: Peace Kotamnives Date: Mon, 15 Jan 2024 17:57:09 -0500 Subject: [PATCH] apply bug fix and correction in #204 and ff_laser_fault #202 --- projects/cm_mcu/LocalTasks.c | 66 ++++++++++++++-------------- projects/cm_mcu/ZynqMonTask.c | 2 +- sm_cm_config/data/PL_MEM_CM_rev2.yml | 37 +++++----------- sm_cm_config/src/mcu_generate.py | 1 - sm_cm_config/src/xml_generate.py | 3 -- 5 files changed, 44 insertions(+), 65 deletions(-) diff --git a/projects/cm_mcu/LocalTasks.c b/projects/cm_mcu/LocalTasks.c index a7b08b66..d2a901f5 100644 --- a/projects/cm_mcu/LocalTasks.c +++ b/projects/cm_mcu/LocalTasks.c @@ -173,10 +173,10 @@ struct sm_command_t sm_command_ffldaq_f1[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {1, 0x00, 0x03, 1, "FF_LOS_ALARM", 0xff, "", PM_STATUS}, {1, 0x00, 0x05, 1, "FF_CDR_LOL_ALARM", 0xff, "", PM_STATUS}, - {2, 0x00, 0x22, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses - {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x22, 2, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses + {2, 0x00, 0x24, 2, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x26, 2, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x28, 2, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, }; uint16_t ffldaq_f1_values[NSUPPLIES_FFLDAQ_F1 * NCOMMANDS_FFLDAQ_F1]; @@ -230,18 +230,18 @@ struct sm_command_t sm_command_fflot_f1[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, - {2, 0x01, 0xe4, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses - {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe4, 2, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses + {2, 0x01, 0xe2, 2, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe0, 2, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xde, 2, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xdc, 2, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xda, 2, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd8, 2, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd6, 2, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd4, 2, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd2, 2, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd0, 2, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xce, 2, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; @@ -319,10 +319,10 @@ struct sm_command_t sm_command_ffldaq_f2[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {1, 0x00, 0x03, 1, "FF_LOS_ALARM", 0xff, "", PM_STATUS}, {1, 0x00, 0x05, 1, "FF_CDR_LOL_ALARM", 0xff, "", PM_STATUS}, - {2, 0x00, 0x22, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses - {2, 0x00, 0x24, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x26, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x00, 0x28, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x22, 2, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 4 Rx-ch registers with increasing addresses + {2, 0x00, 0x24, 2, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x26, 2, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x00, 0x28, 2, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, }; uint16_t ffldaq_f2_values[NSUPPLIES_FFLDAQ_F2 * NCOMMANDS_FFLDAQ_F2]; @@ -374,18 +374,18 @@ struct sm_command_t sm_command_fflot_f2[] = { {1, 0x00, 0x16, 2, "FF_TEMPERATURE", 0xff, "C", PM_STATUS}, {2, 0x00, 0x07, 1, "FF_LOS_ALARM", 0xffff, "", PM_STATUS}, {2, 0x00, 0x14, 1, "FF_CDR_LOL_ALARM", 0xffff, "", PM_STATUS}, - {2, 0x01, 0xe4, 1, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses - {2, 0x01, 0xe2, 1, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xe0, 1, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xde, 1, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xdc, 1, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xda, 1, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd8, 1, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd6, 1, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd4, 1, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd2, 1, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xd0, 1, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, - {2, 0x01, 0xce, 1, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe4, 2, "FF_CH01_OPT_POW", 0xff, "mw", PM_STATUS}, // read 12 Rx-ch registers with decreasing addresses + {2, 0x01, 0xe2, 2, "FF_CH02_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xe0, 2, "FF_CH03_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xde, 2, "FF_CH04_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xdc, 2, "FF_CH05_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xda, 2, "FF_CH06_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd8, 2, "FF_CH07_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd6, 2, "FF_CH08_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd4, 2, "FF_CH09_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd2, 2, "FF_CH10_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xd0, 2, "FF_CH11_OPT_POW", 0xff, "mw", PM_STATUS}, + {2, 0x01, 0xce, 2, "FF_CH12_OPT_POW", 0xff, "mw", PM_STATUS}, }; #ifdef REV1 @@ -818,7 +818,7 @@ void getFFpart() strncpy(vendor_string, vendor_string_rxch, nstring); } else { - if (strncmp(vendor_string_rxch, vendor_string, nstring) == 0 && (strstr(vendor_string_rxch, "14") == NULL) && (strstr(vendor_string_rxch, "CRRNB") == NULL)) { + if (strstr(vendor_string_rxch, "14") == NULL && strstr(vendor_string_rxch, "CRRNB") == NULL) { tmp_ffpart_bit_mask = tmp_ffpart_bit_mask | (0x1U << n); // bit 1 for a 25Gbs ch and assign to a Bit-mask of Firefly 12-ch part } else { diff --git a/projects/cm_mcu/ZynqMonTask.c b/projects/cm_mcu/ZynqMonTask.c index ad02a759..232681b6 100644 --- a/projects/cm_mcu/ZynqMonTask.c +++ b/projects/cm_mcu/ZynqMonTask.c @@ -65,7 +65,7 @@ static void format_data(const uint16_t sensor, const uint16_t data, uint8_t mess message[1] = SENSOR_MESSAGE_DATA_FRAME; message[1] |= ((sensor & 0xf) << 2) | ((RESERVED_DATA >> 2) & 0x3); - // rest of reserved[1:0] (2 bits) and start of data[15:14] (2 bits) + // rest of reserved[1:0] (2 bits) and start of data[15:12] (4 bits) message[2] = SENSOR_MESSAGE_DATA_FRAME; message[2] |= ((RESERVED_DATA & 0x3) << 4) | ((data >> 12) & 0xF); diff --git a/sm_cm_config/data/PL_MEM_CM_rev2.yml b/sm_cm_config/data/PL_MEM_CM_rev2.yml index 92a7ec2c..f7ba9b56 100644 --- a/sm_cm_config/data/PL_MEM_CM_rev2.yml +++ b/sm_cm_config/data/PL_MEM_CM_rev2.yml @@ -205,8 +205,17 @@ config: mcu_extra_call: 3 names: - MCU_CLKR1B_VER - - name: firefly_bits + - name: clkr1cconfigversion start: 244 + count: 4 + type: char + size: 2 + mcu_call: clkconfigversion + mcu_extra_call: 4 + names: + - MCU_CLKR1C_VER + - name: firefly_bits + start: 248 count: 8 type: uint16_t extra: Table=CM_FFARGV_MON;Status=1 @@ -220,29 +229,3 @@ config: postfixes: - IS_FF25Gbs - IS_PRESENT - - name: hexdata - start: 252 - count: 16 - type: uint16_t - extra: Table=CM_HEX_MON;Status=1 - mcu_call: hexdata - mcu_extra_call: null - names: - - HEXFC - - HEXFD - - HEXFE - - HEXFF - - HEX100 - - HEX101 - - HEX102 - - HEX103 - - HEX104 - - HEX105 - - HEX106 - - HEX107 - - HEX108 - - HEX109 - - HEX10a - - HEX10b - postfixes: - - Column0 diff --git a/sm_cm_config/src/mcu_generate.py b/sm_cm_config/src/mcu_generate.py index 03ff001b..209dec10 100644 --- a/sm_cm_config/src/mcu_generate.py +++ b/sm_cm_config/src/mcu_generate.py @@ -75,7 +75,6 @@ expected_length *= len(c['postfixes']) if '32' in c['type']: expected_length *= 2 - #expected_length += 1 #FIXME elif 'char' in c['type']: expected_length = expected_length/2. if 'size' in c: diff --git a/sm_cm_config/src/xml_generate.py b/sm_cm_config/src/xml_generate.py index 833339c5..f1b370a7 100644 --- a/sm_cm_config/src/xml_generate.py +++ b/sm_cm_config/src/xml_generate.py @@ -103,15 +103,12 @@ def __str__(self): def overlaps(self, other): """calculate overlap between two objects""" - actual_size = self.size * (self.width/16) # the self.size is counted based on a 16-bit data if (self.start <= other.start and self.end >= other.start): return True if (self.start <= other.end and self.end >= other.end): return True if (self.start >= other.start and self.end <= other.end): return True - if (abs(self.start - other.start) < actual_size): # the next other.start is larger than self.start + self.size when e.g. data is 32-bit - return True return False def overloads(self):