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

Instances of this class create an interface to an ADS1278 24-bit analog to digital converter. More...

#include <core/DspAdc1278.h>

List of all members.

Classes

struct  tsTccMap

Public Member Functions

 tcDspAdc1278 (int mnMcBSPDevNum, unsigned int anSCLKFreq_Hz, unsigned int anFSample_Hz, int anNumChannels)
 This constructor is used to open a tcDspAdc1278 interface with the the specified settings (optional).
 ~tcDspAdc1278 ()
 Default destructor.
unsigned int GetSamples (int *apBuffer, int anNumWords, SEM_Handle ahHandle)
 Get a sample from the ADC.
int ContinuousCapture (int *apBuffer[2], int anWordsPerBuffer, SEM_Handle ahSemHandle)
 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
 CSL handle to base DMA table.
EDMA_Handle mhEDMA_pong
 CSL handle to pong transfer.
EDMA_Handle mhEDMA_ping
 CSL handle to ping transfer.
int mnTcc
 our allocated transfer complete code
int mnNumChannels
 number of channels collected during operation
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 mnSampleRateHz
 our 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 ADS1278 24-bit analog to digital converter.

See also:
tcDspAdc1278 Page

Constructor & Destructor Documentation

tcDspAdc1278::tcDspAdc1278 ( int  mnMcBSPDevNum,
unsigned int  anSCLKFreq_Hz,
unsigned int  anFSample_Hz,
int  anNumChannels 
)

This constructor is used to open a tcDspAdc1278 interface with the the specified settings (optional).

Parameters:
[in]mnMcBSPDevNumMcBDSP 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_HzDesired chip SCLK rate, in Hz
[in]anFSample_HzDesired sample rate (per channel), in Hz
[in]anNumChannelsNumber of channels read per sample (minimum 1)
Note:
The SCLK rate should be evenly divisible by the ADC CLK rate.
The anFSample_Hz must be at least 256 ADC CLKs.
The SCLK should be evenly divisible by the anFSample_Hz rate

An example to accomplish a 20,000 Hz sampling rate would include:

  • Running the ADC clock at 25 MHz.
  • Running the SCLK at 25 MHz
  • Running the Sampling Rate at 20,000 Hz
Returns:
None.
See also:
DspAdc1278.h
tcDspAdc1278::~tcDspAdc1278 ( )

Default destructor.

Returns:
None.

Member Function Documentation

unsigned int tcDspAdc1278::GetSamples ( int *  apBuffer,
int  anNumWords,
SEM_Handle  ahSemHandle 
)

Get a sample from the ADC.

Parameters:
[in]apBufferBuffer to store the samples
[in]anNumWordsnumber of ADC samples to store into buffer, must be less than 65536 and greater than 0.
[in]ahSemHandleSemaphore Handle that will be posted with transfer completes, if the Handle is NULL, then the operation will block until the transfer completes
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:
DspAdc1278.h
int tcDspAdc1278::ContinuousCapture ( int *  apBuffer[2],
int  anWordsPerBuffer,
SEM_Handle  ahSemHandle 
)

Run ADC continuously into local ping/pong buffer.

Parameters:
[in]apBufferBuffers to store the samples (ping/pong style)
[in]anWordsPerBuffernumber of ADC samples to store into each buffer, must be less than 65536 and greater than 0.
[in]ahSemHandlesemaphore to post when ping/pong flip occurs
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:
DspAdc1278.h
void tcDspAdc1278::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:
DspAdc1278.h
unsigned int MityDSP::tcDspAdc1278::SampleRateHz ( void  )
inline
void tcDspAdc1278::DMA_Channel_Handler ( int  anTcc)
staticprotected

Handle a TCC complete code from an ongoing transfer.

Parameters:
[in]anTcctransfer complete code from ISR handler
See also:
DspAdc1278.h

Member Data Documentation

tcDspAdc1278::tsTccMap tcDspAdc1278::maTccMap
staticprotected
int tcDspAdc1278::mnNumOpenedMcBsps = 0
staticprotected
int MityDSP::tcDspAdc1278::mnDevNum
protected

the McBSP running port number

MCBSP_Handle MityDSP::tcDspAdc1278::mhMcBSPHandle
protected

CSL Handle to McBSP.

EDMA_Handle MityDSP::tcDspAdc1278::mhEDMA
protected

CSL handle to base DMA table.

EDMA_Handle MityDSP::tcDspAdc1278::mhEDMA_pong
protected

CSL handle to pong transfer.

EDMA_Handle MityDSP::tcDspAdc1278::mhEDMA_ping
protected

CSL handle to ping transfer.

int MityDSP::tcDspAdc1278::mnTcc
protected

our allocated transfer complete code

int MityDSP::tcDspAdc1278::mnNumChannels
protected

number of channels collected during operation

SEM_Handle MityDSP::tcDspAdc1278::mhPingPong
protected

semaphore handle to post for continous capture

volatile bool MityDSP::tcDspAdc1278::mbAbortCapture
protected

true when a continuous capture abort is pending

volatile bool MityDSP::tcDspAdc1278::mbCCaptureRunning
protected

true when a continuous capture is running

unsigned int MityDSP::tcDspAdc1278::mnSampleRateHz
protected

our sampling rate


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