Skip to content

Commit

Permalink
adding the AxiStreamDmaMon python class
Browse files Browse the repository at this point in the history
  • Loading branch information
ruck314 committed Apr 22, 2024
1 parent a0f44e3 commit d536379
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
103 changes: 103 additions & 0 deletions python/pyrogue/hardware/axi/_AxiStreamDmaMon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#-----------------------------------------------------------------------------
# Company: SLAC National Accelerator Laboratory
#-----------------------------------------------------------------------------
# Description: Module for monitoring the DMA kernel driver
#-----------------------------------------------------------------------------
# This file is part of the rogue software platform. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the rogue software platform, including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------

import pyrogue as pr
import rogue.hardware.axi

class AxiStreamDmaMon(pr.Device):
def __init__(self, axiStreamDma, pollInterval=1, **kwargs):
super(self.__class__, self).__init__(**kwargs)

# Create a pointer to the AXI Stream DMA object
self._dma = axiStreamDma

# Add variables
self.add(pr.LocalVariable(
name = 'BuffSize',
description = 'size of buffers (RX/TX)',
mode = 'RO',
value = 0x0,
typeStr = 'UInt32',
units = 'Bytes',
disp = '{:#x}',
localGet = lambda: self._dma.getBuffSize(),
))

self.add(pr.LocalVariable(
name = 'RxBuffCount',
description = 'Get the number of RX buffers',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getRxBuffCount(),
))

self.add(pr.LocalVariable(
name = 'TxBuffCount',
description = 'Get the number of TX buffers',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffCount(),
))

self.add(pr.LocalVariable(
name = 'TxBuffinUserCount',
description = 'TX buffer in User count',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffinUserCount(),
pollInterval= pollInterval,
))

self.add(pr.LocalVariable(
name = 'TxBuffinHwCount',
description = 'TX buffer in HW count',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffinHwCount(),
pollInterval= pollInterval,
))

self.add(pr.LocalVariable(
name = 'TxBuffinPreHwQCount',
description = 'TX buffer in Pre-HW Queue count',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffinPreHwQCount(),
pollInterval= pollInterval,
))

self.add(pr.LocalVariable(
name = 'TxBuffinSwQCount',
description = 'TX buffer in SW Queue count',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffinSwQCount(),
pollInterval= pollInterval,
))

self.add(pr.LocalVariable(
name = 'getTxBuffMissCount',
description = 'TX buffer missing count',
mode = 'RO',
value = 0,
typeStr = 'UInt32',
localGet = lambda: self._dma.getTxBuffMissCount(),
pollInterval= pollInterval,
))
10 changes: 10 additions & 0 deletions python/pyrogue/hardware/axi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#-----------------------------------------------------------------------------
# This file is part of the rogue software platform. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the rogue software platform, including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
from pyrogue.hardware.axi._AxiStreamDmaMon import *

0 comments on commit d536379

Please sign in to comment.