TwiceAsNice
2019-02-18
|
#include "fishcamp.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdbool.h>
#include <libusb-1.0/libusb.h>
Macros | |
#define | MAXRBUF 512 |
Functions | |
int | SendUSB (int camNum, unsigned char *data, int length) |
int | RcvUSB (int camNum, unsigned char *data, int maxBytes) |
bool | haveStarfishLogFile () |
void | creatStarfishLogFile () |
void | check4tooLongLogFile () |
void | fc_timestamp (FILE *out) |
void | Starfish_Log (char *logString) |
bool | sawThisCameraAlready (UInt16 vendor, UInt16 rawProduct, UInt16 finalProduct, UInt16 release) |
int | getCameraDBIndex (UInt16 vendor, UInt16 rawProduct, UInt16 finalProduct, UInt16 release) |
int | getNextFreeDBIndex (void) |
void | printOutDiscoveredCamerasDB (void) |
void | AnchorWrite (struct libusb_device_handle *dev_handle, UInt16 anchorAddress, UInt16 count, UInt8 writeBuffer[]) |
FILE * | openFile (UInt16 vendor, UInt16 product) |
int | hexRead (INTEL_HEX_RECORD *record, FILE *hexFile, UInt16 vendor, UInt16 product) |
int | DownloadToAnchorDevice (struct libusb_device_handle *dev, UInt16 vendor, UInt16 product) |
int | GetLatestSrecFileRevNumber (void) |
FILE * | openSrecFile (UInt16 vendor, UInt16 rawProduct) |
char * | srecRead (UInt8 *record, FILE *srecFile) |
void | DownloadtToMicroBlaze (int camNum) |
UInt16 | fcUsb_GetUsbCmdCksum (UInt16 *cmdParams) |
float | fcImage_calcFullFrameAllColAvg (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
float | fcImage_calcFullFrameRowAvgForRow (UInt16 *frameBufferPtr, int imageWidth, int imageHeight, int theRow) |
void | fcImage_doFullFrameRowLevelNormalization (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_StripBlackCols (int camNum, UInt16 *frameBuffer) |
void | fcImage_IBIS_clearBlackRowAverage (void) |
void | fcImage_IBIS_accumulateBlackRowAverage (void) |
void | fcImage_IBIS_divideBlackRowAverage (void) |
float | fcImage_IBIS_calcFirstBlackRowAverage (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_IBIS_subtractPedestal (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_IBIS_computeAvgColOffsets (int camNum) |
void | fcImage_IBIS_doFullFrameColLevelNormalization (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_PRO_calcColOffsets (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_PRO_doFullFrameColLevelNormalization (UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_PRO_calibrateProCamera (int camNum, UInt16 *frameBufferPtr, int imageWidth, int imageHeight) |
void | fcImage_do_3x3_kernel (UInt16 imageHeight, UInt16 imageWidth, UInt16 *frameBuffer) |
void | fcImage_do_5x5_kernel (UInt16 imageHeight, UInt16 imageWidth, UInt16 *frameBuffer) |
void | fcImage_do_hotPixel_kernel (UInt16 imageHeight, UInt16 imageWidth, UInt16 *frameBuffer) |
void | fcUsb_init (void) |
void | fcUsb_setLogging (bool loggingState) |
void | fcUsb_setSimulation (bool simState) |
void | fcUsb_close (void) |
int | fcUsb_FindCameras (void) |
int | fcUsb_GetFindCamsState (void) |
float | fcUsb_GetFindCamsPercentComplete (void) |
int | fcUsb_OpenCamera (int camNum) |
int | fcUsb_CloseCamera (int camNum) |
int | fcUsb_GetNumCameras (void) |
bool | fcUsb_haveCamera (void) |
int | fcUsb_GetCameraSerialNum (int camNum) |
int | fcUsb_GetCameraVendorID (int camNum) |
int | fcUsb_GetCameraProductID (int camNum) |
int | fcUsb_cmd_nop (int camNum) |
int | fcUsb_cmd_rst (int camNum) |
int | fcUsb_cmd_getinfo (int camNum, fc_camInfo *camInfo) |
int | fcUsb_cmd_setRegister (int camNum, UInt16 regAddress, UInt16 dataValue) |
UInt16 | fcUsb_cmd_getRegister (int camNum, UInt16 regAddress) |
int | fcUsb_cmd_setIntegrationTime (int camNum, UInt32 theTime) |
int | fcUsb_cmd_setGuiderIntegrationTime (int camNum, UInt32 theTime) |
int | fcUsb_cmd_startExposure (int camNum) |
int | fcUsb_cmd_startGuiderExposure (int camNum) |
int | fcUsb_cmd_abortExposure (int camNum) |
int | fcUsb_cmd_abortGuiderExposure (int camNum) |
UInt16 | fcUsb_cmd_getState (int camNum) |
UInt16 | fcUsb_cmd_getGuiderState (int camNum) |
int | fcUsb_cmd_setFrameGrabberTestPattern (int camNum, UInt16 state) |
int | fcUsb_cmd_rdScanLine (int camNum, UInt16 lineNum, UInt16 Xmin, UInt16 Xmax, UInt16 *lineBuffer) |
int | fcUsb_cmd_setRoi (int camNum, UInt16 left, UInt16 top, UInt16 right, UInt16 bottom) |
int | fcUsb_cmd_setBin (int camNum, UInt16 binMode) |
int | fcUsb_cmd_setRelay (int camNum, int whichRelay) |
int | fcUsb_cmd_clearRelay (int camNum, int whichRelay) |
int | fcUsb_cmd_pulseRelay (int camNum, int whichRelay, int onMs, int offMs, bool repeats) |
int | fcUsb_cmd_setTemperature (int camNum, SInt16 theTemp) |
SInt16 | fcUsb_cmd_getTemperature (int camNum) |
UInt16 | fcUsb_cmd_getTECPowerLevel (int camNum) |
bool | fcUsb_cmd_getTECInPowerOK (int camNum) |
int | fcUsb_cmd_turnOffCooler (int camNum) |
int | fcUsb_cmd_getRawFrame (int camNum, UInt16 numRows, UInt16 numCols, UInt16 *frameBuffer) |
int | fcUsb_cmd_setCameraGain (int camNum, UInt16 theGain) |
int | fcUsb_cmd_setCameraOffset (int camNum, UInt16 theOffset) |
int | fcUsb_cmd_setReadMode (int camNum, int DataXfrReadMode, int DataFormat) |
void | fcUsb_setStarfishDefaultRegs (int camNum) |
void | fcUsb_cmd_setImageFilter (int camNum, int theImageFilter) |
UInt16 | fcUsb_cmd_getBlackPedestal (int camNum) |
void | fcUsb_cmd_setCameraProperty (int camNum, int propertyType, int propertyValue) |
#define MAXRBUF 512 |
void AnchorWrite | ( | struct libusb_device_handle * | dev_handle, |
UInt16 | anchorAddress, | ||
UInt16 | count, | ||
UInt8 | writeBuffer[] | ||
) |
void check4tooLongLogFile | ( | ) |
void creatStarfishLogFile | ( | ) |
int DownloadToAnchorDevice | ( | struct libusb_device_handle * | dev, |
UInt16 | vendor, | ||
UInt16 | product | ||
) |
void DownloadtToMicroBlaze | ( | int | camNum | ) |
void fc_timestamp | ( | FILE * | out | ) |
float fcImage_calcFullFrameAllColAvg | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
float fcImage_calcFullFrameRowAvgForRow | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight, | ||
int | theRow | ||
) |
void fcImage_doFullFrameRowLevelNormalization | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_IBIS_accumulateBlackRowAverage | ( | void | ) |
float fcImage_IBIS_calcFirstBlackRowAverage | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_IBIS_clearBlackRowAverage | ( | void | ) |
void fcImage_IBIS_computeAvgColOffsets | ( | int | camNum | ) |
void fcImage_IBIS_divideBlackRowAverage | ( | void | ) |
void fcImage_IBIS_doFullFrameColLevelNormalization | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_IBIS_subtractPedestal | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_PRO_calcColOffsets | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_PRO_calibrateProCamera | ( | int | camNum, |
UInt16 * | frameBufferPtr, | ||
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_PRO_doFullFrameColLevelNormalization | ( | UInt16 * | frameBufferPtr, |
int | imageWidth, | ||
int | imageHeight | ||
) |
void fcImage_StripBlackCols | ( | int | camNum, |
UInt16 * | frameBuffer | ||
) |
void fcUsb_close | ( | void | ) |
int fcUsb_CloseCamera | ( | int | camNum | ) |
int fcUsb_cmd_abortExposure | ( | int | camNum | ) |
int fcUsb_cmd_abortGuiderExposure | ( | int | camNum | ) |
int fcUsb_cmd_clearRelay | ( | int | camNum, |
int | whichRelay | ||
) |
UInt16 fcUsb_cmd_getBlackPedestal | ( | int | camNum | ) |
UInt16 fcUsb_cmd_getGuiderState | ( | int | camNum | ) |
int fcUsb_cmd_getinfo | ( | int | camNum, |
fc_camInfo * | camInfo | ||
) |
UInt16 fcUsb_cmd_getState | ( | int | camNum | ) |
bool fcUsb_cmd_getTECInPowerOK | ( | int | camNum | ) |
UInt16 fcUsb_cmd_getTECPowerLevel | ( | int | camNum | ) |
SInt16 fcUsb_cmd_getTemperature | ( | int | camNum | ) |
int fcUsb_cmd_nop | ( | int | camNum | ) |
int fcUsb_cmd_pulseRelay | ( | int | camNum, |
int | whichRelay, | ||
int | onMs, | ||
int | offMs, | ||
bool | repeats | ||
) |
int fcUsb_cmd_rdScanLine | ( | int | camNum, |
UInt16 | lineNum, | ||
UInt16 | Xmin, | ||
UInt16 | Xmax, | ||
UInt16 * | lineBuffer | ||
) |
int fcUsb_cmd_rst | ( | int | camNum | ) |
int fcUsb_cmd_setBin | ( | int | camNum, |
UInt16 | binMode | ||
) |
int fcUsb_cmd_setCameraGain | ( | int | camNum, |
UInt16 | theGain | ||
) |
int fcUsb_cmd_setCameraOffset | ( | int | camNum, |
UInt16 | theOffset | ||
) |
void fcUsb_cmd_setCameraProperty | ( | int | camNum, |
int | propertyType, | ||
int | propertyValue | ||
) |
int fcUsb_cmd_setFrameGrabberTestPattern | ( | int | camNum, |
UInt16 | state | ||
) |
int fcUsb_cmd_setGuiderIntegrationTime | ( | int | camNum, |
UInt32 | theTime | ||
) |
void fcUsb_cmd_setImageFilter | ( | int | camNum, |
int | theImageFilter | ||
) |
int fcUsb_cmd_setIntegrationTime | ( | int | camNum, |
UInt32 | theTime | ||
) |
special handling for the starfish guide camera if (gCamerasFound[camNum - 1].camFinalProduct == starfish_mono_rev2_final_deviceID) { tell the camera the new setting of the read black cols mode bit. We will read the black cols anytime the integration time is less than 2 seconds. fcUsb_cmd_setReadMode(camNum, gDataXfrReadMode[camNum - 1], gDataFormat[camNum - 1]); resend the ROI params. the fcUsb_cmd_setReadMode routine will have set the gReadBlack variable so the next routine will trick the camera into using a wider ROI. fcUsb_cmd_setRoi(camNum, gRoi_left[camNum - 1], gRoi_top[camNum - 1], gRoi_right[camNum - 1], gRoi_bottom[camNum - 1]); }
int fcUsb_cmd_setReadMode | ( | int | camNum, |
int | DataXfrReadMode, | ||
int | DataFormat | ||
) |
int fcUsb_cmd_setRelay | ( | int | camNum, |
int | whichRelay | ||
) |
int fcUsb_cmd_setTemperature | ( | int | camNum, |
SInt16 | theTemp | ||
) |
int fcUsb_cmd_startExposure | ( | int | camNum | ) |
int fcUsb_cmd_startGuiderExposure | ( | int | camNum | ) |
int fcUsb_cmd_turnOffCooler | ( | int | camNum | ) |
int fcUsb_FindCameras | ( | void | ) |
int fcUsb_GetCameraProductID | ( | int | camNum | ) |
int fcUsb_GetCameraSerialNum | ( | int | camNum | ) |
int fcUsb_GetCameraVendorID | ( | int | camNum | ) |
float fcUsb_GetFindCamsPercentComplete | ( | void | ) |
int fcUsb_GetFindCamsState | ( | void | ) |
int fcUsb_GetNumCameras | ( | void | ) |
bool fcUsb_haveCamera | ( | void | ) |
void fcUsb_init | ( | void | ) |
int fcUsb_OpenCamera | ( | int | camNum | ) |
void fcUsb_setLogging | ( | bool | loggingState | ) |
void fcUsb_setSimulation | ( | bool | simState | ) |
void fcUsb_setStarfishDefaultRegs | ( | int | camNum | ) |
int GetLatestSrecFileRevNumber | ( | void | ) |
int getNextFreeDBIndex | ( | void | ) |
bool haveStarfishLogFile | ( | ) |
int hexRead | ( | INTEL_HEX_RECORD * | record, |
FILE * | hexFile, | ||
UInt16 | vendor, | ||
UInt16 | product | ||
) |
void printOutDiscoveredCamerasDB | ( | void | ) |
int RcvUSB | ( | int | camNum, |
unsigned char * | data, | ||
int | maxBytes | ||
) |
int SendUSB | ( | int | camNum, |
unsigned char * | data, | ||
int | length | ||
) |
char* srecRead | ( | UInt8 * | record, |
FILE * | srecFile | ||
) |
void Starfish_Log | ( | char * | logString | ) |
char driverSupportPath[MAXRBUF] |
SInt32 gBlackOffsets[1280] |
UInt16 gBlackPedestal[kNumCamsSupported] |
char gBuffer[513] |
int gCameraImageFilter[kNumCamsSupported] |
fc_Camera_Information gCamerasFound[kNumCamsSupported] |
struct libusb_context* gCtx |
UInt32 gCurrentGuiderIntegrationTime[kNumCamsSupported] |
UInt32 gCurrentIntegrationTime[kNumCamsSupported] |
int gDataFormat[kNumCamsSupported] |
int gDataXfrReadMode[kNumCamsSupported] |
bool gDoLogging |
bool gDoSimulation |
float gFindCamPercentComplete |
fcFindCamState gFindCamState |
UInt16* gFrameBuffer |
bool gFWInitialized |
int gNumCamerasDiscovered |
SInt32 gProBlackColOffsets[4096] |
SInt32 gProBlackRowOffsets[4096] |
bool gProWantColNormalization |
bool gReadBlack[kNumCamsSupported] |
UInt16 gRelease |
UInt16 gRoi_bottom[kNumCamsSupported] |
UInt16 gRoi_left[kNumCamsSupported] |
UInt16 gRoi_right[kNumCamsSupported] |
UInt16 gRoi_top[kNumCamsSupported] |