|
ZMOD API
|
Public Member Functions | |
| ZMODDAC1411 (uintptr_t baseAddress, uintptr_t dmaAddress, uintptr_t iicAddress, uintptr_t flashAddress, int dmaInterrupt) | |
| uint32_t * | allocChannelsBuffer (size_t length) |
| void | freeChannelsBuffer (uint32_t *buf, size_t length) |
| uint32_t | arrangeChannelData (uint8_t channel, uint16_t data) |
| uint32_t | arrangeSignedChannelData (uint8_t channel, int16_t data) |
| void | setOutputSampleFrequencyDivider (uint16_t val) |
| uint8_t | setData (uint32_t *buffer, size_t length) |
| void | setGain (uint8_t channel, uint8_t gain) |
| void | start () |
| void | stop () |
| void | resetOutputCounter () |
| void | processInterrupt () override |
| int32_t | computeCoefMult (float cg, uint8_t gain) |
| int32_t | computeCoefAdd (float ca, float cg, uint8_t gain) |
| int | readUserCalib () override |
| void | setCalibValues (uint8_t channel, uint8_t gain, float valG, float valA) |
| int32_t | getSignedRawFromVolt (float voltValue, uint8_t gain) |
Public Member Functions inherited from ZMOD | |
| ZMOD (uintptr_t baseAddress, uintptr_t dmaAddress, uintptr_t iicAddress, uintptr_t flashAddress, enum dma_direction direction, int zmodInterrupt, int dmaInterrupt) | |
| ~ZMOD () | |
| void | writeReg (uint8_t regAddr, uint32_t value) |
| void | writeRegFld (uint8_t regAddr, uint8_t lsbBit, uint8_t noBits, uint32_t value) |
| uint32_t | readReg (uint8_t regAddr) |
| uint32_t | readRegFld (uint8_t regAddr, uint8_t lsbBit, uint8_t noBits) |
| void | writeSignedRegFld (uint8_t regAddr, uint8_t lsbBit, uint8_t noBits, int32_t value) |
| int32_t | readSignedRegFld (uint8_t regAddr, uint8_t lsbBit, uint8_t noBits) |
| void | setTransferSize (size_t size) |
| int | startDMATransfer (uint32_t *buffer) |
| bool | isDMATransferComplete () |
| void | sendCommand (uint32_t command) |
| uint32_t | receiveCommand () |
| void | sendCommands (uint32_t *commands, size_t length) |
| size_t | receiveCommands (uint32_t *commands) |
| size_t | sendReceiveCommands (uint32_t *sentCommands, uint32_t *receivedCommands, size_t length) |
| void | writeUserCalib () |
| int | restoreFactoryCalib () |
| void | formatValue (char *dest, float val, const char *unit) |
Additional Inherited Members | |
Protected Member Functions inherited from ZMOD | |
| int | initCalib (uint32_t calibSize, uint8_t calibID, uint32_t userCalibAddr, uint32_t factCalibAddr) |
| void * | allocDMABuffer (size_t size) |
| void | freeDMABuffer (uint32_t *buf, size_t size) |
| uint8_t | computeCRC (uint8_t *pData, uint32_t len) |
| int32_t | toSigned (uint32_t value, uint8_t noBits) |
Protected Attributes inherited from ZMOD | |
| uintptr_t | baseAddr |
| uintptr_t | dmaAddr |
| uintptr_t | flashAddr |
| size_t | transferSize |
| uint8_t * | calib |
| uint32_t | calibSize |
| uint16_t | userCalibAddr |
| uint16_t | factCalibAddr |
| uint8_t | calibID |
| enum dma_direction | direction |
| ZMODDAC1411::ZMODDAC1411 | ( | uintptr_t | baseAddress, |
| uintptr_t | dmaAddress, | ||
| uintptr_t | iicAddress, | ||
| uintptr_t | flashAddress, | ||
| int | dmaInterrupt | ||
| ) |
Initialize a ZMOD DAC1411 instance.
| baseAddr | the base address of the ZMOD device, can be found by either looking in the device tree files on a Linux platform, or the xparameters.h file on a baremetal platform, or in Vivado's Address Editor tab. |
| dmaAddr | the base address of the DMA device, can be found by either looking in the device tree files on a Linux platform, or the xparameters.h file on a baremetal platform, or in Vivado's Address Editor tab. |
| iicAddress | the base address of the I2C device used for flash, can be found by either looking in the device tree files on a Linux platform, or the xparameters.h file on a baremetal platform, or in Vivado's Address Editor tab. |
| flashAddress | is the I2C slave address of the I2C device used for flash, can be found in the carrier board reference manual, associated to the SZG connector where the ZMpd is plugged, |
| direction | the direction of the DMA transfer, can be either DMA_DIRECTION_TX for a transfer from the processor to the FPGA, or DMA_DIRECTION_RX for a transfer from the FPGA to the processor. |
| zmodInterrupt | the interrupt number of the ZMOD device, can be found by looking at the xparameters.h file on a baremental platform, and is irrelevant on a Linux platform. |
| dmaInterrupt | the interrupt number of the DMA device, can be found by looking at the xparameters.h file on a baremental platform, and is irrelevant on a Linux platform. |
| uint32_t * ZMODDAC1411::allocChannelsBuffer | ( | size_t | length | ) |
Allocates the data buffer used for AXI DMA transfers, 4 bytes for each sample.
| length | the number of samples in the buffer. |
| uint32_t ZMODDAC1411::arrangeChannelData | ( | uint8_t | channel, |
| uint16_t | data | ||
| ) |
Position the channel data in a 32 bits value to be sent to IP.
| channel | the channel to extract 0 for channel A, 1 for channel B |
| data | the unsigned channel data (14 bits) |
| uint32_t ZMODDAC1411::arrangeSignedChannelData | ( | uint8_t | channel, |
| int16_t | data | ||
| ) |
Position the channel data in a 32 bits value to be sent to IP.
| channel | the channel to extract 0 for channel A, 1 for channel B |
| data | the signed channel data (14 bits) |
| int32_t ZMODDAC1411::computeCoefAdd | ( | float | ca, |
| float | cg, | ||
| uint8_t | gain | ||
| ) |
Computes the Additive calibration coefficient.
| ca | - add coefficient as it is stored in Flash |
| cg | - gain coefficient as it is stored in Flash |
| gain | 0 LOW and 1 HIGH |
| int32_t ZMODDAC1411::computeCoefMult | ( | float | cg, |
| uint8_t | gain | ||
| ) |
Computes the Multiplicative calibration coefficient.
| cg | - gain coefficient as it is stored in Flash |
| gain | 0 LOW and 1 HIGH |
| void ZMODDAC1411::freeChannelsBuffer | ( | uint32_t * | buf, |
| size_t | length | ||
| ) |
Free the data buffer used for AXI DMA transfers, 4 bytes for each sample.
| buf | the address of the DMA buffer |
| length | the number of samples in the buffer. |
| int32_t ZMODDAC1411::getSignedRawFromVolt | ( | float | voltValue, |
| uint8_t | gain | ||
| ) |
Converts a value in Volts measure unit into a signed raw value (to be provided to the ZmodDAC1411 IP core). If the value is outside the range corresponding to the specified gain, it is limited to the nearest range limit.
| raw | - the signed value as . |
| gain | 0 LOW and 1 HIGH |
|
overridevirtual |
|
overridevirtual |
Reads the calibration data into the calib class member. It calls the ZMOD At the ZMOD class level to read the user calibration data as an array of bytes into the area pointed by calib base class member. Then the calibration data is interpreted according to CALIBECLYPSEDAC structure.
Reimplemented from ZMOD.
| void ZMODDAC1411::resetOutputCounter | ( | ) |
Reset the output counter so that the next time the instrument is started the first value from the buffer will be sent to DAC.
| uint8_t ZMODDAC1411::setData | ( | uint32_t * | buffer, |
| size_t | length | ||
| ) |
Send to the IP the data to be generated by DAC.
| buffer | the buffer containing the data to be sent to DAC, must be previously allocated and filled with data. |
| length | the number of values from buffer to be used. |
| void ZMODDAC1411::setGain | ( | uint8_t | channel, |
| uint8_t | gain | ||
| ) |
Set the gain for a channel.
| channel | the channel: 0 for channel 1, 1 for channel 2 |
| gain | the gain : 0 for LOW gain, 1 for HIGH gain |
| void ZMODDAC1411::setOutputSampleFrequencyDivider | ( | uint16_t | val | ) |
Set the 14 bits output sample frequency divider.
| void ZMODDAC1411::start | ( | ) |
Start the DAC to generate the values previously prepared.
| void ZMODDAC1411::stop | ( | ) |
Stop the DAC.
1.8.16