Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
SocCamera::tcSimSensorSensorBoard Class Reference

The tcSimSensorSensorBoard class. SimSensor Main class manager for a given sensor board. More...

#include <SimSensorSensorBoard.h>

Inheritance diagram for SocCamera::tcSimSensorSensorBoard:
Collaboration diagram for SocCamera::tcSimSensorSensorBoard:

Public Member Functions

 tcSimSensorSensorBoard (const std::string &asArgs)
 
virtual ~tcSimSensorSensorBoard () override
 
virtual tcAbstractHandlergetCustomHandlers (tcAbstractHandler *apTailHandler, std::map< std::string, tcAbstractHandler * > *apStringMap) override
 
virtual void resetFpga () override
 
virtual int GetCameraInfo (tsCameraInfo *apInfo) override
 
virtual int32 initialize () override
 
virtual teNackCode setExposure (int32 anMicroseconds, uint32_t anExpIndex=0) override
 
virtual int32 getExposure (uint32_t anExpIndex=0) override
 
virtual uint32 getMinFrameIntervalMicroS () override
 
virtual teNackCode setFrameInterval (int32 anMicroseconds) override
 
virtual int32 getFrameInterval () override
 
virtual teNackCode setROI (ROI region) override
 
virtual ROI getROI () override
 
virtual teNackCode setVerticalBin (int32 anPixels) override
 
virtual int32 getVerticalBin () override
 
virtual teNackCode setHorizontalBin (int32 anPixels) override
 
virtual int32 getHorizontalBin () override
 
virtual teNackCode setShutterMode (teShutterMode eeMode) override
 
virtual int32 getShutterMode () override
 
virtual teNackCode setBPP (teBPPMode eeMode) override
 
virtual teNackCode setTestPattern (teTestPattern eeSelection) override
 
virtual int32 getTestPattern () override
 
virtual teNackCode setTrigger (teTriggerMode eeTrigger) override
 
virtual int32 getTrigger () override
 
virtual int32 validate () override
 
virtual bool isCapturing () override
 
virtual teNackCode start () override
 
virtual teNackCode stop () override
 
virtual std::string getTemperature (int32 anSensor=0) override
 
virtual std::string getVersion () override
 
virtual teNackCode save (int32 anConfiguration) override
 
virtual teNackCode recall (int32 anConfiguration) override
 
virtual uint64_t fpgaVersion () override
 
virtual void timerTicked (tcTimer *) override
 
- Public Member Functions inherited from SocCamera::tcSensorBoard
 tcSensorBoard (int aeType, uint32 anStreamAddr, int32 length, int32 *aaGpioNum)
 
 tcSensorBoard (int aeType, uint32_t anFpgaBaseAddr, uint32_t anRamStreamAddr, int32 length, int32 *aaGpioNum)
 
virtual ~tcSensorBoard ()
 
int id ()
 
int32 init ()
 
virtual void update (tsUpdate asMessage)
 
virtual teNackCode calibrate ()
 
virtual teNackCode whiteLevelCalibrate ()
 
virtual teNackCode setClockSetting (int32 anSetting)
 
virtual teNackCode getClockSetting (int32 &arSetting)
 
virtual void snap (tsCaptureRequest asSnapRequest)
 start a capture More...
 
teNackCode setExposure (std::chrono::microseconds anMicroseconds, uint32_t anExpIndex=0)
 
std::chrono::microseconds getMinFrameInterval ()
 
teNackCode setFrameInterval (std::chrono::microseconds anMicroseconds)
 
virtual ROI getImageROI ()
 
virtual teNackCode setColor (bool)
 
virtual teNackCode peek (int32 anRegister, int *apValue)
 
virtual teNackCode poke (int32 anRegister, int32 anValue)
 
virtual float getTempCelsius ()
 
virtual float getBoardTempCelsius ()
 
virtual teNackCode setIODirection (int32 anPin, int32 anDirection)
 tcSensorBoard::setIODirection Sets the camera GPIO direction. More...
 
virtual teNackCode setIOValue (int32 anPinNum, int32 anValue)
 tcSensorBoard::setIOValue Sets the output value of the gpio-camio linux module controlling the cam-gpio.vhd critical link camera IO block. More...
 
virtual teNackCode setIOInverter (int32 anPinNum, int32 anInvertEnable)
 tcSensorBoard::setIOInverter Sets the camera GPIO invert state. More...
 
virtual teNackCode power (bool abOn)
 
virtual int32 getIODirection ()
 
