##############################################################################
## 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
#once RssiCore.yaml

RssiCore: &RssiCore
  class: MMIODev
  configPrio: 1
  description: RSSI module
  size: 0x100
  children:
    OpenConn:
      at:
        offset: 0x00
      class: IntField
      name: OpenConn
      sizeBits: 1
      lsBit: 0
      mode: RW
      description: Open Connection Request (Server goes to listen state, Client actively
        requests the connection by sending SYN segment)
    CloseConn:
    #########################################################
      at:
        offset: 0x00
      class: IntField
      name: CloseConn
      sizeBits: 1
      lsBit: 1
      mode: RW
      description: Close Connection Request (Send a RST Segment to peer and close
        the connection)
    Mode:
    #########################################################
      at:
        offset: 0x00
      class: IntField
      name: Mode
      sizeBits: 1
      lsBit: 2
      mode: RW
      description: 'Mode:''0'': Use internal parameters from generics,''1'': Use parameters
        from registers'
    HeaderChksumEn:
    #########################################################
      at:
        offset: 0x00
      class: IntField
      name: HeaderChksumEn
      sizeBits: 1
      lsBit: 3
      mode: RW
      description: 'Header checksum: ''1'': Enable calculation and check, ''0'': Disable
        check and insert 0 in place of header checksum'
    InjectFault:
    #########################################################
      at:
        offset: 0x00
      class: IntField
      name: InjectFault
      sizeBits: 1
      lsBit: 4
      mode: RW
      description: Inject fault to the next packet header checksum (Default '0').
        Acts on rising edge - injects exactly one fault in next segment
    InitSeqN:
    #########################################################
      at:
        offset: 0x04
      class: IntField
      name: InitSeqN
      sizeBits: 8
      mode: RW
      description: Initial sequence number [7:0]
    Version:
    #########################################################
      at:
        offset: 0x08
      class: IntField
      name: Version
      sizeBits: 4
      mode: RW
      description: Version register [3:0]
    MaxOutsSeg:
    #########################################################
      at:
        offset: 0x0C
      class: IntField
      name: MaxOutsSeg
      sizeBits: 8
      mode: RW
      description: Maximum out standing segments [7:0]
    MaxSegSize:
    #########################################################
      at:
        offset: 0x10
      class: IntField
      name: MaxSegSize
      sizeBits: 16
      mode: RW
      description: Maximum segment size [15:0]
    RetransTimeout:
    #########################################################
      at:
        offset: 0x14
      class: IntField
      name: RetransTimeout
      sizeBits: 16
      mode: RW
      description: Retransmission timeout [15:0]
    CumAckTimeout:
    #########################################################
      at:
        offset: 0x18
      class: IntField
      name: CumAckTimeout
      sizeBits: 16
      mode: RW
      description: Cumulative acknowledgment timeout [15:0]
    NullSegTimeout:
    #########################################################
      at:
        offset: 0x1C
      class: IntField
      name: NullSegTimeout
      sizeBits: 16
      mode: RW
      description: Null segment timeout [15:0]
    MaxNumRetrans:
    #########################################################
      at:
        offset: 0x20
      class: IntField
      name: MaxNumRetrans
      sizeBits: 8
      mode: RW
      description: Maximum number of retransmissions [7:0]
    MaxCumAck:
    #########################################################
      at:
        offset: 0x24
      class: IntField
      name: MaxCumAck
      sizeBits: 8
      mode: RW
      description: Maximum cumulative acknowledgments [7:0]
    MaxOutOfSeq:
    #########################################################
      at:
        offset: 0x28
      class: IntField
      name: MaxOutOfSeq
      sizeBits: 8
      mode: RW
      description: Max out of sequence segments (EACK) [7:0]
    ConnectionActive:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ConnectionActive
      sizeBits: 1
      lsBit: 0
      mode: RO
      description: Connection Active
    ErrMaxRetrans:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ErrMaxRetrans
      sizeBits: 1
      lsBit: 1
      mode: RO
      description: Maximum retransmissions exceeded retransMax.
    ErrNullTout:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ErrNullTout
      sizeBits: 1
      lsBit: 2
      mode: RO
      description: Null timeout reached (server) nullTout.
    ErrAck:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ErrAck
      sizeBits: 1
      lsBit: 3
      mode: RO
      description: Error in acknowledgment mechanism.
    ErrSsiFrameLen:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ErrSsiFrameLen
      sizeBits: 1
      lsBit: 4
      mode: RO
      description: SSI Frame length too long
    ErrConnTout:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ErrConnTout
      sizeBits: 1
      lsBit: 5
      mode: RO
      description: 'Connection to peer timed out. Timeout defined in generic PEER_CONN_TIMEOUT_G
        (Default: 1000 ms)'
    ParamRejected:
    #########################################################
      at:
        offset: 0x40
      class: IntField
      name: ParamRejected
      sizeBits: 1
      lsBit: 6
      mode: RO
      description: Client rejected the connection (parameters out of range), Server
        proposed new parameters (parameters out of range)
    ValidCnt:
    #########################################################
      at:
        offset: 0x44
      class: IntField
      name: ValidCnt
      sizeBits: 32
      mode: RO
      description: Number of valid segments [31:0]
    DropCnt:
    #########################################################    
      at:
        offset: 0x48
      class: IntField
      name: DropCnt
      sizeBits: 32
      mode: RO
      description: Number of dropped segments [31:0]
    RetransmitCnt:
    #########################################################
      at:
        offset: 0x4C
      class: IntField
      name: RetransmitCnt
      sizeBits: 32
      mode: RO
      description: Counts all retransmission requests within the active connection
        [31:0]
    ReconnectCnt:
    #########################################################    
      at:
        offset: 0x50
      class: IntField
      name: ReconnectCnt
      sizeBits: 32
      mode: RO
      description: Counts all reconnections from reset [31:0]
    FrameRate:
    #########################################################    
      at:
        offset: 0x54
        nelms: 2
        stride: 4
      class: IntField
      name: FrameRate
      sizeBits: 32
      mode: RO
      description: Frame Rate (in units of Hz)
    #########################################################    
    Bandwidth:
      at:
        offset: 0x5C
        nelms: 2
        stride: 8
      class: IntField
      sizeBits: 64
      mode: RO
      description: Bandwidth (in units of bytes per second)
    #########################################################    
    C_OpenConn:
      class: SequenceCommand
      at:
        offset: 0x0
      description: Open connection request
      sequence:
      - entry: OpenConn
        value: 0x1
      - entry: OpenConn
        value: 0x0
    #########################################################
    C_CloseConn:
      class: SequenceCommand
      at:
        offset: 0x0
      description: Close connection request
      sequence:
      - entry: CloseConn
        value: 0x1
      - entry: CloseConn
        value: 0x0
    #########################################################
    C_InjectFault:
      class: SequenceCommand
      at:
        offset: 0x0
      description: Inject a single fault(for debug and test purposes only). Corrupts
        checksum during transmission
      sequence:
      - entry: InjectFault
        value: 0x1
      - entry: InjectFault
        value: 0x0
