Documentation
¶
Overview ¶
Package lancero provides an interface to all Lancero scatter-gather DMA character devices, read/write from/to registers of SOPC slaves, wait for SOPC component interrupt events and handle the cyclic mode of SGDMA. Exports object Lancero for general use. Internally, that object works with the lower-level adapter, collector, and lanceroDevice.
Package lancero provides an interface to all Lancero SGDMA character devices, read/write from/to registers of SOPC slaves, wait for SOPC component interrupt events and handle the cyclic mode of SGDMA.
Index ¶
- Constants
- func EnumerateLanceroDevices() (devices []int, err error)
- func FindFrameBits(b []byte, offset int) (int, int, int, error)
- func OdDashTX(b []byte, maxLines int) string
- func SetLogOutput(w io.Writer)
- type Lancero
- func (lan *Lancero) AvailableBuffer() ([]byte, time.Time, error)
- func (lan *Lancero) ChangeRingBuffer(length, threshold int) error
- func (lan *Lancero) Close() error
- func (lan *Lancero) CollectorConfigure(linePeriod, dataDelay int, channelMask uint32, frameLength int) error
- func (lan *Lancero) InspectAdapter() uint32
- func (lan *Lancero) ReleaseBytes(nBytes int) error
- func (lan *Lancero) StartAdapter(waitSeconds int) error
- func (lan *Lancero) StartCollector(simulate bool) error
- func (lan *Lancero) StopAdapter() error
- func (lan *Lancero) StopCollector() error
- func (lan *Lancero) Wait() (time.Time, time.Duration, error)
- type Lanceroer
- type NoHardware
- func (lan *NoHardware) AvailableBuffer() ([]byte, time.Time, error)
- func (lan *NoHardware) ChangeRingBuffer(length, threshold int) error
- func (lan *NoHardware) Close() error
- func (lan *NoHardware) CollectorConfigure(linePeriod, dataDelay int, channelMask uint32, frameLength int) error
- func (lan *NoHardware) InspectAdapter() uint32
- func (lan *NoHardware) ReleaseBytes(nBytes int) error
- func (lan *NoHardware) StartAdapter(waitSeconds int) error
- func (lan *NoHardware) StartCollector(simulate bool) error
- func (lan *NoHardware) StopAdapter() error
- func (lan *NoHardware) StopCollector() error
- func (lan NoHardware) String() string
- func (lan *NoHardware) Wait() (time.Time, time.Duration, error)
Constants ¶
const ( // HardMaxBufSize Longest allowed adapter buffer HardMaxBufSize uint32 = 40 * (1 << 20) )
Variables ¶
This section is empty.
Functions ¶
func EnumerateLanceroDevices ¶
EnumerateLanceroDevices returns a list of lancero device numbers that exist in the devfs. If /dev/lancero_user0 exists, and _control0, _events0, and _sgdma0 all exist and are device files, then 0 is added to the list.
func FindFrameBits ¶
FindFrameBits (buffer, offset) studies the buffer and returns (q,p,n,err). buffer is the raw data; offset is the byte where frame bits are expected in in the least significant bit. So if the offset is b, frame bits will be expected in buffer[b]&1, buffer[b+4]&1, buffer[b+8]&1, etc.
q index of word with first frame bit following non-frame index p index of word with next frame bit following non-frame index word means 4 bytes: errLerrMfbkLfbkM (L=least signifiant byte, M=most significant byte) n number of consecutive words with frame bit set, starting at q err is nil if q,p,n all found as expected
func SetLogOutput ¶
SetLogOutput calls log.SetOutput from within Lancero
Types ¶
type Lancero ¶
type Lancero struct {
// contains filtered or unexported fields
}
Lancero is the high-level object used to manipulate all user-space functions of the Lancero device driver.
func NewLancero ¶
NewLancero generates and returns a new Lancero object and configures it properly. The devnum value is used to select among /dev/lancero_user0, lancero_user1, etc., if there are more than 1 card in the computer. Usually, you'll use 0 here.
func (*Lancero) AvailableBuffer ¶
AvailableBuffer returns a COPY OF the ring buffer segment now ready for reading, plus the best estimate of the time stamp taken immediately after the end of the segment, and any error. Because this returns a COPY, it is encouraged to call ReleaseBytes as soon as the caller is sure how many bytes are to be released, even if the caller is not done using the copy of the data.
func (*Lancero) ChangeRingBuffer ¶
ChangeRingBuffer re-sizes the adapter's ring buffer.
func (*Lancero) CollectorConfigure ¶
func (lan *Lancero) CollectorConfigure(linePeriod, dataDelay int, channelMask uint32, frameLength int) error
CollectorConfigure configures the data serialization component.
func (*Lancero) InspectAdapter ¶
InspectAdapter prints adapter status info and returns the status word.
func (*Lancero) ReleaseBytes ¶
ReleaseBytes instructed the ring buffer adapter to release nBytes bytes for over-writing.
func (*Lancero) StartAdapter ¶
StartAdapter starts the ring buffer adapter, waiting up to waitSeconds sec for it to work.
func (*Lancero) StartCollector ¶
StartCollector starts the data serializer.
func (*Lancero) StopAdapter ¶
StopAdapter stops the ring buffer adapter.
func (*Lancero) StopCollector ¶
StopCollector stops the data serializer.
type Lanceroer ¶
type Lanceroer interface { ChangeRingBuffer(int, int) error Close() error StartAdapter(int) error StopAdapter() error CollectorConfigure(int, int, uint32, int) error StartCollector(bool) error StopCollector() error Wait() (time.Time, time.Duration, error) AvailableBuffer() ([]byte, time.Time, error) ReleaseBytes(int) error InspectAdapter() uint32 }
Lanceroer is the interaface shared by Lancero and NoHardware used to allow testing without lancero hardware
type NoHardware ¶
type NoHardware struct {
// contains filtered or unexported fields
}
NoHardware is a drop in replacement for Lancero (implements Lanceroer) that requires no hardware. Use it for testing the interface.
func NewNoHardware ¶
func NewNoHardware(ncols int, nrows int, linePeriod int) (*NoHardware, error)
NewNoHardware generates and returns a new Lancero object in test mode, meaning it emulate a lancero without any hardware. Here linePeriod is the equivalent of LSYNC: how many 8 ns clocks per row of readout.
func (*NoHardware) AvailableBuffer ¶
func (lan *NoHardware) AvailableBuffer() ([]byte, time.Time, error)
AvailableBuffer returns some simulated data size matches what you should get in 1 millisecond all entries other than frame bits are zeros
func (*NoHardware) ChangeRingBuffer ¶
func (lan *NoHardware) ChangeRingBuffer(length, threshold int) error
ChangeRingBuffer doesnt error
func (*NoHardware) CollectorConfigure ¶
func (lan *NoHardware) CollectorConfigure(linePeriod, dataDelay int, channelMask uint32, frameLength int) error
CollectorConfigure returns nil
func (*NoHardware) InspectAdapter ¶
func (lan *NoHardware) InspectAdapter() uint32
InspectAdapter does nothing and returns 0
func (*NoHardware) ReleaseBytes ¶
func (lan *NoHardware) ReleaseBytes(nBytes int) error
ReleaseBytes increments bytesReleased
func (*NoHardware) StartAdapter ¶
func (lan *NoHardware) StartAdapter(waitSeconds int) error
StartAdapter errors if already started
func (*NoHardware) StartCollector ¶
func (lan *NoHardware) StartCollector(simulate bool) error
StartCollector errors if Collector Already Started
func (*NoHardware) StopAdapter ¶
func (lan *NoHardware) StopAdapter() error
StopAdapter errors if not started
func (*NoHardware) StopCollector ¶
func (lan *NoHardware) StopCollector() error
StopCollector errors if Collector not started
func (NoHardware) String ¶
func (lan NoHardware) String() string
String implements Stringer for NoHardware, aka controls how Println output looks