virtual int32 getIOValue ()
 tcSensorBoard::getIOValue More...
 
virtual int32 getNumPins ()
 
virtual teNackCode setMirroring (bool isX, bool Enabled)
 
virtual teNackCode getMirroring (bool isX, bool *Enabled)
 
virtual teNackCode setNoiseReduct (bool enHi, uint16_t threshhi, bool enLo, uint16_t threshlo)
 
virtual teNackCode getNoiseReduct (bool &enHi, uint16_t &threshhi, bool &enLo, uint16_t &threshlo)
 
virtual teNackCode setSqrtCompression (bool enable)
 
virtual teNackCode getSqrtCompression (bool &enable)
 
virtual teNackCode setDemoMode (int32 anMode)
 
virtual teNackCode getDemoMode (int32 &arMode)
 
virtual teNackCode loadColumnBias (const char *asFilename)
 
virtual teNackCode loadColumnGain (const char *asFilename)
 
virtual teNackCode loadPixelCal (const char *asFilename)
 
virtual tcRAMStreamergetStreamer ()
 
virtual tcTimestamp * getTimestamper ()
 
virtual void setTimestamper (tcTimestamp *apStamper)
 
virtual tcSensorBoardself ()
 
uint32 getFrameSizeBytes ()
 
int getSysIdNumber (unsigned short &major, unsigned short &minor)
 
uint32 getMaxImgCount ()
 
uint32 getNumSnapFramesLeft ()
 
virtual void Handler (unsigned int gpionum, unsigned int val)
 Handler GPIO Handler notifies changes on any gpio with edges enabled. More...
 
virtual uint32 getPixelFormat (void)
 Get the pixel format generated by the pixel pipeline. More...
 
virtual tcVoltageSensorgetVoltageSensor ()
 get the temperature monitor object for this sensor More...
 
virtual tcTemperatureSensorgetTempSensor ()
 get the tcTemperature monitor object for this sensor More...
 
virtual void runPeriodic ()
 can be called by framework to do any periodic work. More...
 
virtual int32_t getSensorWidth ()
 
virtual int32_t getSensorHeight ()
 
- Public Member Functions inherited from tcObserver
 tcObserver ()
 
virtual ~tcObserver ()
 
- Public Member Functions inherited from tcTimedObject
 tcTimedObject ()
 
virtual ~tcTimedObject ()
 

Protected Attributes

bool mbCapturing
 true when running a capture More...
 
ROI msROI
 Selected ROI. More...
 
std::chrono::microseconds mcEmulatedPorchTime
 
std::chrono::microseconds mcExpTime
 the desired exposure time More...
 
std::chrono::microseconds mcFrameIntervalTime
 the desired Frame Interval Time More...
 
tcTimer mcTimer
 timer to kick sending frames More...
 
tcImageGenerator mcImageGenerator
 utility for building simulated images More...
 
tcTestPatternGeneratormpTestPatternGenerator
 a valid FPGA pointer More...
 
- Protected Attributes inherited from SocCamera::tcSensorBoard
bool mbIsPowered
 
tcMutex mhMutex
 
MityDSP::tcGpio * mpCamIO
 
MityDSP::tcGpio::PinConfig * maPinConfigs
 
int32 mnPinCount
 
tcRAMStreamermpStreamer
 
std::map< int, std::pair< tcIntAccessor *, IntAccessorFunction > > mhPeekMap
 
std::map< int, std::pair< tcIntSetter *, IntSetterFunction > > mhPokeMap
 
tcPollingInterruptThread mcInterruptThread
 
MityDSP::tcAD741x * mpTempSensor
 
uint32 mnMaxImgCount
 
const sensors_chip_name * mpChipnameAD7414
 lmsensors chipname for AD7414 on A10/CV More...
 
const sensors_chip_name * mpChipnameLM95235
 lmsensors chipname for LM95235 on A10 More...
 
int mnAD7414_sf
 TEMP input subfeature number needed to get the actual temperature. More...
 
int mnLM95235_die_sf
 TEMP input subfeature for die temperature (CPU) sensor. More...
 
int mnLM95235_board_sf
 TEMP input subfeature for on-chip sensor. More...
 

Static Protected Attributes

static const int mnPatternGeneratorPixelsPerClock = 4
 
static constexpr float mnPatternGeneratorClockMhz = 125.0f
 

Additional Inherited Members

- Static Public Attributes inherited from SocCamera::tcSensorBoard
static const std::string NO_TEMPERATURE_SENSOR
 
