Instances of this class handle. More...
#include <core/DspCameraLink.h>
Classes | |
struct | tsFrameDataNotify |
This structure is the mailbox message structure passed up by the FrameCapture logic to calling applications. More... | |
union | tuFrameData |
This union represents the camera link FIFO data. More... | |
Public Member Functions | |
tcDspCameraLink (void *apAddress, int anThreadPrio=8, int anFrameRows=1, int anFrameCols=1024) | |
This constructor is used to open a DspCameraLink interface with the specified settings (optional). | |
virtual | ~tcDspCameraLink () |
This destructor is used to close up and free the resources tied to the associated Camera Link interface. | |
virtual int | SetImageSize (int anFrameRows, int anFrameCols) |
Sets the Frame/Image size for subsequent captures expected on the LVDS link. | |
virtual int | CaptureFrames (char *apCaptureBuffer, unsigned int anBufferSize, MBX_Handle ahCapturePost, int anNumFrames, int anNumFramesPerSemPost, void *apUserData=NULL) |
Initiate a frame capture cycle. | |
virtual int | AbortCapture (bool abFlush=false) |
Aborts an ongoing frame capture cycle. | |
virtual int | GetFIFODepth (void) |
Retrieves the current number of 32 bit samples available on the receive FIFO for the camera link interface. | |
virtual void | GetImageSize (int &arFrameRows, int &arFrameCols) |
Get the current image size. | |
virtual int | SetPacked (bool IsPacked) |
Sets the Camera Link interface to packing mode for data samples less than 16 bits in width. | |
virtual bool | GetPacked (void) |
Gets the current packing mode of the camera link interface. | |
virtual int | SetFrameBitsMask (bool ApplyMask) |
This method allows data words to have the frame and line strobe bits masked to zero in the FIFO data words. | |
virtual bool | GetFrameBitsMasked (void) |
Returns the Frame and Line bits masking state of the camera link interface. | |
virtual bool | IsFIFOEmpty (void) |
Determine the FIFO empty status. | |
virtual int | GetNumPixelsPerFrame (void) |
Returns number of pixels capture per frame as seen on link interface. | |
virtual int | GetNumTicksPerFrame (void) |
Returns period in EMIF clocks / 50 (nominally 1 usec) between successive Frame Start strobes on the LVDS camera link. | |
virtual int | InvertDataValid (bool abInvert) |
This function can be used to invert the data valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been encountered with certain Hitachi products). | |
virtual int | InvertLineValid (bool abInvert) |
This function can be used to invert the line valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been reported with certain products). | |
virtual int | InvertFrameValid (bool abInvert) |
This function can be used to invert the frame valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been reported with certain products). | |
virtual int | SetAltFIFOAddress (void *apAltFIFOAddr) |
This function can be used to instruct the DspCameraLink core that the read FIFO has been memory mapped to an alternate location of the FPGA. | |
virtual int | SetFrameDecimation (int anDecimation) |
Sets the frame decimation factor to use when running camera link engine. | |
virtual int | SetBitDepth (int anDepth) |
This function can be used to set the bit depth for a camera. | |
virtual int | GetBitDepth (void) |
This function can be used to set the bit depth for a camera. | |
virtual int | SetHorizontalSkip (int anSkip) |
This function can be used to set horizontal timing controls for the camera. | |
virtual int | GetHorizontalSkip (void) |
This function can be used to get the horizontal timing controls for the camera. | |
virtual int | SetVerticalSkip (int anSkip) |
This function can be used to set vertical timing controls for the camera. | |
virtual int | GetVerticalSkip (void) |
This function can be used to get the vertical timing controls for the camera. | |
Static Public Member Functions | |
static int | interrupt_dispatch (Arg arMyObject) |
Static interrupt dispatch routine. | |
Public Attributes | |
unsigned int | mnInterruptCount |
ISR counter (debug). | |
Protected Types | |
enum | teFIFOLevel { eeEmpty, eeOneQ, eeHalf, eeThreeQ, eeFull, eeDMALevel } |
The teFIFOLevel enumeration defines the various FIFO levels that may be checked for the tcDspAdcBase class. More... | |
Protected Member Functions | |
virtual void | CaptureThread (void) |
Main capture thread. | |
virtual bool | DrainFIFO (void) |
This routine will drain the FIFO on the engine. | |
virtual void | LinkInterrupt (void) |
Interrupt service routine for the ADC cores. | |
virtual void | Enable (bool abEnable) |
Enables the capture engine for the Camera Link Interface. | |
virtual bool | IsEnabled (void) |
Returns the enabled state of the capture engine. | |
virtual void | DisableFIFOInterrupts (void) |
Disables all FIFO interrupt enables. | |
virtual void | SetFIFOInterruptLevel (teFIFOLevel aeLevel) |
Enables interrupts for the specified level. | |
virtual bool | IsFpgaDmaCapable (void) |
Determines if the camera link core is capable of writing camera data directly to attached RAM (rather than requiring DSP to read from FIFO). | |
virtual bool | IsDmaRollEnabled (void) |
Checks to see if the camera link DMA engine is configured to treat the SDRAM buffer as circular (and roll over when the top is reached). | |
virtual void | ConfigureDmaBuffers (unsigned int *apStartAddr, unsigned int *apEndAddr, unsigned int anBytesPerInt, bool abSetRollOver) |
Set up a SDRAM shared buffer for the Camera Link Core to DMA to during image capture. | |
Static Protected Member Functions | |
static int | CaptureThreadDispatch (Arg arMyObject) |
This method is a utility function to dispatch the CaptureThread method. | |
Protected Attributes | |
volatile unsigned int * | mpBaseAddr |
unsigned short | mnMyIntMask |
core interrupt mask. | |
int | mnMyIntLevel |
core interrupt level. | |
int | mnMyIntVector |
core interrupt vector. | |
int | mnFrameRows |
number of rows in a camera link frame | |
int | mnFrameCols |
number of cols in a camera link frame | |
int | mnNumFrames |
number of frames requested | |
int | mnNumFramesPerMbx |
number of frames to report per message box | |
int | mnTotalFrames |
total number of frames captured | |
MBX_Handle | mhMailBox |
mailbox handle for frame report message | |
SEM_Handle | mhDataSem |
DMA data transfer complete semaphore. | |
int | mnBufferSize |
size of the working data buffer | |
int | mnThreadPrio |
DMA receiver thread priority. | |
char * | mpCaptureBuffer |
DMA data buffer to transfer to. | |
volatile bool | mbStopCapture |
when true, abort capturing process | |
volatile int | mnNextDMAStartAddr |
offset (character) to next location for DMA transfers | |
int | mnHalfFifoSize |
1/2 size of the FIFO (DMA transfer size) | |
CACHE_L2Mode | msL2Mode |
used for flushing the cache | |
bool | mbIsPacked |
when true, pixels are packed into 2 16 bit words | |
int | mnFifoFull |
very, very bad | |
void * | mpUserData |
passed back to the user from data payload | |
volatile unsigned int * | mpFIFOAddr |
holds address to use for FIFO access | |
volatile bool | mbFpgaDmaEnabled |
true when direct DMA transfer is being used | |
volatile unsigned int | mnNumFpgaDmaWords |
number of dma words FPGA will transfer |
Instances of this class handle.
enum MityDSP::tcDspCameraLink::teFIFOLevel [protected] |
The teFIFOLevel enumeration defines the various FIFO levels that may be checked for the tcDspAdcBase class.
tcDspCameraLink::tcDspCameraLink | ( | void * | apAddress, | |
int | anThreadPrio = 8 , |
|||
int | anFrameRows = 1 , |
|||
int | anFrameCols = 1024 | |||
) |
This constructor is used to open a DspCameraLink interface with the specified settings (optional).
The interface is not yet enabled for capture following construction.
[in] | apAddress | Base Address of ADC core |
[in] | anThreadPrio | Priority to run capture thread, used to parse DMA data from link. |
[in] | anFrameRows | Number of rows per frame |
[in] | anFrameCols | Number of cols per frame |
tcDspCameraLink::~tcDspCameraLink | ( | ) | [virtual] |
This destructor is used to close up and free the resources tied to the associated Camera Link interface.
int tcDspCameraLink::SetImageSize | ( | int | anFrameRows, | |
int | anFrameCols | |||
) | [virtual] |
Sets the Frame/Image size for subsequent captures expected on the LVDS link.
The camera link must be idle (no Frame Captures in process) for this command to execute.
anFrameRows | Number of rows expected in subsequent images | |
anFrameCols | Number of cols expected in subsequent images |
int tcDspCameraLink::CaptureFrames | ( | char * | apCaptureBuffer, | |
unsigned int | anBufferSize, | |||
MBX_Handle | ahCaptureMbx, | |||
int | anNumFrames, | |||
int | anNumFramesPerMbx, | |||
void * | apUserData = NULL | |||
) | [virtual] |
Initiate a frame capture cycle.
This routine will enable the Camera Link FIFO capture logic and begin capturing Frames of data of size specified by SetImageSize() to the apCaptureBuffer memory.
The routine is designed to support buffering of multiple frames of data so that calling software may pipeline process one or more images while more are transferred from the link to memory. The user provided data is treated as a circular buffer window. The capture logic always starts at the zeroth offset for the first frame.
If the buffer is not an even multiple of anNumFramesPerMbx the "remainder" of the capture buffer will not be used; the capture process will roll over to the beginning of the capture buffer so as to gauranteee continuous frame data in memory.
[out] | apCaptureBuffer | Buffered Memory, should be a minimum of 2xRowsxColsxanNumFramesPerMbx elements. Must by 4 byte aligned. |
[in] | anBufferSize | size of buffer in bytes. |
[in] | ahCaptureMbx | Mailbox handle that will be used to post tsFrameDataNotify mailbox messages. |
[in] | anNumFrames | Total number of frames to collect before stopping. If < 1, capture will run continuously until aborted with AbortCapture. |
[in] | anNumFramesPerMbx | Post Number of frames collected per mailbox msg |
[in] | apUserData | optional user pointer returned in mailbox msg, default NULL. |
int tcDspCameraLink::AbortCapture | ( | bool | abFlush = false |
) | [virtual] |
Aborts an ongoing frame capture cycle.
[in] | abFlush | - indicates whether to flush the mailbox queue after the capture is aborted. |
drain the mailbox queue of any extra camera information We drain it here so we know that the camera is shut down and we know that another command has not started.
int tcDspCameraLink::GetFIFODepth | ( | void | ) | [virtual] |
Retrieves the current number of 32 bit samples available on the receive FIFO for the camera link interface.
void tcDspCameraLink::GetImageSize | ( | int & | arFrameRows, | |
int & | arFrameCols | |||
) | [virtual] |
Get the current image size.
[out] | arFrameRows | size of the frame in vertical direction |
[out] | arFrameCols | size of the frame in the horizontal direction |
int tcDspCameraLink::SetPacked | ( | bool | IsPacked | ) | [virtual] |
Sets the Camera Link interface to packing mode for data samples less than 16 bits in width.
IsPacked | when true, data should be packed |
bool tcDspCameraLink::GetPacked | ( | void | ) | [virtual] |
Gets the current packing mode of the camera link interface.
int tcDspCameraLink::SetFrameBitsMask | ( | bool | ApplyMask | ) | [virtual] |
This method allows data words to have the frame and line strobe bits masked to zero in the FIFO data words.
This may be useful for large data processing where individually masking the frame/line bits may be prohibitive for performance purposes. Use this feature with care.
ApplyMask | when true Frame and Line Valid bits will be disabled. |
bool tcDspCameraLink::GetFrameBitsMasked | ( | void | ) | [virtual] |
Returns the Frame and Line bits masking state of the camera link interface.
bool tcDspCameraLink::IsFIFOEmpty | ( | void | ) | [virtual] |
Determine the FIFO empty status.
int tcDspCameraLink::GetNumPixelsPerFrame | ( | void | ) | [virtual] |
Returns number of pixels capture per frame as seen on link interface.
int tcDspCameraLink::GetNumTicksPerFrame | ( | void | ) | [virtual] |
Returns period in EMIF clocks / 50 (nominally 1 usec) between successive Frame Start strobes on the LVDS camera link.
int tcDspCameraLink::InvertDataValid | ( | bool | abInvert | ) | [virtual] |
This function can be used to invert the data valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been encountered with certain Hitachi products).
[in] | abInvert | when true, data valid line should be inverted. |
int tcDspCameraLink::InvertLineValid | ( | bool | abInvert | ) | [virtual] |
This function can be used to invert the line valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been reported with certain products).
[in] | abInvert | when true, line valid line should be inverted. |
int tcDspCameraLink::InvertFrameValid | ( | bool | abInvert | ) | [virtual] |
This function can be used to invert the frame valid strobe on cameras that do not assert this strobe (not technically compliant with camera link, but condition has been reported with certain products).
[in] | abInvert | when true, frame valid line should be inverted. |
int tcDspCameraLink::SetAltFIFOAddress | ( | void * | apAltFIFOAddr | ) | [virtual] |
This function can be used to instruct the DspCameraLink core that the read FIFO has been memory mapped to an alternate location of the FPGA.
This may be useful for scenarios requiring high bus bandwidth, and the FPGA designer chooses to route the output FIFO to CE2 space with lower latency wait state configuration (or a configuration supporting synchronous burst RAM access, etc.) Once the default pointer to the FIFO has been overridden, the original pointer cannot be restored.
[in] | apAltFIFOAddr | pointer to alternate data FIFO location. |
int tcDspCameraLink::SetFrameDecimation | ( | int | anDecimation | ) | [virtual] |
Sets the frame decimation factor to use when running camera link engine.
This specifies the number of frames to skip between capture cycles, allowing reduction of frame streaming rate into the DSP.
[in] | anDecimation | Number of frames to skip between captures (range 0 to 15). |
int tcDspCameraLink::SetBitDepth | ( | int | anDepth | ) | [virtual] |
This function can be used to set the bit depth for a camera.
The FPGA core 0's bits above this in the frame buffer
[in] | anDepth | - bit depth (0-15). |
int tcDspCameraLink::GetBitDepth | ( | void | ) | [virtual] |
This function can be used to set the bit depth for a camera.
The FPGA core 0's bits above this in the frame buffer
int tcDspCameraLink::SetHorizontalSkip | ( | int | anSkip | ) | [virtual] |
This function can be used to set horizontal timing controls for the camera.
[in] | anSkip | - Frame grabber skips this many pixels at the start of a line. |
int tcDspCameraLink::GetHorizontalSkip | ( | void | ) | [virtual] |
This function can be used to get the horizontal timing controls for the camera.
int tcDspCameraLink::SetVerticalSkip | ( | int | anSkip | ) | [virtual] |
This function can be used to set vertical timing controls for the camera.
[in] | anSkip | - Frame grabber skips this many rows at the start of a frame. |
int tcDspCameraLink::GetVerticalSkip | ( | void | ) | [virtual] |
This function can be used to get the vertical timing controls for the camera.
int tcDspCameraLink::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 tcDspAdcBase associated with this ISR. |
int tcDspCameraLink::CaptureThreadDispatch | ( | Arg | arMyObject | ) | [static, protected] |
This method is a utility function to dispatch the CaptureThread method.
void tcDspCameraLink::CaptureThread | ( | void | ) | [protected, virtual] |
Main capture thread.
This thread will capture incoming QDMA'd data from the camera link ISR. If there is enough frame data to post a mailbox message to the waiting client thread than it will do so. If more data is expected then the FIFO interrupts will be re-enabled.
bool tcDspCameraLink::DrainFIFO | ( | void | ) | [protected, virtual] |
This routine will drain the FIFO on the engine.
It is useful when a clearing operation is require or after initialization.
void tcDspCameraLink::LinkInterrupt | ( | void | ) | [protected, virtual] |
Interrupt service routine for the ADC cores.
The ISR reads and clears any pending interrupts. If any of the pending interrupts 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.
void tcDspCameraLink::Enable | ( | bool | abEnable | ) | [protected, virtual] |
Enables the capture engine for the Camera Link Interface.
[in] | abEnable | When true, capture is enabled. |
bool tcDspCameraLink::IsEnabled | ( | void | ) | [protected, virtual] |
Returns the enabled state of the capture engine.
void tcDspCameraLink::DisableFIFOInterrupts | ( | void | ) | [protected, virtual] |
Disables all FIFO interrupt enables.
void tcDspCameraLink::SetFIFOInterruptLevel | ( | teFIFOLevel | aeLevel | ) | [protected, virtual] |
Enables interrupts for the specified level.
This routine will disable other level interrupts if they were previously enabled.
aeLevel | Level to Enable the Interrupt for |
bool tcDspCameraLink::IsFpgaDmaCapable | ( | void | ) | [protected, virtual] |
Determines if the camera link core is capable of writing camera data directly to attached RAM (rather than requiring DSP to read from FIFO).
bool tcDspCameraLink::IsDmaRollEnabled | ( | void | ) | [protected, virtual] |
Checks to see if the camera link DMA engine is configured to treat the SDRAM buffer as circular (and roll over when the top is reached).
void tcDspCameraLink::ConfigureDmaBuffers | ( | unsigned int * | apStartAddr, | |
unsigned int * | apEndAddr, | |||
unsigned int | anBytesPerInt, | |||
bool | abSetRollOver | |||
) | [protected, virtual] |
Set up a SDRAM shared buffer for the Camera Link Core to DMA to during image capture.
This routine should only be used when the camera link core has been configured to support direct FPGA DMA to SDRAM.
[in] | apStartAddr | pointer to start address in SDRAM of buffer |
[in] | apEndAddr | pointer to end address in SDRAM of buffer |
[in] | anBytesPerInt | number of bytes between FPGA transfers per interrupt |
[in] | abSetRollOver | when true, will true buffer as circular (continuous) |
If abSetRollOver is false, DMA activity will stop when the end address is reached.
unsigned int MityDSP::tcDspCameraLink::mnInterruptCount |
ISR counter (debug).
volatile unsigned int* MityDSP::tcDspCameraLink::mpBaseAddr [protected] |
unsigned short MityDSP::tcDspCameraLink::mnMyIntMask [protected] |
core interrupt mask.
int MityDSP::tcDspCameraLink::mnMyIntLevel [protected] |
core interrupt level.
int MityDSP::tcDspCameraLink::mnMyIntVector [protected] |
core interrupt vector.
int MityDSP::tcDspCameraLink::mnFrameRows [protected] |
number of rows in a camera link frame
int MityDSP::tcDspCameraLink::mnFrameCols [protected] |
number of cols in a camera link frame
int MityDSP::tcDspCameraLink::mnNumFrames [protected] |
number of frames requested
int MityDSP::tcDspCameraLink::mnNumFramesPerMbx [protected] |
number of frames to report per message box
int MityDSP::tcDspCameraLink::mnTotalFrames [protected] |
total number of frames captured
MBX_Handle MityDSP::tcDspCameraLink::mhMailBox [protected] |
mailbox handle for frame report message
SEM_Handle MityDSP::tcDspCameraLink::mhDataSem [protected] |
DMA data transfer complete semaphore.
int MityDSP::tcDspCameraLink::mnBufferSize [protected] |
size of the working data buffer
int MityDSP::tcDspCameraLink::mnThreadPrio [protected] |
DMA receiver thread priority.
char* MityDSP::tcDspCameraLink::mpCaptureBuffer [protected] |
DMA data buffer to transfer to.
volatile bool MityDSP::tcDspCameraLink::mbStopCapture [protected] |
when true, abort capturing process
volatile int MityDSP::tcDspCameraLink::mnNextDMAStartAddr [protected] |
offset (character) to next location for DMA transfers
int MityDSP::tcDspCameraLink::mnHalfFifoSize [protected] |
1/2 size of the FIFO (DMA transfer size)
CACHE_L2Mode MityDSP::tcDspCameraLink::msL2Mode [protected] |
used for flushing the cache
bool MityDSP::tcDspCameraLink::mbIsPacked [protected] |
when true, pixels are packed into 2 16 bit words
int MityDSP::tcDspCameraLink::mnFifoFull [protected] |
very, very bad
void* MityDSP::tcDspCameraLink::mpUserData [protected] |
passed back to the user from data payload
volatile unsigned int* MityDSP::tcDspCameraLink::mpFIFOAddr [protected] |
holds address to use for FIFO access
volatile bool MityDSP::tcDspCameraLink::mbFpgaDmaEnabled [protected] |
true when direct DMA transfer is being used
volatile unsigned int MityDSP::tcDspCameraLink::mnNumFpgaDmaWords [protected] |
number of dma words FPGA will transfer