sdfgen 0.24.0__cp313-cp313-musllinux_1_2_x86_64.whl → 0.26.0__cp313-cp313-musllinux_1_2_x86_64.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.
Binary file
libcsdfgen.so CHANGED
Binary file
libcsdfgen.so.0 CHANGED
Binary file
libcsdfgen.so.0.26.0 ADDED
Binary file
sdfgen/module.py CHANGED
@@ -14,6 +14,7 @@ class SddfStatus(IntEnum):
14
14
  INVALID_CLIENT = 2,
15
15
  NET_DUPLICATE_COPIER = 100,
16
16
  NET_DUPLICATE_MAC_ADDR = 101,
17
+ NET_INVALID_OPTIONS = 103,
17
18
 
18
19
 
19
20
  # TOOD: double check
@@ -78,13 +79,17 @@ libsdfgen.sdfgen_channel_get_pd_b_id.argtypes = [c_void_p]
78
79
 
79
80
  libsdfgen.sdfgen_map_create.restype = c_void_p
80
81
  libsdfgen.sdfgen_map_create.argtypes = [c_void_p, c_uint64, MapPermsType, c_bool]
82
+ libsdfgen.sdfgen_map_get_vaddr.restype = c_uint64
83
+ libsdfgen.sdfgen_map_get_vaddr.argtypes = [c_void_p]
81
84
  libsdfgen.sdfgen_map_destroy.restype = None
82
85
  libsdfgen.sdfgen_map_destroy.argtypes = [c_void_p]
83
86
 
84
87
  libsdfgen.sdfgen_mr_create.restype = c_void_p
85
88
  libsdfgen.sdfgen_mr_create.argtypes = [c_char_p, c_uint64]
86
89
  libsdfgen.sdfgen_mr_create_physical.restype = c_void_p
87
- libsdfgen.sdfgen_mr_create_physical.argtypes = [c_char_p, c_uint64, c_uint64]
90
+ libsdfgen.sdfgen_mr_create_physical.argtypes = [c_void_p, c_char_p, c_uint64, POINTER(c_uint64)]
91
+ libsdfgen.sdfgen_mr_get_size.restype = c_uint64
92
+ libsdfgen.sdfgen_mr_get_size.argtypes = [c_void_p]
88
93
  libsdfgen.sdfgen_mr_get_paddr.restype = c_bool
89
94
  libsdfgen.sdfgen_mr_get_paddr.argtypes = [c_void_p, POINTER(c_uint64)]
90
95
 
@@ -123,6 +128,8 @@ libsdfgen.sdfgen_pd_destroy.argtypes = [c_void_p]
123
128
 
124
129
  libsdfgen.sdfgen_pd_add_child.restype = c_int8
125
130
  libsdfgen.sdfgen_pd_add_child.argtypes = [c_void_p, c_void_p, POINTER(c_uint8)]
131
+ libsdfgen.sdfgen_pd_get_map_vaddr.restype = c_uint64
132
+ libsdfgen.sdfgen_pd_get_map_vaddr.argtypes = [c_void_p, c_void_p]
126
133
  libsdfgen.sdfgen_pd_add_map.restype = None
127
134
  libsdfgen.sdfgen_pd_add_map.argtypes = [c_void_p, c_void_p]
128
135
  libsdfgen.sdfgen_pd_add_irq.restype = c_int8
@@ -183,7 +190,7 @@ libsdfgen.sdfgen_sddf_serial_serialise_config.restype = c_bool
183
190
  libsdfgen.sdfgen_sddf_serial_serialise_config.argtypes = [c_void_p, c_char_p]
184
191
 
185
192
  libsdfgen.sdfgen_sddf_net.restype = c_void_p
186
- libsdfgen.sdfgen_sddf_net.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
193
+ libsdfgen.sdfgen_sddf_net.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p]
187
194
  libsdfgen.sdfgen_sddf_net_destroy.restype = None
188
195
  libsdfgen.sdfgen_sddf_net_destroy.argtypes = [c_void_p]
189
196
 
@@ -192,7 +199,9 @@ libsdfgen.sdfgen_sddf_net_add_client_with_copier.argtypes = [
192
199
  c_void_p,
193
200
  c_void_p,
194
201
  c_void_p,
195
- c_char_p
202
+ c_char_p,
203
+ c_bool,
204
+ c_bool
196
205
  ]
197
206
 
198
207
  libsdfgen.sdfgen_sddf_net_connect.restype = c_bool
@@ -328,6 +337,17 @@ def ffi_uint32_ptr(n: Optional[int]):
328
337
  return pointer(c_uint32(n))
329
338
 
330
339
 
340
+ def ffi_uint64_ptr(n: Optional[int]):
341
+ """
342
+ Convert an int value to a uint64_t pointer for FFI.
343
+ If 'n' is None then we return None (which acts as a null pointer)
344
+ """
345
+ if n is None:
346
+ return None
347
+
348
+ return pointer(c_uint64(n))
349
+
350
+
331
351
  def ffi_bool_ptr(val: Optional[bool]):
332
352
  """
333
353
  Convert a bool value to a bool pointer for FFI.
@@ -406,9 +426,6 @@ class SystemDescription:
406
426
  """
407
427
 
408
428
  _obj: c_void_p
409
- # We need to hold references to the PDs in case they get GC'd.
410
- # TODO: is this really necessary?
411
- _pds: List[ProtectionDomain]
412
429
 
413
430
  class Arch(IntEnum):
414
431
  """Target architecture. Used to resolve architecture specific features or attributes."""
@@ -422,9 +439,8 @@ class SystemDescription:
422
439
 
423
440
  class ProtectionDomain:
424
441
  _name: str
442
+ _program_image: str
425
443
  _obj: c_void_p
426
- # We need to hold references to the PDs in case they get GC'd.
427
- _child_pds: List[SystemDescription.ProtectionDomain]
428
444
 
429
445
  def __init__(
430
446
  self,
@@ -438,10 +454,10 @@ class SystemDescription:
438
454
  cpu: Optional[int] = None,
439
455
  ) -> None:
440
456
  self._name = name
457
+ self._program_image = program_image
441
458
  c_name = c_char_p(name.encode("utf-8"))
442
459
  c_program_image = c_char_p(program_image.encode("utf-8"))
443
460
  self._obj = libsdfgen.sdfgen_pd_create(c_name, c_program_image)
444
- self._child_pds = []
445
461
  if priority is not None:
446
462
  libsdfgen.sdfgen_pd_set_priority(self._obj, priority)
447
463
  if budget is not None:
@@ -459,6 +475,10 @@ class SystemDescription:
459
475
  def name(self) -> str:
460
476
  return self._name
461
477
 
478
+ @property
479
+ def program_image(self) -> str:
480
+ return self._program_image
481
+
462
482
  def add_child_pd(self, child_pd: SystemDescription.ProtectionDomain, child_id=None) -> int:
463
483
  """
464
484
  Returns allocated ID for the child.
@@ -469,10 +489,14 @@ class SystemDescription:
469
489
  if id < 0:
470
490
  raise Exception(f"failed to add child to PD '{self.name}'")
471
491
 
472
- self._child_pds.append(child_pd)
473
-
474
492
  return id
475
493
 
494
+ def get_map_vaddr(self, mr: SystemDescription.MemoryRegion) -> int:
495
+ """
496
+ Returns next available vaddr for memory region map.
497
+ """
498
+ return libsdfgen.sdfgen_pd_get_map_vaddr(self._obj, mr._obj)
499
+
476
500
  def add_map(self, map: SystemDescription.Map):
477
501
  libsdfgen.sdfgen_pd_add_map(self._obj, map._obj)
478
502
 
@@ -494,8 +518,6 @@ class SystemDescription:
494
518
  def __repr__(self) -> str:
495
519
  return f"ProtectionDomain({self.name})"
496
520
 
497
- # TODO: __del__ is more complicated for virtual machine since it may be owned
498
- # by a protection domain meaning it would result in a double free
499
521
  class VirtualMachine:
500
522
  _name: str
501
523
  _obj: c_void_p
@@ -533,6 +555,9 @@ class SystemDescription:
533
555
  def add_map(self, map: SystemDescription.Map):
534
556
  libsdfgen.sdfgen_vm_add_map(self._obj, map._obj)
535
557
 
558
+ def __del__(self):
559
+ libsdfgen.sdfgen_vm_destroy(self._obj)
560
+
536
561
  def __repr__(self) -> str:
537
562
  return f"VirtualMachine({self.name})"
538
563
 
@@ -564,22 +589,35 @@ class SystemDescription:
564
589
  if self._obj is None:
565
590
  raise Exception("failed to create mapping")
566
591
 
592
+ @property
593
+ def vaddr(self):
594
+ return libsdfgen.sdfgen_map_get_vaddr(self._obj)
595
+
567
596
  class MemoryRegion:
568
597
  _obj: c_void_p
569
598
 
570
599
  # TODO: handle more options
571
600
  def __init__(
572
601
  self,
602
+ sdf: SystemDescription,
573
603
  name: str,
574
604
  size: int,
575
605
  *,
606
+ physical: Optional[bool] = None,
576
607
  paddr: Optional[int] = None
577
608
  ) -> None:
578
609
  c_name = c_char_p(name.encode("utf-8"))
579
610
  if paddr:
580
- self._obj = libsdfgen.sdfgen_mr_create_physical(c_name, size, paddr)
611
+ physical = True
612
+ if physical:
613
+ self._obj = libsdfgen.sdfgen_mr_create_physical(sdf._obj, c_name, size, ffi_uint64_ptr(paddr))
581
614
  else:
582
615
  self._obj = libsdfgen.sdfgen_mr_create(c_name, size)
616
+ self._size = size
617
+
618
+ @property
619
+ def size(self):
620
+ return libsdfgen.sdfgen_mr_get_size(self._obj)
583
621
 
584
622
  @property
585
623
  def paddr(self):
@@ -665,13 +703,11 @@ class SystemDescription:
665
703
  Create a System Description
666
704
  """
