Skip to content

Python Reference Documentation

Board Driver

Boards Module

This Module contains the Board Driver class which is the entry point to drive the Firmware functionalities.

This module init script contains factory methods to create a Board Driver instance based on the target configuration.

For Example:

  • getGeccoUARTDriver() returns a Driver configured for the Gecco Target connected via UART
  • getGeccoNODriver() returns a Board Driver without I/O, or a dummy IO layer - useful to test scripts without a Hardware connected

BoardDriver

Source code in drivers/boards/board_driver.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
class BoardDriver():

    def __init__(self,rfg):
        self.rfg = rfg
        self.houseKeeping = drivers.astep.housekeeping.Housekeeping(self,rfg)
        self.asics = []

        # Synchronisation Utils
        ########

        ## Opened Event -> Set/unset by close/open
        ## Useful to start or stop tasks dependent on open/close state of the driver
        self.openedEvent = asyncio.Event()

    def selectUARTIO(self,portPath : str | None = None ):
        """This method is common to all targets now, because all targets have a USB-UART Converter available"""
        if (portPath == None):
            import drivers.astep.serial
            port = drivers.astep.serial.selectFirstLinuxFTDIPort()
            if port:
                self.rfg.withUARTIO(port.device)
                return self
            else:
                raise RuntimeError("No Serial Port could be listed")
        else:
            self.rfg.withUARTIO(portPath)
            return self


    async def open(self):
        """Open the Register File I/O Connection to the underlying driver"""
        await self.rfg.io.open()
        self.openedEvent.set()

    async def close(self):
        """Close the Register File I/O Connection to the underlying driver"""
        self.openedEvent.clear()
        await self.rfg.io.close()

    async def waitOpened(self):
        await self.openedEvent.wait()

    def isOpened(self) -> bool: 
        return self.openedEvent.is_set()

    def debug_full(self):
        rfg.core.debug()

    def flush(self):
        """Flushed the RFG instance, use to be sure no bytes are pending writting"""
        self.rfg.flush()

    async def readFirmwareVersion(self):
        """Returns the raw integer with the firmware Version"""
        return (await (self.rfg.read_hk_firmware_version()))

    async def readFirmwareID(self):
        """Returns the raw integer with the firmware id"""
        return await (self.rfg.read_hk_firmware_id())

    async def readFirmwareIDName(self):
        """"""
        boards  =  {0xab02: 'Nexys GECCO Astropix v2',0xab03: 'Nexys GECCO Astropix v3',0xac03:"CMOD Astropix v3"}
        boardID =  await (self.readFirmwareID())
        return boards.get(boardID,"Firmware ID unknown: {0}".format(hex(boardID)))

    async def checkFirmwareVersionAfter(self,v):
        return await (self.readFirmwareVersion()) >= v

    def getFPGACoreFrequency(self):
        """Returns the Core Clock frequency to help clock divider configuration - this method is overriden by implementation class (Gecco or Cmod)"""
        pass

    ## Gecco
    ###############
    def geccoGetVoltageBoard(self):
        return self.getVoltageBoard(slot = 4 )
    def geccoGetInjectionBoard(self):
        return self.getInjectionBoard(slot = 3 )

    ## Loopback Model
    ################
    def getLoopbackModelForLayer(self,layer):
        return Astropix3LBModel(self,layer)

    ## Chips
    ################
    async def setupASICSAuto(self, configFile : str ):

        #assert version >=2 and version < 4 , "Only Astropix 2 and 3 Supported"
        self.asics.clear()
        asic = Asic(rfg = self.rfg, row = 0)
        asic.chipversion = (await self.readFirmwareID()) & 0x0F
        print(configFile)
        self.asics.append(asic)

        return asic

    def setupASICS(self, version : int , rows: int = 1 , chipsPerRow:int = 1 , configFile : str | None = None):
        assert version >=2 and version < 4 , "Only Astropix 2 and 3 Supported"
        if version == 2: 
            self.geccoGetVoltageBoard().dacvalues =  (8, [0, 0, 1.1, 1, 0, 0, 1, 1.100])

        for i in range(rows):
            asic = Asic(rfg = self.rfg, row = i)
            asic.chipversion = version
            self.asics.append(asic)
            asic.num_chips = chipsPerRow

            if configFile is not None: 
                asic.load_conf_from_yaml(configFile)

    def getAsic(self,row = 0 ): 
        """Returns the Asic Model for the Given Row - Other chips in the Daisy Chain are handeled by the returned 'front' model"""
        return self.asics[row]

    async def enableSensorClocks(self,flush:bool = False):
        """Writes the I/O Control register to enable both Timestamp and Sample clock outputs"""
        await self.ioSetSampleClock(enable=True, flush=flush)
        await self.ioSetTimestampClock( enable=True, flush=flush)

    async def getIOControlRegister(self):
        return await self.rfg.read_io_ctrl()

    async def ioSetSampleClock(self,enable:bool,flush:bool = False):
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x1 
        else: v &= ~(0x1)
        await self.rfg.write_io_ctrl(v,flush) 

    async def ioSetTimestampClock(self,enable:bool,flush:bool = False):
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x2 
        else: v &= ~(0x2)
        await self.rfg.write_io_ctrl(v,flush) 

    async def ioSetSampleClockSingleEnded(self,enable:bool,flush:bool = False):
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x4 
        else: v &= ~(0x4)
        await self.rfg.write_io_ctrl(v,flush) 

    async def ioSetInjectionToGeccoInjBoard(self,enable:bool,flush:bool = False):
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x8 
        else: v &= ~(0x8)
        await self.rfg.write_io_ctrl(v,flush) 


    async def ioSetFPGAExternalTSClockDifferential(self,enable:bool,flush:bool = False):
        """If an external clock input is used for the FPGA TS counter, it is differential or not"""
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x10 
        else: v &= ~(0x10)
        await self.rfg.write_io_ctrl(v,flush)

    async def ioSetAstropixTSToFPGATS(self,enable:bool,flush:bool = False):
        """The Astropix TS clock can be sourced from the external FPGA TS clock (it true) or from the internal TS clock (if false)"""
        v = await self.rfg.read_io_ctrl()
        if enable: v|=0x20 
        else: v &= ~(0x20)
        await self.rfg.write_io_ctrl(v,flush) 

    ## Layers
    ##################
    async def configureLayersFrameTag(self,enable, flush = False):
        await self.rfg.write_layers_cfg_frame_tag_counter_ctrl(1 if enable is True else 0,flush)

    async def configureLayersFrameTagFrequency(self, targetFrequencyHz : int , flush = False):
        """Calculated required divider to reach the provided target SPI clock frequency"""
        coreFrequency = self.getFPGACoreFrequency()
        divider = int( coreFrequency / ( targetFrequencyHz))
        assert divider >=1 and divider <=255 , (f"Divider {divider} is too high, min. clock frequency: {int(coreFrequency/255)}")
        await self.configureLayersFrameTagDivider(divider,flush)

    async def configureLayersFrameTagDivider(self, divider , flush = False):
        await self.rfg.write_layers_cfg_frame_tag_counter_trigger_match(divider,False)
        await self.rfg.write_layers_cfg_frame_tag_counter_trigger(0,flush)

    async def configureLayerSPIFrequency(self, targetFrequencyHz : int , flush = False):
        """Calculated required divider to reach the provided target SPI clock frequency"""
        coreFrequency = self.getFPGACoreFrequency()
        divider = int( coreFrequency / (2 * targetFrequencyHz))
        assert divider >=1 and divider <=255 , (f"Divider {divider} is too high, min. clock frequency: {int(coreFrequency/2/255)}")
        await self.configureLayerSPIDivider(divider,flush)

    async def configureLayerSPIDivider(self, divider:int , flush = False):
        await self.rfg.write_spi_layers_ckdivider(divider,flush)


    async def layerSelectSPI(self, layer , cs : bool, flush = False):
        """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
        it's a helper to be used only if the hardware uses a shared Chip Select!!
        If any Layer is in autoread mode, chip select will be already asserted
        """
        layerCfg = await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()
        layerCfg = (layerCfg | (1 << 3)) if cs else (layerCfg & ~(1 << 3))
        await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(layerCfg,flush)


    async def layersSetSPICSN(self, cs = False, flush = False):
        """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
        it's a helper to be used only if the hardware uses a shared Chip Select!!
        If any Layer is in autoread mode, chip select will be already asserted
        """
        layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
        if cs:
            layer0Cfg = layer0Cfg | (1 << 3)
        else:
            layer0Cfg = layer0Cfg & ~(1 << 3)

        await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)

    async def layersSelectSPI(self, flush = False):
        """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
        it's a helper to be used only if the hardware uses a shared Chip Select!!
        If any Layer is in autoread mode, chip select will be already asserted
        """
        layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
        layer0Cfg = layer0Cfg | (1 << 3)
        await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)

    async def layersDeselectSPI(self, flush = False):
        """This helper method deasserts the shared CSN to 1 by deselecting CS on layer 0
        it's a helper to be used only if the hardware uses a shared Chip Select!!
        If any Layer is in autoread mode, chip select will stay asserted
        """
        layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
        layer0Cfg = layer0Cfg & ~(1 << 3)
        await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)


    async def resetLayer(self, layer : int , waitTime : float = 0.5 ):
        """Sets Layer in Reset then Remove reset after a wait time. The registers are written right now.

        Args:
            waitTime (float):  Reset duration - Default 0.5s
        """
        await self.setLayerReset(layer = layer, reset = True , flush = True )
        await asyncio.sleep(waitTime)
        await self.setLayerReset(layer = layer, reset = False , flush = True )

    @deprecated("Please use clearer setLayerConfig method")
    async def setLayerReset(self,layer:int, reset : bool, disable_autoread : bool  = True, modify : bool = False, flush = False):
        """Asserts/Deasserts the Reset output for the given layer

        Args:
            disable_autoread (int): By default 1, disables the automatic layer readout upon interruptn=0 condition
            modify (bool): Reads the Control register first and only change the required bits
            flush (bool): Write the register right away

        """
        regval = 0xff if reset is True else 0x00
        if modify is True:
            regval =  await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()

        if reset is True:
            regval |= (1<<1)
        else:
            regval &= ~(1<<1)

        if disable_autoread is True:
            regval |= (1<<2)
        else:
            regval &= ~(1<<2)

        #if not reset: 
        #    regval = regval | ( disable_autoread << 2 )
        await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(regval,flush)

    async def setLayerConfig(self,layer:int, reset : bool, autoread : bool, hold:bool , chipSelect:bool = False,disableMISO:bool = False, flush = False):
        """Modified the layer config with provided bools

        Args:
            autoread (bool): Enables or Disables interrupt-based automatic reading
            reset (bool): Assert/deassert reset I/O to ASIC
            hold (bool): Assert/deassert hold I/O to ASIC
            chipSelect (bool): Assert/deassert Chip Select for this layer (I/O is inverted in firmware to produce low-active signal)
            disableMISO (bool): Disable SPI MISO bytes reading. Setting this bit to 1 prevents the Firmware from reading bytes
            flush (bool): Write the register right away

        """
        regval =  await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()

        if reset is True:
            regval |= (1<<1)
        else:
            regval &= ~(1<<1)

        if hold is True:
            regval |= 1 
        else: 
            regval &= 0XFE

        # Autoread is "disable" in config, so True here means False in the register
        if autoread is False:
            regval |= (1<<2)
        else:
            regval &= ~(1<<2)

        if chipSelect is True:
            regval |= (1<<3)
        else:
            regval &= ~(1<<3)

        if disableMISO is True:
            regval |= (1<<4)
        else:
            regval &= ~(1<<4)

        await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(regval,flush)

    async def holdLayer(self,layer:int,hold:bool = True,flush:bool = False):
        """Asserts/Deasserts the hold signal for the given layer - This method reads the ctrl register and modifies it"""
        ctrl = await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()
        if hold:
            ctrl |= 1 
        else: 
            ctrl &= 0XFE
        await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(ctrl,flush=flush) 


    async def writeLayerBytes(self,layer : int , bytes: bytearray,flush:bool = False):
        await getattr(self.rfg, f"write_layer_{layer}_mosi_bytes")(bytes,flush)

    async def writeBytesToLayer(self,layer : int , bytes: bytearray,waitBytesSend : bool = False, flush:bool = False):
        await getattr(self.rfg, f"write_layer_{layer}_mosi_bytes")(bytes,flush)
        if waitBytesSend is True:
            await self.assertLayerNotInReset(layer)
            while (await getattr(self.rfg, f"read_layer_{layer}_mosi_write_size")() > 0):
                pass

    async def getLayerMOSIBytesCount(self,layer:int):
        return await getattr(self.rfg,f"read_layer_{layer}_mosi_write_size")()

    async def getLayerStatIDLECounter(self,layer:int):
        return await getattr(self.rfg, f"read_layer_{layer}_stat_idle_counter")()

    async def getLayerStatFRAMECounter(self,layer:int):
        return await getattr(self.rfg, f"read_layer_{layer}_stat_frame_counter")()

    async def getLayerStatus(self,layer:int):
        return await getattr(self.rfg, f"read_layer_{layer}_status")()

    async def getLayerControl(self,layer:int):
        return await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()

    async def assertLayerNotInReset(self,layer:int):
        ctrlReg = await self.getLayerControl(layer)
        if ((ctrlReg >> 1) & 0x1) == 1:
            raise Exception(f"Layer {layer} is in reset, user requests it is not")

    async def resetLayerStatCounters(self,layer:int,flush:bool = True):
        await getattr(self.rfg, f"write_layer_{layer}_stat_frame_counter")(0,False)
        await getattr(self.rfg, f"write_layer_{layer}_stat_idle_counter")(0,flush)

    async def getLayerMISOBytesCount(self,layer:int):
        """Returns the number of bytes in the Slave Out Bytes Buffer"""
        return await getattr(self.rfg, f"read_layer_{layer}_mosi_write_size")()


    ## Readout
    ################
    async def readoutGetBufferSize(self):
        """Returns the actual size of buffer"""
        return await self.rfg.read_layers_readout_read_size()

    async def readoutReadBytes(self,count : int):
        ## Using the _raw version returns an array of bytes, while the normal method converts to int based on the number of bytes
        return  await self.rfg.read_layers_readout_raw(count = count) if count > 0 else  []


    ## FPGA Timestamp config
    ############

    async def layersConfigFPGATimestamp(self,enable:bool,force : bool,source_match_counter:bool,source_external:bool,flush:bool = False):
        """Configure the FPGA Timestamp to count from the internal match counter, the external TS input or force at each clock cycle"""
        assert not (source_match_counter is True and source_external is True) , "Don't configure FPGA TS to both count from internal match counter or the external clock"
        regVal = 0
        regVal |= 0x0 if enable is False else 0x1
        regVal |= 0x0 if source_match_counter is False else 0x2
        regVal |= 0x0 if source_external is False else 0x4
        regVal |= 0x0 if force is False else 0x8
        await self.rfg.write_layers_cfg_frame_tag_counter_ctrl(regVal,flush)

    async def layersConfigFPGATimestampFrequency(self,targetFrequencyHz:int,flush:bool = False):
        """Configure the internal matching counter to trigger an FPGA Timestmap count with a certain frequency"""
        coreFrequency = self.getFPGACoreFrequency()
        divider = int( coreFrequency / (targetFrequencyHz))
        assert divider >=1 and divider < pow(2,32) , (f"Target Freq is too slow, Divider {divider} is too high, min. clock frequency: {int(coreFrequency/pow(2,32))}")
        await self.rfg.write_layers_cfg_frame_tag_counter_trigger_match(divider,flush)

close() async

Close the Register File I/O Connection to the underlying driver

Source code in drivers/boards/board_driver.py
47
48
49
50
async def close(self):
    """Close the Register File I/O Connection to the underlying driver"""
    self.openedEvent.clear()
    await self.rfg.io.close()

configureLayerSPIFrequency(targetFrequencyHz, flush=False) async

Calculated required divider to reach the provided target SPI clock frequency

Source code in drivers/boards/board_driver.py
192
193
194
195
196
197
async def configureLayerSPIFrequency(self, targetFrequencyHz : int , flush = False):
    """Calculated required divider to reach the provided target SPI clock frequency"""
    coreFrequency = self.getFPGACoreFrequency()
    divider = int( coreFrequency / (2 * targetFrequencyHz))
    assert divider >=1 and divider <=255 , (f"Divider {divider} is too high, min. clock frequency: {int(coreFrequency/2/255)}")
    await self.configureLayerSPIDivider(divider,flush)

configureLayersFrameTagFrequency(targetFrequencyHz, flush=False) async

Calculated required divider to reach the provided target SPI clock frequency

Source code in drivers/boards/board_driver.py
181
182
183
184
185
186
async def configureLayersFrameTagFrequency(self, targetFrequencyHz : int , flush = False):
    """Calculated required divider to reach the provided target SPI clock frequency"""
    coreFrequency = self.getFPGACoreFrequency()
    divider = int( coreFrequency / ( targetFrequencyHz))
    assert divider >=1 and divider <=255 , (f"Divider {divider} is too high, min. clock frequency: {int(coreFrequency/255)}")
    await self.configureLayersFrameTagDivider(divider,flush)

enableSensorClocks(flush=False) async

Writes the I/O Control register to enable both Timestamp and Sample clock outputs

Source code in drivers/boards/board_driver.py
129
130
131
132
async def enableSensorClocks(self,flush:bool = False):
    """Writes the I/O Control register to enable both Timestamp and Sample clock outputs"""
    await self.ioSetSampleClock(enable=True, flush=flush)
    await self.ioSetTimestampClock( enable=True, flush=flush)

flush()

Flushed the RFG instance, use to be sure no bytes are pending writting

Source code in drivers/boards/board_driver.py
61
62
63
def flush(self):
    """Flushed the RFG instance, use to be sure no bytes are pending writting"""
    self.rfg.flush()

getAsic(row=0)

Returns the Asic Model for the Given Row - Other chips in the Daisy Chain are handeled by the returned 'front' model

Source code in drivers/boards/board_driver.py
125
126
127
def getAsic(self,row = 0 ): 
    """Returns the Asic Model for the Given Row - Other chips in the Daisy Chain are handeled by the returned 'front' model"""
    return self.asics[row]

getFPGACoreFrequency()

Returns the Core Clock frequency to help clock divider configuration - this method is overriden by implementation class (Gecco or Cmod)

Source code in drivers/boards/board_driver.py
82
83
84
def getFPGACoreFrequency(self):
    """Returns the Core Clock frequency to help clock divider configuration - this method is overriden by implementation class (Gecco or Cmod)"""
    pass

