Instances of this class handle configuring, and enabling the MityDSP Arbitrary Waveform Generator core I/O interface. More...
#include <core/DspAwg.h>
Classes | |
union | tuSampleData |
Definition of sample data holding area. More... | |
Public Types | |
enum | teDegOrRad { eeDegrees, eeRadians } |
Enumeration to specify inputs in degrees vs. radians. More... | |
Public Member Functions | |
tcDspAwg (void *apAddress) | |
This constructor is used to open a AWG core instance. | |
~tcDspAwg () | |
Default destructor. | |
void | Enable (bool abEnable) |
Enable the AWG Core (output waveform on next clock if internally triggered, or next clock after external trigger). | |
void | SetExtTrigger (bool abExtTrigger) |
Configure AWG Trigger Mode. | |
void | SetPhase (unsigned int anPhase) |
Configure AWG starting phase. | |
void | SetPhase (double afValue, teDegOrRad aeUnits) |
Configure AWG starting phase. | |
void | SetPhaseIncrement (unsigned int anPhaseInc) |
Set the AWG phase increment. | |
void | SetPhaseIncrement (double afValue, teDegOrRad aeUnits) |
Set the AWG phase increment. | |
int | SetWaveformSamples (unsigned short *apValues, int anNumValues, int anStartIndex=0, bool abImplementNow=true) |
Update the working copy of the AWG waveform sample table. | |
void | SetWaveformSin (unsigned short anHalfAmplitude=0x7FFF) |
Configure AWG waveform memory for sin wave output. | |
bool | IsEnabled (void) |
Check if AWG Core is enabled. | |
bool | IsExtTriggered (void) |
Check if AWG Core is configured for external trigger operation. | |
unsigned int | GetPhase (void) |
Read back the current 24-bit phase value. | |
unsigned int | GetPhaseIncrement (void) |
Read back the current phase increment value. | |
Static Public Attributes | |
static const int | gnNumSamples = 512 |
Number of waveform samples supported. | |
static const int | gnPhaseAccumulatorSize = 0x01000000 |
Number of possible phase values. | |
Protected Member Functions | |
void | CopyWaveform (void) |
Internal routine to copy the working waveform table to the FPGA core. | |
Protected Attributes | |
SEM_Handle | mhMutex |
volatile unsigned int * | mpBaseAddr |
Mutex to serialize access. | |
tuSampleData | maSamples [gnNumSamples] |
AWG Core base address. |
Instances of this class handle configuring, and enabling the MityDSP Arbitrary Waveform Generator core I/O interface.
Each AWG Core provides 512 16-bit samples (linearly interpolated) to define a waveform, and a 24-bit phase accumulator and programmable increment to define the frequency.
tcDspAwg::tcDspAwg | ( | void * | apAddress | ) |
This constructor is used to open a AWG core instance.
The base address of the FPGA core must be provided.
[in] | apAddress | The base address of the AWG core. |
tcDspAwg::~tcDspAwg | ( | ) |
Default destructor.
void tcDspAwg::Enable | ( | bool | abEnable | ) |
Enable the AWG Core (output waveform on next clock if internally triggered, or next clock after external trigger).
[in] | abEnable | When true, waveform generation is enabled. |
void tcDspAwg::SetExtTrigger | ( | bool | abExtTrigger | ) |
Configure AWG Trigger Mode.
[in] | abExtTrigger | When true, the core will be configured to start generating pulses when a rising edge is seen on the provided external trigger port of the core. When false, the core will generate pulses immediately (given it is enabled). |
void tcDspAwg::SetPhase | ( | unsigned int | anPhase | ) |
Configure AWG starting phase.
It is not recommended that this value be updated while the AWG is enabled.
[in] | anPhase | The initial phase, as a 24-bit integer. |
void tcDspAwg::SetPhase | ( | double | afValue, | |
teDegOrRad | aeUnits | |||
) |
Configure AWG starting phase.
It is not recommended that this value be updated while the AWG is enabled.
[in] | afValue | The initial phase, as double precision float. |
[in] | aeUnits | Indicates whether phase is in degrees (eeDegrees) or radians (eeRadians) |
void tcDspAwg::SetPhaseIncrement | ( | unsigned int | anPhaseInc | ) |
Set the AWG phase increment.
This is the number of counts that the 24-bit phase register is incremented each clock cycle. The waveform value output is linearly interpolated from the surrounding values in the sample table.
[in] | anPhaseInc | The phase increment, as a 24-bit integer. |
void tcDspAwg::SetPhaseIncrement | ( | double | afValue, | |
teDegOrRad | aeUnits | |||
) |
Set the AWG phase increment.
This is the number of counts that the 24-bit phase register is incremented each clock cycle. The waveform value output is linearly interpolated from the surrounding values in the sample table.
[in] | afValue | The phase increment, as a 24-bit integer. |
[in] | aeUnits | Indicates whether phase increment is in degrees (eeDegrees) or radians (eeRadians). |
int tcDspAwg::SetWaveformSamples | ( | unsigned short * | apValues, | |
int | anNumValues, | |||
int | anStartIndex = 0 , |
|||
bool | abImplementNow = true | |||
) |
Update the working copy of the AWG waveform sample table.
This table consists of 512 16-bit amplitude samples uniformly distributed across 360-degrees of phase. The number of samples to be provided, and (optionally) the starting index in the sample table are provided. A boolean indicates whether or not the working table should be loaded to the FPGA following the update.
[in] | apValues | Pointer to an array of 16-bit sample values. |
[in] | anNumValues | Number of values provided (0-512). |
[in] | anStartIndex | Starting index in the sample table (0-511, default:0). |
[in] | abImplementNow | Indicates whether or not working table should be copied to AWG (default: true). |
void tcDspAwg::SetWaveformSin | ( | unsigned short | anHalfAmplitude = 0x7FFF |
) |
Configure AWG waveform memory for sin wave output.
The output is scaled to be centered at 1/2 the full scale output of the AWG.
[in] | anHalfAmplitude | Number of LSB's for 1/2 amplitude. Maximum value should be 0x7FFF. |
bool tcDspAwg::IsEnabled | ( | void | ) |
Check if AWG Core is enabled.
bool tcDspAwg::IsExtTriggered | ( | void | ) |
Check if AWG Core is configured for external trigger operation.
unsigned int tcDspAwg::GetPhase | ( | void | ) |
Read back the current 24-bit phase value.
unsigned int tcDspAwg::GetPhaseIncrement | ( | void | ) |
Read back the current phase increment value.
void tcDspAwg::CopyWaveform | ( | void | ) | [protected] |
Internal routine to copy the working waveform table to the FPGA core.
const int MityDSP::tcDspAwg::gnNumSamples = 512 [static] |
Number of waveform samples supported.
const int MityDSP::tcDspAwg::gnPhaseAccumulatorSize = 0x01000000 [static] |
Number of possible phase values.
SEM_Handle MityDSP::tcDspAwg::mhMutex [protected] |
volatile unsigned int* MityDSP::tcDspAwg::mpBaseAddr [protected] |
Mutex to serialize access.
tuSampleData MityDSP::tcDspAwg::maSamples[gnNumSamples] [protected] |
AWG Core base address.