Lambdaya-0.1.1.0: Library for RedPitaya

Safe HaskellNone
LanguageHaskell2010

System.RedPitaya.Fpga

Contents

Description

Red Pitaya native library for accessing Fpga

Synopsis

Documentation

data Fpga a Source

Environment where one can read and write Fpga registries

type Registry = Word32 Source

type representing fpga registry

data Channel Source

Redpitaya Channel A or B.

Constructors

A 
B 

withOpenFpga :: Fpga a -> IO a Source

This function handles initialising Fpga memory mapping and evaluates Fpga action.

Housekeeping

various housekeeping and Gpio functions

fpgaId :: Fpga Registry Source

get ID , 0 prototype , 1 release

setExpDirP :: Registry -> Fpga () Source

set expansion connector direction P registry

1 out , 0 in

getExpDirP :: Fpga Registry Source

get expansion connector direction P registry

1 out , 0 in

setExpDirN :: Registry -> Fpga () Source

set expansion connector direction N registry

1 out , 0 in

getExpDirN :: Fpga Registry Source

get expansion connector direction N registry

1 out , 0 in

setExpOutP :: Registry -> Fpga () Source

expansion connector P output registry value

setExpOutN :: Registry -> Fpga () Source

expansion connector N output registry value

getExpInP :: Fpga Registry Source

expansion connector P input registry value

getExpInN :: Fpga Registry Source

expansion connector N input registry value

data GpioType Source

type of gpio can be either P on N

Constructors

P

P gpio

N

N gpio

Instances

data GpioDirection Source

represent gpio direction, that can be either Input or Output

Constructors

Input 
Output 

type PinNum = Int Source

type representing pin number

setExpDir :: GpioType -> GpioDirection -> PinNum -> Fpga () Source

Sets direction of pin

data GpioValue Source

represent gpio value that can be either Hi or Low

Constructors

Low 
Hi 

Instances

setExpOut :: GpioType -> GpioValue -> PinNum -> Fpga () Source

Sets outout value of pin

getExpOut :: GpioType -> PinNum -> Fpga GpioValue Source

Sets output value of single pin

setLed :: Registry -> Fpga () Source

write in led registry

getLed :: Fpga Registry Source

read in led registry

Oscilloscope

functions for accessing oscilloscope features

resetWriteSM :: Fpga () Source

reset write state machine for oscilloscope

triggerNow :: Fpga () Source

start writing data into memory (ARM trigger).

data TriggerSource Source

oscilloscope trigger selection

Constructors

Immediately

trig immediately

ChAPositiveEdge

ch A threshold positive edge

ChANegativeEdge

ch A threshold negative edge

ChBPositiveEdge

ch B threshold positive edge

ChBNegativeEdge

ch B threshold negative edge

ExtPositiveEdge

external trigger positive edge - DIO0_P pin

ExtNegaitveEdge

external trigger negative edge

AWGPositiveEdge

arbitrary wave generator application positive edge

AWGNegativeEdge

arbitrary wave generator application negative edge

setOscTrigger :: TriggerSource -> Fpga () Source

set oscilloscope trigger

triggerDelayEnded :: Fpga Bool Source

when trigger delay is value becomes True

setTreshold :: Channel -> Registry -> Fpga () Source

Ch x threshold, makes trigger when ADC value cross this value

getTreshold :: Channel -> Fpga Registry Source

gets ch x threshold

setDelayAfterTrigger :: Registry -> Fpga () Source

Number of decimated data after trigger written into memory

getDelayAfterTrigger :: Fpga Registry Source

gets delay after trigger value

setOscDecimationRaw :: Registry -> Fpga () Source

sets oscilloscope decimation registry, allows only 1,8, 64,1024,8192,65536. If other value is written data will NOT be correct.

getOscDecimationRaw :: Fpga Registry Source

oscilloscope decimation registry value

data OscDecimation Source

oscilloscope decimation

setOscDecimation :: OscDecimation -> Fpga () Source

set oscilloscope decimation

getOscWpCurrent :: Fpga Registry Source

write pointer - current

getOscWpTrigger :: Fpga Registry Source

write pointer - trigger

setOscHysteresis :: Channel -> Registry -> Fpga () Source

set ch x hysteresis

enableOscDecimationAvarage :: Bool -> Fpga () Source

Enable signal average at decimation True enables, False disables

setEqualFilter :: Channel -> [Registry] -> Fpga () Source

set ch A equalization filter, takes array with coefficients [AA,BB,KK,PP]

getEqualFilter :: Channel -> Fpga [Registry] Source

get ch x equalization filter, return array with coefficients [AA,BB,KK,PP]

setAxiLowerAddress :: Channel -> Registry -> Fpga () Source

starting writing address ch x - CH x AXI lower address

getAxiLowerAddress :: Channel -> Fpga Registry Source

read - starting writing address ch x - CH x AXI lower address

setAxiUpperAddress :: Channel -> Registry -> Fpga () Source

starting writing address ch x - CH x AXI lower address

getAxiUpperAddress :: Channel -> Fpga Registry Source

read - starting writing address ch x - CH x AXI lower address

setAxiDelayAfterTrigger :: Channel -> Registry -> Fpga () Source

set umber of decimated data after trigger written into memory

getAxiDelayAfterTrigger :: Channel -> Fpga Registry Source

read - Number of decimated data after trigger written into memory

enableAxiMaster :: Channel -> Bool -> Fpga () Source

Enable AXI master

getAxiWritePtrTrigger :: Channel -> Fpga Registry Source

Write pointer for ch x at time when trigger arrived

getAxiWritePtrCurrent :: Channel -> Fpga Registry Source

current write pointer for ch x

getOscBuffer :: Channel -> Offset -> Int -> Fpga [Registry] Source

reads oscilloscope buffer for channel x from Fpga passing offset and length. buffer should fit within 16k sampling range. Returns less than requested data if trying to read over the bounds.

Arbitrary Signal Generator (ASG)

getAsgOption :: Fpga Registry Source

get ASGoption registry

setAsgOption :: Registry -> Fpga () Source

set ASG option registry

setAsgOptionBExtGatRep :: Registry -> Fpga () Source

ch B external gated repetitions, registry can be either 0x0 or 0x1

getAsgOptionBExtGatRep :: Fpga Registry Source

get ch B external gated repetitions, registry can be either 0x0 or 0x1

setAsgAmplitudeScale :: Channel -> Registry -> Fpga () Source

TODO others

todo other registries

Ch x amplitude scale (14 bist) - out = (data*scale)/0x2000 + offset

setAsgAmplitudeOffset :: Channel -> Registry -> Fpga () Source

Ch x amplitude offset (14 bits) - out = (data*scale)/0x2000 + offset

setAsgCounterWrap :: Channel -> Registry -> Fpga () Source

Ch x counter wrap - Value where counter wraps around. Depends on SM wrap setting. If it is 1 new value is get by wrap, if value is 0 counter goes to offset value. 16 bits for decimals.

setAsgCounterStartOffset :: Channel -> Registry -> Fpga () Source

Ch x Counter start offset. Start offset when trigger arrives. 16 bits for decimals.

setAsgCounterStep :: Channel -> Registry -> Fpga () Source

Ch x counter step. 16 bits for decimals.

getAsgCounterReadPtr :: Channel -> Fpga Registry Source

get ch x buffer current read pointer

setAsgCounterReadPtr :: Channel -> Registry -> Fpga () Source

set ch x buffer current read pointer

getAsgNumReadCycles :: Channel -> Fpga Registry Source

get ch x number of read cycles in one burst

setAsgNumReadCycles :: Channel -> Registry -> Fpga () Source

set ch x number of read cycles in one burst

getAsgNumRepetitions :: Channel -> Fpga Registry Source

get ch x number of read cycles in one burst

setAsgNumRepetitions :: Channel -> Registry -> Fpga () Source

set ch x number of read cycles in one burst

getAsgBurstDelay :: Channel -> Fpga Registry Source

get ch x delay between burst repetitions, granularity=1us

setAsgBurstDelay :: Channel -> Registry -> Fpga () Source

set ch x delay between burst repetitions, granularity=1us

Plumbing

low level functions for direct Fpga access, used to extend interface

type Page = Int Source

type representing fpga memory page

type Offset = Int Source

type representing fpga memory offset from page

fpgaRead :: Page -> Offset -> Fpga Registry Source

direct read from fpga registry

fpgaWrite :: Page -> Offset -> Registry -> Fpga () Source

direct write in fpga registry

fpgaFmap :: Page -> Offset -> (Registry -> Registry) -> Fpga () Source

apply transformation on fpga registry value

pokeFpgaArray :: Page -> Offset -> [Registry] -> Fpga () Source

write array in fpga memory

peekFpgaArray :: Page -> Offset -> Int -> Fpga [Registry] Source

read array from fpga memory, passing page, offset and length