From 806f108e60ec0d2f0276cf50be936e61d22ad0db Mon Sep 17 00:00:00 2001 From: hna Date: Mon, 19 Jun 2023 18:17:28 +0000 Subject: [PATCH 1/2] adding PP_PHYRXEQ_EXT message --- xoa_driver/enums.py | 4 ++ xoa_driver/internals/commands/enums.py | 18 +++++++ xoa_driver/internals/commands/pp_commands.py | 53 +++++++++++++++++++- 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/xoa_driver/enums.py b/xoa_driver/enums.py index d8ebd9d7..795cc759 100644 --- a/xoa_driver/enums.py +++ b/xoa_driver/enums.py @@ -161,6 +161,8 @@ LinkTrainEncoding, LinkTrainPresets, AnLtLogControl, + RxEqExtCap, + RxEqExtCapStatus ) __all__ = ( @@ -324,4 +326,6 @@ "LinkTrainEncoding", "LinkTrainPresets", "AnLtLogControl", + "RxEqExtCap", + "RxEqExtCapStatus" ) diff --git a/xoa_driver/internals/commands/enums.py b/xoa_driver/internals/commands/enums.py index ca1c531f..5b3b08f0 100644 --- a/xoa_driver/internals/commands/enums.py +++ b/xoa_driver/internals/commands/enums.py @@ -2458,5 +2458,23 @@ class AnLtLogControl(IntEnum): LOG_TYPE_FSM_LT_ALG1 = 0x800000 """link training algorithm -1 state machine transitions""" +class RxEqExtCap(IntEnum): + """Rx Equalizer Advanced Capability type.""" + + CTLE_LOW = 0 + """CTLE low frequency.""" + CTLE_HIGH = 1 + """CTLE high frequency.""" + +class RxEqExtCapStatus(IntEnum): + """Status for Rx Equalizer Advanced Capability.""" + + STATUS_AUTO = 0 + """Auto.""" + STATUS_MANUAL = 1 + """Manual.""" + STATUS_FREEZE = 2 + """Freeze.""" + # endregion diff --git a/xoa_driver/internals/commands/pp_commands.py b/xoa_driver/internals/commands/pp_commands.py index ad518529..2a8d6606 100644 --- a/xoa_driver/internals/commands/pp_commands.py +++ b/xoa_driver/internals/commands/pp_commands.py @@ -55,6 +55,8 @@ PRBSPattern, PHYSignalStatus, OnOffDefault, + RxEqExtCap, + RxEqExtCapStatus ) @@ -1803,7 +1805,7 @@ def set(self, link_training_on_off: OnOff, precode_on_off: OnOffDefault, graycod @dataclass class PP_PHYRXEQ: """ - RX EQ parameters. + RX EQ parameters (For non Freya Modules). """ code: typing.ClassVar[int] = 380 @@ -1853,6 +1855,55 @@ def set(self, auto: int, ctle: int, reserved: int) -> Token[None]: return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex], auto=auto, ctle=ctle, reserved=reserved)) +@register_command +@dataclass +class PP_PHYRXEQ_EXT: + """ + GET/SET RX EQ Advanced parameters(Only for Freya Modules). + """ + + code: typing.ClassVar[int] = 397 + pushed: typing.ClassVar[bool] = True + + _connection: 'interfaces.IConnection' + _module: int + _port: int + _serdes_xindex: int + _capability_type: RxEqExtCap + + class GetDataAttr(ResponseBodyStruct): + status: RxEqExtCapStatus = field(XmpInt()) + """The status of the capability""" + value: int = field(XmpInt()) + """The value for the capability""" + + class SetDataAttr(RequestBodyStruct): + status: RxEqExtCapStatus = field(XmpInt()) + """The status of the capability Auto/Manual/Freeze""" + value: int = field(XmpInt()) + """The value for the capability""" + + def get(self) -> Token[GetDataAttr]: + """Get RX EQ Advanced parameters. + + :return: status Auto/Manual/Freeze, value. + :rtype: PP_PHYRXEQ_EXT.GetDataAttr + """ + + return Token(self._connection, build_get_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex, self._capability_type])) + + def set(self, status: RxEqExtCapStatus, value: int) -> Token[None]: + """Set RX EQ Advanced parameters. + The type of the capability(RxEqExtCap) should be passed as the second index. + + :param status: Auto/Manual/Freeze + :type status: RxEqExtCapStatus + :param value: The value for the capability + :type value: int + """ + + return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex, self._capability_type], status=status, value=value)) + @register_command @dataclass class PP_AUTONEG: From e412ec3af9f2973f6b46e09ebe973b2358f1ee34 Mon Sep 17 00:00:00 2001 From: Artem Constantinov Date: Wed, 28 Jun 2023 17:27:11 +0800 Subject: [PATCH 2/2] format to pep8 --- xoa_driver/internals/commands/enums.py | 5 +++++ xoa_driver/internals/commands/pp_commands.py | 1 + 2 files changed, 6 insertions(+) diff --git a/xoa_driver/internals/commands/enums.py b/xoa_driver/internals/commands/enums.py index 5b3b08f0..752c3b5c 100644 --- a/xoa_driver/internals/commands/enums.py +++ b/xoa_driver/internals/commands/enums.py @@ -2458,21 +2458,26 @@ class AnLtLogControl(IntEnum): LOG_TYPE_FSM_LT_ALG1 = 0x800000 """link training algorithm -1 state machine transitions""" + class RxEqExtCap(IntEnum): """Rx Equalizer Advanced Capability type.""" CTLE_LOW = 0 """CTLE low frequency.""" + CTLE_HIGH = 1 """CTLE high frequency.""" + class RxEqExtCapStatus(IntEnum): """Status for Rx Equalizer Advanced Capability.""" STATUS_AUTO = 0 """Auto.""" + STATUS_MANUAL = 1 """Manual.""" + STATUS_FREEZE = 2 """Freeze.""" diff --git a/xoa_driver/internals/commands/pp_commands.py b/xoa_driver/internals/commands/pp_commands.py index 2a8d6606..b70289f9 100644 --- a/xoa_driver/internals/commands/pp_commands.py +++ b/xoa_driver/internals/commands/pp_commands.py @@ -1904,6 +1904,7 @@ def set(self, status: RxEqExtCapStatus, value: int) -> Token[None]: return Token(self._connection, build_set_request(self, module=self._module, port=self._port, indices=[self._serdes_xindex, self._capability_type], status=status, value=value)) + @register_command @dataclass class PP_AUTONEG: