The tcDspTimingGenerator class is used to interface to the MityDSP Timing Generator core. More...
#include <core/DspTimingGenerator.h>
Classes | |
union | tuOpCode |
This union defines the timing generator OpCode RAM vector that is used to generate patterns by the internal state machine. More... | |
Public Types | |
enum | eeOpCode { meJUMP = 0, meREPEAT = 1, meSETA = 2, meSETB = 3, meLOOPA = 4, meLOOPB = 5, meCALL = 6, meRETURN = 7 } |
This enumeration defines the timing generator valid OpCodes. More... | |
typedef void(* | tfIsrCallback )(int anPayloadBit) |
prototype for the ISR callbacks. | |
typedef void(* | tfIsrCallbackWithArg )(int anPayloadBit, void *apUserArg) |
Public Member Functions | |
tcDspTimingGenerator (void *apBaseAddr, int anLevel=gnAutoLevel) | |
This constructor is used to create an interface to the MityDSP timing generator core located at the specified base address. | |
~tcDspTimingGenerator () | |
This destructor is used to close up and free tcDspTimingGenerator resources. | |
int | LoadMicroCode (unsigned int StartWord, unsigned int NumWords, tuOpCode *apCode, bool abClearAndTrapPC=false, bool TrapTablePos=0) |
This routine will load Timing Generator MicroCode to the timing generator core at the specified starting location. | |
void | SetJumpAddress (unsigned int TablePos, unsigned int JumpAddress) |
This routine Sets the PC alternate jump address (used by the meJUMP instruction) at location TablePos to the address specified by JumpAddress. | |
void | ClearAndTrapPC (unsigned int DefaultPayload=0, bool TrapTablePos=false) |
This routine clears the timing generator opcode memory with meJUMP instructions pointing to address 0 using an alternate jump address specified by TrapTablePos and a payload of DefaultPayload. | |
bool | DecodeMicroCode (unsigned int NumWords, tuOpCode *apCode, bool abPrint=true) |
This is a debug utility that will decode and optionally print the provided microcode to the tcDspError::report() method using the debug level. | |
bool | DecodeMicroCode (bool abPrint=true) |
This is a debug utility that will decode and optionally print the microcode loaded in the Timing Generator Code to the tcDspError::report() method using the debug level. | |
int | ReadMicroCode (unsigned int StartWord, unsigned int NumWords, tuOpCode *apCode) |
This method will extract the microcode currently loaded into the TimingGenerator memory to a locally allocated buffer. | |
bool | getInterruptEnable (unsigned int anBit) |
Gets it interrupt enable status of the given payload bit. | |
void | setInterruptEnable (unsigned int anBit, bool abEnable) |
Sets interrupt enable for a given payload bit. | |
void | registerIsrHandler (unsigned int anBit, tfIsrCallback afCallback) |
Sets interrupt enable for a given payload bit. | |
void | registerIsrHandler (unsigned int anBit, tfIsrCallbackWithArg afCallback, void *apUserArg=NULL) |
Sets interrupt enable for a given payload bit. | |
int | getProgramSize (void) |
int | SetPayloadOverride (unsigned short anOverrideMask, unsigned short anOverrideValue) |
This method provides the capability to override the tming generator payload output bits with a DSP controlled output. | |
Static Public Member Functions | |
static int | interrupt_dispatch (Arg arMyObject) |
Interrupt dispatch routine (static). | |
Public Attributes | |
unsigned int | mnInterruptCount |
ISR counter (debug). | |
Static Public Attributes | |
static const unsigned int | gnMAX_PAYLOAD = 16 |
payload size | |
Protected Member Functions | |
void | HandleInterrupt (void) |
Interrupt Handler. | |
Protected Attributes | |
SEM_Handle | mhMyMutex |
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 [gnMAX_PAYLOAD] |
ISR callback. | |
tfIsrCallbackWithArg | mfIsrCallbackWithArg [gnMAX_PAYLOAD] |
ISR callback w/user argument. | |
void * | mpUserArg [gnMAX_PAYLOAD] |
user-supplied callback argument | |
bool | mbIntEnabled [gnMAX_PAYLOAD] |
interrupt enables | |
bool | mbIsTrapped |
when true, PC should be trapped | |
unsigned int | mnAddr |
unsigned int | mnNumWords |
number of Block Ram words | |
tuFirmwareVersion | muVersion |
copy of our version info | |
unsigned int | mnMaxAltJumpPos |
maximum working alternate jump table size |
The tcDspTimingGenerator class is used to interface to the MityDSP Timing Generator core.
typedef void(* MityDSP::tcDspTimingGenerator::tfIsrCallback)(int anPayloadBit) |
prototype for the ISR callbacks.
typedef void(* MityDSP::tcDspTimingGenerator::tfIsrCallbackWithArg)(int anPayloadBit, void *apUserArg) |
This enumeration defines the timing generator valid OpCodes.
tcDspTimingGenerator::tcDspTimingGenerator | ( | void * | apAddress, | |
int | anLevel = gnAutoLevel | |||
) |
This constructor is used to create an interface to the MityDSP timing generator core located at the specified base address.
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 Counter core |
[in] | anLevel | - Optional interrupt level parameter |
tcDspTimingGenerator::~tcDspTimingGenerator | ( | ) |
This destructor is used to close up and free tcDspTimingGenerator resources.
int tcDspTimingGenerator::LoadMicroCode | ( | unsigned int | StartWord, | |
unsigned int | NumWords, | |||
tuOpCode * | apCode, | |||
bool | abClearAndTrapPC = false , |
|||
bool | TrapTablePos = 0 | |||
) |
This routine will load Timing Generator MicroCode to the timing generator core at the specified starting location.
The routine will, if specified, automatically clear the Timing Generator memory and trap the PC to the last location in the Timing Generator memory. (see the ClearAndTrapPC() method below).
[in] | StartWord | Address of Timing Generator RAM to begin the load, range 0 to getProgramSize()-1. |
[in] | NumWords | Number of microcode words to load to RAM. Range is from 1 to getProgramSize()-StartWord. |
[in] | apCode | Pointer to MicroCode to load (length NumWords) |
[in] | abClearAndTrapPC | When true, the Timing Generator RAM will be cleared (using all zeros) forcing the timing generator program counter to a "tight loop" at address 0, using the alternate jump address pointer specified by TrapTablePos. |
[in] | TrapTablePos | If ClearAndTrapPC is set, this number specifies the alternate jump position that must be written in order to move the PC from address 0. |
void tcDspTimingGenerator::SetJumpAddress | ( | unsigned int | TablePos, | |
unsigned int | JumpAddress | |||
) |
This routine Sets the PC alternate jump address (used by the meJUMP instruction) at location TablePos to the address specified by JumpAddress.
The altername jump table is a write-once-clear-once operation. Using the alternate jump address more than one time requires a separate write for each alternate jump operation.
[in] | TablePos | Alternate Jump location (0 to 7) |
[in] | JumpAddress | 9 bit address the PC should be set to upon hitting a meJUMP opcode with the specified alternate jump location |
void tcDspTimingGenerator::ClearAndTrapPC | ( | unsigned int | DefaultPayload = 0 , |
|
bool | TrapTablePos = false | |||
) |
This routine clears the timing generator opcode memory with meJUMP instructions pointing to address 0 using an alternate jump address specified by TrapTablePos and a payload of DefaultPayload.
[in] | DefaultPayload | optional, default payload to use when loading the data... |
[in] | TrapTablePos | optional, default alternate jump location to use for filling call. |
bool tcDspTimingGenerator::DecodeMicroCode | ( | unsigned int | NumWords, | |
tuOpCode * | apCode, | |||
bool | abPrint = true | |||
) |
This is a debug utility that will decode and optionally print the provided microcode to the tcDspError::report() method using the debug level.
The primary use of this function is to verify microcode instructions during development of a timing generation system.
[in] | NumWords | number of microcode words to decode |
[in] | apCode | Code location of microcode |
[in] | abPrint | [default true] if true, decoded data will be dumped to the tcDspError::report method. Else silent. Useful if microcode validation is desired without displaying valid opcodes. |
bool tcDspTimingGenerator::DecodeMicroCode | ( | bool | abPrint = true |
) |
This is a debug utility that will decode and optionally print the microcode loaded in the Timing Generator Code to the tcDspError::report() method using the debug level.
The primary use of this function is to verify microcode instructions during development of a timing generation system.
[in] | abPrint | [default true] if true, decoded data will be dumped to the tcDspError::report method. Else silent. Useful if microcode validation is desired without displaying valid opcodes. |
int tcDspTimingGenerator::ReadMicroCode | ( | unsigned int | StartWord, | |
unsigned int | NumWords, | |||
tuOpCode * | apCode | |||
) |
This method will extract the microcode currently loaded into the TimingGenerator memory to a locally allocated buffer.
[in] | StartWord | location in memory to start the read |
[in] | NumWords | number of microcode words (32 bits) to read |
[in] | apCode | location to store microcode |
int tcDspTimingGenerator::interrupt_dispatch | ( | Arg | arMyObject | ) | [static] |
Interrupt dispatch routine (static).
This routine captures interrupts from the Timing Generator core and dispatches the appropriate object to handle them. Works around the fact that a tcFirmware callback must be static.
[in] | arMyObject | pointer to a tcDspTimingGenerator associated with the interrupt. |
bool tcDspTimingGenerator::getInterruptEnable | ( | unsigned int | anBit | ) |
Gets it interrupt enable status of the given payload bit.
[in] | anBit | bit for requested status (0 to gnMAX_PAYLOAD-1) |
void tcDspTimingGenerator::setInterruptEnable | ( | unsigned int | anBit, | |
bool | abEnable | |||
) |
Sets interrupt enable for a given payload bit.
[in] | anBit | bit for payload interrupt enable (0 to gnMAX_PAYLOAD-1) |
[in] | abEnable | true to enable the interrupt, false to disable it. |
void tcDspTimingGenerator::registerIsrHandler | ( | unsigned int | anBit, | |
tfIsrCallback | afCallback | |||
) |
Sets interrupt enable for a given payload bit.
[in] | anBit | Payload bit interrupt handler should be associated to. |
[in] | afCallback | ISR to handle the callback |
void tcDspTimingGenerator::registerIsrHandler | ( | unsigned int | anBit, | |
tfIsrCallbackWithArg | afCallback, | |||
void * | apUserArg = NULL | |||
) |
Sets interrupt enable for a given payload bit.
[in] | anBit | Payload bit interrupt handler should be associated to. |
[in] | afCallback | ISR to handle the callback |
[in] | apUserArg | An argument to be supplied with the callback. |
int MityDSP::tcDspTimingGenerator::getProgramSize | ( | void | ) | [inline] |
int tcDspTimingGenerator::SetPayloadOverride | ( | unsigned short | anOverrideMask, | |
unsigned short | anOverrideValue | |||
) |
This method provides the capability to override the tming generator payload output bits with a DSP controlled output.
Override outputs will be applied on the next valid clock cycle controlling the timing generator payload logic. By default, all 16 payload bits of the timing generator are controlled by the timing generator state machine.
[in] | anOverrideMask | 16 bit mask enabling overrides for each payload pin |
[in] | anOverrideValue | 16 bit mask applicable to bits set in anOverrideMask |
void tcDspTimingGenerator::HandleInterrupt | ( | void | ) | [protected] |
const unsigned int MityDSP::tcDspTimingGenerator::gnMAX_PAYLOAD = 16 [static] |
payload size
unsigned int MityDSP::tcDspTimingGenerator::mnInterruptCount |
ISR counter (debug).
SEM_Handle MityDSP::tcDspTimingGenerator::mhMyMutex [protected] |
to serialize access
volatile unsigned int* MityDSP::tcDspTimingGenerator::mpBaseAddr [protected] |
core base address
unsigned short MityDSP::tcDspTimingGenerator::mnMyIntMask [protected] |
core interrupt mask.
int MityDSP::tcDspTimingGenerator::mnMyIntLevel [protected] |
core interrupt level.
int MityDSP::tcDspTimingGenerator::mnMyIntVector [protected] |
core interrupt vector.
ISR callback.
ISR callback w/user argument.
void* MityDSP::tcDspTimingGenerator::mpUserArg[gnMAX_PAYLOAD] [protected] |
user-supplied callback argument
bool MityDSP::tcDspTimingGenerator::mbIntEnabled[gnMAX_PAYLOAD] [protected] |
interrupt enables
bool MityDSP::tcDspTimingGenerator::mbIsTrapped [protected] |
when true, PC should be trapped
unsigned int MityDSP::tcDspTimingGenerator::mnAddr [protected] |
unsigned int MityDSP::tcDspTimingGenerator::mnNumWords [protected] |
number of Block Ram words
copy of our version info
unsigned int MityDSP::tcDspTimingGenerator::mnMaxAltJumpPos [protected] |
maximum working alternate jump table size