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

Instances of this class handle sending, receiving, and configuring Quick DMA tranfers. More...

#include <core/DspQDMA.h>

List of all members.

Public Member Functions

int ReadFromFIFO (SEM_Handle *apHandle, void *apSRC, void *apDST, unsigned short NumWords, unsigned int anSize=EDMA_OPT_ESIZE_32BIT, unsigned int anPri=EDMA_OPT_PRI_HIGH, bool apFromIsr=false)
 Reads data from a FIFO to contiguous block of memory.
int WriteToFIFO (SEM_Handle *apHandle, void *apSRC, void *apDST, unsigned short NumWords, unsigned int anSize=EDMA_OPT_ESIZE_32BIT, unsigned int anPri=EDMA_OPT_PRI_HIGH, bool apFromIsr=false)
 Writes data from a contiguous block of memory to a FIFO (single address endpoint).
int BlockTransfer (SEM_Handle *apHandle, void *apSRC, void *apDST, unsigned short NumWords, unsigned int anSize=EDMA_OPT_ESIZE_32BIT, unsigned int anPri=EDMA_OPT_PRI_HIGH, bool apFromIsr=false)
 Transfer a contiguous block of data from one location to another.

Static Public Member Functions

static tcDspQDMAGetInstance (void)
 Single accessor.

Static Public Attributes

static const int NUM_QDMA_CHANNELS = 6
static const unsigned int EDMA_OPT_PRI_ANY = 0xFFFFFFFF

Protected Member Functions

int AcquireChannel (unsigned int &anPri, bool apFromIsr)
 Internal function.
 tcDspQDMA (void)
 Constructor.
 ~tcDspQDMA (void)
 Destructor.

Static Protected Member Functions

static void QDMA_Channel_Handler (int anTcc)
 Handler for Quick DMA complete.
static void QDMA_ISR_Handler (void)
 QDMA interrupt handler.

Protected Attributes

SEM_Handle mhThreadLock
 Semaphore to serialize access.

Static Protected Attributes

static tcDspQDMAgpDspQDMA = NULL
 Singleton object.
static volatile SEM_Handle * ghDMADone [6]
 Indicated QDMA transfer is complete.
static volatile bool maDMAActive [6]
 Used to check SEMS are complete.
static int mnTcc [NUM_QDMA_CHANNELS]
 EDMA channel assignments.
static int mnChannel [EDMA_CHA_CNT]
 Reverse EDMA to channel lookup.

Detailed Description

Instances of this class handle sending, receiving, and configuring Quick DMA tranfers.

This class installs an ISR and should be used for all application quick DMA transfer requests.

See also:
tcDspQDMA Page

Constructor & Destructor Documentation

tcDspQDMA::tcDspQDMA ( void  )
protected

Constructor.

tcDspQDMA::~tcDspQDMA ( void  )
protected

Destructor.


Member Function Documentation

tcDspQDMA * tcDspQDMA::GetInstance ( void  )
static

Single accessor.

int tcDspQDMA::ReadFromFIFO ( SEM_Handle *  apHandle,
void *  apSRC,
void *  apDST,
unsigned short  NumWords,
unsigned int  anSize = EDMA_OPT_ESIZE_32BIT,
unsigned int  anPri = EDMA_OPT_PRI_HIGH,
bool  abFromIsr = false 
)

Reads data from a FIFO to contiguous block of memory.

Parameters:
apHandlePointer to semaphore handle for notification of FIFO completion. Can be NULL.
apSRCSource location, must be word aligned.
apDSTDestination location, must be word aligned
NumWordsTotal number of words to transfer
anSizespecify:
  • EDMA_OPT_ESIZE_8BIT
  • EDMA_OPT_ESIZE_32BIT
  • EDMA_OPT_ESIZE_16BIT
anPrispecify:
  • EDMA_OPT_PRI_HIGH
  • EDMA_OPT_PRI_LOW
  • EDMA_OPT_PRI_ANY
abFromIsrSet to true if being called from an HWI or SWI (default:false)
Warning:
This function does not manage system caches. The user should consider calling a CACHE_InvL2() or CACHE_wbInvL1() as required.
Returns:
Less than zero if a failure occurred (no DMA available)
int tcDspQDMA::WriteToFIFO ( SEM_Handle *  apHandle,
void *  apSRC,
void *  apDST,
unsigned short  NumWords,
unsigned int  anSize = EDMA_OPT_ESIZE_32BIT,
unsigned int  anPri = EDMA_OPT_PRI_HIGH,
bool  abFromIsr = false 
)

