Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
tcIOChannel Class Referenceabstract

Camera Output IO channel management class. More...

#include <IOChannel.h>

Inheritance diagram for tcIOChannel:
Collaboration diagram for tcIOChannel:

Public Member Functions

 tcIOChannel (SocCamera::teIOChannels aeIOId, SocCamera::tcSensorBoard *apSensor)
 Construct a new tcIOChannel::tcIOChannel object. More...
 
virtual ~tcIOChannel ()
 
virtual SocCamera::teNackCode capture (tsCaptureRequest asRequest)=0
 
virtual SocCamera::teNackCode setBpp (SocCamera::teBPPMode aeBppMode)=0
 
virtual void initialized ()
 
SocCamera::teBPPMode getBpp ()
 
virtual void sendUpdate (tsNewFrameMsg *apMsg)=0
 
virtual void processUpdate (tsNewFrameMsg *apMsg)
 
void setEnable (bool abEnable)
 
tcImagegrabImage ()
 
SocCamera::teIOChannels id ()
 
virtual void invalidateCache (void *apMem, size_t anSize)
 
virtual void * memory ()
 
- Public Member Functions inherited from tcIOCallback
 tcIOCallback ()
 
virtual ~tcIOCallback ()
 

Protected Member Functions

void invalidateCache (tsNewFrameMsg *apMsg)
 
void invalidateCache ()
 
void Report (const char *fmt,...)
 This method routes text to stderr. More...
 
void ReportError (const char *fmt,...)
 

Protected Attributes

std::string m_name
 
SocCamera::teIOChannels meIOId
 
SocCamera::tcSensorBoardmpSensor
 
SocCamera::teBPPMode meBppMode
 
int64 mnImgCount
 
std::list< tsNewFrameMsgmlUpdates
 
tcMutex mcMutex
 
tcCondition mcCond
 
void * mpMemory
 
tcIOChannelThread mcThread
 
tsNewFrameMsg msLastUpdate
 
bool mbSimRAM
 

Static Protected Attributes

static uint32 CAPTURE_START_ADDR = (0x20000000)
 
static uint32 MEMORY_BLOCK_SIZE = (0x20000000)
 
static bool CMEM_USED = (true)
 
static bool MMAP_USED = (true)
 

Friends

class tcIOChannelThread
 

Detailed Description

Camera Output IO channel management class.

The tcIOChannel provides a base class abstraction for C++ class that are responsible for taking received sensor streaming image data and routing it to an output channel. Output channels might include USB or ethernet endpoints, or HDMI endpoints, or even custom processing blocks.

Multiple tcIOChannels may exist within a camera design in order to support processing the sensor data for multiple output paths, such as EVKs that transmit data to a U3V (USB 3) interface as well as provide previews on an HDMI output, etc.

Constructor & Destructor Documentation

◆ tcIOChannel()

tcIOChannel::tcIOChannel ( SocCamera::teIOChannels  aeIOId,
SocCamera::tcSensorBoard apSensor 
)

Construct a new tcIOChannel::tcIOChannel object.

Parameters
aeIOIdThe type of IO channel being constructed.
apSensora pointer to the tcSensorBoard sensor interface, keeper of the tcRAMStreamer object.

This section of code allocates or reserves a block of memory for the Sensor FPGA pipeline to stream images / data into and provides it to the tcRAMStreamer() (or a class derived from it). Memory is only allocated 1 time, so only the first constructor of multiple tcIOChannel instances will perform allocation.

Memory allocation can occur using a couple of mechanisms: (1) If the processor needs to access the streamed data, then TI's LUDEV / CMEM library is generally the preferred method, as it supports mapping the memory as cached and includes invalidation IO calls. (2) If CMEM is not available then we'll try to mmap() it using /dev/mem. This is slower, as the memory will not be cacheable.

(3) If the memory does not need to be accessed by the processor (e.g., it is buffered, but transmitted directly by the FPGA. In some cases the FPGA can access memory regions that processors, such as the top 1GB of memory in the Intel Cyclone V or Arria 10 SoC devices), this will simply note the physical memory location and pass it to the streamer object.

It would seem that this code might be better placed in the constructor / initializer of the tcSensorBoard->tcRAMStreamer object, however the IO channel threads do need access to the memory pointers in order to extract stream data and manage cache flushingm, etc. At the moment, the design does the memory allocation here.

The original parameters used had been hardcoded. As the software has evolved to support other use cases, most of memory allocation parameters have migrated to an INI file called "ram_cfg.ini".

◆ ~tcIOChannel()

tcIOChannel::~tcIOChannel ( )
virtual

Member Function Documentation

◆ capture()

virtual SocCamera::teNackCode tcIOChannel::capture ( tsCaptureRequest  asRequest)
pure virtual

Start a capture with this request. If the requests number of frames is tsNewRequest::CANCEL_CAPTURE then the current capture is stopped if possible.

Parameters
asRequest- the request for capture being made.
Returns
a nack code if the capture parameters are inelligable for this IOChannel.