667
705
  self._obj = libsdfgen.sdfgen_create(arch.value, paddr_top)
668
- self._pds = []
669
706
 
670
707
  def __del__(self):
671
708
  libsdfgen.sdfgen_destroy(self._obj)
672
709
 
673
710
  def add_pd(self, pd: ProtectionDomain):
674
- self._pds.append(pd)
675
711
  libsdfgen.sdfgen_add_pd(self._obj, pd._obj)
676
712
 
677
713
  def add_mr(self, mr: MemoryRegion):
@@ -872,23 +908,30 @@ class Sddf:
872
908
  device: Optional[DeviceTree.Node],
873
909
  driver: SystemDescription.ProtectionDomain,
874
910
  virt_tx: SystemDescription.ProtectionDomain,
875
- virt_rx: SystemDescription.ProtectionDomain
911
+ virt_rx: SystemDescription.ProtectionDomain,
912
+ rx_dma_mr: Optional[SystemDescription.MemoryRegion] = None
876
913
  ) -> None:
877
914
  if device is None:
878
915
  device_obj = None
879
916
  else:
880
917
  device_obj = device._obj
918
+ if rx_dma_mr is None:
919
+ rx_dma_mr_obj = None
920
+ else:
921
+ rx_dma_mr_obj = rx_dma_mr._obj
881
922
 
882
923
  self._obj = libsdfgen.sdfgen_sddf_net(
883
- sdf._obj, device_obj, driver._obj, virt_tx._obj, virt_rx._obj
924
+ sdf._obj, device_obj, driver._obj, virt_tx._obj, virt_rx._obj, rx_dma_mr_obj
884
925
  )
885
926
 
886
927
  def add_client_with_copier(
887
928
  self,
888
929
  client: SystemDescription.ProtectionDomain,
889
- copier: SystemDescription.ProtectionDomain,
930
+ copier: Optional[SystemDescription.ProtectionDomain] = None,
890
931
  *,
891
- mac_addr: Optional[str] = None
932
+ mac_addr: Optional[str] = None,
933
+ rx: Optional[bool] = None,
934
+ tx: Optional[bool] = None
892
935
  ) -> None:
893
936
  """
894
937
  Add a client connected to a copier component for RX traffic.
@@ -904,8 +947,20 @@ class Sddf:
904
947
  c_mac_addr = c_char_p(0)
905
948
  if mac_addr is not None:
906
949
  c_mac_addr = c_char_p(mac_addr.encode("utf-8"))
950
+ if copier is None:
951
+ copier_obj = None
952
+ else:
953
+ copier_obj = copier._obj
954
+ if rx is None or rx is True:
955
+ rx_arg = True
956
+ else:
957
+ rx_arg = False
958
+ if tx is None or tx is True:
959
+ tx_arg = True
960
+ else:
961
+ tx_arg = False
907
962
  ret = libsdfgen.sdfgen_sddf_net_add_client_with_copier(
908
- self._obj, client._obj, copier._obj, c_mac_addr
963
+ self._obj, client._obj, copier_obj, c_mac_addr, rx_arg, tx_arg
909
964
  )
910
965
  if ret == SddfStatus.OK:
911
966
  return
@@ -917,6 +972,8 @@ class Sddf:
917
972
  raise Exception(f"duplicate copier given '{copier}'")
918
973
  elif ret == SddfStatus.NET_DUPLICATE_MAC_ADDR:
919
974
  raise Exception(f"duplicate MAC address given '{mac_addr}'")
975
+ elif ret == SddfStatus.NET_INVALID_OPTIONS:
976
+ raise Exception(f"client must have rx or tx access")
920
977
  else:
921
978
  raise Exception(f"internal error: {ret}")
922
979
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdfgen
3
- Version: 0.24.0
3
+ Version: 0.26.0
4
4
  Summary: Automating the creation of Microkit System Description Files (SDF)
5
5
  Home-page: https://github.com/au-ts/microkit_sdf_gen
6
6
  Description-Content-Type: text/markdown
@@ -0,0 +1,11 @@
1
+ libcsdfgen.so.0,sha256=DnV9M5Aerwbg99_vN34e75EnSAZEtI5ZajIu36KMe4g,3992552
2
+ csdfgen.cpython-313-x86_64-linux-musl.so,sha256=DnV9M5Aerwbg99_vN34e75EnSAZEtI5ZajIu36KMe4g,3992552
3
+ libcsdfgen.so,sha256=DnV9M5Aerwbg99_vN34e75EnSAZEtI5ZajIu36KMe4g,3992552
4
+ libcsdfgen.so.0.26.0,sha256=DnV9M5Aerwbg99_vN34e75EnSAZEtI5ZajIu36KMe4g,3992552
5
+ sdfgen/module.py,sha256=D7_EwTuYhocW3SGGrGo4Hn0fhBf1bGoYeTNUiz0Yxoc,47070
6
+ sdfgen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ sdfgen/__init__.py,sha256=_d7GGV8GhadIAEYP8uiJlez0yKtXnHMHdRkRzVMKS3c,143
8
+ sdfgen-0.26.0.dist-info/RECORD,,
9
+ sdfgen-0.26.0.dist-info/METADATA,sha256=7M2-Ci34pRRPKOPze_GFLE1DaNWOP69e5odEALWssUk,4549
10
+ sdfgen-0.26.0.dist-info/top_level.txt,sha256=M3gUW9vTMij10peQKgv1Qs0jZkdsk_PG0REFxuv6jNY,15
11
+ sdfgen-0.26.0.dist-info/WHEEL,sha256=4VbEOkf4fdBUBHdV24POjoH-zuik_eIDLSImZZCAQpQ,112
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp313-cp313-musllinux_1_2_x86_64
5
5
 
libcsdfgen.so.0.24.0 DELETED
Binary file
@@ -1,11 +0,0 @@
1
- libcsdfgen.so.0.24.0,sha256=YzD6Ck34WrTVeB2_ebIhGxF2ylR7BiTayPxiQV9azzQ,5424768
2
- libcsdfgen.so.0,sha256=YzD6Ck34WrTVeB2_ebIhGxF2ylR7BiTayPxiQV9azzQ,5424768
3
- csdfgen.cpython-313-x86_64-linux-musl.so,sha256=YzD6Ck34WrTVeB2_ebIhGxF2ylR7BiTayPxiQV9azzQ,5424768
4
- libcsdfgen.so,sha256=YzD6Ck34WrTVeB2_ebIhGxF2ylR7BiTayPxiQV9azzQ,5424768
5
- sdfgen-0.24.0.dist-info/top_level.txt,sha256=M3gUW9vTMij10peQKgv1Qs0jZkdsk_PG0REFxuv6jNY,15
6
- sdfgen-0.24.0.dist-info/METADATA,sha256=nLuya7UbzSfHITmPU9TH8LVmjl_3VBaugiabDiLcX2k,4549
7
- sdfgen-0.24.0.dist-info/RECORD,,
8
- sdfgen-0.24.0.dist-info/WHEEL,sha256=TuRlN4kXuN1xOwcMU4SCl4C1_CV-in7CdWbVFicdzh4,112
9
- sdfgen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- sdfgen/module.py,sha256=XCdJ3HyUF7sPTYm-tw9BzE9O7fA-zuFGcA3jBwYTrP8,45235
11
- sdfgen/__init__.py,sha256=_d7GGV8GhadIAEYP8uiJlez0yKtXnHMHdRkRzVMKS3c,143