getLayerMISOBytesCount(layer) async

Returns the number of bytes in the Slave Out Bytes Buffer

Source code in drivers/boards/board_driver.py
369
370
371
async def getLayerMISOBytesCount(self,layer:int):
    """Returns the number of bytes in the Slave Out Bytes Buffer"""
    return await getattr(self.rfg, f"read_layer_{layer}_mosi_write_size")()

holdLayer(layer, hold=True, flush=False) async

Asserts/Deasserts the hold signal for the given layer - This method reads the ctrl register and modifies it

Source code in drivers/boards/board_driver.py
325
326
327
328
329
330
331
332
async def holdLayer(self,layer:int,hold:bool = True,flush:bool = False):
    """Asserts/Deasserts the hold signal for the given layer - This method reads the ctrl register and modifies it"""
    ctrl = await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()
    if hold:
        ctrl |= 1 
    else: 
        ctrl &= 0XFE
    await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(ctrl,flush=flush) 

ioSetAstropixTSToFPGATS(enable, flush=False) async

The Astropix TS clock can be sourced from the external FPGA TS clock (it true) or from the internal TS clock (if false)

Source code in drivers/boards/board_driver.py
169
170
171
172
173
174
async def ioSetAstropixTSToFPGATS(self,enable:bool,flush:bool = False):
    """The Astropix TS clock can be sourced from the external FPGA TS clock (it true) or from the internal TS clock (if false)"""
    v = await self.rfg.read_io_ctrl()
    if enable: v|=0x20 
    else: v &= ~(0x20)
    await self.rfg.write_io_ctrl(v,flush) 

ioSetFPGAExternalTSClockDifferential(enable, flush=False) async

If an external clock input is used for the FPGA TS counter, it is differential or not

Source code in drivers/boards/board_driver.py
162
163
164
165
166
167
async def ioSetFPGAExternalTSClockDifferential(self,enable:bool,flush:bool = False):
    """If an external clock input is used for the FPGA TS counter, it is differential or not"""
    v = await self.rfg.read_io_ctrl()
    if enable: v|=0x10 
    else: v &= ~(0x10)
    await self.rfg.write_io_ctrl(v,flush)

layerSelectSPI(layer, cs, flush=False) async

This helper method asserts the shared CSN to 0 by selecting CS on layer 0 it's a helper to be used only if the hardware uses a shared Chip Select!! If any Layer is in autoread mode, chip select will be already asserted

Source code in drivers/boards/board_driver.py
203
204
205
206
207
208
209
210
async def layerSelectSPI(self, layer , cs : bool, flush = False):
    """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
    it's a helper to be used only if the hardware uses a shared Chip Select!!
    If any Layer is in autoread mode, chip select will be already asserted
    """
    layerCfg = await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()
    layerCfg = (layerCfg | (1 << 3)) if cs else (layerCfg & ~(1 << 3))
    await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(layerCfg,flush)

layersConfigFPGATimestamp(enable, force, source_match_counter, source_external, flush=False) async

Configure the FPGA Timestamp to count from the internal match counter, the external TS input or force at each clock cycle

Source code in drivers/boards/board_driver.py
388
389
390
391
392
393
394
395
396
async def layersConfigFPGATimestamp(self,enable:bool,force : bool,source_match_counter:bool,source_external:bool,flush:bool = False):
    """Configure the FPGA Timestamp to count from the internal match counter, the external TS input or force at each clock cycle"""
    assert not (source_match_counter is True and source_external is True) , "Don't configure FPGA TS to both count from internal match counter or the external clock"
    regVal = 0
    regVal |= 0x0 if enable is False else 0x1
    regVal |= 0x0 if source_match_counter is False else 0x2
    regVal |= 0x0 if source_external is False else 0x4
    regVal |= 0x0 if force is False else 0x8
    await self.rfg.write_layers_cfg_frame_tag_counter_ctrl(regVal,flush)

layersConfigFPGATimestampFrequency(targetFrequencyHz, flush=False) async

Configure the internal matching counter to trigger an FPGA Timestmap count with a certain frequency

Source code in drivers/boards/board_driver.py
398
399
400
401
402
403
async def layersConfigFPGATimestampFrequency(self,targetFrequencyHz:int,flush:bool = False):
    """Configure the internal matching counter to trigger an FPGA Timestmap count with a certain frequency"""
    coreFrequency = self.getFPGACoreFrequency()
    divider = int( coreFrequency / (targetFrequencyHz))
    assert divider >=1 and divider < pow(2,32) , (f"Target Freq is too slow, Divider {divider} is too high, min. clock frequency: {int(coreFrequency/pow(2,32))}")
    await self.rfg.write_layers_cfg_frame_tag_counter_trigger_match(divider,flush)

