MityDSP Documentation Index
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
MityDSP::tcDspAwg Class Reference

Instances of this class handle configuring, and enabling the MityDSP Arbitrary Waveform Generator core I/O interface. More...

#include <core/DspAwg.h>

List of all members.

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.

Detailed Description

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.

See also:
tcDspAwg Page

Member Enumeration Documentation

Enumeration to specify inputs in degrees vs. radians.

Enumerator:
eeDegrees 
eeRadians 

Constructor & Destructor Documentation

tcDspAwg::tcDspAwg ( void *  apAddress)

This constructor is used to open a AWG core instance.

The base address of the FPGA core must be provided.

Parameters:
[in]apAddressThe base address of the AWG core.
Returns:
None.
See also:
DspAwg.h
tcDspAwg::~tcDspAwg ( )

Default destructor.


Member Function Documentation

void tcDspAwg::Enable ( bool  abEnable)

Enable the AWG Core (output waveform on next clock if internally triggered, or next clock after external trigger).

Parameters:
[in]abEnableWhen true, waveform generation is enabled.
Returns:
None.
void tcDspAwg::SetExtTrigger ( bool  abExtTrigger)

Configure AWG Trigger Mode.

Parameters:
[in]abExtTriggerWhen 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).
Returns:
None.
void tcDspAwg::SetPhase ( unsigned int  anPhase)

Configure AWG starting phase.

It is not recommended that this value be updated while the AWG is enabled.

Parameters:
[in]anPhaseThe initial phase, as a 24-bit integer.
Returns:
None.
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.

Parameters:
[in]afValueThe initial phase, as double precision float.
[in]aeUnitsIndicates whether phase is in degrees (eeDegrees) or radians (eeRadians)
Returns:
None.
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.

Parameters:
[in]anPhaseIncThe phase increment, as a 24-bit integer.
Returns:
None.
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.

Parameters:
[in]afValueThe phase increment, as a 24-bit integer.
[in]aeUnitsIndicates whether phase increment is in degrees (eeDegrees) or radians (eeRadians).
Returns:
None.
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.

Note:
The application need only provide the 512 16-bit samples. Offsetting and repeating the values as required for the FPGA is handled internally.
For a discontinuous waveform, 513 samples may be provided. The last data point becomes the "next" sample for the 512th entry in the waveform table. Discontinuous waveforms cannot be defined in sections.
Parameters:
[in]apValuesPointer to an array of 16-bit sample values.
[in]anNumValuesNumber of values provided (0-512).
[in]anStartIndexStarting index in the sample table (0-511, default:0).
[in]abImplementNowIndicates whether or not working table should be copied to AWG (default: true).
Returns:
Number of samples actually written.
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.

Parameters:
[in]anHalfAmplitudeNumber of LSB's for 1/2 amplitude. Maximum value should be 0x7FFF.
Returns:
None.
bool tcDspAwg::IsEnabled ( void  )

Check if AWG Core is enabled.

Returns:
true if the core is enabled.
bool tcDspAwg::IsExtTriggered ( void  )

Check if AWG Core is configured for external trigger operation.

Returns:
true if the core triggering is from external source.
unsigned int tcDspAwg::GetPhase ( void  )

Read back the current 24-bit phase value.

Returns:
The 24-bit phase value.
unsigned int tcDspAwg::GetPhaseIncrement ( void  )

Read back the current phase increment value.

Returns:
The current 24-bit phase increment per clock.
void tcDspAwg::CopyWaveform ( void  )
protected

Internal routine to copy the working waveform table to the FPGA core.

Note:
Currently, no support for a partial table load. The working table may be loaded in pieces, but sending the working table to the FPGA is always done in its entirety.
Returns:
None.

Member Data Documentation

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.


  
Generated on Mon Apr 22 2013 11:33:03 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.