static const std::string TEMPERATURE_SENSOR_ERROR
 
- Protected Member Functions inherited from SocCamera::tcSensorBoard
void nextRequest ()
 
void initGpios (int32 length, int32 *aaGpioNum)
 
virtual uint32 GetSkipFrames (bool &reload)
 GetSkipFrames If the current sensor needs to skip initially received frames, they can overload this function, which will be called immediately prior to a ::start() call, to set the number of frames to skip. This only works with the RAMStreamer image data. More...
 
uint32 ConvertPixelFormat (uint32 anFormat, bool abFlipX, bool abFlipY)
 Utility routine to convert PFNC pixel format given flip options. More...
 
teNackCode GetA10BoardTemp (uint32 anIndex, float &anTemp)
 Utility routine to get the temp sensor readings off an A10 processor card. More...
 

Detailed Description

The tcSimSensorSensorBoard class. SimSensor Main class manager for a given sensor board.

The sensor board class is responsible for the management of the electro-optical imager (the Focal Plane Array) and the image signal processing pipeline in the FPGA to the point of image transmission for a given camera configuration. In general, a sensor board implementation is required for each Sensor Board in the MityCAM stack. If done correctly, a single sensor board implementation should support any combination of back end interface boards. This, however, does require some coordination with the FPGA designer (a consistent pipeline is needed for each FPA + interface board permuation).

Typically, a sensor board implementation includes an FPGA helper class (manages the FPGA pipeline) and a sensor helper class (manages the sensor register interface, typically SPI or I2C). This is not required, but in general the pattern most implementations follow.

Constructor & Destructor Documentation

◆ tcSimSensorSensorBoard()

tcSimSensorSensorBoard::tcSimSensorSensorBoard ( const std::string &  asArgs)

Construct a new SimSensor sensorboard.

Parameters
asDevice- the /dev/ node for the sensor's SPI port

◆ ~tcSimSensorSensorBoard()

tcSimSensorSensorBoard::~tcSimSensorSensorBoard ( )
overridevirtual

Member Function Documentation

◆ fpgaVersion()

virtual uint64_t SocCamera::tcSimSensorSensorBoard::fpgaVersion ( )
inlineoverridevirtual

Reimplemented from SocCamera::tcSensorBoard.

◆ GetCameraInfo()

int tcSimSensorSensorBoard::GetCameraInfo ( tsCameraInfo apInfo)
overridevirtual

Get the camera info for the given sensor board.

Parameters
apInfo- pointer to camera structure to fill in.
Returns
zero on success.

Implements SocCamera::tcSensorBoard.

◆ getCustomHandlers()

tcAbstractHandler * tcSimSensorSensorBoard::getCustomHandlers ( tcAbstractHandler apTailHandler,
std::map< std::string, tcAbstractHandler * > *  apStringMap 
)
overridevirtual

See tcSensorBoard.h for descriptions of these required methods. We must implement the methods below to instantiate this class and operate correctly with the rest of the MityCAM framework.

Reimplemented from SocCamera::tcSensorBoard.

◆ getExposure()

int32 tcSimSensorSensorBoard::getExposure ( uint32_t  anExpIndex = 0)
overridevirtual

Returns the currently set exposure time in microseconds.

Returns
an int32 for the number of microseconds the exposure is set to.

Implements SocCamera::tcSensorBoard.

◆ getFrameInterval()

int32 tcSimSensorSensorBoard::getFrameInterval ( )
overridevirtual

Returns the frame interval time in microseconds.

Returns
an int32 for the number of microseconds the interval is set to.

Implements SocCamera::tcSensorBoard.

◆ getHorizontalBin()

int32 tcSimSensorSensorBoard::getHorizontalBin ( )
overridevirtual

Gets the currently set horizontal binning factor being used.

Returns
an int32 - the number of pixels being binned horizontally

Implements SocCamera::tcSensorBoard.

◆ getMinFrameIntervalMicroS()

virtual uint32 SocCamera::tcSimSensorSensorBoard::getMinFrameIntervalMicroS ( )
inlineoverridevirtual

Returns the minimum frame interval period in microseconds

Note
Defaults to 1000uS (1000fps) as thats whats in most of the xml pages. This should be overridden by the individual sensors.
The FrameIntervalHandler will update the register file any time the host requests it by calling update_word(SENS_MIN_FRAME_PERIOD_ADDR, getMinFrameIntervalMicroS()). Ideally, the sensor XML file should specify which fields invalidate this value.
Returns
Minimum frame interval period in microseconds

Reimplemented from SocCamera::tcSensorBoard.

◆ getROI()

ROI tcSimSensorSensorBoard::getROI ( )
overridevirtual

Returns the currently set region of interest for the camera.

Returns
the ROI the sensor will produce.

Implements SocCamera::tcSensorBoard.

◆ getShutterMode()

int32 tcSimSensorSensorBoard::getShutterMode ( )
overridevirtual

Returns the current shutter mode of the camera.

Returns
an int32 from eeShutterModes to state the shutter mode of the camera

Implements SocCamera::tcSensorBoard.

◆ getTemperature()

std::string tcSimSensorSensorBoard::getTemperature ( int32  anSensor = 0)
overridevirtual

Returns the temperature for the sensor specified if there are multiple. This function returns tcSensorBoard::NO_TEMPERATURE_SENSOR (below absolute 0) if not implemented for a specific sensor.

Parameters
anSensor- the sensor to request.
Returns
the response as a string. this may be information about the lack of a sensor etc.

Implements SocCamera::tcSensorBoard.

◆ getTestPattern()

int32 tcSimSensorSensorBoard::getTestPattern ( )
overridevirtual

Get the currently set test pattern from eeTestPatterns.

Returns
an int32 - the current test pattern from eeTestPatterns

Implements SocCamera::tcSensorBoard.

◆ getTrigger()

int32 tcSimSensorSensorBoard::getTrigger ( )
overridevirtual

Returns the currently set trigger mode.

Returns
an int32 - the current trigger from eeTriggerModes

Implements SocCamera::tcSensorBoard.

◆ getVersion()

std::string tcSimSensorSensorBoard::getVersion ( )
overridevirtual

Get the chip version of the sensor board if possible.

Returns
a string with the chip version.

Implements SocCamera::tcSensorBoard.

◆ getVerticalBin()

int32 tcSimSensorSensorBoard::getVerticalBin ( )
overridevirtual

Gets the currently set vertical binnign factor being used.

Returns
an int32 - the number of pixels being binned vertically

Implements SocCamera::tcSensorBoard.

◆ initialize()

int32 tcSimSensorSensorBoard::initialize ( )
overridevirtual

Performs the operations of initialization. This consists of power up, setting default register values and configuring peripherals.

Returns
an int32 for the status; 0 if successful, non zero for error.

Implements SocCamera::tcSensorBoard.

◆ isCapturing()

bool tcSimSensorSensorBoard::isCapturing ( )
overridevirtual

Test if the camera is currently capturing. Used to prevent setting certain paramters when the device is capturing.

Returns
a bool - true if the camera is currently capturing; false otherwise

Implements SocCamera::tcSensorBoard.

◆ recall()

teNackCode tcSimSensorSensorBoard::recall ( int32  anConfiguration)
overridevirtual

Recall a configuration identified by anConfiguration.

Parameters
anConfiguration- an int32 specifying the config to recall
Returns
the teNackCode that fits the situation.

Implements SocCamera::tcSensorBoard.

◆ resetFpga()

void tcSimSensorSensorBoard::resetFpga ( )
overridevirtual

Resets the FPGA if appropriate; this is needed to decouple certain pipeline components from the IOChannel object.

Function is an empty adapter; only some FPGA/IOChannel combos will need this

Reimplemented from SocCamera::tcSensorBoard.

◆ save()

teNackCode tcSimSensorSensorBoard::save ( int32  anConfiguration)
overridevirtual

Saves a configuration identified by anConfiguration.

Parameters
anConfiguration- an int32 specifying the config to recall
Returns
the teNackCode that fits the situation

Implements SocCamera::tcSensorBoard.

◆ setBPP()

teNackCode tcSimSensorSensorBoard::setBPP ( teBPPMode  eeMode)
overridevirtual

A request to set the BPP mode of the camera.

Parameters
eeMode- an int32 from eeBPPMode for the mode to enter
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setExposure()

teNackCode tcSimSensorSensorBoard::setExposure ( int32  anMicroseconds,
uint32_t  anExpIndex = 0 
)
overridevirtual

Sets the exposure time to the nearest valid exposure time which is greater than the parameter.

Parameters
anMicroseconds- an int32 - the number of microseconds the exposure should be
anExpIndex- index of exposure control, typically 0 (default). Can be used for HDR type configuration to specific a second exposure setting
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setFrameInterval()