layersDeselectSPI(flush=False) async

This helper method deasserts the shared CSN to 1 by deselecting CS on layer 0 it's a helper to be used only if the hardware uses a shared Chip Select!! If any Layer is in autoread mode, chip select will stay asserted

Source code in drivers/boards/board_driver.py
235
236
237
238
239
240
241
242
async def layersDeselectSPI(self, flush = False):
    """This helper method deasserts the shared CSN to 1 by deselecting CS on layer 0
    it's a helper to be used only if the hardware uses a shared Chip Select!!
    If any Layer is in autoread mode, chip select will stay asserted
    """
    layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
    layer0Cfg = layer0Cfg & ~(1 << 3)
    await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)

layersSelectSPI(flush=False) async

This helper method asserts the shared CSN to 0 by selecting CS on layer 0 it's a helper to be used only if the hardware uses a shared Chip Select!! If any Layer is in autoread mode, chip select will be already asserted

Source code in drivers/boards/board_driver.py
226
227
228
229
230
231
232
233
async def layersSelectSPI(self, flush = False):
    """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
    it's a helper to be used only if the hardware uses a shared Chip Select!!
    If any Layer is in autoread mode, chip select will be already asserted
    """
    layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
    layer0Cfg = layer0Cfg | (1 << 3)
    await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)

layersSetSPICSN(cs=False, flush=False) async

This helper method asserts the shared CSN to 0 by selecting CS on layer 0 it's a helper to be used only if the hardware uses a shared Chip Select!! If any Layer is in autoread mode, chip select will be already asserted

Source code in drivers/boards/board_driver.py
213
214
215
216
217
218
219
220
221
222
223
224
async def layersSetSPICSN(self, cs = False, flush = False):
    """This helper method asserts the shared CSN to 0 by selecting CS on layer 0
    it's a helper to be used only if the hardware uses a shared Chip Select!!
    If any Layer is in autoread mode, chip select will be already asserted
    """
    layer0Cfg = await self.rfg.read_layer_0_cfg_ctrl()
    if cs:
        layer0Cfg = layer0Cfg | (1 << 3)
    else:
        layer0Cfg = layer0Cfg & ~(1 << 3)

    await self.rfg.write_layer_0_cfg_ctrl(layer0Cfg,flush)

open() async

Open the Register File I/O Connection to the underlying driver

Source code in drivers/boards/board_driver.py
42
43
44
45
async def open(self):
    """Open the Register File I/O Connection to the underlying driver"""
    await self.rfg.io.open()
    self.openedEvent.set()

readFirmwareID() async

Returns the raw integer with the firmware id

Source code in drivers/boards/board_driver.py
69
70
71
async def readFirmwareID(self):
    """Returns the raw integer with the firmware id"""
    return await (self.rfg.read_hk_firmware_id())

readFirmwareIDName() async

Source code in drivers/boards/board_driver.py
73
74
75
76
77
async def readFirmwareIDName(self):
    """"""
    boards  =  {0xab02: 'Nexys GECCO Astropix v2',0xab03: 'Nexys GECCO Astropix v3',0xac03:"CMOD Astropix v3"}
    boardID =  await (self.readFirmwareID())
    return boards.get(boardID,"Firmware ID unknown: {0}".format(hex(boardID)))

readFirmwareVersion() async

Returns the raw integer with the firmware Version

Source code in drivers/boards/board_driver.py
65
66
67
async def readFirmwareVersion(self):
    """Returns the raw integer with the firmware Version"""
    return (await (self.rfg.read_hk_firmware_version()))

readoutGetBufferSize() async

Returns the actual size of buffer

Source code in drivers/boards/board_driver.py
376
377
378
async def readoutGetBufferSize(self):
    """Returns the actual size of buffer"""
    return await self.rfg.read_layers_readout_read_size()

resetLayer(layer, waitTime=0.5) async

Sets Layer in Reset then Remove reset after a wait time. The registers are written right now.

Parameters:

Name Type Description Default
waitTime float

Reset duration - Default 0.5s

0.5
Source code in drivers/boards/board_driver.py
245
246
247
248
249
250
251
252
253
async def resetLayer(self, layer : int , waitTime : float = 0.5 ):
    """Sets Layer in Reset then Remove reset after a wait time. The registers are written right now.

    Args:
        waitTime (float):  Reset duration - Default 0.5s
    """
    await self.setLayerReset(layer = layer, reset = True , flush = True )
    await asyncio.sleep(waitTime)
    await self.setLayerReset(layer = layer, reset = False , flush = True )

selectUARTIO(portPath=None)

This method is common to all targets now, because all targets have a USB-UART Converter available

Source code in drivers/boards/board_driver.py
27
28
29
30
31
32
33
34
35
36
37
38
39
def selectUARTIO(self,portPath : str | None = None ):
    """This method is common to all targets now, because all targets have a USB-UART Converter available"""
    if (portPath == None):
        import drivers.astep.serial
        port = drivers.astep.serial.selectFirstLinuxFTDIPort()
        if port:
            self.rfg.withUARTIO(port.device)
            return self
        else:
            raise RuntimeError("No Serial Port could be listed")
    else:
        self.rfg.withUARTIO(portPath)
        return self

setLayerConfig(layer, reset, autoread, hold, chipSelect=False, disableMISO=False, flush=False) async

Modified the layer config with provided bools

Parameters:

Name Type Description Default
autoread bool

Enables or Disables interrupt-based automatic reading

required
reset bool

Assert/deassert reset I/O to ASIC

required
hold bool

Assert/deassert hold I/O to ASIC

required
chipSelect bool

Assert/deassert Chip Select for this layer (I/O is inverted in firmware to produce low-active signal)

False
disableMISO bool

Disable SPI MISO bytes reading. Setting this bit to 1 prevents the Firmware from reading bytes

False
flush bool

Write the register right away

