Instances of this class handle sending, receiving, and configuring Quick DMA tranfers. More...
#include <core/DspQDMA.h>
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 tcDspQDMA * | GetInstance (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 tcDspQDMA * | gpDspQDMA = 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. |
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.
tcDspQDMA::tcDspQDMA | ( | void | ) | [protected] |
Constructor.
tcDspQDMA::~tcDspQDMA | ( | void | ) | [protected] |
Destructor.
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.
apHandle | Pointer to semaphore handle for notification of FIFO completion. Can be NULL. | |
apSRC | Source location, must be word aligned. | |
apDST | Destination location, must be word aligned | |
NumWords | Total number of words to transfer | |
anSize | specify:
| |
anPri | specify:
| |
abFromIsr | Set to true if being called from an HWI or SWI (default:false) |
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.
apHandle | Pointer to semaphore handle for notification of FIFO completion. Can be NULL. | |
apSRC | Source location, must be word aligned. | |
apDST | Destination location, must be word aligned | |
NumWords | Total number of words to transfer | |
anSize | specify:
| |
anPri | specify:
| |
abFromIsr | Set to true if being called from an HWI or SWI (default:false) |
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.
apHandle | Pointer to semaphore handle for notification of FIFO completion. Can be NULL. | |
apSRC | Source location, must be word aligned. | |
apDST | Destination location, must be word aligned | |
NumWords | Total number of words to transfer | |
anSize | specify:
| |
anPri | specify:
| |
abFromIsr | Set to true if being called from an HWI or SWI (default:false) |
int tcDspQDMA::AcquireChannel | ( | unsigned int & | anPri, | |
bool | abFromIsr | |||
) | [protected] |
Internal function.
This routine locates an available TCC code for use with the QDMA transfer.
anPri | The priority EDMA_OPT_PRI_HIGH, EDMA_OPT_PRI_LOW or EDMA_OPT_PRI_ANY | |
abFromIsr | True if function called from ISR space (default: false) |
void tcDspQDMA::QDMA_Channel_Handler | ( | int | anTcc | ) | [static, protected] |
Handler for Quick DMA complete.
[in] | anTcc | DMA channel number. |
void tcDspQDMA::QDMA_ISR_Handler | ( | void | ) | [static, protected] |
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.
const int MityDSP::tcDspQDMA::NUM_QDMA_CHANNELS = 6 [static] |
const unsigned int MityDSP::tcDspQDMA::EDMA_OPT_PRI_ANY = 0xFFFFFFFF [static] |
tcDspQDMA * tcDspQDMA::gpDspQDMA = NULL [static, protected] |
Singleton object.
volatile SEM_Handle * tcDspQDMA::ghDMADone [static, protected] |
Indicated QDMA transfer is complete.
volatile bool tcDspQDMA::maDMAActive [static, protected] |
Used to check SEMS are complete.
int tcDspQDMA::mnTcc [static, protected] |
EDMA channel assignments.
int tcDspQDMA::mnChannel [static, protected] |
Reverse EDMA to channel lookup.
SEM_Handle MityDSP::tcDspQDMA::mhThreadLock [protected] |
Semaphore to serialize access.