teNackCode tcSimSensorSensorBoard::setFrameInterval ( int32  anMicroseconds)
overridevirtual

Sets the frame interval to the nearest valid interval time which is shorter than the paramter.

Parameters
anMicroseconds- an int32 - the number of microseconds the frame interval time should be
Returns
an int32 for the status; 0 if successful, non-zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setHorizontalBin()

teNackCode tcSimSensorSensorBoard::setHorizontalBin ( int32  anPixels)
overridevirtual

A request to set the horizontal binning factor of the camera.

Parameters
anPixels- an int32 - the number of pixels to bin horizontally
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setROI()

teNackCode tcSimSensorSensorBoard::setROI ( ROI  region)
overridevirtual

Sets the ROI from the sensor's perspective; binning will reduce the the actual number of pixels in a frame.

Parameters
region- ROI struct - dictates the top left of the region and the size.
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setShutterMode()

teNackCode tcSimSensorSensorBoard::setShutterMode ( teShutterMode  eeMode)
overridevirtual

A request to set the shutter mode of the camera.

Parameters
eeMode- an int32 from eeShutterMode to place the camera into.
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setTestPattern()

teNackCode tcSimSensorSensorBoard::setTestPattern ( teTestPattern  eeSelection)
overridevirtual

Request to set the test pattern from eeTestPatterns.

Parameters
eeSelection- an int32 from eeTestPatterns for which pattern to use
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setTrigger()

teNackCode tcSimSensorSensorBoard::setTrigger ( teTriggerMode  eeTrigger)
overridevirtual

Selects the trigger mode to use.

Parameters
eeTrigger- an int32 from eeTriggerModes
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ setVerticalBin()

teNackCode tcSimSensorSensorBoard::setVerticalBin ( int32  anPixels)
overridevirtual

A request to set the vertical binning factor of the camera.

Parameters
anPixels- an int32 - the number of pixels to bin vertically
Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ start()

teNackCode tcSimSensorSensorBoard::start ( )
overridevirtual

Request to start capturing if configuration is valid.

Returns
an int32 for the status; 0 if successful and camera is now capturing, non zero corresponding to the appropriate NACK value if not capturing.

Implements SocCamera::tcSensorBoard.

◆ stop()

teNackCode tcSimSensorSensorBoard::stop ( )
overridevirtual

Request to stop the camera from capturing.

Returns
an int32 for the status; 0 if successful, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

◆ timerTicked()

void tcSimSensorSensorBoard::timerTicked ( tcTimer apTimer)
overridevirtual

Implements tcTimedObject.

◆ validate()

int32 tcSimSensorSensorBoard::validate ( )
overridevirtual

Checks if the current configuration is valid and can be applied when trying to begin capturing.

Returns
an int32 for the status; 0 if valid, non zero corresponding to the appropriate NACK value.

Implements SocCamera::tcSensorBoard.

Member Data Documentation

◆ mbCapturing

bool SocCamera::tcSimSensorSensorBoard::mbCapturing
protected

true when running a capture

Class Specific methods

◆ mcEmulatedPorchTime

std::chrono::microseconds SocCamera::tcSimSensorSensorBoard::mcEmulatedPorchTime
protected

◆ mcExpTime

std::chrono::microseconds SocCamera::tcSimSensorSensorBoard::mcExpTime
protected

the desired exposure time

◆ mcFrameIntervalTime

std::chrono::microseconds SocCamera::tcSimSensorSensorBoard::mcFrameIntervalTime
protected

the desired Frame Interval Time

◆ mcImageGenerator

tcImageGenerator SocCamera::tcSimSensorSensorBoard::mcImageGenerator
protected

utility for building simulated images

◆ mcTimer

tcTimer SocCamera::tcSimSensorSensorBoard::mcTimer
protected

timer to kick sending frames

◆ mnPatternGeneratorClockMhz

constexpr float SocCamera::tcSimSensorSensorBoard::mnPatternGeneratorClockMhz = 125.0f
staticconstexprprotected

◆ mnPatternGeneratorPixelsPerClock

const int SocCamera::tcSimSensorSensorBoard::mnPatternGeneratorPixelsPerClock = 4
staticprotected

◆ mpTestPatternGenerator

tcTestPatternGenerator* SocCamera::tcSimSensorSensorBoard::mpTestPatternGenerator
protected

a valid FPGA pointer

◆ msROI

ROI SocCamera::tcSimSensorSensorBoard::msROI
protected

Selected ROI.


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