False
Source code in drivers/boards/board_driver.py
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
async def setLayerConfig(self,layer:int, reset : bool, autoread : bool, hold:bool , chipSelect:bool = False,disableMISO:bool = False, flush = False):
    """Modified the layer config with provided bools

    Args:
        autoread (bool): Enables or Disables interrupt-based automatic reading
        reset (bool): Assert/deassert reset I/O to ASIC
        hold (bool): Assert/deassert hold I/O to ASIC
        chipSelect (bool): Assert/deassert Chip Select for this layer (I/O is inverted in firmware to produce low-active signal)
        disableMISO (bool): Disable SPI MISO bytes reading. Setting this bit to 1 prevents the Firmware from reading bytes
        flush (bool): Write the register right away

    """
    regval =  await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()

    if reset is True:
        regval |= (1<<1)
    else:
        regval &= ~(1<<1)

    if hold is True:
        regval |= 1 
    else: 
        regval &= 0XFE

    # Autoread is "disable" in config, so True here means False in the register
    if autoread is False:
        regval |= (1<<2)
    else:
        regval &= ~(1<<2)

    if chipSelect is True:
        regval |= (1<<3)
    else:
        regval &= ~(1<<3)

    if disableMISO is True:
        regval |= (1<<4)
    else:
        regval &= ~(1<<4)

    await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(regval,flush)

setLayerReset(layer, reset, disable_autoread=True, modify=False, flush=False) async

Asserts/Deasserts the Reset output for the given layer

Parameters:

Name Type Description Default
disable_autoread int

By default 1, disables the automatic layer readout upon interruptn=0 condition

True
modify bool

Reads the Control register first and only change the required bits

False
flush bool

Write the register right away

False
Source code in drivers/boards/board_driver.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
@deprecated("Please use clearer setLayerConfig method")
async def setLayerReset(self,layer:int, reset : bool, disable_autoread : bool  = True, modify : bool = False, flush = False):
    """Asserts/Deasserts the Reset output for the given layer

    Args:
        disable_autoread (int): By default 1, disables the automatic layer readout upon interruptn=0 condition
        modify (bool): Reads the Control register first and only change the required bits
        flush (bool): Write the register right away

    """
    regval = 0xff if reset is True else 0x00
    if modify is True:
        regval =  await getattr(self.rfg, f"read_layer_{layer}_cfg_ctrl")()

    if reset is True:
        regval |= (1<<1)
    else:
        regval &= ~(1<<1)

    if disable_autoread is True:
        regval |= (1<<2)
    else:
        regval &= ~(1<<2)

    #if not reset: 
    #    regval = regval | ( disable_autoread << 2 )
    await getattr(self.rfg, f"write_layer_{layer}_cfg_ctrl")(regval,flush)

Register File

Bases: AbstractRFG

Register File Entry Point Class

