Critical Link MityCam SoC Firmware
1.0
Critical Link MityCam SoC Firmware
|
#include <MityViewerApp.h>
Public Member Functions | |
tcMityViewerApp (tcSensorBoard *apSensor, tcIOChannel *apChannel, uint64 anMaxFramesInQueue=MAX_NUM_FRAMES_IN_QUEUE) | |
virtual | ~tcMityViewerApp (void) |
int | Initialize (tcCommandInterface *apInterface) |
int | Shutdown (void) |
virtual void | Report (const char *fmt,...) |
virtual void | ReportError (const char *buffer) |
virtual void | sendUpdate (tsNewFrameMsg *apMsg) |
tcMityViewerApp::sendUpdate Called when new frame data is available to transmit to host. More... | |
void | setTECHandler (SocCamera::tcTECHandler *apHandler) |
virtual SocCamera::teNackCode | setBpp (SocCamera::teBPPMode aeBppMode) |
virtual SocCamera::teNackCode | capture (tsCaptureRequest asRequest) |
Public Member Functions inherited from tcIOChannel | |
tcIOChannel (SocCamera::teIOChannels aeIOId, SocCamera::tcSensorBoard *apSensor) | |
Construct a new tcIOChannel::tcIOChannel object. More... | |
virtual | ~tcIOChannel () |
virtual void | initialized () |
SocCamera::teBPPMode | getBpp () |
virtual void | processUpdate (tsNewFrameMsg *apMsg) |
void | setEnable (bool abEnable) |
tcImage * | grabImage () |
SocCamera::teIOChannels | id () |
virtual void | invalidateCache (void *apMem, size_t anSize) |
virtual void * | memory () |
Public Member Functions inherited from tcIOCallback | |
tcIOCallback () | |
virtual | ~tcIOCallback () |
Protected Types | |
typedef void(tcMityViewerApp::* | MsgHandler) (tuCameraMessages *apMsg) |
Static Protected Member Functions | |
static void * | DispatchNetworkPoll (void *apThis) |
static void * | DispatchNetworkServer (void *apThis) |
static void * | DispatchMainLoop (void *apThis) |
static bool | DispatchMessageHandler (int anStatus, void *apData, int anLength, unsigned int anInfo, void *apThis) |
Protected Attributes | |
MsgHandler | maHandlers [256] |
function handler table. More... | |
SocCamera::tcTECHandler * | mpTECHandler |
bool | mbHasChannel |
bool | mbUseChannel |
tcSensorBoard * | mpSensor |
tcLegacyCCD * | mpCCD |
tcIOChannel * | mpChannel |
tcCommandInterface * | mpInterface |
bool | mbCalibrated |
volatile bool | mbNetworkActive |
Indicates network socket is connected and active. More... | |
tcCamParser * | mpNetworkParser |
pointer to parser for Network Interface More... | |
bool | mbConfigChange |
flag indicating the config data has changed (from API) More... | |
float | mnMean |
mean value (from set Offset Target processing) More... | |
float | mnStdDev |
StdDev value (from set Offset Target processing) More... | |
unsigned int | mnAreaIntervalms |
area mode update interval More... | |
unsigned int | mnDesiredIntervalms |
last desired setting known More... | |
unsigned int | mnNumAreaRows |
number of rows for an area read More... | |
unsigned int | mnNumAreaCols |
number of columns for an area read More... | |
unsigned int | mnLoopBackErrorCnt |
number of errors encountered on loopback testing More... | |
int | mnMessageInCount |
number of Client messages (from PC) More... | |
int | mnMessageOutCount |
number of Outbound messages to client (PC) More... | |
unsigned short | mnFPGARev |
copy of the FPGA revision level More... | |
unsigned short | mnDSPRev |
copy of the DSP code revision level More... | |
bool | mbConfigValid |
when true, our configuration is OK More... | |
tsSimulationModeMsg | msSimMode |
active simulation mode data More... | |
volatile bool | mbSendHeartBeats |
when true, send heartbeats out interface More... | |
int | mnSocket |
our active network socket connection More... | |
CrcCalc * | mpCRC |
CRC engine for loopback mode. More... | |
tcMutex | mhOutputMutex |
pthread_t | mhNetworkSrvThread |
thread object for network server More... | |
pthread_t | mhNetworkPollThread |
thread object for network poll server More... | |
pthread_t | mhMainThread |
thread object for heatbeat/status processsing More... | |
volatile int | maShutdownPipes [3 *2] |
pipes used to shut stuff down (reader/writer) More... | |
volatile bool | mbShutdown |
true when app should shut down More... | |
tsHdwrParamMsg | msHdwrParamMsg |
copy of our hardware parameters More... | |
tsCaptureConfigMsg | msCaptureConfigMsg |
copy of the capture configuration More... | |
volatile unsigned int | mnMillisecsToGo |
number of milliseconds of exp on current frame More... | |
unsigned int | mnFanEnable |
1 when FAN is enabled More... | |
unsigned int | mnTECEnable |
1 when TEC is enabled More... | |
float | mnTargetTemp |
target setpoin, degrees C More... | |
volatile float | mnPID [3] |
P,I,D controls. More... | |
float | mnCoolingDuty |
cooling duty (0 to 1) More... | |
unsigned int | mnGpioPinState |
GPIO pin state. More... | |
volatile bool | mbDSPShutdown |
true when DSP is shutdown More... | |
volatile bool | mbSendNoOps |
when true, send NO OP packets More... | |
volatile int | mnNoOpCounter |
NOOP counter. More... | |
volatile int | mnMsPerNoOp |
time between NOOP sends More... | |
uint64 | mnMaxFramesInQueue |
bool | mbCancelUpdate |
unsigned int * | mp32BitBuffer |
local buffer for expanding 16-bit data to 32-bit data More... | |
uint32_t | mn32BitBufferWords |
size of the mp32BitBuffer in 32-bit words More... | |
char ** | mp16BitHeaders |
pointer vector for 16 bit headers More... | |
char ** | mp32BitHeaders |
pointer vector for 16 bit headers More... | |
struct iovec * | mpIOV |
IOV structure for iov write calls. More... | |
uint32_t * | mpOutputBinning |
cached copy of bin params for processing binned images More... | |
bool | mbShear |
enable flag for shearing More... | |
unsigned int | mnShearThresh |
shearing threshold More... | |
unsigned int | mnShearWinX |
number of columns to average in shearing process More... | |
unsigned int | mnShearWinY |
number of rows to average in shearing process More... | |
bool | mbFlipY |
Protected Attributes inherited from tcIOChannel | |
std::string | m_name |
SocCamera::teIOChannels | meIOId |
SocCamera::tcSensorBoard * | mpSensor |
SocCamera::teBPPMode | meBppMode |
int64 | mnImgCount |
std::list< tsNewFrameMsg > | mlUpdates |
tcMutex | mcMutex |
tcCondition | mcCond |
void * | mpMemory |
tcIOChannelThread | mcThread |
tsNewFrameMsg | msLastUpdate |
bool | mbSimRAM |
Static Protected Attributes | |
static const int | gnPacketsPerWrite = 64 |
number of packets in an iov write call for TCP writev() More... | |
Static Protected Attributes inherited from tcIOChannel | |
static uint32 | CAPTURE_START_ADDR = (0x20000000) |
static uint32 | MEMORY_BLOCK_SIZE = (0x20000000) |
static bool | CMEM_USED = (true) |
static bool | MMAP_USED = (true) |
|
protected |
tcMityViewerApp::tcMityViewerApp | ( | tcSensorBoard * | apSensor, |
tcIOChannel * | apChannel, | ||
uint64 | anMaxFramesInQueue = MAX_NUM_FRAMES_IN_QUEUE |
||
) |
SCMOS Application Class Constructor.
The main purpose of this class is to inialize all of the class context fields to sane values. Users of this class (or deriving from this class) can override the MityDSP Core base address values, task priorities, and interface parsers prior to calling the Initialize method.
|
virtual |
Application destructor.
The application is designed to run indefinitately. This method should never be called.
|
protected |
|
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.
asRequest | - the request for capture being made. |
Implements tcIOChannel.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Clear a CCD Sensor
|
staticprotected |
Dispatch Main Loop Thread
This method is a static C++ method/utility to launch the MainLoop method with appropriate object context in place.
[in] | apThis | pointer to a valid tcSCMOSApp object. |
|
staticprotected |
Dispatch Message Handler
Called by either mpUSBParser or mpNetworkParser class. Interface handler for PC/client messages. Routes commands to local object.
|
staticprotected |
Dispatch Network Poll Thread
This method is a static C++ method/utility to launch the NetworkPoll method with appropriate object context in place.
apThis | pointer to a valid tcSCMOSApp object. |
|
staticprotected |
Dispatch Network Server Thread
This method is a static C++ method/utility to launch the NetworkServer method with appropriate object context in place.
apThis | pointer to a valid tcSCMOSApp object. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Get the exposure time of the CCD.
|
protected |
Get the exposure time of the CCD.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int tcMityViewerApp::Initialize | ( | tcCommandInterface * | apInterface | ) |
Main Initialization routine.
This routine performs the following funtions:
|
protected |
|
protected |
Main Loop
This method performs any processing that is independent of input messages/commands. This is a virtual method and may be overridden for custom applications.
For the base tcSCMOSApp class, the Main Loop collects temperature data from the CCD and the I/O Board on the CCDsp camera hardware and issues a status message every 2 seconds.
|
protected |
Client Command Message Handler
Called by either mpUSBParser or mpNetworkParser class. Interface handler for PC/client messages. Routes commands to local object.
|
protected |
|
protected |
|
protected |
Network Poll Request Handler
This method looks for UDP poll/discovery requests from potential camera controllers (PCs, etc.) and responds with the camera configuration and network information.
< 19200 is fine, no reason to make this configurable..
|
protected |
Network Socket / Server Thread
This method/task handles the network interface for the tcSCMOSApp communication. The method creates a server socket which listens on the configured server port. When a client connects, the task accepts the connection. As net data is received, it is routed to the mpNetworkParser (if not NULL). If an error is detected on the socket, then it is closed and the process starts over on the next client connection request.
|
protected |
|
protected |
|
protected |
|
protected |
Read the CCD in area mode.
|
protected |
|
virtual |
|
virtual |
Report Error Fucntion
This method routes error text to the CCDsp RS232 serial port.
[in] | buffer | error text to display (NULL terminated C string) |
|
protected |
|
protected |
Send a 16 bit frame back to the MityViewer.
apMsg |
Write image data out using writev() with at least 32 packets per writev system call. Should noticably improve efficiency.
|
protected |
tcMityViewerApp::Send32BitFrame
Send a 32 bit frame back to the MityViewer.
apMsg | |
apMsg |
Write image data out using writev() with at least 32 packets per writev system call. Should noticably improve efficiency.
|
protected |
Misc Functions
|
protected |
Send a Message
This method sends a data message to Network Interface (if it is connected) or the USB interface (if the network is not connected). An optional apPayload buffer may be provided in order to allow reduction of memcpys() for efficiency.
Prior to sending the message, this method will call the tcCamParser::PrepareOutput method, which usually performs such tasks as updating sequence numbers and computing checksums, etc.
[in] | Msg | pointer to a valid camera message |
[in] | len | length of the Msg buffer to be transmitted |
[in] | apPayload | pointer to additional payload buffer to append to Msg |
[in] | payload_len | length of the apPayload buffer to be appended |
|
protected |
Sends a message when there is an error nack code.
aeCode | - the nack code of the operation |
asMessage | - a message for the operation that was done. |
|
protected |
|
virtual |
tcMityViewerApp::sendUpdate Called when new frame data is available to transmit to host.
apMsg | information on the frame. |
if we are a legacy CCD sensor and were in binning mode, then we need to assemble and transmit the 32 bit frame (summing digitial any rows with the BINCODE_SUM opcode). Otherwise, if we are not the legacy CCD sensor, we always transmit 16 bit data. This is a limitation of the MityCCD interface protocol.
Implements tcIOChannel.
|
protected |
|
protected |
|
protected |
|
virtual |
Sets the bits-per-pixel output of the camera.
aeBppMode | - the bits per pixel mode. |
Implements tcIOChannel.
|
protected |
|
protected |
Client API INTERFACE FUNCTIONS
Set the Exposure time of the CCD.
This routine sets the time the image acquisition cycle will wait prior to acquiring a new image.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Set the desired imaging rate for multi-frame CCD captures.
This routine will allow continuous sampling of CCD images at a fixed image rate (start of exposure to start of exposure timing). The routine computes the closest frame rate that can be achieved that matches the desired interval rate for area captures and binning captures for binning sequence number 0.
The results are stored in the mnDesiredIntervalms, mnAreaIntervalms, mnBinIntervalms, and mnAreaIntervalms parameters. Times computed include an estimate of the overhead associated with link transfer as well as CCD transfer.
|
protected |
|
protected |
|
protected |
Set the background (bias).
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void tcMityViewerApp::setTECHandler | ( | SocCamera::tcTECHandler * | apHandler | ) |
|
protected |
[MAW] right now, some cameras limit which pins can be trigger pins. The limitations are documented in the user guides. Try applying setting if a valid pin is identified. Low level setters should raise errors.
|
protected |
|
protected |
implements legacy MityCCD shearing operation on RAW CCD data
[in,out] | apData | Pointer to the RAW data buffer to manipulate |
[in] | rows | number of rows in the image data |
[in] | cols | number of columns in the image data |
int tcMityViewerApp::Shutdown | ( | void | ) |
Shutdown all threads spawned directly or indirectly from application
|
protected |
|
protected |
Write updated configuration file back out to disk.
|
protected |
|
protected |
|
staticprotected |
number of packets in an iov write call for TCP writev()
|
protected |
function handler table.
|
protected |
pipes used to shut stuff down (reader/writer)
|
protected |
|
protected |
|
protected |
flag indicating the config data has changed (from API)
|
protected |
when true, our configuration is OK
|
protected |
true when DSP is shutdown
|
protected |
|
protected |
|
protected |
Indicates network socket is connected and active.
|
protected |
when true, send heartbeats out interface
|
protected |
when true, send NO OP packets
|
protected |
enable flag for shearing
|
protected |
true when app should shut down
|
protected |
|
protected |
thread object for heatbeat/status processsing
|
protected |
thread object for network poll server
|
protected |
thread object for network server
|
protected |
|
protected |
size of the mp32BitBuffer in 32-bit words
|
protected |
area mode update interval
|
protected |
cooling duty (0 to 1)
|
protected |
last desired setting known
|
protected |
copy of the DSP code revision level
|
protected |
1 when FAN is enabled
|
protected |
copy of the FPGA revision level
|
protected |
GPIO pin state.
|
protected |
number of errors encountered on loopback testing
|
protected |
|
protected |
mean value (from set Offset Target processing)
|
protected |
number of Client messages (from PC)
|
protected |
number of Outbound messages to client (PC)
|
protected |
number of milliseconds of exp on current frame
|
protected |
time between NOOP sends
|
protected |
NOOP counter.
|
protected |
number of columns for an area read
|
protected |
number of rows for an area read
|
protected |
P,I,D controls.
|
protected |
shearing threshold
|
protected |
number of columns to average in shearing process
|
protected |
number of rows to average in shearing process
|
protected |
our active network socket connection
|
protected |
StdDev value (from set Offset Target processing)
|
protected |
target setpoin, degrees C
|
protected |
1 when TEC is enabled
|
protected |
pointer vector for 16 bit headers
|
protected |
local buffer for expanding 16-bit data to 32-bit data
|
protected |
pointer vector for 16 bit headers
|
protected |
|
protected |
|
protected |
CRC engine for loopback mode.
|
protected |
|
protected |
IOV structure for iov write calls.
|
protected |
pointer to parser for Network Interface
|
protected |
cached copy of bin params for processing binned images
|
protected |
|
protected |
|
protected |
copy of the capture configuration
|
protected |
copy of our hardware parameters
|
protected |
active simulation mode data