Instances of this class create an interface to an ADS834x 16-bit analog to digital converter.
More...
#include <core/DspAdc834xMcBsp.h>
List of all members.
Public Member Functions |
| tcDspAdc834xMcBsp (int mnMcBSPDevNum, unsigned int anSCLKFreq_Hz=1000000, unsigned int anFSample_Hz=20000, bool abSingleEnded=true) |
| This constructor is used to open a tcDspAdc834xMcBsp interface with the the specified settings (optional).
|
| ~tcDspAdc834xMcBsp () |
| Default destructor.
|
unsigned int | GetSamples (int *apBuffer, int anNumWords, SEM_Handle ahHandle, int ChannelMask=0x0FF) |
| Get a sample from the ADC.
|
int | ContinuousCapture (int *apBuffer[2], int anWordsPerBuffer, SEM_Handle ahSemHandle, int ChannelMask=0x0FF) |
| Run ADC continuously into local ping/pong buffer.
|
void | AbortCapture (void) |
| Aborts a continuous capture cycle.
|
unsigned int | SampleRateHz (void) |
Static Protected Member Functions |
static void | DMA_Channel_Handler (int anTcc) |
| Handle a TCC complete code from an ongoing transfer.
|
Protected Attributes |
int | mnDevNum |
| the McBSP running port number
|
MCBSP_Handle | mhMcBSPHandle |
| CSL Handle to McBSP.
|
EDMA_Handle | mhEDMA_Tx |
| CSL handle to base Tx DMA.
|
EDMA_Handle | mhEDMA_Tx_pong |
| CSL handle to base Tx DMA pong transfer.
|
EDMA_Handle | mhEDMA |
| CSL handle to base DMA table (and ping transfer)
|
EDMA_Handle | mhEDMA_ping |
| CSL handle to ping transfer.
|
EDMA_Handle | mhEDMA_pong |
| CSL handle to pong transfer.
|
int | mnTcc |
| our allocated transfer complete code
|
int | mnTcc_Tx |
| our allocated Tx DMA transfer complete code
|
SEM_Handle | mhPingPong |
| semaphore handle to post for continous capture
|
volatile bool | mbAbortCapture |
| true when a continuous capture abort is pending
|
volatile bool | mbCCaptureRunning |
| true when a continuous capture is running
|
unsigned int * | mpTxDMAData |
| pointer to outbound control word DMA data
|
bool | mbSingleEnded |
| true when device is single ended (not differential)
|
unsigned int | mnSampleRateHz |
| our aggregate sampling rate
|
Detailed Description
Instances of this class create an interface to an ADS834x 16-bit analog to digital converter.
- See also:
- tcDspAdc834xMcBsp Page
Constructor & Destructor Documentation
tcDspAdc834xMcBsp::tcDspAdc834xMcBsp |
( |
int |
mnMcBSPDevNum, |
|
|
unsigned int |
anSCLKFreq_Hz = 1000000 , |
|
|
unsigned int |
anFSample_Hz = 20000 , |
|
|
bool |
abSingleEnded = true |
|
) |
| |
This constructor is used to open a tcDspAdc834xMcBsp interface with the the specified settings (optional).
- Parameters:
-
[in] | mnMcBSPDevNum | McBDSP Number as defined by CSL (MCBSP_DEV0 or MCBSP_DEV1 for MityDSP/XM) (CSL_MCBSP_0 or CSL_MCBSP_1 for MityDSP-PRO) |
[in] | anSCLKFreq_Hz | Desired chip SCLK rate, in Hz, Max 2.4 MHz (default 1 MHz) |
[in] | anFSample_Hz | Desired sample rate (aggregate), in Hz (default 20 KHz) |
[in] | abSingleEnded | When true, device is single ended (default true). |
- Note:
- The SCLK rate must be evenly divisible by the cpu_clock / 2 (or 4 for the PRO)
-
The anFSample_Hz must be at least 24 SCLKs.
Given a nominal CPU clock of 100 MHz,
- Running the SCLK at 12.5 MHz
- Running the Aggregate Sampling Rate at 20,000 Hz
- Returns:
- None.
- See also:
- DspAdc834xMcBsp.h
tcDspAdc834xMcBsp::~tcDspAdc834xMcBsp |
( |
| ) |
|
Default destructor.
- Returns:
- None.
Member Function Documentation
unsigned int tcDspAdc834xMcBsp::GetSamples |
( |
int * |
apBuffer, |
|
|
int |
anNumWords, |
|
|
SEM_Handle |
ahSemHandle, |
|
|
int |
ChannelMask = 0x0FF |
|
) |
| |
Get a sample from the ADC.
- Parameters:
-
[in] | apBuffer | Buffer to store the samples |
[in] | anNumWords | number of ADC samples to store into buffer, must be less than 65536 and greater than 0. |
[in] | ahSemHandle | Semaphore Handle that will be posted with transfer completes, if the Handle is NULL, then the operation will block until the transfer completes |
[in] | ChannelMask | Bit mask of channels to read. |
- Note:
- it would make sense to have the anNumWords evenly divisible by the anNumChannels specified in the constructor.
- Returns:
- the number of samples scheduled for a read
- See also:
- DspAdc834xMcBsp.h
int tcDspAdc834xMcBsp::ContinuousCapture |
( |
int * |
apBuffer[2], |
|
|
int |
anWordsPerBuffer, |
|
|
SEM_Handle |
ahSemHandle, |
|
|
int |
ChannelMask = 0x0FF |
|
) |
| |
Run ADC continuously into local ping/pong buffer.
- Parameters:
-
[in] | apBuffer | Buffers to store the samples (ping/pong style) |
[in] | anWordsPerBuffer | number of ADC samples to store into each buffer, must be less than 65536 and greater than 0. |
[in] | ahSemHandle | semaphore to post when ping/pong flip occurs |
[in] | ChannelMask | Bit mask of channels to read. |
- Note:
- it would make sense to have the anNumWords evenly divisible by the anNumChannels specified in the constructor.
- Returns:
- the value read from the ADC
- See also:
- DspAdc834xMcBsp.h
void tcDspAdc834xMcBsp::AbortCapture |
( |
void |
| ) |
|
Aborts a continuous capture cycle.
Should be called to terminate a continuous capture operation. Returns when DMA engine has beed disabled.
- See also:
- DspAdc834xMcBsp.h
unsigned int MityDSP::tcDspAdc834xMcBsp::SampleRateHz |
( |
void |
| ) |
|
|
inline |
void tcDspAdc834xMcBsp::DMA_Channel_Handler |
( |
int |
anTcc | ) |
|
|
staticprotected |
Handle a TCC complete code from an ongoing transfer.
- Parameters:
-
[in] | anTcc | transfer complete code from ISR handler |
- See also:
- DspAdc834xMcBsp.h
Member Data Documentation
int tcDspAdc834xMcBsp::mnNumOpenedMcBsps = 0 |
|
staticprotected |
int MityDSP::tcDspAdc834xMcBsp::mnDevNum |
|
protected |
the McBSP running port number
MCBSP_Handle MityDSP::tcDspAdc834xMcBsp::mhMcBSPHandle |
|
protected |
EDMA_Handle MityDSP::tcDspAdc834xMcBsp::mhEDMA_Tx |
|
protected |
CSL handle to base Tx DMA.
EDMA_Handle MityDSP::tcDspAdc834xMcBsp::mhEDMA_Tx_pong |
|
protected |
CSL handle to base Tx DMA pong transfer.
EDMA_Handle MityDSP::tcDspAdc834xMcBsp::mhEDMA |
|
protected |
CSL handle to base DMA table (and ping transfer)
EDMA_Handle MityDSP::tcDspAdc834xMcBsp::mhEDMA_ping |
|
protected |
CSL handle to ping transfer.
EDMA_Handle MityDSP::tcDspAdc834xMcBsp::mhEDMA_pong |
|
protected |
CSL handle to pong transfer.
int MityDSP::tcDspAdc834xMcBsp::mnTcc |
|
protected |
our allocated transfer complete code
int MityDSP::tcDspAdc834xMcBsp::mnTcc_Tx |
|
protected |
our allocated Tx DMA transfer complete code
SEM_Handle MityDSP::tcDspAdc834xMcBsp::mhPingPong |
|
protected |
semaphore handle to post for continous capture
volatile bool MityDSP::tcDspAdc834xMcBsp::mbAbortCapture |
|
protected |
true when a continuous capture abort is pending
volatile bool MityDSP::tcDspAdc834xMcBsp::mbCCaptureRunning |
|
protected |
true when a continuous capture is running
unsigned int* MityDSP::tcDspAdc834xMcBsp::mpTxDMAData |
|
protected |
pointer to outbound control word DMA data
bool MityDSP::tcDspAdc834xMcBsp::mbSingleEnded |
|
protected |
true when device is single ended (not differential)
unsigned int MityDSP::tcDspAdc834xMcBsp::mnSampleRateHz |
|
protected |
our aggregate sampling rate