tdl-xoa-driver 1.6.3__py3-none-any.whl → 1.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tdl_xoa_driver-1.6.3.dist-info → tdl_xoa_driver-1.7.2.dist-info}/METADATA +2 -2
- {tdl_xoa_driver-1.6.3.dist-info → tdl_xoa_driver-1.7.2.dist-info}/RECORD +25 -16
- {tdl_xoa_driver-1.6.3.dist-info → tdl_xoa_driver-1.7.2.dist-info}/WHEEL +1 -1
- xoa_driver/__init__.py +2 -2
- xoa_driver/enums.py +2 -0
- xoa_driver/functions/async_wrapper.py +130 -0
- xoa_driver/functions/layer1_adv.py +340 -0
- xoa_driver/functions/mgmt.py +94 -32
- xoa_driver/functions/xcvr.py +196 -0
- xoa_driver/hlfuncs.py +6 -0
- xoa_driver/internals/commands/__init__.py +1 -0
- xoa_driver/internals/commands/enums.py +11 -1
- xoa_driver/internals/commands/pl1_commands.py +1 -1
- xoa_driver/internals/commands/pl1ad_commands.py +702 -0
- xoa_driver/internals/hli/ports/port_l23/family_freya.py +5 -0
- xoa_driver/internals/hli/ports/port_l23/family_odin.py +1 -1
- xoa_driver/internals/hli/ports/port_l23/layer1_adv/__init__.py +0 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_adv/freq.py +38 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_adv/pcs_fec.py +214 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_adv/rs_fault.py +24 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_freya.py +5 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_freya_adv.py +61 -0
- xoa_driver/internals/hli/ports/port_l23/tcvr/transceiver.py +4 -4
- {tdl_xoa_driver-1.6.3.dist-info → tdl_xoa_driver-1.7.2.dist-info}/licenses/LICENSE +0 -0
- {tdl_xoa_driver-1.6.3.dist-info → tdl_xoa_driver-1.7.2.dist-info}/top_level.txt +0 -0
xoa_driver/functions/mgmt.py
CHANGED
|
@@ -15,8 +15,8 @@ from typing import (
|
|
|
15
15
|
from xoa_driver import enums, ports
|
|
16
16
|
from xoa_driver.utils import apply
|
|
17
17
|
if TYPE_CHECKING:
|
|
18
|
-
from xoa_driver.ports import GenericL23Port, Z800FreyaPort, Z1600EdunPort, GenericAnyPort
|
|
19
|
-
from xoa_driver.modules import GenericAnyModule, GenericL23Module,
|
|
18
|
+
from xoa_driver.ports import GenericL23Port, Z800FreyaPort, Z1600EdunPort, GenericAnyPort, E100ChimeraPort
|
|
19
|
+
from xoa_driver.modules import GenericAnyModule, GenericL23Module, Z800FreyaModule, Z1600EdunModule, E100ChimeraModule
|
|
20
20
|
from xoa_driver.testers import L23Tester
|
|
21
21
|
FreyaEdunModule = Union[Z800FreyaModule, Z1600EdunModule]
|
|
22
22
|
FreyaEdunPort = Union[Z800FreyaPort, Z1600EdunPort]
|
|
@@ -94,7 +94,7 @@ async def get_chassis_sys_uptime(tester: L23Tester) -> int:
|
|
|
94
94
|
# region Modules
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
def obtain_modules_by_ids(tester: L23Tester, module_ids: List[str]) -> Tuple[
|
|
97
|
+
async def obtain_modules_by_ids(tester: L23Tester, module_ids: List[str], reserve: bool = False) -> Tuple[GenericL23Module | E100ChimeraModule, ...]:
|
|
98
98
|
"""
|
|
99
99
|
Get the module objects of the tester specified by module index ids
|
|
100
100
|
|
|
@@ -107,25 +107,76 @@ def obtain_modules_by_ids(tester: L23Tester, module_ids: List[str]) -> Tuple[Gen
|
|
|
107
107
|
If the list is empty, return all modules of the tester
|
|
108
108
|
|
|
109
109
|
:type module_ids: List[str]
|
|
110
|
+
:param reserve: should reserve the modules, defaults to False
|
|
111
|
+
:type reserve: bool, optional
|
|
110
112
|
:raises NoSuchModuleError: No such a module index on the tester
|
|
111
113
|
:return: module objects
|
|
112
|
-
:rtype: List[:class:`~xoa_driver.modules.
|
|
114
|
+
:rtype: List[:class:`~xoa_driver.modules.GenericL23Module` | :class:`~xoa_driver.modules.E100ChimeraModule`]
|
|
113
115
|
"""
|
|
114
116
|
|
|
115
|
-
if len(module_ids) == 0:
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if len(module_ids) == 0 or "*" in module_ids:
|
|
118
|
+
module_list = [m for m in tuple(tester.modules)]
|
|
119
|
+
if reserve:
|
|
120
|
+
await reserve_modules(modules=module_list, force=reserve)
|
|
118
121
|
return tuple(tester.modules)
|
|
119
122
|
else:
|
|
123
|
+
module_list = [tester.modules.obtain(int(module_id)) for module_id in module_ids]
|
|
124
|
+
if reserve:
|
|
125
|
+
await reserve_modules(modules=module_list, force=reserve)
|
|
120
126
|
return tuple(tester.modules.obtain(int(module_id)) for module_id in module_ids)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def obtain_module_by_id(tester: L23Tester, module_id: str, reserve: bool = False) -> Union[GenericL23Module, E100ChimeraModule]:
|
|
130
|
+
"""
|
|
131
|
+
Get the module object of the tester specified by module index id
|
|
132
|
+
|
|
133
|
+
:param tester: The tester object
|
|
134
|
+
:type tester: :class:`~xoa_driver.testers.L23Tester`
|
|
135
|
+
:param module_id: the index id of the module.
|
|
136
|
+
|
|
137
|
+
:type module_id: str
|
|
138
|
+
:param reserve: should reserve the module, defaults to False
|
|
139
|
+
:type reserve: bool, optional
|
|
140
|
+
:raises NoSuchModuleError: No such a module index on the tester
|
|
141
|
+
:return: module object
|
|
142
|
+
:rtype: Union[:class:`~xoa_driver.modules.GenericL23Module`, :class:`~xoa_driver.modules.E100ChimeraModule`]
|
|
143
|
+
"""
|
|
144
|
+
if reserve:
|
|
145
|
+
await reserve_modules([tester.modules.obtain(int(module_id))], force=reserve)
|
|
146
|
+
return tester.modules.obtain(int(module_id))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def obtain_module_by_port_id(tester: L23Tester, port_id: str, separator: str = "/", reserve: bool = False) -> Union[GenericL23Module, E100ChimeraModule]:
|
|
150
|
+
"""
|
|
151
|
+
Get the module object of the tester specified by the port index id
|
|
152
|
+
|
|
153
|
+
:param tester: The tester object
|
|
154
|
+
:type tester: :class:`~xoa_driver.testers.L23Tester`
|
|
155
|
+
:param port_id: the index id of the port.
|
|
156
|
+
|
|
157
|
+
:type port_id: str
|
|
158
|
+
:param separator: The separator between module index and port index in port id, defaults to "/"
|
|
159
|
+
:type separator: str, optional
|
|
160
|
+
:param reserve: should reserve the module, defaults to False
|
|
161
|
+
:type reserve: bool, optional
|
|
162
|
+
:raises NoSuchModuleError: No such a module index on the tester
|
|
163
|
+
:return: module object
|
|
164
|
+
:rtype: Union[:class:`~xoa_driver.modules.GenericL23Module`, :class:`~xoa_driver.modules.E100ChimeraModule`]
|
|
165
|
+
"""
|
|
166
|
+
if separator not in port_id:
|
|
167
|
+
raise ValueError(f"Invalid port_id format: {port_id}. Expected format 'm{separator}p'.")
|
|
168
|
+
module_id = port_id.split(separator)[0]
|
|
169
|
+
if reserve:
|
|
170
|
+
await reserve_modules([tester.modules.obtain(int(module_id))], force=reserve)
|
|
171
|
+
return tester.modules.obtain(int(module_id))
|
|
121
172
|
|
|
122
173
|
|
|
123
|
-
async def reserve_modules(modules: List[
|
|
174
|
+
async def reserve_modules(modules: List[GenericL23Module | E100ChimeraModule], force: bool = True) -> None:
|
|
124
175
|
"""
|
|
125
176
|
Reserve modules regardless whether they are owned by others or not.
|
|
126
177
|
|
|
127
178
|
:param modules: The modules to reserve
|
|
128
|
-
:type modules: List[:class:`~xoa_driver.modules.
|
|
179
|
+
:type modules: List[Union[:class:`~xoa_driver.modules.GenericL23Module`, :class:`~xoa_driver.modules.E100ChimeraModule`]]
|
|
129
180
|
:param force: Should force reserve the module, defaults to True
|
|
130
181
|
:type force: boolean
|
|
131
182
|
:return:
|
|
@@ -137,12 +188,12 @@ async def reserve_modules(modules: List[GenericAnyModule], force: bool = True) -
|
|
|
137
188
|
|
|
138
189
|
|
|
139
190
|
async def release_modules(
|
|
140
|
-
modules: List[
|
|
191
|
+
modules: List[GenericL23Module | E100ChimeraModule], should_release_ports: bool = False
|
|
141
192
|
) -> None:
|
|
142
193
|
"""
|
|
143
194
|
Free modules. If a module is reserved by you, release the module. If a module is reserved by others, relinquish the module. The modules should have no owner afterwards.
|
|
144
195
|
:param module: The module to free
|
|
145
|
-
:type module: :class:`~xoa_driver.modules.
|
|
196
|
+
:type module: Union[:class:`~xoa_driver.modules.GenericL23Module`, :class:`~xoa_driver.modules.E100ChimeraModule`]
|
|
146
197
|
:param should_release_ports: should ports also be freed, defaults to False
|
|
147
198
|
:type should_release_ports: bool, optional
|
|
148
199
|
:return:
|
|
@@ -160,13 +211,13 @@ async def release_modules(
|
|
|
160
211
|
|
|
161
212
|
|
|
162
213
|
def get_module_supported_configs(
|
|
163
|
-
module: Union[GenericL23Module,
|
|
214
|
+
module: Union[GenericL23Module, E100ChimeraModule],
|
|
164
215
|
) -> List[Tuple[MediaConfigurationType, int, int]]:
|
|
165
216
|
"""
|
|
166
217
|
Get the module's supported configurations in a list.
|
|
167
218
|
|
|
168
219
|
:param module: The module object
|
|
169
|
-
:type module: Union[GenericL23Module,
|
|
220
|
+
:type module: Union[GenericL23Module, E100ChimeraModule]
|
|
170
221
|
:return: List of tuple(supported media, port count, port speed) (The port speed in Mbps, e.g. 40000 for 40G)
|
|
171
222
|
:rtype: List[Tuple[MediaConfigurationType, int, int]]
|
|
172
223
|
"""
|
|
@@ -179,7 +230,7 @@ def get_module_supported_configs(
|
|
|
179
230
|
|
|
180
231
|
|
|
181
232
|
async def set_module_config(
|
|
182
|
-
module: Union[GenericL23Module,
|
|
233
|
+
module: Union[GenericL23Module, E100ChimeraModule],
|
|
183
234
|
media: enums.MediaConfigurationType,
|
|
184
235
|
port_count: int,
|
|
185
236
|
port_speed: int,
|
|
@@ -188,7 +239,7 @@ async def set_module_config(
|
|
|
188
239
|
"""Change the module configuration to the target media, port count and port speed.
|
|
189
240
|
|
|
190
241
|
:param module: the module object
|
|
191
|
-
:type module: Union[GenericL23Module,
|
|
242
|
+
:type module: Union[GenericL23Module, E100ChimeraModule]
|
|
192
243
|
:param media: the target media for the module
|
|
193
244
|
:type media: enums.MediaConfigurationType
|
|
194
245
|
:param port_count: the target port count
|
|
@@ -203,7 +254,7 @@ async def set_module_config(
|
|
|
203
254
|
await set_module_configs([(module, media, port_count, port_speed)], force)
|
|
204
255
|
|
|
205
256
|
|
|
206
|
-
async def set_module_configs(module_configs: List[Tuple[Union[GenericL23Module,
|
|
257
|
+
async def set_module_configs(module_configs: List[Tuple[Union[GenericL23Module, E100ChimeraModule], enums.MediaConfigurationType, int, int]], force: bool = True) -> None:
|
|
207
258
|
|
|
208
259
|
"""Configure multiple modules with specified media, port count and port speed.
|
|
209
260
|
|
|
@@ -211,7 +262,7 @@ async def set_module_configs(module_configs: List[Tuple[Union[GenericL23Module,
|
|
|
211
262
|
|
|
212
263
|
Each tuple contains (module object, target media, target port count, target port speed in Mbps, should forcibly reserve the module)
|
|
213
264
|
|
|
214
|
-
:type module_configs: List[Tuple[Union[GenericL23Module,
|
|
265
|
+
:type module_configs: List[Tuple[Union[GenericL23Module, E100ChimeraModule], enums.MediaConfigurationType, int, int, bool]]
|
|
215
266
|
|
|
216
267
|
:param force: should forcibly reserve the modules, defaults to True
|
|
217
268
|
:type force: bool, optional
|
|
@@ -246,12 +297,12 @@ async def set_module_configs(module_configs: List[Tuple[Union[GenericL23Module,
|
|
|
246
297
|
await release_modules([module for (module, _, _, _) in module_configs], False)
|
|
247
298
|
|
|
248
299
|
|
|
249
|
-
async def get_module_eol_date(module:
|
|
300
|
+
async def get_module_eol_date(module: Union[GenericL23Module, E100ChimeraModule]) -> str:
|
|
250
301
|
"""
|
|
251
302
|
Get module's End-of-Life date
|
|
252
303
|
|
|
253
304
|
:param module: The module object
|
|
254
|
-
:type module:
|
|
305
|
+
:type module: Union[GenericL23Module, E100ChimeraModule]
|
|
255
306
|
:return: Module's EOL date
|
|
256
307
|
:rtype: str
|
|
257
308
|
"""
|
|
@@ -260,12 +311,12 @@ async def get_module_eol_date(module: GenericAnyModule) -> str:
|
|
|
260
311
|
return MODULE_EOL_INFO.get(module_key, "2999-01-01")
|
|
261
312
|
|
|
262
313
|
|
|
263
|
-
async def get_module_eol_days(module:
|
|
314
|
+
async def get_module_eol_days(module: Union[GenericL23Module, E100ChimeraModule]) -> int:
|
|
264
315
|
"""
|
|
265
316
|
Get days until module's End-of-Life date
|
|
266
317
|
|
|
267
318
|
:param module: The module object
|
|
268
|
-
:type module:
|
|
319
|
+
:type module: Union[GenericL23Module, E100ChimeraModule]
|
|
269
320
|
:return: days until module's End-of-Life date
|
|
270
321
|
:rtype: int
|
|
271
322
|
"""
|
|
@@ -314,7 +365,7 @@ async def get_cage_count(module: Union[Z800FreyaModule, Z1600EdunModule]) -> int
|
|
|
314
365
|
# region Ports
|
|
315
366
|
|
|
316
367
|
|
|
317
|
-
def obtain_ports_by_ids(tester: L23Tester, port_ids: List[str], separator: str = "/") -> tuple[
|
|
368
|
+
async def obtain_ports_by_ids(tester: L23Tester, port_ids: List[str], separator: str = "/", reserve: bool = False) -> tuple[Union[GenericL23Port, E100ChimeraPort], ...]:
|
|
318
369
|
"""
|
|
319
370
|
Get ports of the tester specified by port ids
|
|
320
371
|
|
|
@@ -335,13 +386,17 @@ def obtain_ports_by_ids(tester: L23Tester, port_ids: List[str], separator: str =
|
|
|
335
386
|
:type port_ids: List[str]
|
|
336
387
|
:param separator: The separator between module index and port index in port id, defaults to `/`
|
|
337
388
|
:type separator: str, optional
|
|
389
|
+
:param reserve: should reserve the ports, defaults to False
|
|
390
|
+
:type reserve: bool, optional
|
|
338
391
|
:return: List of port objects
|
|
339
|
-
:rtype: tuple[
|
|
392
|
+
:rtype: tuple[Union[GenericL23Port, E100ChimeraPort]]
|
|
340
393
|
"""
|
|
341
394
|
|
|
342
395
|
returned_ports = []
|
|
343
396
|
if len(port_ids) == 0 or f"*{separator}*" in port_ids or f"*" in port_ids: # [] or ["*/*"] or ["*"]
|
|
344
397
|
all_ports_ = (m.ports for m in tester.modules)
|
|
398
|
+
if reserve:
|
|
399
|
+
await reserve_ports(list(chain.from_iterable(all_ports_)), force=reserve)
|
|
345
400
|
return tuple(chain.from_iterable(all_ports_))
|
|
346
401
|
else:
|
|
347
402
|
for port_id in port_ids:
|
|
@@ -359,10 +414,12 @@ def obtain_ports_by_ids(tester: L23Tester, port_ids: List[str], separator: str =
|
|
|
359
414
|
pid = port_id.split(separator)[1]
|
|
360
415
|
for module in tester.modules:
|
|
361
416
|
returned_ports.append(module.ports.obtain(int(pid)))
|
|
417
|
+
if reserve:
|
|
418
|
+
await reserve_ports(returned_ports, force=reserve)
|
|
362
419
|
return tuple(returned_ports)
|
|
363
420
|
|
|
364
421
|
|
|
365
|
-
def obtain_port_by_id(tester: L23Tester, port_id: str, separator: str = "/") ->
|
|
422
|
+
async def obtain_port_by_id(tester: L23Tester, port_id: str, separator: str = "/", reserve: bool = False) -> Union[GenericL23Port, E100ChimeraPort]:
|
|
366
423
|
"""
|
|
367
424
|
Get a port of the module
|
|
368
425
|
|
|
@@ -372,23 +429,26 @@ def obtain_port_by_id(tester: L23Tester, port_id: str, separator: str = "/") ->
|
|
|
372
429
|
:type port_id: str
|
|
373
430
|
:param separator: The separator between module index and port index in port id, defaults to "/"
|
|
374
431
|
:type separator: str, optional
|
|
432
|
+
:param reserve: should reserve the port, defaults to False
|
|
433
|
+
:type reserve: bool, optional
|
|
375
434
|
:raises NoSuchPortError: No port found with the index
|
|
376
435
|
:return: The port object
|
|
377
|
-
:rtype:
|
|
436
|
+
:rtype: Union[GenericL23Port, E100ChimeraPort]
|
|
378
437
|
"""
|
|
379
438
|
if "*" in port_id:
|
|
380
439
|
raise ValueError("Wildcard '*' is not allowed in port_id for obtain_port_by_id function.")
|
|
381
440
|
if separator not in port_id:
|
|
382
441
|
raise ValueError(f"Invalid port_id format: {port_id}. Expected format 'm{separator}p'.")
|
|
383
|
-
|
|
442
|
+
port_obj = (await obtain_ports_by_ids(tester, [port_id], separator=separator, reserve=reserve))[0]
|
|
443
|
+
return port_obj
|
|
384
444
|
|
|
385
445
|
|
|
386
|
-
async def reserve_ports(ports: list[
|
|
446
|
+
async def reserve_ports(ports: list[Union[GenericL23Port, E100ChimeraPort]], force: bool = True, reset: bool = False) -> None:
|
|
387
447
|
"""
|
|
388
448
|
Reserve a port regardless whether it is owned by others or not.
|
|
389
449
|
|
|
390
450
|
:param ports: The ports to reserve
|
|
391
|
-
:type ports: list[
|
|
451
|
+
:type ports: list[Union[GenericL23Port, E100ChimeraPort]]
|
|
392
452
|
:param force: Should force reserve the ports, defaults to True
|
|
393
453
|
:type force: boolean, optional
|
|
394
454
|
:param reset: Should reset the ports after reserving, defaults to False
|
|
@@ -409,12 +469,12 @@ async def reserve_ports(ports: list[GenericAnyPort], force: bool = True, reset:
|
|
|
409
469
|
await port.reset.set()
|
|
410
470
|
|
|
411
471
|
|
|
412
|
-
async def release_ports(ports: List[
|
|
472
|
+
async def release_ports(ports: List[Union[GenericL23Port, E100ChimeraPort]]) -> None:
|
|
413
473
|
"""
|
|
414
474
|
Free a port. If the port is reserved by you, release the port. If the port is reserved by others, relinquish the port. The port should have no owner afterwards.
|
|
415
475
|
|
|
416
476
|
:param port: The port to free
|
|
417
|
-
:type port:
|
|
477
|
+
:type port: Union[GenericL23Port, E100ChimeraPort]
|
|
418
478
|
:return:
|
|
419
479
|
:rtype: None
|
|
420
480
|
"""
|
|
@@ -426,12 +486,12 @@ async def release_ports(ports: List[GenericAnyPort]) -> None:
|
|
|
426
486
|
await port.reservation.set_release()
|
|
427
487
|
|
|
428
488
|
|
|
429
|
-
async def reset_ports(ports: List[
|
|
489
|
+
async def reset_ports(ports: List[Union[GenericL23Port, E100ChimeraPort]]) -> None:
|
|
430
490
|
"""
|
|
431
491
|
Reset a list of ports.
|
|
432
492
|
|
|
433
493
|
:param ports: The ports to reset
|
|
434
|
-
:type ports: List[
|
|
494
|
+
:type ports: List[Union[GenericL23Port, E100ChimeraPort]]
|
|
435
495
|
:return:
|
|
436
496
|
:rtype: None
|
|
437
497
|
"""
|
|
@@ -459,6 +519,8 @@ __all__ = (
|
|
|
459
519
|
"release_tester",
|
|
460
520
|
"get_chassis_sys_uptime",
|
|
461
521
|
"obtain_modules_by_ids",
|
|
522
|
+
"obtain_module_by_id",
|
|
523
|
+
"obtain_module_by_port_id",
|
|
462
524
|
"reserve_modules",
|
|
463
525
|
"release_modules",
|
|
464
526
|
"get_module_supported_configs",
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Transceiver R/W functions
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
import asyncio
|
|
7
|
+
from typing import (
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Union,
|
|
11
|
+
List,
|
|
12
|
+
Tuple,
|
|
13
|
+
)
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from xoa_driver.ports import Z800FreyaPort, Z1600EdunPort, Z100LokiPort, Z10OdinPort, Z400ThorPort
|
|
16
|
+
|
|
17
|
+
from ..misc import Hex
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def get_xcvr_rw_seq_bank(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", bank: int, page: int, register: int, length: int) -> str:
|
|
22
|
+
"""Read a number of bytes from transceiver register interface via I2C.
|
|
23
|
+
|
|
24
|
+
:param port: The port object
|
|
25
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
26
|
+
:param bank: The bank address, e.g. 10 or 0xA
|
|
27
|
+
:type bank: int
|
|
28
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
29
|
+
:type page: int
|
|
30
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
31
|
+
:type register: int
|
|
32
|
+
:param length: The number of bytes to read
|
|
33
|
+
:type length: int
|
|
34
|
+
:return: The read bytes as a string, e.g. 'DEADBEEF'
|
|
35
|
+
:rtype: str
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
resp = await port.transceiver.access_rw_seq_bank(bank_address=bank, page_address=page, register_address=register, byte_count=length).get()
|
|
39
|
+
return resp.value
|
|
40
|
+
|
|
41
|
+
async def set_xcvr_rw_seq_bank(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", bank: int, page: int, register: int, value: str) -> None:
|
|
42
|
+
"""Write a number of bytes to transceiver register interface via I2C.
|
|
43
|
+
|
|
44
|
+
:param port: The port object
|
|
45
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
46
|
+
:param bank: The bank address, e.g. 10 or 0xA
|
|
47
|
+
:type bank: int
|
|
48
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
49
|
+
:type page: int
|
|
50
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
51
|
+
:type register: int
|
|
52
|
+
:param value: The bytes to write as a string, e.g. 'DEADBEEF'
|
|
53
|
+
:type value: str
|
|
54
|
+
"""
|
|
55
|
+
await port.transceiver.access_rw_seq_bank(bank_address=bank, page_address=page, register_address=register, byte_count=len(value)//2).set(value=Hex(value))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def get_xcvr_rw_seq(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", page: int, register: int, length: int) -> str:
|
|
59
|
+
"""Read a number of bytes from transceiver register interface via I2C.
|
|
60
|
+
|
|
61
|
+
:param port: The port object
|
|
62
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
63
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
64
|
+
:type page: int
|
|
65
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
66
|
+
:type register: int
|
|
67
|
+
:param length: The number of bytes to read
|
|
68
|
+
:type length: int
|
|
69
|
+
:return: The read bytes as a string, e.g. 'DEADBEEF'
|
|
70
|
+
:rtype: str
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
resp = await port.transceiver.access_rw_seq(page_address=page, register_address=register, byte_count=length).get()
|
|
74
|
+
return resp.value
|
|
75
|
+
|
|
76
|
+
async def set_xcvr_rw_seq(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", page: int, register: int, value: str) -> None:
|
|
77
|
+
"""Write a number of bytes to transceiver register interface via I2C.
|
|
78
|
+
|
|
79
|
+
:param port: The port object
|
|
80
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
81
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
82
|
+
:type page: int
|
|
83
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
84
|
+
:type register: int
|
|
85
|
+
:param value: The bytes to write as a string, e.g. 'DEADBEEF'
|
|
86
|
+
:type value: str
|
|
87
|
+
"""
|
|
88
|
+
await port.transceiver.access_rw_seq(page_address=page, register_address=register, byte_count=len(value)//2).set(value=Hex(value))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
async def get_xcvr_rw(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", page: int, register: int) -> str:
|
|
92
|
+
"""Read 4 bytes from transceiver register interface.
|
|
93
|
+
|
|
94
|
+
:param port: The port object
|
|
95
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
96
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
97
|
+
:type page: int
|
|
98
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
99
|
+
:type register: int
|
|
100
|
+
:return: The read bytes as a string, e.g. 'DEADBEEF'
|
|
101
|
+
:rtype: str
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
resp = await port.transceiver.access_rw(page_address=page, register_address=register).get()
|
|
105
|
+
return resp.value
|
|
106
|
+
|
|
107
|
+
async def set_xcvr_rw(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", page: int, register: int, value: str) -> None:
|
|
108
|
+
"""Write 4 bytes to transceiver register interface.
|
|
109
|
+
|
|
110
|
+
:param port: The port object
|
|
111
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
112
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
113
|
+
:type page: int
|
|
114
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
115
|
+
:type register: int
|
|
116
|
+
:param value: The bytes to write as a string, e.g. 'DEADBEEF'
|
|
117
|
+
:type value: str
|
|
118
|
+
"""
|
|
119
|
+
await port.transceiver.access_rw(page_address=page, register_address=register).set(value=Hex(value))
|
|
120
|
+
|
|
121
|
+
async def get_xcvr_mii(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", register: int) -> str:
|
|
122
|
+
"""Read 2 bytes from transceiver register interface.
|
|
123
|
+
|
|
124
|
+
:param port: The port object
|
|
125
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
126
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
127
|
+
:type register: int
|
|
128
|
+
:return: The read 2 bytes as a string, e.g. 'DEAF'
|
|
129
|
+
:rtype: str
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
resp = await port.transceiver.access_mii(register_address=register).get()
|
|
133
|
+
return resp.value
|
|
134
|
+
|
|
135
|
+
async def set_xcvr_mii(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort",register: int, value: str) -> None:
|
|
136
|
+
"""Write 2 bytes to transceiver register interface.
|
|
137
|
+
|
|
138
|
+
:param port: The port object
|
|
139
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
140
|
+
:param page: The page address, e.g. 10 or 0xA
|
|
141
|
+
:type page: int
|
|
142
|
+
:param register: The register address, e.g. 10 or 0xA
|
|
143
|
+
:type register: int
|
|
144
|
+
:param value: The 2 bytes to write as a string, e.g. 'DEAF'
|
|
145
|
+
:type value: str
|
|
146
|
+
"""
|
|
147
|
+
await port.transceiver.access_mii(register_address=register).set(value=Hex(value))
|
|
148
|
+
|
|
149
|
+
async def get_i2c_freq_khz(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort") -> int:
|
|
150
|
+
"""Read access speed on a transceiver I2C access in the unit of KHz. Default to 100.
|
|
151
|
+
|
|
152
|
+
When the transceiver is plugged out and in again, the speed will be reset to the default value 100. The speed has a minimum and a maximum, which can be obtained from P_CAPABILITIES.
|
|
153
|
+
|
|
154
|
+
The I2C speed configuration will not be included in the port configuration file (.xpc).
|
|
155
|
+
When you load a port configuration to a port, the transceiver I2C access speed will be reset to default 100.
|
|
156
|
+
|
|
157
|
+
:param port: The port object
|
|
158
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
159
|
+
:return: The current I2C access speed in KHz
|
|
160
|
+
:rtype: int
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
resp = await port.transceiver.i2c_config.get()
|
|
164
|
+
return resp.frequency
|
|
165
|
+
|
|
166
|
+
async def set_i2c_freq_khz(port: "Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort", frequency: int) -> None:
|
|
167
|
+
"""Set access speed on a transceiver I2C access in the unit of KHz.
|
|
168
|
+
|
|
169
|
+
When the transceiver is plugged out and in again, the speed will be reset to the default value 100. The speed has a minimum and a maximum, which can be obtained from P_CAPABILITIES.
|
|
170
|
+
|
|
171
|
+
The I2C speed configuration will not be included in the port configuration file (.xpc).
|
|
172
|
+
When you load a port configuration to a port, the transceiver I2C access speed will be reset to default 100.
|
|
173
|
+
|
|
174
|
+
:param port: The port object
|
|
175
|
+
:type port: Z1600EdunPort | Z800FreyaPort | Z400ThorPort | Z100LokiPort | Z10OdinPort
|
|
176
|
+
:param frequency: The desired I2C access speed in KHz
|
|
177
|
+
:type frequency: int
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
await port.transceiver.i2c_config.set(frequency=frequency)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
__all__ = (
|
|
186
|
+
"get_xcvr_rw_seq_bank",
|
|
187
|
+
"set_xcvr_rw_seq_bank",
|
|
188
|
+
"get_xcvr_rw_seq",
|
|
189
|
+
"set_xcvr_rw_seq",
|
|
190
|
+
"get_xcvr_rw",
|
|
191
|
+
"set_xcvr_rw",
|
|
192
|
+
"get_xcvr_mii",
|
|
193
|
+
"set_xcvr_mii",
|
|
194
|
+
"get_i2c_freq_khz",
|
|
195
|
+
"set_i2c_freq_khz",
|
|
196
|
+
)
|
xoa_driver/hlfuncs.py
CHANGED
|
@@ -9,6 +9,9 @@ from xoa_driver.functions import (
|
|
|
9
9
|
exceptions,
|
|
10
10
|
headers,
|
|
11
11
|
cmis,
|
|
12
|
+
layer1_adv,
|
|
13
|
+
async_wrapper,
|
|
14
|
+
xcvr,
|
|
12
15
|
)
|
|
13
16
|
|
|
14
17
|
__all__ = (
|
|
@@ -19,4 +22,7 @@ __all__ = (
|
|
|
19
22
|
"config_io",
|
|
20
23
|
"headers",
|
|
21
24
|
"cmis",
|
|
25
|
+
"layer1_adv",
|
|
26
|
+
"async_wrapper",
|
|
27
|
+
"xcvr",
|
|
22
28
|
)
|
|
@@ -3309,4 +3309,14 @@ class MACSecPNMode(IntEnum):
|
|
|
3309
3309
|
RESET = 1
|
|
3310
3310
|
"""Reset the PN value"""
|
|
3311
3311
|
|
|
3312
|
-
# endregion
|
|
3312
|
+
# endregion
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
class TrueFalse(IntEnum):
|
|
3316
|
+
"""True or False"""
|
|
3317
|
+
|
|
3318
|
+
FALSE = 0
|
|
3319
|
+
"""False"""
|
|
3320
|
+
|
|
3321
|
+
TRUE = 1
|
|
3322
|
+
"""True"""
|