|
ZMOD API
|
Public Member Functions | |
| ZMODADC1410 (uintptr_t baseAddress, uintptr_t dmaAddress, uintptr_t iicAddress, uintptr_t flashAddress, int zmodInterrupt, int dmaInterrupt) | |
| uint32_t * | allocChannelsBuffer (size_t length) |
| void | freeChannelsBuffer (uint32_t *buf, size_t length) |
| uint16_t | channelData (uint8_t channel, uint32_t data) |
| int16_t | signedChannelData (uint8_t channel, uint32_t data) |
| void | setTransferLength (size_t length) |
| void | setTrigger (uint8_t channel, uint8_t mode, int16_t level, uint8_t edge, uint32_t window) |
| void | enableBufferFullInterrupt (uint8_t enBuffFullInt) |
| uint8_t | isBufferFull () |
| void | waitForBufferFullPolling () |
| void | start () |
| void | stop () |
| uint8_t | acquireTriggeredPolling (uint32_t *buffer, uint8_t channel, uint32_t level, uint32_t edge, uint32_t window, size_t length) |
| uint8_t | acquireImmediatePolling (uint32_t *buffer, size_t length) |
| uint8_t | acquireTriggeredInterrupt (uint32_t *buffer, uint8_t channel, uint32_t level, uint32_t edge, uint32_t window, size_t length) |
| uint8_t | acquireImmediateInterrupt (uint32_t *buffer, uint8_t channel, size_t length) |
| uint8_t | autoTestRamp (uint8_t channel, uint32_t level, uint32_t edge, uint32_t window, size_t length) |
| void | processInterrupt () override |
| void | setGain (uint8_t channel, uint8_t gain) |
| void | setCoupling (uint8_t channel, uint8_t coupling) |
| int32_t | computeCoefMult (float cg, uint8_t gain) |
| int32_t | computeCoefAdd (float ca, uint8_t gain) |
| virtual int | readUserCalib () |
| void | setCalibValues (uint8_t channel, uint8_t gain, float valG, float valA) |
| float | getVoltFromSignedRaw (int32_t raw, 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 |
| ZMODADC1410::ZMODADC1410 | ( | uintptr_t | baseAddress, |
| uintptr_t | dmaAddress, | ||
| uintptr_t | iicAddress, | ||
| uintptr_t | flashAddress, | ||
| int | zmodInterrupt, | ||
| int | dmaInterrupt | ||
| ) |
Initialize a ZMOD ADC1410 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. |
| uint8_t ZMODADC1410::acquireImmediateInterrupt | ( | uint32_t * | buffer, |
| uint8_t | channel, | ||
| size_t | length | ||
| ) |
(Baremetal only) Acquire data using an interrupt method, will block until the acquisition completes.
| channel | the channel on which to run the data acquisition, 0 for channel 1, 1 for channel 2s |
| length | the number of samples to be acquired |
| uint8_t ZMODADC1410::acquireImmediatePolling | ( | uint32_t * | buffer, |
| size_t | length | ||
| ) |
Acquire data using a polling method, will block until the acquisition completes.
| buffer | the buffer to receive the acquired data, must be previously allocated to a dimension large enough to accommodate the requested acquisition |
| length | the number of samples to be acquired |
| uint8_t ZMODADC1410::acquireTriggeredInterrupt | ( | uint32_t * | buffer, |
| uint8_t | channel, | ||
| uint32_t | level, | ||
| uint32_t | edge, | ||
| uint32_t | window, | ||
| size_t | length | ||
| ) |
(Baremetal only) Acquire data using an interrupt method, will block until the acquisition completes.
| buffer | the buffer to receive the acquired data, must be previously allocated to a dimension large enough to accommodate the requested acquisition |
| channel | the channel for which trigger is set: 0 for channel 1, 1 for channel 2 |
| level | the level on which to run the data acquisition, can be any valid 14bit unsigned number |
| edge | the trigger edge at which to run the data acquisition, 0 for rising edge, 1 for falling edge |
| window | the window position at which to run the data acquisition, can be any unsigned number smaller than length |
| length | the number of samples to be acquired |
| uint8_t ZMODADC1410::acquireTriggeredPolling | ( | uint32_t * | buffer, |
| uint8_t | channel, | ||
| uint32_t | level, | ||
| uint32_t | edge, | ||
| uint32_t | window, | ||
| size_t | length | ||
| ) |
Acquire data using a polling method, will block until the acquisition completes.
| buffer | the buffer to receive the acquired data, must be previously allocated to a dimension large enough to accommodate the requested acquisition |
| channel | the channel for which trigger is set: 0 for channel 1, 1 for channel 2 |
| level | the level on which to run the data acquisition, can be any valid 14bit unsigned number |
| edge | the trigger edge at which to run the data acquisition, 0 for rising edge, 1 for falling edge |
| window | the window position at which to run the data acquisition, can be any unsigned number smaller than length |
| length | the number of samples to be acquired |
| uint32_t * ZMODADC1410::allocChannelsBuffer | ( | size_t | length | ) |
Allocates the data buffer used for AXI DMA transfers, 4 bytes for each element (sample).
| length | the number of elements (samples) in the buffer. |
| uint8_t ZMODADC1410::autoTestRamp | ( | uint8_t | channel, |
| uint32_t | level, | ||
| uint32_t | edge, | ||
| uint32_t | window, | ||
| size_t | length | ||
| ) |
Performs an auto test in ramp mode. It puts the Analog to Digital converter in test mode ramp mode, then performs an acquisition according to the specified trigger parameters. Then it checks the acquired data to be consistent with the trigger parameters.
| channel | the channel for which trigger is set: 0 for channel 1, 1 for channel 2 |
| level | the level on which to run the data acquisition, can be any valid 14bit unsigned number |
| edge | the trigger edge at which to run the data acquisition, 0 for rising edge, 1 for falling edge |
| window | the window position at which to run the data acquisition, can be any unsigned number smaller than length |
| length | the number of samples to be acquired |
| uint16_t ZMODADC1410::channelData | ( | uint8_t | channel, |
| uint32_t | data | ||
| ) |
Extract channel data from a buffer element.
| channel | the channel to extract 0 for channel 1, 1 for channel 2 |
| data | the buffer element from which to extract the channel data (32 bits) |
| int32_t ZMODADC1410::computeCoefAdd | ( | float | ca, |
| uint8_t | gain | ||
| ) |
Computes the Additive calibration coefficient.
| ca | - add coefficient as it is stored in Flash |
| gain | 0 LOW and 1 HIGH |
| int32_t ZMODADC1410::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 ZMODADC1410::enableBufferFullInterrupt | ( | uint8_t | enBuffFullInt | ) |
Enables / disables the buffer full ZMODADC1410 IP interrupt.
| length | the length of the transfer in number of elements (samples) to be transfered |
| void ZMODADC1410::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. |
| float ZMODADC1410::getVoltFromSignedRaw | ( | int32_t | raw, |
| uint8_t | gain | ||
| ) |
Converts a signed raw value (provided by ZmodADC1410 IP core) to a value in Volts measure unit.
| raw | - the signed value as . |
| gain | 0 LOW and 1 HIGH |
| uint8_t ZMODADC1410::isBufferFull | ( | ) |
Check if the ZMODADC1410 buffer is full by reading the Buffer Full bit in Status Register.
|
overridevirtual |
|
virtual |
Reads the calibration data into the calib class member. It calls the readUserCalib from 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 CALIBECLYPSEADC structure.
Reimplemented from ZMOD.
| void ZMODADC1410::setCalibValues | ( | uint8_t | channel, |
| uint8_t | gain, | ||
| float | valG, | ||
| float | valA | ||
| ) |
Set a pair of calibration values for a specific channel and gain into the calib area (interpreted as CALIBECLYPSEADC). In order for this change to be applied to user calibration area from flash, writeUserCalib function must be called.
| channel | the channel for which calibration values are set: 0 for channel 1, 1 for channel 2 |
| gain | the gain for which calibration values are set: 0 for LOW gain, 1 for HIGH gain |
| valG | the gain calibration value to be set |
| valA | the additive calibration value to be set |
| void ZMODADC1410::setCoupling | ( | uint8_t | channel, |
| uint8_t | coupling | ||
| ) |
Set the coupling for a channel.
| channel | the channel: 0 for DC Coupling, 1 for AC Coupling |
| void ZMODADC1410::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 ZMODADC1410::setTransferLength | ( | size_t | length | ) |
Set the length of a transfer.
| length | the length of the transfer in number of elements (samples) to be transfered |
| void ZMODADC1410::setTrigger | ( | uint8_t | channel, |
| uint8_t | mode, | ||
| int16_t | level, | ||
| uint8_t | edge, | ||
| uint32_t | window | ||
| ) |
Set the trigger parameters of the data acquisition.
| channel | the trigger channel, 0 for channel 1, 1 for channel 2 |
| mode | the trigger mode for the data acquisition, 0 for normal trigger, 1 for not trigger |
| level | the level on which to run the data acquisition, can be any valid 14bit unsigned number |
| edge | the trigger edge at which to run the data acquisition, 0 for rising edge, 1 for falling edge |
| window | the window position at which to run the data acquisition |
| int16_t ZMODADC1410::signedChannelData | ( | uint8_t | channel, |
| uint32_t | data | ||
| ) |
Extract signed channel data from a buffer element, making sure the most significant bit is taken into account.
| channel | the channel to extract 0 for channel 1, 1 for channel 2 |
| data | the buffer element from which to extract the channel data (32 bits) |
| void ZMODADC1410::start | ( | ) |
Start the ADC to acquire data according to previous acquisition settings.
| void ZMODADC1410::stop | ( | ) |
Stop the ADC acquisition process.
| void ZMODADC1410::waitForBufferFullPolling | ( | ) |
Wait (by polling) until the ZMODADC1410 sets the Buffer Full bit in Status Register, will block until buffer full is set.
1.8.16