Source code in fsp/astep24_3l_top/__init__.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
class main_rfg(AbstractRFG):
    """Register File Entry Point Class"""


    class Registers(RFGRegister):
        HK_FIRMWARE_ID = 0x0
        HK_FIRMWARE_VERSION = 0x4
        HK_XADC_TEMPERATURE = 0x8
        HK_XADC_VCCINT = 0xa
        HK_CONVERSION_TRIGGER = 0xc
        HK_STAT_CONVERSIONS_COUNTER = 0x10
        HK_CTRL = 0x14
        HK_ADCDAC_MOSI_FIFO = 0x15
        HK_ADC_MISO_FIFO = 0x16
        HK_ADC_MISO_FIFO_READ_SIZE = 0x17
        SPI_LAYERS_CKDIVIDER = 0x1b
        SPI_HK_CKDIVIDER = 0x1c
        LAYER_0_CFG_CTRL = 0x1d
        LAYER_1_CFG_CTRL = 0x1e
        LAYER_2_CFG_CTRL = 0x1f
        LAYER_0_STATUS = 0x20
        LAYER_1_STATUS = 0x21
        LAYER_2_STATUS = 0x22
        LAYER_0_STAT_FRAME_COUNTER = 0x23
        LAYER_1_STAT_FRAME_COUNTER = 0x27
        LAYER_2_STAT_FRAME_COUNTER = 0x2b
        LAYER_0_STAT_IDLE_COUNTER = 0x2f
        LAYER_1_STAT_IDLE_COUNTER = 0x33
        LAYER_2_STAT_IDLE_COUNTER = 0x37
        LAYER_0_MOSI = 0x3b
        LAYER_0_MOSI_WRITE_SIZE = 0x3c
        LAYER_1_MOSI = 0x40
        LAYER_1_MOSI_WRITE_SIZE = 0x41
        LAYER_2_MOSI = 0x45
        LAYER_2_MOSI_WRITE_SIZE = 0x46
        LAYER_0_LOOPBACK_MISO = 0x4a
        LAYER_0_LOOPBACK_MISO_WRITE_SIZE = 0x4b
        LAYER_1_LOOPBACK_MISO = 0x4f
        LAYER_1_LOOPBACK_MISO_WRITE_SIZE = 0x50
        LAYER_2_LOOPBACK_MISO = 0x54
        LAYER_2_LOOPBACK_MISO_WRITE_SIZE = 0x55
        LAYER_0_LOOPBACK_MOSI = 0x59
        LAYER_0_LOOPBACK_MOSI_READ_SIZE = 0x5a
        LAYER_1_LOOPBACK_MOSI = 0x5e
        LAYER_1_LOOPBACK_MOSI_READ_SIZE = 0x5f
        LAYER_2_LOOPBACK_MOSI = 0x63
        LAYER_2_LOOPBACK_MOSI_READ_SIZE = 0x64
        LAYERS_CFG_FRAME_TAG_COUNTER_CTRL = 0x68
        LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER = 0x69
        LAYERS_CFG_FRAME_TAG_COUNTER = 0x6d
        LAYERS_CFG_NODATA_CONTINUE = 0x71
        LAYERS_SR_OUT = 0x72
        LAYERS_SR_IN = 0x73
        LAYERS_INJ_CTRL = 0x74
        LAYERS_INJ_WADDR = 0x75
        LAYERS_INJ_WDATA = 0x76
        LAYERS_READOUT = 0x77
        LAYERS_READOUT_READ_SIZE = 0x78
        IO_CTRL = 0x7c
        IO_LED = 0x7d
        GECCO_SR_CTRL = 0x7e
        HK_CONVERSION_TRIGGER_MATCH = 0x7f
        LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER_MATCH = 0x83



    def __init__(self):
        super().__init__()


    def hello(self):
        logger.info("Hello World")



    async def read_hk_firmware_id(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_FIRMWARE_ID'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_firmware_id_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_FIRMWARE_ID'],count = count, increment = True)




    async def read_hk_firmware_version(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_FIRMWARE_VERSION'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_firmware_version_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_FIRMWARE_VERSION'],count = count, increment = True)




    async def read_hk_xadc_temperature(self, count : int = 2 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_XADC_TEMPERATURE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_xadc_temperature_raw(self, count : int = 2 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_XADC_TEMPERATURE'],count = count, increment = True)




    async def read_hk_xadc_vccint(self, count : int = 2 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_XADC_VCCINT'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_xadc_vccint_raw(self, count : int = 2 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_XADC_VCCINT'],count = count, increment = True)




    async def write_hk_conversion_trigger(self,value : int,flush = False):
        self.addWrite(register = self.Registers['HK_CONVERSION_TRIGGER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_hk_conversion_trigger(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_CONVERSION_TRIGGER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_conversion_trigger_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_CONVERSION_TRIGGER'],count = count, increment = True)




    async def read_hk_stat_conversions_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_STAT_CONVERSIONS_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_stat_conversions_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_STAT_CONVERSIONS_COUNTER'],count = count, increment = True)




    async def write_hk_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['HK_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_hk_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_hk_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_CTRL'],count = count, increment = False)




    async def write_hk_adcdac_mosi_fifo(self,value : int,flush = False):
        self.addWrite(register = self.Registers['HK_ADCDAC_MOSI_FIFO'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_hk_adcdac_mosi_fifo_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['HK_ADCDAC_MOSI_FIFO'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_hk_adc_miso_fifo(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_ADC_MISO_FIFO'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_hk_adc_miso_fifo_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_ADC_MISO_FIFO'],count = count, increment = False)




    async def read_hk_adc_miso_fifo_read_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_ADC_MISO_FIFO_READ_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_adc_miso_fifo_read_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_ADC_MISO_FIFO_READ_SIZE'],count = count, increment = True)




    async def write_spi_layers_ckdivider(self,value : int,flush = False):
        self.addWrite(register = self.Registers['SPI_LAYERS_CKDIVIDER'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_spi_layers_ckdivider(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['SPI_LAYERS_CKDIVIDER'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_spi_layers_ckdivider_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['SPI_LAYERS_CKDIVIDER'],count = count, increment = False)




    async def write_spi_hk_ckdivider(self,value : int,flush = False):
        self.addWrite(register = self.Registers['SPI_HK_CKDIVIDER'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_spi_hk_ckdivider(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['SPI_HK_CKDIVIDER'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_spi_hk_ckdivider_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['SPI_HK_CKDIVIDER'],count = count, increment = False)




    async def write_layer_0_cfg_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_0_CFG_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layer_0_cfg_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_CFG_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_0_cfg_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_CFG_CTRL'],count = count, increment = False)




    async def write_layer_1_cfg_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_1_CFG_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layer_1_cfg_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_CFG_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_1_cfg_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_CFG_CTRL'],count = count, increment = False)




    async def write_layer_2_cfg_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_2_CFG_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layer_2_cfg_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_CFG_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_2_cfg_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_CFG_CTRL'],count = count, increment = False)




    async def read_layer_0_status(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_STATUS'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_0_status_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_STATUS'],count = count, increment = False)




    async def read_layer_1_status(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_STATUS'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_1_status_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_STATUS'],count = count, increment = False)




    async def read_layer_2_status(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_STATUS'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_2_status_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_STATUS'],count = count, increment = False)




    async def write_layer_0_stat_frame_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_0_STAT_FRAME_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_0_stat_frame_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_STAT_FRAME_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_0_stat_frame_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_STAT_FRAME_COUNTER'],count = count, increment = True)




    async def write_layer_1_stat_frame_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_1_STAT_FRAME_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_1_stat_frame_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_STAT_FRAME_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_1_stat_frame_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_STAT_FRAME_COUNTER'],count = count, increment = True)




    async def write_layer_2_stat_frame_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_2_STAT_FRAME_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_2_stat_frame_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_STAT_FRAME_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_2_stat_frame_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_STAT_FRAME_COUNTER'],count = count, increment = True)




    async def write_layer_0_stat_idle_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_0_STAT_IDLE_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_0_stat_idle_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_STAT_IDLE_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_0_stat_idle_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_STAT_IDLE_COUNTER'],count = count, increment = True)




    async def write_layer_1_stat_idle_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_1_STAT_IDLE_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_1_stat_idle_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_STAT_IDLE_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_1_stat_idle_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_STAT_IDLE_COUNTER'],count = count, increment = True)




    async def write_layer_2_stat_idle_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_2_STAT_IDLE_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layer_2_stat_idle_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_STAT_IDLE_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_2_stat_idle_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_STAT_IDLE_COUNTER'],count = count, increment = True)




    async def write_layer_0_mosi(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_0_MOSI'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_0_mosi_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_0_MOSI'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_0_mosi_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_MOSI_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_0_mosi_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_MOSI_WRITE_SIZE'],count = count, increment = True)




    async def write_layer_1_mosi(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_1_MOSI'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_1_mosi_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_1_MOSI'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_1_mosi_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_MOSI_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_1_mosi_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_MOSI_WRITE_SIZE'],count = count, increment = True)




    async def write_layer_2_mosi(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_2_MOSI'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_2_mosi_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_2_MOSI'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_2_mosi_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_MOSI_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_2_mosi_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_MOSI_WRITE_SIZE'],count = count, increment = True)




    async def write_layer_0_loopback_miso(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_0_LOOPBACK_MISO'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_0_loopback_miso_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_0_LOOPBACK_MISO'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_0_loopback_miso_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_0_loopback_miso_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True)




    async def write_layer_1_loopback_miso(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_1_LOOPBACK_MISO'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_1_loopback_miso_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_1_LOOPBACK_MISO'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_1_loopback_miso_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_1_loopback_miso_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True)




    async def write_layer_2_loopback_miso(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYER_2_LOOPBACK_MISO'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def write_layer_2_loopback_miso_bytes(self,values : bytearray,flush = False):
        for b in values:
            self.addWrite(register = self.Registers['LAYER_2_LOOPBACK_MISO'],value = b,increment = False,valueLength=1)
        if flush == True:
            await self.flush()




    async def read_layer_2_loopback_miso_write_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_2_loopback_miso_write_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MISO_WRITE_SIZE'],count = count, increment = True)




    async def read_layer_0_loopback_mosi(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MOSI'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_0_loopback_mosi_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MOSI'],count = count, increment = False)




    async def read_layer_0_loopback_mosi_read_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_0_loopback_mosi_read_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_0_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True)




    async def read_layer_1_loopback_mosi(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MOSI'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_1_loopback_mosi_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MOSI'],count = count, increment = False)




    async def read_layer_1_loopback_mosi_read_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_1_loopback_mosi_read_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_1_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True)




    async def read_layer_2_loopback_mosi(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MOSI'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layer_2_loopback_mosi_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MOSI'],count = count, increment = False)




    async def read_layer_2_loopback_mosi_read_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layer_2_loopback_mosi_read_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYER_2_LOOPBACK_MOSI_READ_SIZE'],count = count, increment = True)




    async def write_layers_cfg_frame_tag_counter_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_cfg_frame_tag_counter_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_cfg_frame_tag_counter_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_CTRL'],count = count, increment = False)




    async def write_layers_cfg_frame_tag_counter_trigger(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layers_cfg_frame_tag_counter_trigger(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layers_cfg_frame_tag_counter_trigger_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER'],count = count, increment = True)




    async def write_layers_cfg_frame_tag_counter(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layers_cfg_frame_tag_counter(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layers_cfg_frame_tag_counter_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER'],count = count, increment = True)




    async def write_layers_cfg_nodata_continue(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_CFG_NODATA_CONTINUE'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_cfg_nodata_continue(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_CFG_NODATA_CONTINUE'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_cfg_nodata_continue_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_CFG_NODATA_CONTINUE'],count = count, increment = False)




    async def write_layers_sr_out(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_SR_OUT'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_sr_out(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_SR_OUT'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_sr_out_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_SR_OUT'],count = count, increment = False)




    async def write_layers_sr_in(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_SR_IN'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_sr_in(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_SR_IN'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_sr_in_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_SR_IN'],count = count, increment = False)




    async def write_layers_inj_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_INJ_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_inj_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_INJ_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_inj_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_INJ_CTRL'],count = count, increment = False)




    async def write_layers_inj_waddr(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_INJ_WADDR'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_inj_waddr(self, count : int = 0 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_INJ_WADDR'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_inj_waddr_raw(self, count : int = 0 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_INJ_WADDR'],count = count, increment = False)




    async def write_layers_inj_wdata(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_INJ_WDATA'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_layers_inj_wdata(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_INJ_WDATA'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_inj_wdata_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_INJ_WDATA'],count = count, increment = False)




    async def read_layers_readout(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_READOUT'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_layers_readout_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_READOUT'],count = count, increment = False)




    async def read_layers_readout_read_size(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_READOUT_READ_SIZE'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layers_readout_read_size_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_READOUT_READ_SIZE'],count = count, increment = True)




    async def write_io_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['IO_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_io_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['IO_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_io_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['IO_CTRL'],count = count, increment = False)




    async def write_io_led(self,value : int,flush = False):
        self.addWrite(register = self.Registers['IO_LED'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_io_led(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['IO_LED'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_io_led_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['IO_LED'],count = count, increment = False)




    async def write_gecco_sr_ctrl(self,value : int,flush = False):
        self.addWrite(register = self.Registers['GECCO_SR_CTRL'],value = value,increment = False,valueLength=1)
        if flush == True:
            await self.flush()


    async def read_gecco_sr_ctrl(self, count : int = 1 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['GECCO_SR_CTRL'],count = count, increment = False , targetQueue = targetQueue), 'little') 


    async def read_gecco_sr_ctrl_raw(self, count : int = 1 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['GECCO_SR_CTRL'],count = count, increment = False)




    async def write_hk_conversion_trigger_match(self,value : int,flush = False):
        self.addWrite(register = self.Registers['HK_CONVERSION_TRIGGER_MATCH'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_hk_conversion_trigger_match(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['HK_CONVERSION_TRIGGER_MATCH'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_hk_conversion_trigger_match_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['HK_CONVERSION_TRIGGER_MATCH'],count = count, increment = True)




    async def write_layers_cfg_frame_tag_counter_trigger_match(self,value : int,flush = False):
        self.addWrite(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER_MATCH'],value = value,increment = True,valueLength=4)
        if flush == True:
            await self.flush()


    async def read_layers_cfg_frame_tag_counter_trigger_match(self, count : int = 4 , targetQueue: str | None = None) -> int: 
        return  int.from_bytes(await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER_MATCH'],count = count, increment = True , targetQueue = targetQueue), 'little') 


    async def read_layers_cfg_frame_tag_counter_trigger_match_raw(self, count : int = 4 ) -> bytes: 
        return  await self.syncRead(register = self.Registers['LAYERS_CFG_FRAME_TAG_COUNTER_TRIGGER_MATCH'],count = count, increment = True)