Implemented in tcMityViewerApp, tcFilesystemIO, SocCamera::tcBufferedCameraLinkIO, tcMemoryIO, SocCamera::tcQueueIO, SocCamera::tcGigEIO, SocCamera::tcU3VIO, and tcCameraLinkIO.

◆ getBpp()

SocCamera::teBPPMode tcIOChannel::getBpp ( )

Return the currently configured bits-per-pixel setting.

Returns
the bits-per-pixel setting.

◆ grabImage()

tcImage * tcIOChannel::grabImage ( )

Copies the latest image captured into memory. The caller assumes responsibility for this image. After grabbing the image, the caller should check if the data is packed or stored as separate 16 bit values.

Returns
NULL if there is no image or a dynamically allocated image object.

◆ id()

SocCamera::teIOChannels tcIOChannel::id ( )

Provide an "isA" test

Returns
the id of the IOChannel to identify it.

◆ initialized()

void tcIOChannel::initialized ( )
virtual

◆ invalidateCache() [1/3]

void tcIOChannel::invalidateCache ( )
protected

◆ invalidateCache() [2/3]

void tcIOChannel::invalidateCache ( tsNewFrameMsg apMsg)
protected

◆ invalidateCache() [3/3]

void tcIOChannel::invalidateCache ( void *  apMem,
size_t  anSize 
)
virtual

Performs a cache invalidation at the memory location of the size specified.

Implements tcIOCallback.

◆ memory()

void * tcIOChannel::memory ( )
virtual

memory mapped pointer that can be passed to invalidate cache.

Implements tcIOCallback.

◆ processUpdate()

void tcIOChannel::processUpdate ( tsNewFrameMsg apMsg)
virtual

Enqueues the update for the IOChannelThread to send when possible.

Implements tcIOCallback.

◆ Report()

void tcIOChannel::Report ( const char *  fmt,
  ... 
)
protected

This method routes text to stderr.

◆ ReportError()

void tcIOChannel::ReportError ( const char *  fmt,
  ... 
)
protected

Report Error Function This method routes error text to stderr

◆ sendUpdate()

virtual void tcIOChannel::sendUpdate ( tsNewFrameMsg apMsg)
pure virtual

Actually sends the frame by whatever means; called by the internal thread.

Parameters
apMsg

Implemented in tcFilesystemIO, tcMemoryIO, SocCamera::tcBufferedCameraLinkIO, SocCamera::tcQueueIO, tcMityViewerApp, tcCameraLinkIO, SocCamera::tcGigEIO, and SocCamera::tcU3VIO.

◆ setBpp()

virtual SocCamera::teNackCode tcIOChannel::setBpp ( SocCamera::teBPPMode  aeBppMode)
pure virtual

Sets the bits-per-pixel output of the camera.

Parameters
aeBppMode- the bits per pixel mode.
Returns
the nack code for the operation

Implemented in tcFilesystemIO, SocCamera::tcBufferedCameraLinkIO, SocCamera::tcQueueIO, tcMityViewerApp, tcMemoryIO, tcCameraLinkIO, SocCamera::tcGigEIO, and SocCamera::tcU3VIO.

◆ setEnable()

void tcIOChannel::setEnable ( bool  abEnable)

Friends And Related Function Documentation

◆ tcIOChannelThread

friend class tcIOChannelThread
friend

Member Data Documentation

◆ CAPTURE_START_ADDR

uint32 tcIOChannel::CAPTURE_START_ADDR = (0x20000000)
staticprotected

◆ CMEM_USED

bool tcIOChannel::CMEM_USED = (true)
staticprotected

◆ m_name

std::string tcIOChannel::m_name
protected

◆ mbSimRAM

bool tcIOChannel::mbSimRAM
protected

◆ mcCond

tcCondition tcIOChannel::mcCond
protected

◆ mcMutex

tcMutex tcIOChannel::mcMutex
protected

◆ mcThread

tcIOChannelThread tcIOChannel::mcThread
protected

◆ meBppMode

SocCamera::teBPPMode tcIOChannel::meBppMode
protected

◆ meIOId

SocCamera::teIOChannels tcIOChannel::meIOId
protected

◆ MEMORY_BLOCK_SIZE

uint32 tcIOChannel::MEMORY_BLOCK_SIZE = (0x20000000)
staticprotected

◆ mlUpdates

std::list<tsNewFrameMsg> tcIOChannel::mlUpdates
protected

◆ MMAP_USED

bool tcIOChannel::MMAP_USED = (true)
staticprotected

◆ mnImgCount

int64 tcIOChannel::mnImgCount
protected

◆ mpMemory

void* tcIOChannel::mpMemory
protected

◆ mpSensor

SocCamera::tcSensorBoard* tcIOChannel::mpSensor
protected

◆ msLastUpdate

tsNewFrameMsg tcIOChannel::msLastUpdate
protected

The documentation for this class was generated from the following files: