goipbus: bitbucket.org/NickRyder/goipbus/ipbus Index | Files

package ipbus

import "bitbucket.org/NickRyder/goipbus/ipbus"

Package ipbus enables communication with FPGAs using the IPbus UDP protocol.

Index

Package Files

connectionmanager.go dummy.go hw.go hw_stuff.go ipbus.go license.go parser.go register.go target.go transaction.go

Constants

const DefaultAutoDispatch = false
const DefaultTimeout = 3 * time.Second
const IPbusVersion = 2.0

Supported IPbus protocol version

const PackageVersion = 1.0 // 23 Jun 17

Variables

var MaxPacketSize = uint(1500)

Maxiumum Ethernet packet size (bytes)

func License Uses

func License()

Print the license the goipbus package is relased under.

type CM Uses

type CM struct {
    Devices []string
    // contains filtered or unexported fields
}

Connection Manager

func NewCM Uses

func NewCM(fn string) (CM, error)

func (CM) Target Uses

func (cm CM) Target(name string) (Target, error)

type InfoCode Uses

type InfoCode uint8

Information codes

const BadHeader InfoCode = 0x1
const BusReadError InfoCode = 0x4
const BusReadTimeout InfoCode = 0x6
const BusWriteError InfoCode = 0x5
const Request InfoCode = 0xf
const Success InfoCode = 0x0

type Register Uses

type Register struct {
    Name  string
    Addr  uint32   // Global IPbus address
    Masks []string // List of names bitmasks
    // contains filtered or unexported fields
}

func (Register) ReadMask Uses

func (r Register) ReadMask(mask string, val uint32) (uint32, error)

Read the value of masked part of register

func (Register) String Uses

func (r Register) String() string

func (Register) WriteMask Uses

func (r Register) WriteMask(mask string, val uint32) (uint32, uint32, error)

type Response Uses

type Response struct {
    Err   error
    Code  InfoCode
    Data  []uint32
    DataB []byte
}

Response to a control transaction

type Target Uses

type Target struct {
    Name string
    // TimeoutPeriod defines the period to wait after queuing an initial transaction
    // before sending all queued transactions, if AutoDispatch is true.
    // The Timeout is restarted each time a transaction is added when the queue is empty.
    TimeoutPeriod time.Duration
    Regs          map[string]Register
    // Enable/disable automatic dispatch of transactions.
    // If enabled transactions are sent at the first opportunity when:
    // a) A full UDP packet worth of transactions can be sent
    // b) Target.dt has elapsed since the first queued transaction
    // or
    // c) Target.Dispatch() is called.
    // If disabled transactions are only sent when Target.Dispatch() is called.
    AutoDispatch bool

    Addr net.Addr
    // contains filtered or unexported fields
}

func New Uses

func New(name, fn string, conn net.Conn) (Target, error)

Create a new target by parsing an XML file description.

func (Target) Dispatch Uses

func (t Target) Dispatch()

Blocking call to send queued transactions, returns once all replies are received.

func (Target) MaskedReadNow Uses

func (t Target) MaskedReadNow(reg Register, mask string) (uint32, error)

Immediately perform a read on a register and return the masked value once return packet is received

func (Target) MaskedWrite Uses

func (t Target) MaskedWrite(reg Register, mask string, value uint32) (chan Response, error)

MaskedWrite performs a RMWbits for updarting the masked part of the register to the given value

func (Target) MaskedWriteNow Uses

func (t Target) MaskedWriteNow(reg Register, mask string, value uint32) (uint32, error)

Immediately perform a masked write on a register and return the previous value once return packet is received

func (Target) RMWbits Uses

func (t Target) RMWbits(reg Register, andterm, orterm uint32) chan Response

Update reg by operation: x = (x & andterm) | orterm. Receive previous value of reg in reply.

func (Target) RMWsum Uses

func (t Target) RMWsum(reg Register, addend uint32) chan Response

Update reg by operation: x <= (x + addend). Receive previous value of reg in reply.

func (Target) Read Uses

func (t Target) Read(reg Register, nword uint) chan Response

Read nword words from register reg.

func (Target) ReadB Uses

func (t Target) ReadB(reg Register, nword uint) chan Response

Read transaction where reply is kept in []byte array.

func (Target) ReadNow Uses

func (t Target) ReadNow(reg Register, nword uint) ([]uint32, error)

Immediately send read command and return all read words once all return packets are recieved

func (Target) String Uses

func (t Target) String() string

func (Target) Write Uses

func (t Target) Write(reg Register, data []uint32) chan Response

Write words in data to register reg.

func (Target) WriteNow Uses

func (t Target) WriteNow(reg Register, data []uint32) error

Immediately send a write command and return any error once all return packets are received

Package ipbus imports 13 packages (graph). Updated 2019-05-20. Refresh now. Tools for package owners.