##############################################################################
## This file is part of 'SLAC Firmware Standard Library'.
## 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 'SLAC Firmware Standard Library', including this file,
## may be copied, modified, propagated, or distributed except according to
## the terms contained in the LICENSE.txt file.
##############################################################################
#schemaversion 3.0.0

SeqCount: &SeqCount
  class: MMIODev
  description: Sequence event counters
  size: 0x10
  children:
    Count:
      at:
        offset: 0
        stride: 4
        nelms: 4
      class: IntField
      name: Count
      sizeBits: 32
      lsbit: 0
      mode: RO
      description: Single sequence count
      
TPGStatus: &TPGStatus
  class: MMIODev
  description: Timing pattern generator status
  size: 0x1000
  metadata:
    nseq: &nseq 100
  #########
  children:
  #########
    #########################################################
    BsaStatus:
      at:
        offset: 0x0000
        stride: 4
        nelms: 64
      class: IntField
      name: BsaStatus
      sizeBits: 32
      lsbit: 0
      mode: RO
      description: BSA status num averaged/written
    #########################################################
    CountPLL:
      at:
        offset: 0x0100
      class: IntField
      name: CountPLL
      sizeBits: 32
      mode: RO
      description: PLL Status changes
    #########################################################
    Count186M:
      at:
        offset: 0x0104
      class: IntField
      name: Count186M
      sizeBits: 32
      mode: RO
      description: 186MHz clock counts / 16
    #########################################################
    CountSyncE:
      at:
        offset: 0x0108
      class: IntField
      name: CountSyncE
      sizeBits: 32
      mode: RO
      description: Sync error counts
    #########################################################
    CountIntv:
      at:
        offset: 0x010C
      class: IntField
      name: CountIntv
      sizeBits: 32
      mode: RW
      description: Interval timer
    #########################################################
    CountBRT:
      at:
        offset: 0x0110
      class: IntField
      name: CountBRT
      sizeBits: 32
      mode: RO
      description: Base rate trigger count in interval
    #########################################################
    CountTrig:
      at:
        offset: 0x0114
        stride: 4
        nelms: 12
      class: IntField
      name: CountTrig
      sizeBits: 32
      mode: RO
      description: External trigger count in interval
    #########################################################
    RxStatus:
      at:
        offset: 0x0144
      class: IntField
      name: RxStatus
      sizeBits: 32
      mode: RO
      description: Status of RX link
    #########################################################
    CountRxClks:
      at:
        offset: 0x0148
      class: IntField
      name: CountRxClks
      sizeBits: 32
      mode: RO
      description: Recovered clock count / 16
    #########################################################
    CountRxDV:
      at:
        offset: 0x014C
      class: IntField
      name: CountRxDV
      sizeBits: 32
      mode: RO
      description: Received data valid count
    #########################################################
    BsaTimestamp:
      at:
        offset: 0x0150
        stride: 8
        nelms: 2
      class: IntField
      name: BsaTimestamp
      sizeBits: 64
#      sizeBits: 128
      mode: RO
      description: BSA timestamp
    #########################################################
#    BsaStatusDone:
#      at:
#        offset: 0x0158
#      class: IntField
#      name: BsaStatusDone
#      sizeBits: 64
#      mode: RO
#      description: BSA done update (mask of arrays)
    #########################################################
#    CountSeq:
#      <<: *SeqCount
#      at:
#        offset: 0x0400
#        stride: 16
#        nelms: *nseq
    CountSeq:
      at:
        offset: 0x0400
        stride: 4
        nelms: 400
      class: IntField
      name: CountSeq
      sizeBits: 32
      mode: RO
