MityDSP::tcDspAdc834xMcBsp Class Reference
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.
Classes |
struct | tsTccMap |
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
|
Static Protected Attributes |
static tsTccMap | maTccMap [_MCBSP_PORT_CNT] |
static int | mnNumOpenedMcBsps = 0 |
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 |
) |
[static, protected] |
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
the McBSP running port number
CSL handle to base Tx DMA.
CSL handle to base Tx DMA pong transfer.
CSL handle to base DMA table (and ping transfer).
CSL handle to ping transfer.
CSL handle to pong transfer.
our allocated transfer complete code
our allocated Tx DMA transfer complete code
semaphore handle to post for continous capture
true when a continuous capture abort is pending
true when a continuous capture is running
pointer to outbound control word DMA data
true when device is single ended (not differential)
our aggregate sampling rate