sdfgen 0.9.0__cp312-cp312-macosx_14_0_arm64.whl → 0.9.1__cp312-cp312-macosx_14_0_arm64.whl

Sign up to get free protection for your applications and to get access to all the features.
Binary file
sdfgen/module.py CHANGED
@@ -7,6 +7,12 @@ from ctypes import (
7
7
  from typing import Optional, List, Tuple
8
8
  from enum import IntEnum
9
9
 
10
+ class SddfStatus(IntEnum):
11
+ OK = 0,
12
+ DUPLICATE_CLIENT = 1,
13
+ NET_DUPLICATE_COPIER = 100,
14
+ NET_DUPLICATE_MAC_ADDR = 101,
15
+
10
16
  # TOOD: double check
11
17
  MapPermsType = c_uint32
12
18
 
@@ -95,7 +101,7 @@ libsdfgen.sdfgen_sddf_timer.argtypes = [c_void_p, c_void_p, c_void_p]
95
101
  libsdfgen.sdfgen_sddf_timer_destroy.restype = None
96
102
  libsdfgen.sdfgen_sddf_timer_destroy.argtypes = [c_void_p]
97
103
 
98
- libsdfgen.sdfgen_sddf_timer_add_client.restype = None
104
+ libsdfgen.sdfgen_sddf_timer_add_client.restype = c_uint32
99
105
  libsdfgen.sdfgen_sddf_timer_add_client.argtypes = [c_void_p, c_void_p]
100
106
 
101
107
  libsdfgen.sdfgen_sddf_timer_connect.restype = c_bool
@@ -108,7 +114,7 @@ libsdfgen.sdfgen_sddf_i2c.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
108
114
  libsdfgen.sdfgen_sddf_i2c_destroy.restype = None
109
115
  libsdfgen.sdfgen_sddf_i2c_destroy.argtypes = [c_void_p]
110
116
 
111
- libsdfgen.sdfgen_sddf_i2c_add_client.restype = None
117
+ libsdfgen.sdfgen_sddf_i2c_add_client.restype = c_uint32
112
118
  libsdfgen.sdfgen_sddf_i2c_add_client.argtypes = [c_void_p, c_void_p]
113
119
 
114
120
  libsdfgen.sdfgen_sddf_i2c_connect.restype = c_bool
@@ -121,7 +127,7 @@ libsdfgen.sdfgen_sddf_block.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p]
121
127
  libsdfgen.sdfgen_sddf_block_destroy.restype = None
122
128
  libsdfgen.sdfgen_sddf_block_destroy.argtypes = [c_void_p]
123
129
 
124
- libsdfgen.sdfgen_sddf_block_add_client.restype = None
130
+ libsdfgen.sdfgen_sddf_block_add_client.restype = c_uint32
125
131
  libsdfgen.sdfgen_sddf_block_add_client.argtypes = [c_void_p, c_void_p, c_uint32]
126
132
 
127
133
  libsdfgen.sdfgen_sddf_block_connect.restype = c_bool
@@ -135,7 +141,7 @@ libsdfgen.sdfgen_sddf_serial.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p,
135
141
  libsdfgen.sdfgen_sddf_serial_destroy.restype = None
136
142
  libsdfgen.sdfgen_sddf_serial_destroy.argtypes = [c_void_p]
137
143
 
138
- libsdfgen.sdfgen_sddf_serial_add_client.restype = None
144
+ libsdfgen.sdfgen_sddf_serial_add_client.restype = c_uint32
139
145
  libsdfgen.sdfgen_sddf_serial_add_client.argtypes = [c_void_p, c_void_p]
140
146
 
141
147
  libsdfgen.sdfgen_sddf_serial_connect.restype = c_bool
@@ -309,6 +315,9 @@ class SystemDescription:
309
315
  def __del__(self):
310
316
  libsdfgen.sdfgen_pd_destroy(self._obj)
311
317
 
318
+ def __repr__(self) -> str:
319
+ return f"ProtectionDomain({self.name})"
320
+
312
321
  class VirtualMachine:
313
322
  _obj: c_void_p
314
323
 
@@ -478,7 +487,13 @@ class Sddf:
478
487
 
479
488
  def add_client(self, client: SystemDescription.ProtectionDomain):
480
489
  """Add a new client connection to the serial system."""
481
- libsdfgen.sdfgen_sddf_serial_add_client(self._obj, client._obj)
490
+ ret = libsdfgen.sdfgen_sddf_serial_add_client(self._obj, client._obj)
491
+ if ret == SddfStatus.OK:
492
+ return
493
+ elif ret == SddfStatus.DUPLICATE_CLIENT:
494
+ raise Exception(f"duplicate client given '{client}'")
495
+ else:
496
+ raise Exception(f"internal error: {ret}")
482
497
 
483
498
  def connect(self) -> bool:
