The tcDspRamBlock class is a virtual base class to provide consistent access to various firmware cores that adhere to the RAM Block interface. More...
#include <core/DspRamBlock.h>
Public Types | |
typedef void(* | tfIsrCallback )(unsigned int, tcDspRamBlock *) |
prototype for the ISR callback | |
typedef void(* | tfIsrCallbackWithArg )(unsigned int, tcDspRamBlock *, void *) |
Public Member Functions | |
tcDspRamBlock (void *apAddress, int anLevel=gnAutoLevel) | |
This constructor is used to create the base class functionality required for cores that adhere to the MityDSP RAM Block interface. | |
virtual | ~tcDspRamBlock () |
This destructor is used to close up and free tcDspRamBlock resources. | |
virtual bool | isDirty (unsigned int anId) |
Determine whether a given input block is dirty. | |
virtual int | getBlockWidth (void) |
Returns the width of the registers in the RAM block interface. | |
virtual void | writeBlock (unsigned int anId, unsigned int anValue) |
Writes the value at the specified RAM Block ID. | |
virtual unsigned int | readBlock (unsigned int anId) |
Reads the value at the specified RAM Block ID. | |
virtual void | interruptEnable (bool abEnable) |
Enables or disables the Block Dirty interrupt. | |
virtual void | registerIsrHandler (tfIsrCallback afCallback) |
Registers the user-supplied callback to be run whenever the Block Dirty interrupt occurs. | |
virtual void | registerIsrHandler (tfIsrCallbackWithArg afCallback, void *apUserArg=NULL) |
Registers the user-supplied callback to be run whenever the Block Dirty interrupt occurs. | |
Static Public Member Functions | |
static int | interrupt_dispatch (Arg arMyObject) |
Static interrupt dispatch routine. | |
Public Attributes | |
unsigned int | mnInterruptCount |
ISR counter (debug). | |
Static Public Attributes | |
static const int | gnNUM_RAM_BLOCKS = 16 |
Protected Member Functions | |
void | blockDirtyInterrupt (void) |
Interrupt service routine for RAM Block-based cores. | |
Protected Attributes | |
SEM_Handle | mhMutex |
Used to serialize access. | |
volatile unsigned int * | mpBaseAddr |
Core base address. | |
unsigned short | mnMyIntMask |
core interrupt mask | |
int | mnMyIntLevel |
core interrupt level | |
int | mnMyIntVector |
core interrupt vector | |
tfIsrCallback | mfIsrCallback |
ISR callbacks. | |
tfIsrCallbackWithArg | mfIsrCallbackWithArg |
ISR callback with user argument. | |
void * | mpUserArg |
User-supplied callback parameter. | |
int | mnBlockWidth |
RAM block data width (bytes). |
The tcDspRamBlock class is a virtual base class to provide consistent access to various firmware cores that adhere to the RAM Block interface.
In general, this class should be used to derive a specific class for a given device and should not be used directly.
typedef void(* MityDSP::tcDspRamBlock::tfIsrCallback)(unsigned int, tcDspRamBlock *) |
prototype for the ISR callback
typedef void(* MityDSP::tcDspRamBlock::tfIsrCallbackWithArg)(unsigned int, tcDspRamBlock *, void *) |
tcDspRamBlock::tcDspRamBlock | ( | void * | apAddress, | |
int | anLevel = gnAutoLevel | |||
) |
This constructor is used to create the base class functionality required for cores that adhere to the MityDSP RAM Block interface.
An interrupt level may be specified to install a chained ISR at the proper level, otherwise automatic interrupt vectoring is employed.
[in] | apAddress | Base Address of the RAM Block interface |
[in] | anLevel | Optional interrupt level parameter |
tcDspRamBlock::~tcDspRamBlock | ( | ) | [virtual] |
This destructor is used to close up and free tcDspRamBlock resources.
int tcDspRamBlock::interrupt_dispatch | ( | Arg | ahMyObject | ) | [static] |
Static interrupt dispatch routine.
Required because of the hidden this pointer associated with a member function, which cannot be passed directly to the interrupt dispatcher.
[in] | ahMyObject | The "this->" pointer for the instance of tcDspRamBlock associated with this ISR. |
bool tcDspRamBlock::isDirty | ( | unsigned int | anId | ) | [virtual] |
Determine whether a given input block is dirty.
[in] | anId | The input block ID being queried. |
int tcDspRamBlock::getBlockWidth | ( | void | ) | [virtual] |
Returns the width of the registers in the RAM block interface.
void tcDspRamBlock::writeBlock | ( | unsigned int | anId, | |
unsigned int | anValue | |||
) | [virtual] |
Writes the value at the specified RAM Block ID.
The width of the data actually written is determined by the data width reported in the block control register. The dirty flag associated with the output block ID is set after writing it.
[in] | anId | The output block ID being updated. |
[in] | anValue | The value to be stored at the specified block. |
unsigned int tcDspRamBlock::readBlock | ( | unsigned int | anId | ) | [virtual] |
Reads the value at the specified RAM Block ID.
The dirty flag associated with the value is cleared.
[in] | anId | The input block ID being requested. |
void tcDspRamBlock::interruptEnable | ( | bool | abEnable | ) | [virtual] |
Enables or disables the Block Dirty interrupt.
[in] | abEnable | True to enable interrupts. |
void tcDspRamBlock::registerIsrHandler | ( | tfIsrCallback | afCallback | ) | [virtual] |
Registers the user-supplied callback to be run whenever the Block Dirty interrupt occurs.
Caution should be used as this callback will execute in ISR context (no DSP/BIOS calls that can potentially block are allowed).
[in] | afCallback | Pointer to the callback routine (or NULL to disable callbacks. |
void tcDspRamBlock::registerIsrHandler | ( | tfIsrCallbackWithArg | afCallback, | |
void * | apUserArg = NULL | |||
) | [virtual] |
Registers the user-supplied callback to be run whenever the Block Dirty interrupt occurs.
Caution should be used as this callback will execute in ISR context (no DSP/BIOS calls that can potentially block are allowed).
[in] | afCallback | Pointer to the callback routine (or NULL to disable callbacks. |
[in] | apUserArg | An argument to be supplied with the callback. |
void tcDspRamBlock::blockDirtyInterrupt | ( | void | ) | [protected] |
Interrupt service routine for RAM Block-based cores.
The ISR reads and clears any pending interrupts. If the pending interrupt has a callback registered for it, the routine is called.
"Interrupt-ness" is taken care of by the 'dispatcher' in DSP/BIOS. Installed by the constructor.
const int MityDSP::tcDspRamBlock::gnNUM_RAM_BLOCKS = 16 [static] |
unsigned int MityDSP::tcDspRamBlock::mnInterruptCount |
ISR counter (debug).
SEM_Handle MityDSP::tcDspRamBlock::mhMutex [protected] |
Used to serialize access.
volatile unsigned int* MityDSP::tcDspRamBlock::mpBaseAddr [protected] |
Core base address.
unsigned short MityDSP::tcDspRamBlock::mnMyIntMask [protected] |
core interrupt mask
int MityDSP::tcDspRamBlock::mnMyIntLevel [protected] |
core interrupt level
int MityDSP::tcDspRamBlock::mnMyIntVector [protected] |
core interrupt vector
tfIsrCallback MityDSP::tcDspRamBlock::mfIsrCallback [protected] |
ISR callbacks.
ISR callback with user argument.
void* MityDSP::tcDspRamBlock::mpUserArg [protected] |
User-supplied callback parameter.
int MityDSP::tcDspRamBlock::mnBlockWidth [protected] |
RAM block data width (bytes).