Writes data from a contiguous block of memory to a FIFO (single address endpoint).

Data must be contiguously packed in memory.

Parameters:
apHandlePointer to semaphore handle for notification of FIFO completion. Can be NULL.
apSRCSource location, must be word aligned.
apDSTDestination location, must be word aligned
NumWordsTotal number of words to transfer
anSizespecify:
  • EDMA_OPT_ESIZE_8BIT
  • EDMA_OPT_ESIZE_32BIT
  • EDMA_OPT_ESIZE_16BIT
anPrispecify:
  • EDMA_OPT_PRI_HIGH
  • EDMA_OPT_PRI_LOW
  • EDMA_OPT_PRI_ANY
abFromIsrSet to true if being called from an HWI or SWI (default:false)
Warning:
This function does not manage system caches. The user should consider calling a CACHE_InvL2() or CACHE_wbInvL1() as required.
Returns:
Less than zero if a failure occurred (no DMA available)
int tcDspQDMA::BlockTransfer ( SEM_Handle *  apHandle,
void *  apSRC,
void *  apDST,
unsigned short  NumWords,
unsigned int  anSize = EDMA_OPT_ESIZE_32BIT,
unsigned int  anPri = EDMA_OPT_PRI_HIGH,
bool  abFromIsr = false 
)

Transfer a contiguous block of data from one location to another.

Words must be packed.

Parameters:
apHandlePointer to semaphore handle for notification of FIFO completion. Can be NULL.
apSRCSource location, must be word aligned.
apDSTDestination location, must be word aligned
NumWordsTotal number of words to transfer
anSizespecify:
  • EDMA_OPT_ESIZE_8BIT
  • EDMA_OPT_ESIZE_32BIT
  • EDMA_OPT_ESIZE_16BIT
anPrispecify:
  • EDMA_OPT_PRI_HIGH
  • EDMA_OPT_PRI_LOW
  • EDMA_OPT_PRI_ANY
abFromIsrSet to true if being called from an HWI or SWI (default:false)
Warning:
This function does not manage system caches. The user should consider calling a CACHE_InvL2() or CACHE_wbInvL1() as required.
Returns:
Less than zero if a failure occurred (no DMA available)
int tcDspQDMA::AcquireChannel ( unsigned int &  anPri,
bool  abFromIsr 
)
protected

Internal function.

This routine locates an available TCC code for use with the QDMA transfer.

Parameters:
anPriThe priority EDMA_OPT_PRI_HIGH, EDMA_OPT_PRI_LOW or EDMA_OPT_PRI_ANY
abFromIsrTrue if function called from ISR space (default: false)
Returns:
the index (0 to 5) to use or non-zero
void tcDspQDMA::QDMA_Channel_Handler ( int  anTcc)
staticprotected

Handler for Quick DMA complete.

Parameters:
[in]anTccDMA channel number.
Returns:
None.
void tcDspQDMA::QDMA_ISR_Handler ( void  )
staticprotected

QDMA interrupt handler.

The EDMA library does not auto-install the interrupt dispatcher, so we'll install it here. A couple of notes: The interrupt dispatcher clears the CIPR register before it calls the corresponding channel handler. This is sort of bad, because corresponding handlers can't be written to deal with multiple channel events (as they can't figure out which event fired the handler).

Rather then creating a slightly smarter handler, we chose to use the EDMA_ library approach to support other applications which might want to use the EDMA_intHook() type interface.


Member Data Documentation

const int MityDSP::tcDspQDMA::NUM_QDMA_CHANNELS = 6
static
const unsigned int MityDSP::tcDspQDMA::EDMA_OPT_PRI_ANY = 0xFFFFFFFF
static
tcDspQDMA * tcDspQDMA::gpDspQDMA = NULL
staticprotected

Singleton object.

volatile SEM_Handle * tcDspQDMA::ghDMADone
staticprotected

Indicated QDMA transfer is complete.

volatile bool tcDspQDMA::maDMAActive
staticprotected

Used to check SEMS are complete.

int tcDspQDMA::mnTcc
staticprotected

EDMA channel assignments.

int tcDspQDMA::mnChannel
staticprotected

Reverse EDMA to channel lookup.

SEM_Handle MityDSP::tcDspQDMA::mhThreadLock
protected

Semaphore to serialize access.


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