484
499
  """
@@ -516,7 +531,13 @@ class Sddf:
516
531
  self._obj = libsdfgen.sdfgen_sddf_i2c(sdf._obj, device_obj, driver._obj, virt._obj)
517
532
 
518
533
  def add_client(self, client: SystemDescription.ProtectionDomain):
519
- libsdfgen.sdfgen_sddf_i2c_add_client(self._obj, client._obj)
534
+ ret = libsdfgen.sdfgen_sddf_i2c_add_client(self._obj, client._obj)
535
+ if ret == SddfStatus.OK:
536
+ return
537
+ elif ret == SddfStatus.DUPLICATE_CLIENT:
538
+ raise Exception(f"duplicate client given '{client}'")
539
+ else:
540
+ raise Exception(f"internal error: {ret}")
520
541
 
521
542
  def connect(self) -> bool:
522
543
  return libsdfgen.sdfgen_sddf_i2c_connect(self._obj)
@@ -546,7 +567,13 @@ class Sddf:
546
567
  self._obj = libsdfgen.sdfgen_sddf_block(sdf._obj, device_obj, driver._obj, virt._obj)
547
568
 
548
569
  def add_client(self, client: SystemDescription.ProtectionDomain, *, partition: int):
549
- libsdfgen.sdfgen_sddf_block_add_client(self._obj, client._obj, partition)
570
+ ret = libsdfgen.sdfgen_sddf_block_add_client(self._obj, client._obj, partition)
571
+ if ret == SddfStatus.OK:
572
+ return
573
+ elif ret == SddfStatus.DUPLICATE_CLIENT:
574
+ raise Exception(f"duplicate client given '{client}'")
575
+ else:
576
+ raise Exception(f"internal error: {ret}")
550
577
 
551
578
  def connect(self) -> bool:
552
579
  return libsdfgen.sdfgen_sddf_block_connect(self._obj)
@@ -600,16 +627,16 @@ class Sddf:
600
627
  ret = libsdfgen.sdfgen_sddf_net_add_client_with_copier(
601
628
  self._obj, client._obj, copier._obj, c_mac_addr
602
629
  )
603
- if ret == 0:
630
+ if ret == SddfStatus.OK:
604
631
  return
605
- elif ret == 1:
606
- raise Exception(f"duplicate MAC address given '{mac_addr}'")
607
- elif ret == 2:
632
+ elif ret == SddfStatus.DUPLICATE_CLIENT:
608
633
  raise Exception(f"duplicate client given '{client}'")
609
- elif ret == 3:
634
+ elif ret == SddfStatus.NET_DUPLICATE_COPIER:
610
635
  raise Exception(f"duplicate copier given '{copier}'")
636
+ elif ret == SddfStatus.NET_DUPLICATE_MAC_ADDR:
637
+ raise Exception(f"duplicate MAC address given '{mac_addr}'")
611
638
  else:
612
- raise Exception("internal error")
639
+ raise Exception(f"internal error: {ret}")
613
640
 
614
641
  def connect(self) -> bool:
615
642
  return libsdfgen.sdfgen_sddf_net_connect(self._obj)
@@ -638,7 +665,13 @@ class Sddf:
638
665
  self._obj: c_void_p = libsdfgen.sdfgen_sddf_timer(sdf._obj, device_obj, driver._obj)
639
666
 
640
667
  def add_client(self, client: SystemDescription.ProtectionDomain):
641
- libsdfgen.sdfgen_sddf_timer_add_client(self._obj, client._obj)
668
+ ret = libsdfgen.sdfgen_sddf_timer_add_client(self._obj, client._obj)
669
+ if ret == SddfStatus.OK:
670
+ return
671
+ elif ret == SddfStatus.DUPLICATE_CLIENT:
672
+ raise Exception(f"duplicate client given '{client}'")
673
+ else:
674
+ raise Exception(f"internal error: {ret}")
642
675
 
643
676
  def connect(self) -> bool:
644
677
  return libsdfgen.sdfgen_sddf_timer_connect(self._obj)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sdfgen
3
- Version: 0.9.0
3
+ Version: 0.9.1
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,8 @@
1
+ csdfgen.cpython-312-darwin.so,sha256=RpA5vN6Y-kAqrifji-gJbq8XAoSj3BBAsRe8fvgSx-o,727408
2
+ sdfgen/__init__.py,sha256=qFoYMCiM89s1BduC2hWsDRa3kGhvmJcxJsaHMWLhf1g,131
3
+ sdfgen/module.py,sha256=O_-r_xy2Ff-1esvlMSHzZ3N42fcQeaAROX4Nym9okII,26211
4
+ sdfgen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ sdfgen-0.9.1.dist-info/METADATA,sha256=Ax5YErZgRAJggzlWMo2FB6qqwbA7AZU8lvRqBcJEmAA,6004
6
+ sdfgen-0.9.1.dist-info/WHEEL,sha256=K6Spq1kyvln8vdZf4xAPz20_F-9hz62IhBAuac6sFbY,109
7
+ sdfgen-0.9.1.dist-info/top_level.txt,sha256=M3gUW9vTMij10peQKgv1Qs0jZkdsk_PG0REFxuv6jNY,15
8
+ sdfgen-0.9.1.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- csdfgen.cpython-312-darwin.so,sha256=3ONcjQR2Lsd0bKydltUiS-I5ZZ62-RAvkrV3u32V6J0,727408
2
- sdfgen/__init__.py,sha256=qFoYMCiM89s1BduC2hWsDRa3kGhvmJcxJsaHMWLhf1g,131
3
- sdfgen/module.py,sha256=0DK9UsggaL7dqP-16bh1q-2LJsU-AOzn-bpdVkQg9-I,24807
4
- sdfgen/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- sdfgen-0.9.0.dist-info/METADATA,sha256=MXxKvhmvKBvvrsgBxyNTSvjdAZubk2fUbNZIMJYWzIY,6004
6
- sdfgen-0.9.0.dist-info/WHEEL,sha256=K6Spq1kyvln8vdZf4xAPz20_F-9hz62IhBAuac6sFbY,109
7
- sdfgen-0.9.0.dist-info/top_level.txt,sha256=M3gUW9vTMij10peQKgv1Qs0jZkdsk_PG0REFxuv6jNY,15
8
- sdfgen-0.9.0.dist-info/RECORD,,
File without changes