MityDSP Documentation Index

MityDSP::tcDspTimingGenerator Class Reference

The tcDspTimingGenerator class is used to interface to the MityDSP Timing Generator core. More...

#include <core/DspTimingGenerator.h>

List of all members.

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

Detailed Description

The tcDspTimingGenerator class is used to interface to the MityDSP Timing Generator core.

See also:
tcDspTimingGenerator Page

Member Typedef Documentation

typedef void(* MityDSP::tcDspTimingGenerator::tfIsrCallback)(int anPayloadBit)

prototype for the ISR callbacks.

typedef void(* MityDSP::tcDspTimingGenerator::tfIsrCallbackWithArg)(int anPayloadBit, void *apUserArg)

Member Enumeration Documentation

This enumeration defines the timing generator valid OpCodes.

Enumerator:
meJUMP 

JUMP to JUMP Address.

meREPEAT 

REPEAT FOR N Counts.

meSETA 

SET Loop Counter A.

meSETB 

SET Loop Counter B.

meLOOPA 

Decrement branch loop counter A.

meLOOPB 

Decrement branch loop counter B.

meCALL 

Call subroutine.

meRETURN 

Return.


Constructor & Destructor Documentation

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.

Parameters:
[in] apAddress - Base Address of Counter core
[in] anLevel - Optional interrupt level parameter
Returns:
None.
See also:
DspTimingGenerator.h
DspIntDispatch.h
tcDspTimingGenerator::~tcDspTimingGenerator (  ) 

This destructor is used to close up and free tcDspTimingGenerator resources.

Returns:
None.
See also:
DspTimingGenerator.h

Member Function Documentation

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).

Parameters:
[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.
Note:
abClearAndTrapPC requires that MicroCode address position 0 is reserved (i.e., microcode should not be loaded at this position).
Returns:
Non-Zero on Error.
See also:
DspTimingGenerator.h
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.

Parameters:
[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
Returns:
None.
See also:
DspTimingGenerator.h
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.

Parameters:
[in] DefaultPayload optional, default payload to use when loading the data...
[in] TrapTablePos optional, default alternate jump location to use for filling call.
Returns:
None.
See also:
DspTimingGenerator.h
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.

Parameters:
[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.
Note:
The decoding process will stop upon detection of an invalid opcode
Returns:
false if invalid microcode instructions are detected
See also:
DspTimingGenerator.h
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.

Parameters:
[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.
Note:
The decoding process will stop upon detection of an invalid opcode
Returns:
false if invalid microcode instructions are detected
See also:
DspTimingGenerator.h
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.

Parameters:
[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
Returns:
0 on success
See also:
DspTimingGenerator.h
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.

Parameters:
[in] arMyObject pointer to a tcDspTimingGenerator associated with the interrupt.
Returns:
0
See also:
DspTimingGenerator.h
bool tcDspTimingGenerator::getInterruptEnable ( unsigned int  anBit  ) 

Gets it interrupt enable status of the given payload bit.

Parameters:
[in] anBit bit for requested status (0 to gnMAX_PAYLOAD-1)
Returns:
true if the interrupt is enabled, false if not
See also:
DspTimingGenerator.h
void tcDspTimingGenerator::setInterruptEnable ( unsigned int  anBit,
bool  abEnable 
)

Sets interrupt enable for a given payload bit.

Parameters:
[in] anBit bit for payload interrupt enable (0 to gnMAX_PAYLOAD-1)
[in] abEnable true to enable the interrupt, false to disable it.
Returns:
None.
See also:
DspTimingGenerator.h
void tcDspTimingGenerator::registerIsrHandler ( unsigned int  anBit,
tfIsrCallback  afCallback 
)

Sets interrupt enable for a given payload bit.

Parameters:
[in] anBit Payload bit interrupt handler should be associated to.
[in] afCallback ISR to handle the callback
Note:
only one ISR per payload bit is allowed. Setting this ISR overrides any existing ISR handler. Set this to NULL to clear an ISR.
Returns:
None.
See also:
DspTimingGenerator.h
void tcDspTimingGenerator::registerIsrHandler ( unsigned int  anBit,
tfIsrCallbackWithArg  afCallback,
void *  apUserArg = NULL 
)

Sets interrupt enable for a given payload bit.

Parameters:
[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.
Note:
only one ISR per payload bit is allowed. Setting this ISR overrides any existing ISR handler. Set this to NULL to clear an ISR.
Returns:
None.
See also:
DspTimingGenerator.h
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.

Note:
The tcDspTimingGenerator class does not provide for individual override control over the payload bits. Users of this API must manage the override state of all the bits and apply them all each time a state change is necessary.
Parameters:
[in] anOverrideMask 16 bit mask enabling overrides for each payload pin
[in] anOverrideValue 16 bit mask applicable to bits set in anOverrideMask
Returns:
0 on success
See also:
DspTimingGenerator.h
void tcDspTimingGenerator::HandleInterrupt ( void   )  [protected]

Interrupt Handler.

Returns:
None
See also:
DspTimingGenerator.h

Member Data Documentation

const unsigned int MityDSP::tcDspTimingGenerator::gnMAX_PAYLOAD = 16 [static]

payload size

ISR counter (debug).

to serialize access

volatile unsigned int* MityDSP::tcDspTimingGenerator::mpBaseAddr [protected]

core base address

unsigned short MityDSP::tcDspTimingGenerator::mnMyIntMask [protected]

core interrupt mask.

core interrupt level.

core interrupt vector.

ISR callback.

ISR callback w/user argument.

user-supplied callback argument

interrupt enables

when true, PC should be trapped

unsigned int MityDSP::tcDspTimingGenerator::mnAddr [protected]

number of Block Ram words

copy of our version info

maximum working alternate jump table size


  
Generated on Fri Sep 23 16:33:56 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.