Home
5 ARC API Reference
Contents
1. cout lt lt endl exit EXIT FAILURE Handle program arguments for int i 2 i lt argc i std string sArgv argv i if sArgv compare f 0 amp amp argc gt i 1 sTimFile argv i 1 cout lt lt Timing File Set lt lt sTimFile lt lt endl else if sArgv compare e 0 amp amp argc gt i 1 fExpTime float atof argv i 1 cout lt lt Exposure Time Set lt lt fExpTime lt lt endl els e if Q Q Fh C Fh U 1Cols atol argv i 1 exit EXIT FAILURE sArgv compare r 0 amp amp argc gt i 1 lRows atol argv i 1 out lt lt Number Of Rows Set lt lt lRows lt lt endl sArgv compare c 0 amp amp argc gt i 1 out lt lt Number Of Cols Set lt lt 1Cols lt lt endl sArgv compare d 0 amp amp argc gt i 1 lDeintAlg atol argv i 1 out lt lt Deinterlace Set lt lt lDeintAlg lt lt endl sArgv compare h SAGE argv 0 Create an instance of the ARC controller API auto_ptr lt CArcDevice gt pArcDev new CArcPCle IE sDev compare PCI 0 pArcDev reset new CArcPCI cout lt lt endl TEY Find all ARC PCI e device cout lt lt SetDots
2. CArcTools StringToUpper Syntax const std string StringToUpper std string sStr Description Function to transform a string into all uppercase letters Parameters sStr The string to convert Throws Exception N A const std string The converted string Notes Usage n cout lt lt The string lowercase as uppercase lt lt CArcTools StringToUpper lowercase lt lt endl CArcTools GetSystemMessage Syntax std string GetSystemMessage int dCode Description Used to get a formatted message string from the specified system error code Parameters dCode A system error code Throws Exception N A The system error code string Notes Usage CArcTools ConvertWideToAnsi Syntax std string ConvertWideToAnsi wchar t wcharString Description Converts the specified wide char string unicode to an ANSI std string Parameters wcharString Wide character string to be converted to std string Throws Exception N A The converted string Notes Usage CArcTools ConvertWideToAnsi Syntax std string ConvertWideToAnsi const std wstring amp wsString Description Converts the specified wide string unicode to an ansi std string Parameters wsString Wide string to be converted to std string Throws Exception N A The converted string Notes Usage
3. ASTRONOMICAL RESEARCH Cameras INC ARC API User Manual Version 3 0 March 2012 Getting Started The ARC API is a set of C libraries that can be used to command all ARC host and controller boards There are also several utility libraries for de interlacing images displaying images via DS9 saving FITS and TIFF files and determining image statistics Development Tools The API libraries were built using the following development environments Windows Applications and API DLL Microsoft Visual C C 2008 Linux Applications and API Library Standard CentOS 6 0 linux distribution using GCC MAC OS X Applications and API Library XCode Version Compatibility When using the ARC API it is important that all components are of the same version The older Version 2 0 CController library is completely incompatible with the Version 3 0 CArcDevice library and should not be used for new applications Version 3 0 contains the interface that will be used in all future versions That being said the other Version 2 0 libraries such as CFitsFile CDeinterlace Clmage etc are independent of the hardware and are included as part of Version 3 0 Building an Application Using the API Include necessary header file location On Windows C xxx ARC_API 3 0 CArcDevice C xxx ARC_API 2 0 CDeinterlace C xxx ARC_API 2 0 CFitsFile etc On Linux xxx ARC_API 3 0 CArcDevice xxx ARC_API 2 0 CDeinterlace xxx ARC_API 2 0 CFit
4. lt lt pArcDev gt CommonBufferPA lt lt endl cout lt lt Image buf size lt lt pArcDev gt CommonBufferSize lt lt endl else cerr lt lt Failed to read buffer properties lt lt endl CArcDevice FillCommonBuffer Syntax void FillCommonBuffer unsigned short ul6Value 0 Description Fills the common buffer with the specified 16 bit value Parameters u16Value The value to fill the common image buffer with default 0 Throws Exception std runtime_error N A Usage CArcDevice pArcDev new CArcPCIe Open device etc Fill the buffer with OxBEEF Fy pArcDev gt FillCommonBuffer OxBEEF CArcDevice CommonBufferVA Syntax void CommonBufferVA Description Returns the common buffer user virtual address Parameters N A Throws Exception N A The buffer base virtual address NULL No buffer exists or GetCommonBufferProperties has not been called Notes The user virtual address can only be valid after calling CArcDevice GetCommonBufferProperties Usage CArcDevice pArcDev new CArcPCIe Open device etc Lh Get the virtual address to 16 bit data unsigned short pUl6Buf unsigned short pArcDev gt CommonBufferVA Print the first ten values for int i 0 i lt 10 itt cout lt lt Buffer lt l
5. Fa Reset the PCI board CArcDevice pArcDev new CArcECI pArcDev gt Reset Reset the PCIe board CArcDevice pArcDev new CArcPCIe pArcDev gt Reset CArcDevice MapCommonBuffer Syntax void MapCommonBuffer int dBufferSize 0 Description Maps a common buffer of the specified size in bytes into user virtual space Parameters dBufferSize The size in bytes of the common image buffer to allocate Throws Exception std runtime_error N A Notes Mapping of the common buffer into user virtual space may fail due to insufficient contiguous memory How and when the common buffer is actually allocated is operating system dependent The size of the buffer should be verified by calling CArcDevice CommonBufferSize The buffer should be unmapped by calling CArcDevice UnMapCommonBuffer or CArcDevice Close The virtual address will cease to be valid after closing the device or after unmapping the buffer Refer to CArcDevice UnMapCommonBuffer The virtual address for the common buffer can be had by calling CArcDevice CommonBufferVA The returned pointer can be used to directly access the buffer This pointer should not be freed by the user the CArcDevice class will handle this Usage define BUFFER SIZE 2200 2200 sizeof unsigned short CArcDevice pArcDev new CArcPCIe Open device 0 pArcDev gt Open 0
6. Map a 2200 x 2200 pixel common image buffer pArcDev gt MapCommonBuffer BUFFER SIZE if pArcDev gt CommonBufferSize BUFFER SIZE cerr lt lt Failed to map image buffer lt lt endl return 1 lt continued next page gt Get the virtual address to 16 bit data unsigned short pUl6Buf unsigned short pArcDev gt CommonBufferVA Print the first ten values for int i 0 i lt 10 i cout lt lt Buffer lt lt i lt lt J lt lt pUl6Buf i lt lt endl UnMap buffer or just call Close pArcDev gt UnMapCommonBuffer pArcDev gt Close CArcDevice UnMapCommonBuffer Syntax void UnMapCommonBuffer Description Unmaps the common buffer from user virtual space Parameters N A Throws Exception N A N A Notes The buffer should be unmapped by calling CArcDevice UnMapCommonBuffer or CArcDevice Close The virtual address will cease to be valid after closing the device or after unmapping the buffer Usage CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 pArcDev gt MapCommonBuffer 1024 1200 2 Do some stuff here pArcDev gt UnMapCommonBuffer CArcDevice ReMapCommonBuffer Syntax void ReMapCommonBuffer int dBufferSize 0 Description Re Maps the common buffer to have the specified size i
7. ETL E ASTROPCI_GET_FRAMES_RE ASTROPCI_HCVR ASTROPCI_SET_ ASTROPCI_SET_ ASTROPCI_PCI_DOWNLOAD ASTROPCI_ AI Stop the current image exposure readout AS A CI_GET_CR_PROGRESS FROPCI Gi BYTE ASTROPCI_GET_CONFIG_WORD ASTROPCI_GET_CONFIG_DWO BYTE ASTROPCI SET CONFIG WORD Write a word to the configuration space header ASTROPCI SET CONFIG DWORD Write a double word to the configuration space header ASTROPCI PCI LOAD WAIT Wait for the PCI board to finish entering download mode Usage CArcDevice pArcDev new CArcECI Read the current pixel count int dPixelCount pArcDev gt ToctlDevice ASTROPCI GET PROGRESS cout lt lt Pixel Count lt lt dPixelCount lt lt endl Should actually do it this way pArcDev gt GetPixelCount CArcPCl loctiDevice Syntax int loctlDevice int dIoctlCmd int dArg int dArgCount Description Sends a command to the PCI device driver Parameters dloctlCmd A PCI device driver command dArg Array of arguments required by the command The size of the array depends on the command dArgCount The number of elements in the dArg parameter Throws Exception std runtime_error int The command rep Notes Valid IOCTL commands OCTL Command ASTROPCI_GET_HCTR ASTROPCI_GET_PROGRI ASTROPCI_GET_DM EI E 5 tl D D iw W Read the
8. Send Power On to the controller if pArcDev gt Command TIM ID PON DON throw runtime error PON failed CArcDevice GetControllerld Syntax int GetControllerlIdi Description Returns the hardware ID from the timing board Parameters N A Throws Exception std runtime_error The controller ID 0x455252 ERR The timing board doesn t support a controller ID in hardware Notes Currently 2011 only the SmallCam timing board contains a hardware ID The SmallCam ID is 0x534330 SC where is currently O ArcDefs h defines a macro called S_ARC12 id that can be called to verify that the ID matches that of SmallCam The macro returns bool true or false Usage CArcDevice pArcDev new CArcPCIe int did pArcDev gt GetControllerId if IS ARC12 dId cout lt lt Found SmallCam lt lt endl cout lt lt Controller ID lt lt hex lt lt dId lt lt dec lt lt endl CArcDevice ResetController Syntax void ResetController bool bDSPOnly Description Resets the controller Parameters bDSPOnly SmallCam only True to only reset the SmallCam DSP and not the entire controller Default false Throws Exception std runtime_error N A Notes Usage CArcDevice pArcDev new CArcPCIe pArcDev gt ResetController CArcDevice SetupController
9. Set the image dimensions on the camera controller Parameters dRows The row image dimension in pixels dCols The column image dimension in pixels Throws Exception std runtime_error N A Notes This method is called from within the SetupController method Usage CArcDevice pArcDev new CArcPCIe Set the image size to 1200x1024 4 pArcDev gt SetImageSize 1024 1200 CArcDevice GetimageRows Syntax int GetImageRows Description Get the image row dimension from the camera controller Parameters N A Throws Exception std runtime_error The image row dimension in pixels Notes N A Usage CArcDevice pArcDev new CArcPCIe int dRows pArcDev gt GetImageRow int dCols pArcDev gt GetImageCols cout lt lt Current Image Size lt lt dRows lt lt x lt lt dCols lt lt endl CArcDevice GetimageCols Syntax int GetImageCols Description Get the image column dimension from the camera controller Parameters N A Throws Exception std runtime_error The image column dimension in pixels Notes N A Usage CArcDevice pArcDev new CArcPCIe int dRows pArcDev gt GetImageRow int dCols pArcDev gt GetImageCols cout lt lt Current Image Size lt lt dRows lt lt x lt lt dCols lt lt endl CArcDevice GetCCParams Sy
10. cerr lt lt TDL failed lt lt endl Should actually do it this way pArcDev gt Command TIM ID TDL 0x112233 CExplFace Interface This section documents details of the methods available through the CExplFace class see CExplFace h This class is an abstract interface that provides exposure callbacks for user applications The user may extend this class and pass it into the CArcDevice Expose method for elapsed time and pixel count information The following is a list of these methods with details to follow on subsequent pages void ExposeCallback float fElapsedTime void ReadCallback int dPixelCount CExplFace ExposeCallback Syntax void ExposeCallback float fElapsedTime Description Called from the CArcDevice Expose method to supply the application with elapsed time info Parameters fElapsedTime The current elapsed time Throws Exception std runtime_error N A Notes This class must be sub classed by the user application The sub class can then be passed into the CArcDevice Expose method This is the only way to get elapsed exposure time info from the CArcDevice Expose method Usage class CExplnfo public CExpIFace void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixe
11. in bytes of the common image buffer to allocate Throws Exception std runtime_error N A Notes The number of host interface boards can be found using the FindDevices and DeviceCount class methods Usage define BUFFER SIZE 2200 2200 sizeof unsigned short CArcDevice pArcDev new CArcPCIe Open device 0 with a 2200 x 2200 pixel common image buffer pArcDev gt Open 0 BUFFER SIZE To open a device without allocating an image buffer or if you intend to call CArcDevice MapCommonBuffer separately CArcDevice pArcDev new CArcPCIe Open device 0 with NO common image buffer pArcDev gt Open 0 CArcDevice Close Syntax void Close Description Closes a host interface device connection Parameters N A Throws Exception N A Usage include lt iostream gt include CArcDevices h include CArcPCIe h using namespace std using namespace arc CArcPCIe FindDevices CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 if pArcDev gt IsOpen i cerr lt lt Device failed to open lt lt endl pArcDev gt Close CArcDevice Reset Syntax void Reset Description Resets the host interface device Parameters N A Throws Exception std runtime_error N A Notes May not be implemented for all host interface devices Usage
12. lt lt endl catch std runtime error amp e cout lt lt failed lt lt endl cerr lt lt endl lt lt e what lt lt endl if pArcDev get gt IsReadout pArcDev get gt StopExposure pArcDev get gt Close CAEN ura cerr lt lt endl lt lt Error unknown exception occurred lt lt endl if pArcDev get gt IsReadout pArcDev get gt StopExposure pArcDev get gt Close Us ne ee ee ea ee ee Se a eS ee eS Se ee a ee ee a a bd SetDots i a a ha a r a a a a S dif This function just prints dots for the output SS SS SS eS std string SetDots const char cStr std string sStr cStr for int i sStr length i lt 40 i sStr append return sStr
13. 0x112233 amp tStatus if tStatus dSuccess printf Error s n tStatus szMessage ArcCAPIDevList Structure The ArcCAPIDevList structure is a parameter required by the ArcCam GetDeviceList function and returns a list of device strings The structure has two members dDevCount which contains the device string count and szDevList which is an array of device strings that can be used with the ArcCam OpenByNamexxxX functions The ArcCam GetDeviceList function MUST be called before any open function For example the following shows how to a device ArcCAPIStatus tStatus ArcCAPIDevList tDevList ArcCam GetDeviceList amp tDevList amp tStatus if tStatus dSuccess printf Error s n tStatus szMessage lt e return tStatus dSuccess ArcCameraAPI Functions void ArcCam GetDeviceList s int ArcCa void ArcCa void ArcCa void ArcCa void ArcCa void void void ArcC void ArcC void ArcC int ArcC void ArcC void ArcC ulong ArcC int ArcC int ArcCa int ArcCa void ArcCa void ArcCa void ArcCa int ArcCa m IsOpen stru ArcCam Close ArcCam Reset struct A am MapCommonBu a a am GetCommonBu am Fil1Co am CommonBuffe am CommonBuffe am CommonBuffe m GetId m Ge Struc tStatus s m ClearStatus m Set2xFOT m Command int int int ArcCam CmdiArg int m Open int dDevNum m UnMap
14. CArcPCl GetDeviceStringList Syntax const char GetDeviceStringList Description Returns the list of ARC PCI devices found in the system Parameters N A Throws Exception std runtime_error The device list No Devices Found The device list is empty Notes The user should call PCI FreeDeviceStringList when finished with the returned list Usage CArcDevice pArcDev NULL Find all PCI devices CArcPCI FindDevices List all PCI devices found const char pszDevList CArcPCI GetDeviceStringList for int i 0 i lt CArcPCI DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCI FreeDeviceStringList Open the first PCI device found if CArcPCI DeviceCount gt 0 pArcDev new CArcECI pArcDev gt Open 0 2200 2200 2 CArcPCl FreeDeviceStringList Syntax void FreeDeviceStringList Description Frees the resources for the device string list returned from CArcPCl GetDeviceStringList Parameters N A Throws Exception std runtime_error N A Notes The user should call PCI FreeDeviceStringList when finished with the list returned by PCI GetDeviceStringList Usage CArcDevice pArcDev NULL Find all PCI devices CArcPCI FindDevices List all PCI devices found const char pszDevList CArcPCI GetDeviceStringList for int i 0 i lt CArcPCI
15. CArcTools ConvertAnsiToWide Syntax std wstring ConvertAnsiToWide const char szString Description Converts the specified ANSI char string to a unicode std wstring Parameters szString ANSI C character string to be converted to std wstring Throws Exception N A The converted wide string Notes Usage CArcTools ConvertintToString Syntax std string ConvertIntToString int dNumber Description Converts the specified integer value to a std string Parameters dNumber The integer to convert to std string Throws Exception N A The converted string Notes This is a convenience method Usage Nn cout lt lt The number 10 as a string lt lt CArcTools ConvertIntToString 10 lt lt endl CArcTools StringToHex Syntax long StringToHex std string sStr Description Converts the specified std string to a long integer value Parameters sStr The std string to convert Throws Exception N A The converted long value Notes This is a convenience method Usage ANY cout lt lt The string 10 as a hex value lt lt CArcTools StringToHex 10 lt lt endl CArcTools StringToChar Syntax char StringToChar std string sStr Description Converts the specified std string which represents a single character to a C char value Parameters sStr The std str
16. Finding devices if sDev compare PCIe CArcPCIe FindDevices else CArcPCI FindDevices cout lt lt done lt lt endl Open a driver device connection Td cout lt lt SetDots Opening first device pArcDev get gt Open 0 4200 4200 sizeof unsigned short cout lt lt done Image Buffer Size lt lt pArcDev get gt CommonBufferVA lt lt endl ie Setup the controller cout lt lt SetDots Setting up controller pArcDev get gt SetupController true Reset Controller true Test Data Link true Power On lRows Image row size 1Cols Image col size sTimFile c_str DSP timing file cout lt lt done lt lt endl Expose ae pArcDev get gt Expose fExpTime lRows 1Cols bAbort amp cExposeListener Pie Deinterlace the imag cout lt lt SetDots Deinterlacing image CDeinterlace cDlacer cDlacer RunAlg pArcDev get gt CommonBufferVA lRows 1Cols 1DeintAlg cout lt lt done lt lt endl Save the image to FITS if cout lt lt SetDots Writing FITS CFitsFile cFits Image fit lRows 1Cols cFits Write pArcDev get gt CommonBufferVA cout lt lt done lt lt endl Close the device connection ii cout lt lt SetDots Closing device pArcDev get gt Close cout lt lt done
17. Notes The default constants are stored in TempCtrl h and cannot be permanently overwritten Usage CArcDevice pArcDev new CArcPCIe pArcDev gt SaveTemperatureCtrlData MyTempCtrlFile txt Modify the file contents pArcDev gt LoadTemperatureCtrlData MyTempCtrlFile txt CArcPCle Only Methods This section documents details of the methods only available through the ARC PCle class see CArcPCle h The following is a list of these methods with details to follow on subsequent pages static void FindDevices static void UseDevices const char pszDeviceList int dListCount static int DeviceCount static const char GetDeviceStringList static void FreeDeviceStringList bool IsFiberConnected int dFiber void WriteBar int dBar int dOffset int dValue int ReadBar int dBar int dOffset CArcPCle FindDevices Syntax void FindDevices Description Searches the system for available ARC PCle ARC 66 67 devices Parameters N A Throws Exception std runtime_error N A Notes This static class method MUST be called before any PCle device can be opened accessed The resulting list is stored and allows devices to be accessed via device number 0 1 2 as a parameter to the Open method The list itself can be read via the PCle DeviceCount and PCle GetDeviceStringList methods Usage CArcDevice pA
18. szMessage int dBytes tus pStatus pstatus t ArcCAPIStatus pStatus ruct ArcCAPIStatus pst amp tStatus tatus pst tus pStatus r tatus int t dArg3 tatus E PIStatus pStatus struct ArcCAPIStatus pStatus int ArcCam Cmd2Arg int dBoardId int dCommand int dArgl int dArg2 struct ArcCAPIStatus pStatus int ArcCam_Cmd3Arg int dBoardId int dCommand int dArgl int dArg2 int dArg3 struct ArcCAPIStatus pStatus int ArcCam_GetControlleriId struct ArcCAPIStatus pStatus void ArcCam ResetController struct ArcCAPIStatus pStatus int ArcCam_IsControllerConnected struct ArcCAPIStatus pStatus void ArcCam SetupController int dReset int dTdl int dPower int dRows int dCols const char pszTimFile const char pszUtilFile const char pszPciFile int pAbort struct ArcCAPIStatus pStatus void ArcCam_LoadControllerFile const char pszFilename int dValidate int pAbort struct ArcCAPIStatus pStatus void ArcCam SetImageSize int dRows int dCols struct ArcCAPIStatus pStatus int ArcCam_GetImageRows struct ArcCAPIStatus pStatus int ArcCam_GetImageCols struct ArcCAPIStatus pStatus int ArcCam_GetCCParams struct ArcCAPIStatus pStatus int ArcCam_IsCCParamSupported int dParameter str
19. CArcDevice methods are available all CDeinterlace methods are available and a simple function to write basic FITS files using the CFitsFile class is available Each function in the C interface will be listed here but not detailed All function parameters match those of the wrapped class method and are detailed in the class documentation For example to see the details of the parameters for the ArcCam_Command function see the CArcDevice Command method documentation In general all functions in the C interface have the same name as the wrapped class counterpart but are prefixed with ArcCam_ There are some exceptions but the naming change should be obvious IMPORTANT NOTE The ArcCam GetDeviceList function MUST be called before any ArcCam_OpenXxx function or open will fail The ArcCam GetDeviceList function returns a ArcCAPIDevList structure which contains a list of device strings See below for details ArcCAP Status Structure The ArcCAPIStatus structure is a parameter required by most functions and is used to report any errors The structure has two members dSuccess which is set to 1 if no errors occurred or 0 on error and szMessage which holds an error message if dSuccess equals 0 The status should be checked after every function call For example the following shows how to check the status after sending a TDL command ArcCAPIStatus tStatus int dResult 0 dResult ArcCam CmdiArg TIM ID TDL
20. DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCI FreeDeviceStringList Open the first PCI device found if CArcPCI DeviceCount gt 0 pArcDev new CArcPCI pArcDev gt Open 0 2200 2200 2 CArcPCl SetHctr Syntax void SetHctr int dVal Description Sets the DSP Host Control Register HCTR Parameters dVal The value to write to the register Throws Exception std runtime_error N A Notes N A Usage N A CArcPCl GetHctr Syntax int GetHctr Description Reads the DSP Host Control Register HCTR Parameters N A Throws Exception std runtime_error Return Value Description Notes N A Usage N A CArcPCI GetHstr Syntax int GetHstr Description Reads the DSP Host Status Register HSTR Parameters N A Throws Exception std runtime_error int The HSTR value Notes The status bits are had by masking the return value from the HSTR with CArcPCl HTF_BIT_MASK This is what the CArcPCI GetStatus method does The status bits match one of the following enum TIMEOUT STATUS 0 DONE STATUS EAD REPLY STATUS RROR STATUS YSTEM RESET STATUS EADOUT STATUS USY STATUS W Hi w Usage CArcDevice pArcDev new CArcECI int dHstr pArcDev gt GetHstr amp CArcPCI HTF BIT MASK gt
21. REG CMD ARG3 CArcPCIe REG CMD ARG4 CArcPCIe REG INIT IMG ADDR CArcPCIe REG STATUS CArcPCIe REG CMD REPLY CArcPCIe REG CTLR ARGI CArcPCIe REG CTLR ARG2 CArcPCIe REG PIXEL COUNT CArcPCIe REG FRAME COUNT CArcPCIe REG ID LO CArcPCIe REG ID HI CArcPCIe REG CTLR SPECIAL CMD Local Configuration Registers FPGA Device Registers Command Header Register Command Register Command Argument 1 Register Command Argument 2 Register Command Argument 3 Register Command Argument 4 Register Command Argument 5 Register Image Buffer Physical Address Register Status Register Command Reply Register Controller Argument Register 1 Controller Argument Register 2 Image Pixel Count Register Continuous Readout Frame Count Register Device ID LSW Register Device ID MSW Register Controller Special Command Register Usage CArcDevice pArcDev new CArcPCIe Send the status register int dStatus pArcDev gt ReadBar DEV REG BAR REG STATUS cout lt lt PCIe status 0x lt lt hex lt lt dStatus lt lt dec lt lt endl Instead this should be done as follows int dStatus pArcDev gt GetStatus cout lt lt PCIe status 0x lt lt hex lt lt dStatus lt lt dec lt lt endl CArcPCle Data Structures Types and Constants This section documents detai
22. Syntax void SetupController bool bReset bool bTdl bool bPower int dRows int dCols const char pszTimFile const char pszUtilFile const char pszPciFile const bool amp bAbort Description Convenience function to initialize a camera controller Parameters bReset True to reset the controller Typically be set to true bTdl True to test the data link between the host computer and the host device PCI PCle and the host device and the camera controller Typically set to true bPower True to power on the camera controller Typically set to true dRows Image row dimension in pixels dCols Image column dimension in pixels pszTimFile DSP timing board file lod pszUtilFile DSP utility board file lod Default NULL pszPciFile DSP PCI board file lod Default NULL bAbort Reference variable to allow external program to exit this method Default false Throws Exception std runtime_error N A Notes This method must be called before any exposures or commands other than test data link TDL and read write memory RDM WRM can occur Usage CArcPCle FindDevices if CArcPCle DeviceCount gt 0 CArcDevice pArcDev new CArcPCIe dRows 1024 dcols 1200 int int cr ct pArcDev gt Open 0 dRows dCols 2 pArcDev gt SetupController true reset controller true test data links true power on 1024 ro
23. The following is a list of these methods with details to follow on subsequent pages CArcTools CTokenizer void Victim std string str std string Next bool IsEmpty CArcTools CTokenizer Syntax CArcTools CTokenizer Description Default class constructor Seperates a string into individual tokens deliminated by spaces Parameters N A Throws Exception N A N A Notes Class to separate a string deliminated spaces Usage CArcTools CTokenizer tokenizer new CArcTools CTokenizer tokenizer Victim This is a message while tokenizer IsEmpty cout lt lt Token lt lt tokenizer Next lt lt endl Results in the following output Token This Token is Token a Token message CArcTools CTokenizer Victim Syntax void Victim std string str Description Method used to break a string into individual tokens Parameters str The string to parse Throws Exception std runtime_error N A Notes Seperates the specified string deliminated by spaces Usage CArcTools CTokenizer tokenizer new CArcTools CTokenizer tokenizer Victim This is a message while tokenizer IsEmpty cout lt lt Token lt lt tokenizer Next lt lt endl Results in the following output Token This Token is Token a m Token message
24. exposure time in seconds dRows The number of rows in the image dCols The number of columns in the image bAbort External reference to allow the user to abort the method Default false pExplFace A CExplFace pointer that can be used to provide elapsed time and pixel count information Default NULL bOpenShutter Set to true to open the shutter during an exposure Default true Throws Exception std runtime_error N A Notes This is a convenience method that handles both the exposure and readout of an image The elapsed exposure time and pixel count callback methods of the CExplFace parameter provided it s not NULL will be used to provide feedback to the user application The user application may extend the CExp Face class or implement a separate extension class to handle the callback methods Usage class CMyExplFace public CExpIFace void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixel Count lt lt dPixelCount lt lt endl CArcDevice pArcDev new CArcPCIe CMyExplFace cMyExpIFace pArcDev gt Expose 0 5f 1024 1200 false amp cMyExpIFace In the above example the expose and read callbacks will be called from the Expose method during exposure and readout respectively The CExp Face and CArcPCle classes can be combined
25. lt Device status lt lt pArcDev gt GetStatus lt lt endl CArcDevice ClearStatus Syntax void ClearStatus Description PCle only Clears the device status Parameters N A Throws Exception std runtime_error N A Notes This method is valid for PCle only does nothing on other host interface devices Not generally useful in user applications Usage CArcDevice pArcDev new CArcPCIe pArcDev gt ClearStatus CArcDevice Set2xFOTransmitter Syntax void Set2xFOTransmitter bool bOnOf f Description Enables disables dual fiber optic transmitters on the camera controller Parameters bOnOff true to enable dual transmitters false to disable Throws Exception std runtime_error N A N A Notes For PCle devices dual receivers must be installed on the board For PCle devices this method enables disables dual transmitters on the controller and enables disables dual receivers on the PCle board PCle Dual Receiver Data Format Byte Byte B1A1B2A2 Fiber B gt For PCI devices this method enables disables dual transmitters on the controller only Usage CArcDevice pArcDev new CArcPCIe Enable dual FO transmitters on the controller pArcDev gt Set2xFOTransmitter true CArcDevice LoadDeviceFile Syntax void LoadDeviceFile const char pszFile Description PCI Only Load
26. runtime_error int The current frame count Notes N A Usage CArcDevice SubtractimageHalves Syntax void SubtractImageHalves int dRows int dCols Description Subtracts the first half of an image from the second half Parameters dRows The row image dimension in pixels dCols The column image dimension in pixels Throws Exception std runtime_error Return Value Description N A N A Notes This method is for infrared systems using correlated double sampling CDS where the first half of the image contains a read of the array immediately following a reset This is a noise pattern that is then subtracted from the true image contained within the second half of the image The first half of the image is replaced with the new image The image must have an equal number of rows or an exception will be thrown CA rcDevices SubtracelmageH alves Usage pArcDev gt Expose 0 5f dRows dCols pArcDev gt SubtractImageHalves dRows dCols CFitsFile fits Image fit dRows dCols fits Write pArcDev gt CommonBufferVA CArcDevice ContainsError Syntax bool ContainsError int dWord bool ContainsError int dWord int dWordMin int dWordMax Description The first version checks the specified value for error replies timeout readout header error error system reset and reset The second version checks that th
27. the command is returned as a character string if the command is not a three letter ASCII command Example dCmd 0x54444C gt returns TDL Example dCmd 0x112233 gt returns 0x112233 Usage CArcDevice pArcDev new CArcPCIe cout lt lt Sending lt lt CArcTools CmdToString WRM lt lt endl int dReply pArcDev gt Command TIM ID WRM X MEM 0x3 cout lt lt Sending lt lt CArcTools CmdToString TDL lt lt endl dReply pArcDev gt Command TIM ID TDL 0x123456 CArcTools CmdToString Syntax std string CmdToString int dReply int dBoardId int dCmd int dArgl int dArg2 int dArg3 int dArg4 int dSysErr Description Method used to bundle command values into a string Parameters dReply The command reply dBoardld The command board ID dCmd The command dArg1 The command argument 1 dArg2 The command argument 2 dArg3 The command argument 3 dArg4 The command argument 4 dSysErr The system error code if the command failed Throws Exception N A A text version of the command Notes The command is returned as a character string of the following form CmdHeader Cmd Argl Arg2 Arg3 Arg4 gt Reply n System message Usage CArcTools CmdToString 0x112233 TIM ID TDL 0x112233 Produces the following output 0x203 TDL 0x112233 gt 0x112233 CArcTools CmdToString ERR TIM ID TDL 0x1
28. 12233 Produces the following output 0x203 TDL 0x112233 gt ERR CArcTools StringToCmd Syntax int StringToCmd string sCmd Description Method to convert an ASCII command string such as TDL to the equivalent integer value Parameters sCmd The command string to convert Throws Exception std runtime_error int The integer version of the command string parameter Notes Throws std runtime_error if ASCII command parameter is not three characters in length Example sCmd TDL gt returns 0x54444C Example sCmd 112233 gt returns 0x112233 Usage string sCmd ANY cout lt lt Enter a command 5 cin gt gt sCmd cout lt lt endl int dCmd CArcTools StringToCmd sCmd cout lt lt The user entered the command 0x lt lt hex lt lt dCmd lt lt dec lt lt endl CArcTools FormatString Syntax std string FormatString const char pszFmt Description Method to format a std string using C printf style formatting Parameters pszFmt A printf style format string followed by variables Throws Exception N A The formatted string Notes Acceptable format parameters Format Specifier char string system message x or X lower or upper case hexadecimal integer Usage n cout lt lt Two plus Two equals lt lt CArcTools FormatString Sd 2 2 lt lt endl
29. APIStatus pStatus D D D p p SP p P in rcCam_IsReadout s rcCam GetPixelCoun rcCam GetFrameCoun rcCam GetCRPixelCount struct rcCam SubtractImageHalves int rcCam_ ContainsErro rcCam_ ContainsMinMaxError int r int dWord rcCam_ StopContinuous struct ArcCAPIStatus pStatus truct ArcCAPIStatus pStatus t struct ArcCAPIStatus pStatus ArcCAPIStatus pStatus t struct ArcCAPIStatus pStatus dRows int dCols dWord int dWordMin int dWordMax const char ArcCam GetNextLoggedCmd int void doubl doubl void void void ArcCam GetLoggedCmdCount ArcCam SetLogCmds void ArcCam Deinterlace rcCam_GetArrayTemperature rcCam GetArrayTemperatureDN A A ArcCam SetArrayTemperature double gTempVal A A void pData int dOnOff rceCam LoadTemperatureCtrlData const char pszFilename rcCam_ SaveTemperatureCtrlData const char pszFilename r int dRows int dCols int dAlgorithm struct ArcCAPIStatus pStatus void void ArcCam_DeinterlaceWithArg void pData int dRows int dCols int dAlgorithm void ArcCam WriteToFitsFile const char pszFilename void pData int dArg struct ArcCAPIStatus pStatu int dCols struct ArcCAPIStatus pStatus S int dRows S
30. ArcDev gt CommonBufferSize BUFFER2 SIZE cerr lt lt Failed to re map image buffer lt lt endl return 1 Get the NEW virtual address to 16 bit data p U16Buf unsigned short pArcDev gt CommonBufferVA Print the first ten values for int i 0 i lt 10 i cout lt lt Buffer lt lt i lt lt J lt lt pU16Buf i lt lt endl UnMap buffer or just call Close pArcDev gt UnMapCommonBuffer pArcDev gt Close CArcDevice GetCommonBufferProperties Syntax bool GetCommonBufferProperties Description Calls the host interface driver to retrieve the common buffer properties user virtual address physical address and size in bytes Parameters N A Throws Exception N A The function was successful The function failed Notes The properties are maintained by the CArcDevice class and can be retrieved by calling the following methods CArcDevice CommonBufferVA CArcDevice CommonBufferPA and CArcDevice CommonBufferSize For PCI and PCle host interfaces this function is automatically called within the CArcDevice MapCommonBuffer Usage CArcDevice pArcDev new CArcPCIe Open device etc if pArcDev gt GetCommonBufferProperties cout lt lt Image buf virt addr lt lt pArcDev gt CommonBufferVA lt lt endl cout lt lt Image buf phys addr
31. ArcDev gt IsBinningSet cout lt lt Binning is NO LONGER SET lt lt endl CArcDevice SetBinning Syntax void SetBinning int dRows int dCols int dRowFactor int dColFactor INF daBrnGols is Description Sets the camera controller to binning mode Parameters dRows The number of rows in the un binned image dCols The number of columns in the un binned image dRowFactor The row binning factor dColFactor The column binning factor dBinRows Optional pointer to return the binned image row size to the caller Default NULL dBinCols Optional pointer to return the binned image column size to the caller Default NULL Throws Exception std runtime_error int dBinRows N A Notes Binning is used to combine pixels together on the chip and results in a smaller image The number of pixels that are combined is determined by the row and column parameters which do not need to match A binning factor of 1 means no binning occurs along that image axis Usage CArcDevice pArcDev new CArcPCIe Set the binning to 4x2 Jiad H pArcDev gt SetBinning dRows dCols 2 4 CArcDevice UnSetBinning Syntax void UnSetBinning int dRows int dCols Description Sets the camera controller from binning mode back to normal image readout Parameters dRows The number of rows in the un binned image dCols The number
32. BiasDifset isdi dubcos HP gt bar 7 dSubhows pt dBias Width Over Scan Region Usage CArcDevice pArcDev new CArcECIe int dOldRows 0 dOldCols 0 Create a 600x500 pixel sub array centered at row 150 col 200 with a 100x500 pixel bias region located at an offset of 1100 pixels pArcDev gt SetSubArray dOldRows dOldcols 150 200 500 600 1100 100 CArcDevice UnSetSubArray Syntax void UnSetSubArray int dRows int dCols Description Removes the camera controller from sub array mode Parameters dRows The number of rows in full image to set on the camera controller in pixels dCols The number of columns in full image to set on the camera controller in pixels Throws Exception std runtime_error N A Notes N A Usage CArcDevice pArcDev new CArcPCIe int dOldRows 0 dOldCols 0 Create a 600x500 pixel sub array centered at row 150 col 200 with a 100x500 pixel bias region located at an offset of 1100 pixels 4 H pArcDev gt SetSubArray dOldRows dOldCols 150 200 500 600 1100 100 Expose in sub array mode Li pArcDev gt Expose 1 5f 500 600 Un Set sub array mode 4 pArcDev gt UnSetSubArray dOldRows dOldCols CArcDevice lsSyntheticlmageMode Syntax bool IsSyntheticImageMode Description Determines if the camera cont
33. CArcTools CTokenizer Next Syntax std string Next Description Method used to return the next token Parameters N A Throws Exception std runtime_error The next token from the string Notes Seperates the specified string deliminated by spaces Usage CArcTools CTokenizer tokenizer new CArcTools CTokenizer tokenizer Victim This is a message while tokenizer IsEmpty cout lt lt Token lt lt tokenizer Next lt lt endl Results in the following output Token This Token is Token a Token message CArcTools CTokenizer lsEmpty Syntax bool IsEmpty Description Method used to determine if there are anymore tokens available Parameters N A Throws Exception std runtime_error More tokens are available false No more tokens are available Notes Usage CArcTools CTokenizer tokenizer new CArcTools CTokenizer tokenizer Victim This is a message while tokenizer IsEmpty cout lt lt Token lt lt tokenizer Next lt lt endl Results in the following output Token This Token is z Token a n Token message General Command and Controller Constants and Macros ArcDefs h This section documents details of the command and controller constants and macros as defined in ArcDefs h PCI_ID Type Integer D
34. CommonBuf m ReMapCommonBuf t ArcCA truct A ransmitter ArcCam Open Ef printf retu TLUCLT Struct ct ArcCA S m OpenWithBuffer int dDevNum struct ArcCAPIStatus pStatus ffer fer st fer int ffe mmonBuffer unsigned short rVA struct rPA struct rSize S int m LoadDeviceFile const cha rn tSt ArcCAPIDev PIStatus pSt int dBytes ruct rProperties rcCAPIStat truct ArcCA tStatus dSuccess ANY Error ArcCAPIStatus a truct ArcCAPISta m OpenByName const char pszDeviceName rcCAPIStatus pStatus Struce dBytes s ArcCAPISta ArcCAPISta PIStatus pStatus donoff r pszFile dBoardid int dCommand dArg4 struct dBoardid int dCommand s n tus int dBytes ArcCAPISta truc struct ArcCAPISta ul6Value tus pStatus tus pStatus tus pStatus PIStatus pSta struct ByName tDevList szDevList tStatus tatus dSuccess List pDevList pstatus tus pStatus m OpenByNameWithBuffer const char pszDeviceName ArcCAPIStatus pStatus tus pStatus t ArcCAPISta tus Struc Dy F struct ArcCAPIStatus pStatus 15 E tus st int dArgl ArcCAPIStatus pStatus int dArgl struct ArcCAPISt struct ArcCAPIStat t ArcCA int dArg2 0
35. D TDL 0x123456 pArcDev gt Command TIM ID TDL 0x112233 while pArcDev gt GetLoggedCmdCount gt 0 cout lt lt pArcDev gt GetNextLoggedCmd lt lt endl pArcDev gt SetLogCmds false The above results in the following output 0x203 SET 1000 gt DON 0x203 TDL 0x123456 gt 0x123456 0x203 TDL 0x112233 gt 0x112233 CArcDevice GetLoggedCmdCount Syntax int GetLoggedCmdCount Description Returns the available message count Parameters N A Throws Exception N A fin OE The available message count o The logger is empty Notes This method should only be used within a while loop when used in conjunction with GetNextLoggedCmd or it will not function properly The logger uses a queue which shrinks on each call to GetNextLoggedCmd thus reducing the value of GetLoggedCmdCount Using this method with a fixed for loop will result in messages being lost Correct Usage while pArcDev gt GetLoggedCmdCount gt 0 Incorrect Usage for int i 0 i lt pArcDev gt GetLoggedCmdCount i Usage CArcDevice pArcDev new CArcPCIe pArcDev gt SetLogCmds true pArcDev gt Command TIM ID SET 1000 pArcDev gt Command TIM ID TDL 0x123456 pArcDev gt Command TIM ID TDL 0x112233 while pArcDev gt GetLoggedCmdCount gt 0 cout lt lt pArcDev gt G
36. DSP HSTR Host Status Register Map the image buffer into the user application Windows Onl ASTROPCI GET DMA SIZI Read the image buffer size in bytes ASTROPCI Gl Pl Gl Fl l FRAME 4 v pu E _ READ Read the current frame count continuous readout onl ASTROPCI HCVR DATA Write data to the DSP HCVR data register Gl 5 ASTROPCI SET HCTR Write to the DSP HCTR Host Control Register l HCVR Write to the DSP HCVR Host Vector Register 5 ASTROPCI SI Pl AST i ROPCI ABORT Stop the current image exposure readout TROPCI_CONTROLLER_DOWNLOAD Set the camera controller into download mode ASTROPCI GET CR PROGRESS Read the current pixel count continuous readout onl A E A ASTROPCI PCI DOWNLOAD Set the PCI board into download mode DR 5 ASTROPCI GET CONFIG BY a Read the image buffer physical address LSW for info only si GE 5 5 ST 7 H ASTROPCI SET CONFIG WOR Write a word to the configuration space header ASTROPCI SET CONFIG DWORD Write a double word to the configuration space header Usage ASTROPCI SET CONFIG BYTE Write a byte to the configuration space header CArcDevice pArcDev new CArcECI Send a TDL to the controller int cmdData CTLR CMD MAX 0x203 TDL 0x1 12233 1 i SE y int dReply pArcDev gt IoctlDevice ASTROPCI COMMAND cmdData CTLR CMD MAX if dReply 0x112233
37. SSS SSS eS Sees Sees SSaasee WON lt lt n t0 None n tl Parallel n t2 Serial lt lt M n t3s COD Quad n t4 IR Ou d n ess CDS IR QUAD lt lt n t6 Hawaii RG lt lt n t7 STA1600 lt lt endl lt lt endl std string SetDots const char cStr 0 laa a ee re Exposure Callback Class jf PSSSSS SRS SS SSS SSS SSSR Sees SS SH eSS SSeS Sess seSsesSsseeS class CExposeListener public CExplFace void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPix cout lt lt Pixel Count Pe int main int argc Main program char argv elCount lt lt dPixelCount lt lt endl std string sTimFile tim Lod float fExpTime 0 5 long INumOfFrames 100 long lRows 512 long 1Cols 600 long 1DeintAlg CDeinterlace DEINTERLACE NONE bool bAbort false CExposeListener cExposeListener 14 Set host device if if argc lt 2 cout lt lt Error Invalid number of minimum parameters lt lt endl USAGE argv 0 cout lt lt endl exit EXIT FAILURE string sDev argv 1 if sDev compare PCIe 0 amp amp sDev compare PCI 0 cout lt lt Error Invalid device parameter lt lt sDev lt lt endl USAGE argv 0
38. ace cMyConIFace dRows dCols pArcDev gt Continuous dRows dCols 100 0 5f false amp cMyConIFace In the above example the frame callback will be called from the Continuous method The CCon Face and CArcPCle classes can be combined into a single class as follows class CMyPCIe public CConlFace public CArcECIe CFitsFile pFits CMyConI Face pFits NULL CMyConIFace delete pFits void FrameCallback int dFPB int dCount int dRows int dCols void pBuf cout lt lt Saving frame lt lt dCount lt lt endl if pFits NULL pFits new CFitsFile Image fit dRows dCols CFitsFile BPP16 true pFits gt Write3D pBuf he CMyPCIe cMyECIe cMyPCle Continuous cMyPCIe GetImageRows cMyPCIe GetImageCols 100 0 5f false amp cMyECIe CArcDevice StopContinuous Syntax void StopContinuous Description Causes the camera controller to stop running in continuous mode and return to single image mode Parameters N A Throws Exception std runtime_error N A Notes N A Usage CArcDevice lsReadout Syntax bool IsReadout Description Returns true if the camera controller is currently reading out an image Parameters N A Throws Exception std runtime_error Image readout is in progress Image readout is NOT in progress Notes Except for stop exposure no
39. be accessed via device number 0 1 2 as a parameter to the Open method The list itself can be read via the PCI DeviceCount and PCI GetDeviceStringList methods Usage CArcDevice pArcDev NULL const char pszDevList dev astropci2 dev astropcil CArcPCI UseDevices pszDevList 2 const char pszDevList CArcPCI GetDeviceStringList for int i 0 i lt CArcPCI DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCI FreeDeviceStringList if CArcPCI DeviceCount gt 0 pArcDev new CArcECI pArcDev gt Open 0 2200 2200 2 CArcPCl DeviceCount Syntax int DeviceCount Description Returns the number of ARC PCI devices found in the system Parameters N A Throws Exception std runtime_error int Notes The device count Can be used to access PCI GetDeviceStringList elements or verify that a device has been found Usage CArcDevice pArcDev NULL Find all PCI devices CArcPCI FindDevices List all PCI devices found const char pszDevList CArcPCI GetDeviceStringList for int i 0 i lt CArcPCI DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCI FreeDeviceStringList Open the first PCI device found if CArcPCI DeviceCount gt 0 pArcDev new CArcECI pArcDev gt Open 0 2200 2200 2
40. commands should be sent to the controller during image readout Usage CArcDevice pArcDev new CArcPCIe if pArcDev gt IsReadout pArcDev gt Command TIM ID TDL 0x112233 CArcDevice GetPixelCount Syntax int GetPixelCount Description Returns the current pixel count during image readout Parameters N A Throws Exception std runtime_error int The current pixel count Notes N A Usage CArcDevice pArcDev new CArcPCIe int dPixCnt 0 int dRows 1024 int dCols 1200 Start a 4 5 sec exposure pArcDev gt Command TIM ID SET 4500 pArcDev gt Command TIM ID SEX Loop and print pixel count while dPixCnt lt dRows dCols dPixCnt pArcDev gt GetPixelCount cout lt lt Pixel Count lt lt dPixCnt lt lt endl Sleep 500 CArcDevice GetCRPixelCount Syntax int GetCRPixelCount Description Returns the current pixel count during continuous readout Parameters N A Throws Exception std runtime_error int The current pixel count Notes This is the total pixel count across all frames i e this value goes from 0 to frame count rows cols Usage CArcDevice GetFrameCount Syntax int GetFrameCount Description Returns the current frame count during continuous readout Parameters N A Throws Exception std
41. const char pszFmt Description Method uses printf style formatting that is then used to throw a std runtime_error exception Parameters sClassName Name of the class where the exception occurred sMethodName Name of the method where the exception occurred pszFmt A C printf style format string followed by variables Throws Exception std runtime_error N A N A Notes Throws a std runtime_error exception with the message formatted as follows ClassName ClassMethod Message If the sClassName parameter is empty then the string Class will be used Similarly if the sMethodName parameter is empty then the string Method will be used Acceptable format parameters Format Specifier char string system message x or X lower or upper case hexadecimal integer For Example CArcDevice Command Incorrect reply 0x112233 For Example Class Method Some message goes here Usage CArcDevice pArcDev new CArcPCIe int dReply pArcDev gt Command TIM ID TDL 0x112233 if dReply 0x112233 CArcTools ThrowException CArcDevice Command TDL failed reply 0x X dReply CArcTools CTokenizer Class This section documents details of the methods available through the CArcTools CTokenizer class see CArcTools h This class provides a string tokenizer that uses string streams instead of the older C strtok function
42. ctions for cross platform compatibility Not useful for user applications CArcTools h CArcTools class definition Defines a general set of utility methods for string and command conversions and throwing descriptive exceptions CLog h Clog class definition Defines logger class used internally by CArcDevice to store commands Used for debugging only PCIRegs h PCl e configuration space constant and macro definitions Used by CArcPCIBase class and not useful for user applications Reg9056 h PLX PCle register definitions Used by CArcPCle class and not useful for user applications TempCtrl h Temperature calibration constants and default values CStringList h CStringList class definition Used internally and not exported by library User applications cannot access this class AstroPCleGUID h and astropciGUID h PCle and PCI Windows driver id files respectively Used by CArcPCle and CArcPCI classes to identify device drivers Not useful for user applications CArcDevice Methods This section documents details of the methods available through the CArcDevice class see CArcDevice h These methods define the standard interface for the sub devices PCle and PCI The following is a list of these methods with details to follow on subsequent pages const char ToString bool IsOpen void Open int dDeviceNumber void Open int dDeviceNumber int dBytes void Close void Reset void MapCommonBuffer int dByte
43. d on or connected improperly CArcPCle WriteBar Syntax void WriteBar int dBar int dOffset int dValue Description Write a value to a PCle base address register BAR Parameters dBar The base address register number dOffset The offset within the base address register dValue The value to write Throws Exception std runtime_error N A Notes In general this method should never be called by a user application The dBar parameter can be one of the values CArcPCIe LCL CFG BAR CArcPCIe DEV_REG BAR The dOffset parameter can be on the values CArcPCIe REG_CMD_ HEADER CArcPCIe REG CMD COMMAND CArcPCIe REG CMD ARGO CArcPCIe REG CMD ARG1 CArcPCIle REG CMD ARG2 CArcPCIe REG CMD ARG3 CArcPCIle REG CMD ARG4 CArcPCIe REG INIT IMG ADDR CArcPCIe REG STATUS CArcPCIe REG CMD REPLY CArcPCIe REG CTLR ARG1 CArcPCIle REG CTLR ARG2 CArcPCIe REG PIXEL COUNT CArcPCIe REG FRAME COUNT CArcPCIe REG ID LO CArcPCIe REG_ID_HI CArcPCIe REG_CTLR_ SPECIAL CMD Local Configuration Registers FPGA Device Registers Command Header Register Command Register Command Argument 1 Register Command Argument 2 Register Command Argument 3 Register Command Argument 4 Register Command Argument 5 Register Image Buffer Physical Address Register Status Register Command Reply Register Controller Argument Register 1 Controlle
44. e does not exist on the camera controller The number of frames parameter can be any number up to 16777216 24 bits which when coupled with an exposure time is generally ample enough to provide what is effectively continuous readout This is a convenience method that handles both the exposure and readout of a series of images callback method of the CConlFace parameter provided it s not NULL will be used to provide feedback to the user application The user application may extend the CCon Face class or implement a separate extension class to handle the callback method The frame count The image buffer is divided into sub buffers using the specified image size parameters dRows dCols Each sub buffer starts on a 1k boundary within the main image buffer The camera controller is automatically set back to single image mode at the end of this method Usage class CMyConIFace public CConIFace CFitsFile pFits CMyConIFace int dRows int dCols pFits new CFitsFile Image fit dRows dCols CFitsFile BPP16 true CMyConIFace delete pFits void FrameCallback int dFPB int dCount int dRows int dCols void pBuf cout lt lt Saving frame lt lt dCount lt lt endl pFits gt Write3D pBuf Fs CArcDevice pArcDev new CArcPCIe dRows dCols int int pArcDev gt GetImageRows pArcDev gt GetImageCols T ct CMyConIF
45. e specified value is within the specified range Parameters dWord The value usually a command reply to check dWordMin The minimum range value not inclusive dWordMax The maximum range value not inclusive Throws Exception N A The value contains an error or is not within the specified range false The value doesn t contain any errors or is within the specified range Notes Usage CArcDevice pArcDev new CArcPCIe int dReply pArcDev gt Command TIM ID Si GI lt 1000 if pArcDev gt ContainsError dReply cerr lt lt Failed to set exposure time Reply 0x lt lt hex lt lt dReply lt lt dec lt lt endl int dRows pArcDev gt GetImageRows if pArcDev gt ContainsError dRows 0 4200 cerr lt lt Invalid row size lt lt endl CArcDevice GetNextLoggedCmd Syntax const char GetNextLoggedCmd Description Pops the first message from the command logger and returns it Parameters N A Throws Exception N A he first message in the command logger T NULL The command logger is empty Notes This method is used to log all commands sent to the controller Logging uses large amounts of memory and should only be used for debugging Usage CArcDevice pArcDev new CArcPCIe pArcDev gt SetLogCmds true pArcDev gt Command TIM ID SET 1000 pArcDev gt Command TIM I
46. e_error N A Notes This static class method MUST be called before any PCI device can be opened accessed The resulting list is stored and allows devices to be accessed via device number 0 1 2 as a parameter to the Open method The list itself can be read via the PC DeviceCount and PCI GetDeviceStringList methods Usage CArcDevice pArcDev NULL Find all PCI devices CArcPCI FindDevices List all PCI devices found const char pszDevList CArcPCI GetDeviceStringList for int 1 0 1 lt CArcPCI DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCI FreeDeviceStringList Open the first PCI device found if CArcPCI DeviceCount gt 0 pArcDev new CArcPCI pArcDev gt Open 0 2200 2200 2 CArcPCI UseDevices Syntax void UseDevices const char pszDeviceList int dListCount Description Forces the use of the specified ARC PCI device list Parameters pszDeviceList The list of ARC PCI devices dListCount The number of devices in the list Throws Exception std runtime_error N A Notes Generally not used by user applications Used for backwards compatibility with version 1 7 drivers primarily on linux and solaris systems If used this static class method MUST be called before any PCI device can be opened accessed The resulting list is stored and allows devices to
47. ed the following is allowed CArcPCIe cArcDev cArcDev Open 0 dBufferSize but this is preferred CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 dBufferSize Header Listing CArcDevice h CArcDevice class definition Primary class that should be used for device access This is an abstract class that must point to one of the sub classes CArcPCI or CArcPCle CArcPCIBase h CArcPClBase class definition Provides PCI e configuration space access only Abstract class not useful for user applications CArcPCle h PCle class definition Provides PCle device access and can be instantiated directly by user applications CArcPCl h PCI class definition Provides PCI device access and can be instantiated directly by user applications CExplFace h CExplFace class definition Abstract interface class that provides exposure callbacks for user applications A user defined class extending this interface can be passed into the CArcDevice Expose method for elapsed time and pixel count information CConlFace h CConlFace class definition Abstract interface class that provices continuous readout callbacks for user applications A user defined class extending this interface can be passed into the CArcDevice Continuous method for frame count information ArcDefs h Command reply board id s command parameter and controller configuration parameter constants ArcOSDefs h Generic re mappings of system fun
48. endent string Notes The string returned by this method is device dependent and may change at any time Current PCle String PCle ARC 66 67 Current PCI String PCI ARC 63 64 Usage include lt iostream gt include CArcDevices h include CArcPCIe h using namespace std using namespace arc CArcPCIe FindDevices CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 cout lt lt Device in use lt lt pArcDev gt ToString lt lt endl pArcDev gt Close CArcDevice lsOpen Syntax bool IsOpen Description Returns true if an application has called CArcDevice Open successfully Parameters N A Throws Exception N A The device is already open false The device is not open Usage include lt iostream gt include CArcDevices h include CArcPCIe h using namespace std using namespace arc CArcPCle FindDevices CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 BUFFER SIZE if pArcDev gt IsOpen cerr lt lt Device failed to open lt lt endl CArcDevice Open Syntax void Open int dDeviceNumber void Open int dDeviceNumber int dBufferSize Description Opens a connection to the specified host interface device Parameters dDeviceNumber Device number in the range 0 to N N th host interface board dBufferSize The size
49. escription PCl e board id Defined as 1 TIM_ID Type Integer Description Timing board id Defined as 2 UTIL ID Type Integer Description Utility board id Defined as 3 SMALLCAM DLOAD_ ID Type Integer Description SmallCam DSP download id Defined as 3 X_MEM Type Integer Description DSP X memory space Used as part of the address parameter for read RDM and write WRM memory commands Y_MEM Type Integer Description DSP Y memory space Used as part of the address parameter for read RDM and write WRM memory commands P MEM Type Integer Description DSP program memory space Used as part of the address parameter for read RDM and write WRM memory commands R_MEM Type Integer Description DSP ROM Used as part of the address parameter for read RDM and write WRM memory commands DON Type Integer Description Success reply Most device controller commands return DON on success See the command description document for details on commands and replies Defined as 0x444F4E ERR Type Integer Description Error reply See the command description document for details on commands and replies Defined as 0x455252 SYR Type Integer Description System reset reply This reply means a system reset occurred The CArcDevice ResetCo
50. etDeviceStringList for int i 0 i lt CArcPCIe DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCIe FreeDeviceStringList Open the first PCIe device found if CArcPCIe DeviceCount gt 0 pArcDev new CArcPCIe pArcDev gt Open 0 2200 2200 2 CArcPCle GetDeviceStringList Syntax const char GetDeviceStringList Description Returns the list of ARC PCle devices found in the system Parameters N A Throws Exception std runtime_error The device list No Devices Found The device list is empty Notes The user should call PCle FreeDeviceStringList when finished with the returned list Usage CArcDevice pArcDev NULL Find all PCIe devices CArcPCIle FindDevices List all PCIe devices found const char pszDevList CArcPClIe GetDeviceStringList for int i 0 1 lt CArcPCIe DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCIe FreeDeviceStringList Open the first PCIe device found if CArcPCIe DeviceCount gt 0 pArcDev new CArcPCIe pArcDev gt Open 0 2200 2200 2 CArcPCle FreeDeviceStringList Syntax void FreeDeviceStringList Description Frees the resources for the device string list returned from CArcPCle GetDeviceStringList Parameters N A Throws Exception std runtime_e
51. etNextLoggedCmd lt lt endl pArcDev gt SetLogCmds false The above results in the following output 0x203 SET 1000 gt DON 0x203 TDL 0x123456 gt 0x123456 0x203 TDL 0x112233 gt 0x112233 CArcDevice SetLogCmds Syntax void SetLogCmds bool bOnoff Description Turns command logging on off Parameters bOnOff True to turn command logging on false to turn it off Throws Exception N A N A Notes This logging can be used for debugging to see command details in the following form lt header gt lt cmd gt lt argl gt Example Usage 0x203 TDL 0x112233 gt 0x444 E4F lt arg4 gt gt lt controller reply gt CArcDevice pArcDev new CArcPCIe pArcDev gt SetLogCmds true pArcDev gt Command TIM ID pArcDev gt Command TIM ID pArcDev gt Command while n HA a ET 1000 DL 0x123456 TIM ID TDL 0x112233 pArcDev gt GetLoggedCmdCount gt 0 cout lt lt pArcDev gt GetNextLoggedCmd lt lt endl pArcDev gt SetLogCmds false The above results in the following output 0x203 SI 0x203 1 0x203 1 CD CD ET 1000 gt DON L 0x123456 gt 0x123456 L 0x112233 gt 0x112233 CArcDevice GetArrayTemperature Syntax double GetArrayTemperature Description Returns the average array tem
52. geMode bool bMode void VerifyImageAsSynthetic int dRows int dCols void SetOpenShutter bool bShouldOpen void Expose float fExpTime int dRows int dCols const bool amp bAbort CExplFace pExpIFace bool bOpenShutter void StopExposure void Continuous int dRows int dCols int dNumOfFrames float fExpTime const bool amp bAbort CConlFace pConIFace bool bOpenShutter void StopContinuous bool IsReadout int GetPixelCount int GetCRPixelCount int GetFrameCount void SubtractImageHalves int dRows int dCols bool ContainsError int dWord bool ContainsError int dWord int dWordMin int dWordMax const char GetNextLoggedCmd int void doubl doubl void Get Set e Ge e Ge Se tArrayl tArrayl tArrayl Temperat Temperat Temperat LoggedCmdCount LogCmds bool bOnoff ture tureDN ture double gTempVal r void void Load Temperat Savel tureCt Temperat CRI LDa tureCt tr LDa ta ta const const char pszFil Lename char pszFil Lename CArcDevice ToString Syntax const char ToString Description Returns a descriptive string that represents the device controlled by this library Parameters N A Throws Exception N A Device dep
53. gt 3 if dHstr CArcPCI DONE STATUS cout lt lt CArcTools FormatString Status 0x X DON dHstr else if dHstr CArcPCI ERROR STATUS cout lt lt CArcTools FormatString Status 0x X ERR dHstr CArcPClI PCICommand Syntax int PCICommand int dCommand Description Sends a command directly to the PCI board Parameters dCommand A PCI specific command Throws Exception std runtime_error Return Value Description int The command reply typically DON Notes Valid PCI commands Reset the PCI board ES ABORT_READOUT Stop image readout ESET CONTROLLE Reset the camera controller Usage CArcDevice pArcDev new CArcECI Reset the controller int dReply pArcDev gt PCICommand RESET CONTROLLER if dReply SYR cerr lt lt Reset Controller Failed lt lt endl Or could have just done the following pArcDev gt ResetController CArcPCl loctiDevice Syntax int loctlDevice int dIoctlCmd int dArg Description Sends a command to the PCI device driver Parameters dloctlCmd A PCI device driver command Any argument required by the command Default 1 Throws Exception std runtime_error int The command reply Notes Valid IOCTL commands E E ASTROPCI_GET_DMA_ ASTROPCI_GE ASTROPCI_ME
54. imple Example This section demonstrates a simple use of the ARC API libraries a a a a aa Li File ArcAPIEx3Simple cpp bil Bese RESTES SSSR SSSR ESS SSSR SSSR Se eae SS Se ee Se See eee one if Description This file demonstates a simple use of the ARC API 3 0 for both if the PCI and PCIe interfaces The first device found is used to setup an attached id controller and take an exposure cu Author Scott Streit if Date March 3 2011 bol SSS eS Se a a eS include lt iostream gt include lt iomanip gt include lt string gt include CArcDevice h include CArcPCIe h include CArcPCI h include CDeinterlace h include CFitsFile h include CExplFace h using namespace std using namespace arc define USAGE x cout lt lt endl lt lt Usage lt lt x lt lt PCI PCIe options lt lt endl lt lt endl lt lt toptions lt lt endl lt lt t lt lt endl lt lt t f DSP lod filename Default tim lod lt lt endl lt lt t e exp time s Default 0 5 lt lt endl lt lt t r rows Default 512 lt lt endl lt lt t c cols Default 600 lt lt endl lt lt t d deint alg Default CDeinterlace DEINTERLACE NONE lt lt endl lt lt endl lt lt tDeinterlace Values lt lt Wa bs Sees SSS Sees
55. ing to convert to a char Throws Exception N A The converted character Notes This is a convenience method Usage char c CArcTools StringToHex P cout lt lt e lt lt c lt lt endl CArcTools ThrowException Syntax void ThrowException string sClassName string sMethodName string sMsg Description Throws a std runtime_error based on the supplied cfitsion status value Parameters sClassName Name of the class where the exception occurred sMethodName Name of the method where the exception occurred sMsg The exception message Throws Exception std runtime_error N A Notes Throws a std runtime_error exception with the message formatted as follows ClassName ClassMethod Message If the sClassName parameter is empty then the string Class will be used Similarly if the sMethodName parameter is empty then the string Method will be used For Example CArcDevice Command Incorrect reply 0x112233 For Example Class Method Some message goes here Usage CArcDevice pArcDev new CArcPCIe int dReply pArcDev gt Command TIM ID TDL 0x112233 if dReply 0x112233 CArcTools ThrowException CArcDevice Command TDL Failed CArcTools ThrowException Syntax lt e void ThrowException string sClassName string sMethodName
56. into a single class as follows class CMyPCIe public CExplFace public CArcECIe void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixel Count lt lt dPixelCount lt lt endl he CMyPCIe cMyECIe cMyPCle Expose 0 5f 1024 1200 false amp cMyPCIe CArcDevice StopExposure Syntax void StopExposure Description Causes the current exposure to stop Parameters N A Throws Exception std runtime_error N A Notes N A Usage CArcDevice Continuous Syntax void Continuous int dRows int dCols bAbort CConIFace pConIFace bool bOpenShutter Description Starts continuous readout Parameters dRows The number of rows in each image dCols The number of columns in each image dNumOfFrames The number of frames to read fExpTime The exposure time in seconds bAbort External reference to allow the user to abort the method Default false pConlFace int dNumOfFrames float fExpTime A CConlFace pointer that can be used to provide frame count information Default NULL bOpenShutter Set to true to open the shutter during an exposure Default true Throws Exception std runtime_error const bool amp N A Notes True continuous readout i e video mod
57. l Count lt lt dPixelCount lt lt endl cExpInfo CArcDevice pArcDev new CArcPCIe pArcDev gt Expose 0 5f dRows dCols false amp cExpInfo The CExplFace and CArcPCli e classes can be simultaneously sub classed For example to sub class CArcPCle class CMyDev public CExpIFace public CArcPCIe void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixel Count lt lt dPixelCount lt lt endl CMyDev pArcDev new CMyDev pArcDev gt Expose 0 5f dRows dCols false pArcDev CExplFace ReadCallback Syntax void ReadCallback int dPixelCount Description Called from the CArcDevice Expose method to supply the application with pixel count info Parameters dPixelCount The current pixel count Throws Exception std runtime_error N A Notes This class must be sub classed by the user application The sub class can then be passed into the CArcDevice Expose method This is the only way to get pixel count info from the CArcDevice Expose method Usage class CExplnfo public CExpIFace void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixe
58. l Count lt lt dPixelCount lt lt endl cExpInfo CArcDevice pArcDev new CArcPCIe pArcDev gt Expose 0 5f dRows dCols false amp cExpInfo The CExplFace and CArcPCli e classes can be simultaneously sub classed For example to sub class CArcPCle class CMyDev public CExpIFace public CArcPCIe void ExposeCallback float fElapsedTime cout lt lt Elapsed Time lt lt fElapsedTime lt lt endl void ReadCallback int dPixelCount cout lt lt Pixel Count lt lt dPixelCount lt lt endl CMyDev pArcDev new CMyDev pArcDev gt Expose 0 5f dRows dCols false pArcDev CConlFace Interface This section documents details of the methods available through the CConlFace class see CExplFace h This class is an abstract interface that provides continuous readout callbacks for user applications The user may extend this class and pass it into the CArcDevice Continuous method for frame count and buffer information The following is a list of these methods with details to follow on subsequent pages void FrameCallback int dFPB int dFrameCount int dRows int dCols void pBuffer CConlFace FrameCallback Syntax void FrameCallback int dFPB int dFrameCount int dRows int dCols void pBuffer Description Called from the CArcDevice Continous method to supply the application with frame count and image buffer i
59. ls of the structures data types and constants used by the ARC PCle class CArcECIe FIBER A CArcECIe FIBER B Type Integer Description Parameter for the CArcPCle lsFiberConnected method Fiber A is the standard receive fiber while fiber B is the second receive fiber Note that not all PCle boards have a second fiber installed as this is for non standard applications CArcPCIe ID Type Integer Description Static class constant that matches the MSW ID register Reg 7CH on the PCle board The value of the ID constant is ARC6 0x41524336 CArcPCI Only Methods This section documents details of the methods only available through the ARC PCI class see CArcPCl h The following is a list of these methods with details to follow on subsequent pages static void FindDevices static void UseDevices const char pszDeviceList int dListCount static int DeviceCount static const char GetDeviceStringList static void FreeDeviceStringList void SetHctr int dVal int GetHstr int GetHctr int PCICommand int dCommand int TIoctlDevice int dIoctlCmd int dArg 1 int TIoctlDevice int dIoctliCmd int dArg int dArgCount CArcPCl FindDevices Syntax void FindDevices Description Searches the system for available ARC PCI ARC 63 64 devices Parameters N A Throws Exception std runtim
60. mon image buffer The returned size is only valid after calling CArcDevice GetCommonBufferProperties Usage CArcDevice pArcDev new CArcPCIe Open device etc Lh if pArcDev gt GetCommonBufferProperties cout lt lt cout lt lt cout lt lt else cern lt lt Image buf Image buf Image buf Failed to virt phys size read addr lt lt pArcDev gt CommonBufferVA lt lt endl addr lt lt pArcDev gt CommonBufferPA lt lt endl lt lt pArcDev gt CommonBufferSize lt lt endl buffer properties lt lt endl CArcDevice Getld Syntax int GetId Description Returns the hardware device ID Parameters N A Throws Exception std runtime_error PCle only The hardware device ID 0 No hardware device ID exists Notes The CArcPCle class contains a static constant against which the return value can be compared Usage CArcDevice pArcDev new CArcPCIe if pArcDev gt GetId CArcPCle ID cout lt lt Found PCIe board lt lt endl CArcDevice GetStatus Syntax int GetStatus Description Returns the hardware device status Parameters N A Throws Exception std runtime_error int The hardware device status Notes The returned value is device specific Usage CArcDevice pArcDev new CArcPCIe cout lt
61. n bytes Parameters dBufferSize The size in bytes of the common image buffer Throws Exception std runtime_error N A Notes Re Mapping of the common buffer into user virtual space may fail due to insufficient contiguous memory The size of the buffer should be verified by calling CArcDevice CommonBufferSize Any previous virtual addresses retrieved by calling CArcDevice CommonBufferVA should no longer be used and a new address should be had by re calling CArcDevice CommonBufferVA Usage define BUFFERI SIZE define BUFFER2 SIZE 2200 2200 sizeof unsigned short 1200 1200 sizeof unsigned short CArcDevice pArcDev new CArcPCIe Open device 0 pArcDev gt Open 0 Map a 2200 x 2200 pixel common image buffer pArcDev gt MapCommonBuffer BUFFERI SIZE if pArcDev gt CommonBufferSize BUFFERI SIZE cerr lt lt Failed to map image buffer lt lt endl return 1 lt continued next page gt Get the virtual address to 16 bit data unsigned short pUl6Buf unsigned short pArcDev gt CommonBufferVA Print the first ten values for int i 0 i lt 10 i cout lt lt Buffer lt lt i lt lt J lt lt pUl6Buf i lt lt endl ReMap the buffer to a smaller one pArcDev gt ReMapCommonBuffer BUFFER2 SIZE if p
62. nfo Parameters dFPB The frames per buffer dFrameCount The frame count dRows The number of rows in the frame image dCols The number of columns in the frame image pBuffer Pointer to frame image Throws Exception std runtime_error N A Notes This class must be sub classed by the user application The sub class can then be passed into the CArcDevice Continous method This is the only way to get frame info from the CArcDevice Continous method Usage class CExpInfo public CConlFace void FrameCallback int dFPB int dFrameCount int dRows int dCols void pBuffer cout lt lt Frame Count lt lt dFrameCount lt lt endl Save the image to FITS CFitsFile fits Image fit dRows dCols fits Write pBuffer cExpiInfo CArcDevice pArcDev new CArcPCIe pArcDev gt Continuous dRows dCols dNumOfFrames 0 5f false amp cExpiInfo The CConlFace and CArcPCl e classes can be simultaneously sub classed For example to sub class CArcPCle class CMyDev public CConIFace public CArcPCIe void FrameCallback int dFPB int dFrameCount int dRows int dCols void pBuffer cout lt lt Frame Count lt lt dFrameCount lt lt endl Save the image to FITS CFitsFile fits Image fit dRows dCols fits Write pBuffer CMyDev pArcDev new CMyDev pArcDev gt Continuous dRows dC
63. ntax int GetCCParams Description Get the controller configuration parameter value from the camera controller Parameters N A Throws Exception std runtime_error The current controller configuration parameter value Notes The controller configuration parameter value bits specify the DSP firmware capabilities The capabilities include binning sub array temperature readout shutter existence which ARC boards are in the system etc The current bit definitions can be found in ArcDefs h Call method CArcDevice lsCCParamSupported int to determine if individual capabilities are available Usage include ArcDefs h CArcDevice pArcDev new CArcPCIe int dCCParam pArcDev gt GetCCParam if pArcDev gt IsCCParamSupported ARC22 cout lt lt ARC 22 board in system lt lt endl else if pArcDev gt IsCCParamSupported SHUTTER CC cout lt lt Shutter support lt lt endl else if pArcDev gt IsCCParamSupported SPLIT SERIAL cout lt lt Serial readout supported lt lt endl else if pArcDev gt IsCCParamSupported BINNING cout lt lt Binning supported lt lt endl else if pArcDev gt IsCCParamSupported SUBARRAY cout lt lt Sub Array supported lt lt endl CArcDevice IsCCParamSupported Syntax bool IsCCParamSupported int dParameter Description Determines if the specified contr
64. ntroller method return SYR on success See the command description document for details on commands and replies Defined as 0x535952 RST Type Integer Description Reset reply See the command description document for details on commands and replies Defined as 0x525354 HERR Type Integer Description Header error reply This reply means the command header is improperly formatted See the command description document for details on commands and replies Defined as 0x48455252 TOUT Type Integer Description Timeout reply This reply means the device or controller did not respond with a reply within a reasonable amount of time See the command description document for details on commands and replies Defined as 0x544F5554 ROUT Type Integer Description Readout reply This reply means the controller is currently reading an image See the command description document for details on commands and replies Defined as 0x524F5554 IS ARC12 Type Macro Syntax IS ARCI12 int id Parameter Integer ID as returned from CArcDevice GetControllerld Description Macro that returns true if the ID parameter represents the SmallCam ARC 12 controller Returns false otherwise ArcCameraAPI C Application Interface This section documents details of the ArcCameraAPI library which provides a C interface wrapper to most of the ARC API libraries In particular all
65. of columns in the un binned image Throws Exception std runtime_error N A Notes N A Usage CArcDevice pArcDev new CArcPCIe Set binning mode to 2x2 H pArcDev gt SetBinning dRows dCols 2 2 if pArcDev gt IsBinningSet cout lt lt Binning is SET lt lt endl Un Set binning mode 4 pArcDev gt UnSetBinning dRows dCols if pArcDev gt IsBinningSet cout lt lt Binning is NO LONGER SET lt lt endl CArcDevice SetSubArray Syntax void SetSubArray int amp dOldRows int amp dOldCols int dRow int dCol dSubCols int dBiasOffset int dBiasWidth Description Sets the camera controller into sub array mode Parameters dOldRows The current number of image rows set on the camera controller in pixels dOldCols The current number of image columns set on the camera controller in pixels dRow The row number of the sub array center in pixels dCol The column number of the sub array center in pixels dSubRows The number of rows in the sub image in pixels dSubCols The number of columns in the sub image in pixels dBiasOffset The pixel offset to the start of the bias region dBiasWidth The width of the bias region in pixels Throws Exception std runtime_error int dSubRows N A int RER GRR TRADE mere EE HAE dOldCols Re REA SE ESA z d
66. oller configuration parameter is available on the camera controller Parameters dParameter The controller configuration parameter to check A list of parameters can be found in ArcDefs h Throws Exception N A Notes N A Usage include ArcDefs h CArcDevice pArcDev new CArcPCIe int dCCParam pArcDev gt GetCCParam if pArcDev gt IsCCParamSupported ARC22 cout lt lt ARC 22 board in system lt lt endl else if pArcDev gt IsCCParamSupported SHUTTER CC cout lt lt Shutter support lt lt endl else if pArcDev gt IsCCParamSupported SPLIT SERIAL cout lt lt Serial readout supported lt lt endl else if pArcDev gt IsCCParamSupported BINNING cout lt lt Binning supported lt lt endl else if pArcDev gt IsCCParamSupported SUBARRAY cout lt lt Sub Array supported lt lt endl CArcDevice IsControllerConnected Syntax bool IsControllerConnected Description Determines if a camera controller is connected and powered on Parameters N A Throws Exception std runtime_error Notes N A Usage include ArcDefs h CArcPCIe FindDevices CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 dBufferSize if pArcDev gt IsControllerConnected cout lt lt Yeah A controller is connected lt lt endl cout lt lt Hmmm maybe we forgo
67. ols dNumOfFrames 0 5f false amp pArcDev CArcTools Methods This section documents details of the methods available through the CArcTools class see CArcTools h This provides utility functions used by the library and user applications Note that all methods are class methods that is all methods are static The following is a list of these methods with details to follow on subsequent pages sta tic tiG tie tic TG CIG tie tie tic tic EPG tig tic tic tic std void Th Th string Repl tring Format string CmdTos string CmdToS td string S tring GetSys String tringToUpper tring Conver tring Conver tring Conver rowExcepti tring Conver tringToHex s tringToChar tion rowExcepti tion lyToString int dReply tring int dCmd tring int dReply int dArg2 tringToCmd std string sCmd temMessage int dCode tIntToString int dNumber tWideToAnsi wcha tWideToAnsi const tAnsiToWide const td string sStr std string sStr s a s td st td st tasisi tring sCl tring sCl lassName tring sMsg lassName const char szFmt const char szFmt int dBoardId int dArg3 int int dCmd int dArgl dArg4 int dSysErr S S td st Cdiis std string sStr r t wcharSt
68. perature in Celcius Parameters N A Throws Exception std runtime_error Return Value Description The average array temperature in Celcius Notes The temperature is read CArcDevice gTmpCtrl_SDNumberOfReads protected class member times and averaged Also for a read to be included in the average the difference between the target temperature and the actual temperature must be less than the tolerance specified by CArcDevice gTmpCtrl_SDTolerance protected class member Usage CArcDevice pArcDev new CArcPCIe double gTemp pArcDev gt GetArrayTemperature ANY cout lt lt The current array temperature C lt lt gTemp lt lt endl CArcDevice GetArrayTemperatureDN Syntax double GetArrayTemperatureDN Description Returns the digital number ADU associated with the current array temperature Parameters N A Throws Exception std runtime_error The current digital number Notes Usage CArcDevice pArcDev new CArcPCIe double gTempDN pArcDev gt GetArrayTemperatureDN un cout lt lt The current temperature digital number lt lt gTempDN lt lt endl CArcDevice SetArrayTemperature Syntax void SetArrayTemperature double gTempVal Description Sets the array temperature to regulate around Parameters gTempVal The temperature value in Celcius Throws Exception std runtime_er
69. r Argument Register 2 Image Pixel Count Register Continuous Readout Frame Count Register Device ID LSW Register Device ID MSW Register Controller Special Command Register Usage CArcDevice pArcDev new CArcPCIe Send a TDL command to the controller Send the command header pArcDev gt WriteBar DEV REG BAR REG CMD HEADER 0x203 Send the command pArcDev gt WriteBar DEV REG BAR REG CMD COMMAND TDL Send the argument pArcDev gt WriteBar DEV REG BAR REG CMD ARGO 0x112233 Instead this should be done as follows pArcDev gt Command TIM ID TDL 0x112233 CArcPCle ReadBar Syntax int ReadBar int dBar int dOffset Description Read a value from a PCle base address register BAR Parameters dBar The base address register number dOffset The offset within the base address register Throws Exception std runtime_error int Value of base address register dBar dOffset Notes In general this method should never be called by a user application The dBar parameter can be one of the values CArcPCIe LCL CFG BAR CArcPCIe DEV REG BAR The dOffset parameter can be on the values CArcPCIe REG CMD HEADER CArcPCIe REG CMD COMMAND CArcPCIe REG CMD ARGO CArcPCIe REG CMD ARG1 CArcPCIe REG CMD ARG2 CArcPCIe
70. rcDev NULL Find all PCIe devices CArcPCle FindDevices List all PCIe devices found const char pszDevList CArcPClIe GetDeviceStringList for int i 0 i lt CArcPCIe DeviceCount i cout lt lt pszDevList i lt lt endl CArcPClIe FreeDeviceStringList Open the first PCIe device found if CArcPCIe DeviceCount gt 0 pArcDev new CArcPCIe pArcDev gt Open 0 2200 2200 2 CArcPCle UseDevices Syntax void UseDevices const char pszDeviceList int dListCount Description Forces the use of the specified PCle device list Parameters pszDeviceList The list of devices dListCount The number of devices in the list Throws Exception std runtime_error N A Notes This method is not used for PCle and is only included to mirror the PCI class This method will throw an exception if called Usage N A CArcPCle DeviceCount Syntax int DeviceCount Description Returns the number of ARC PCle devices found in the system Parameters N A Throws Exception std runtime_error int Notes The device count Can be used to access PCle GetDeviceStringList elements or verify that a device has been found Usage CArcDevice pArcDev NULL Find all PCIe devices CArcPCle FindDevices List all PCIe devices found const char pszDevList CArcPCle G
71. ring t char szString tring sMet tring sMet t std wstring amp wsString thodName thodName CArcTools ReplyToString Syntax std string ReplyToString int dReply Description Returns the std string representation of the specified command reply Parameters dReply The command reply to convert to a std string Throws Exception std runtime_error A text version of the reply parameter Notes The hexadecimal value of the reply is returned as a character string if the reply is not a standard value Example dReply 0x455252 gt returns ERR Example dReply 0x112233 gt returns Ox112233 Usage CArcDevice pArcDev new CArcPCIe int dReply pArcDev gt Command TIM ID WRM X MEM 0x3 Outputs WRM reply DON on success cout lt lt WRM reply lt lt CArcTools ReplyToString dReply dReply pArcDev gt Command TIM ID TDL 0x123456 Outputs TDL reply 0x123456 on success cout lt lt TDL reply lt lt CArcTools ReplyToString dReply CArcTools CmdToString Syntax std string CmdToString int dCmd Description Returns the std string representation of the specified command Parameters dCmd The command to convert to a std string Throws Exception N A A text version of the command parameter Notes The hexadecimal value of
72. roller is currently set for synthetic image mode Parameters N A Throws Exception std runtime_error The camera controller is set for synthetic image mode The camera controller is NOT set for synthetic image mode Notes See CArcDevice SetSyntheticlmageMode notes for more details Usage CArcDevice pArcDev new CArcPCIe if pArcDev gt IsSyntheticImageMode cout lt lt Synthetic image mode is SET lt lt endl CArcDevice SetSyntheticlmageMode Syntax void SetSyntheticImageMode bool bMode Description Sets the camera controller into synthetic image mode Parameters bMode True to turn synthetic image mode on false to turn off Throws Exception std runtime_error Return Value Description N A N A Notes Synthetic image mode causes the controller DSP to bypass the A D converters and generate an artificial image pattern The image data will have the following pattern 0 1 2 3 65535 0 1 2 3 65535 0 1 2 3 65535 See the figure below for an example of the pattern The number and size of the pattern depends on the image dimensions Cc a D Q CArcDevice pArcDev new CArcECIe pArcDev gt SetSyntheticImageMode true if pArcDev gt IsSyntheticImageMode cout lt lt Synthetic image mode is SET lt lt endl CArcDevice VerifylmageAsSynthetic Syntax void VerifyImageA
73. ror N A Notes Usage CArcDevice pArcDev new CArcPCIe pArcDev gt SetArrayTemperature 100 6 double gTemp pArcDev gt GetArrayTemperature W cout lt lt The current array temperature C lt lt gTemp lt lt endl CArcDevice LoadTemperatureCtriData Syntax void LoadTemperatureCtrlData const char pszFilename Description Loads temperature control constants from the specified file Parameters pszFilename The file containing temperature control constants in the correct format Throws Exception std runtime_error N A Notes The default constants are stored in TempCtrl h and cannot be permanently overwritten This means any loaded file will need to be reloaded whenever a new CArcDevice object is created The file format is too detailed to show here The best way to create a temperature control constant file is to save the existing constants using CArcDevice Save TemperatureCtrlData The saved file can then be modified and reloaded Usage CArcDevice pArcDev new CArcPCIe pArcDev gt LoadTemperatureCtrlData MyTempCtrlFile txt CArcDevice SaveTemperatureCtriData Syntax void SaveTemperatureCtrlData const char pszFilename Description Saves the current temperature control constants to the specified file Parameters pszFilename The file to save the data too Throws Exception std runtime_error N A
74. rror N A Notes The user should call PCle FreeDeviceStringList when finished with the list returned by PCle GetDeviceStringList Usage CArcDevice pArcDev NULL Find all PCIe devices CArcPCIe FindDevices List all PCIe devices found const char pszDevList CArcPClIe GetDeviceStringList for int i 0 1 lt CArcPCIe DeviceCount i cout lt lt pszDevList i lt lt endl CArcPCIe FreeDeviceStringList Open the first PCIe device found if CArcPCIe DeviceCount gt 0 pArcDev new CArcPCIe pArcDev gt Open 0 2200 2200 2 CArcPCle lsFiberConnected Syntax bool IsFiberConnected int dFiber Description Returns true if the specified PCle fiber optic is connected to a powered on controller Parameters dFiber An integer identifying the fiber A or B to check Default CArcPCle FIBER_A Throws Exception std runtime_error The specified fiber is connected correctl The specified fiber is not connected correctly or no controller is connected and powered on Notes The parameter can be one of CArcPCle FIBER_A or CArcPCle FIBER_B NOT ALL PCle boards have two receive fibers installed Usage CArcDevice pArcDev new CArcPCIe if pArcDev gt IsFiberConnected cout lt lt Controller connected properly lt lt endl 17 Fr cerr lt lt No controller connected powere
75. s void UnMapCommonBuffer void ReMapCommonBuffer int dBytes bool GetCommonBufferProperties void FillCommonBuffer unsigned short ul6Value void CommonBufferVA ulong CommonBufferPA int CommonBufferSize int GetId int GetStatus void ClearStatus void Set2xTransmitters bool bOnOff void LoadDeviceFile const char pszFile int Command int dBoardId int dCommand int dArgl int dArg2 int dArg3 int dArg4 int GetControllerId void ResetController bool IsControllerConnected void SetupController bool bReset bool bTdl bool bPower int dRows int dCols const char pszTimFile const char pszUtilFile const char pszPciFile const bool amp bAbort void LoadControllerFile const char pszFilename bool bValidate const bool amp bAbort void SetImageSize int dRows int dCols int GetImageRows int GetImageCols int GetCCParams bool IsCCParamSupported int dParameter bool IsCCD bool IsBinningSet void UnSetBinning int dRows int dCols void SetBinning int dRows int dCols int dRowFactor int dColFactor int pBinRows int pBinCols void SetSubArray int amp dOldRows int amp dOldCols int dRow int dCol int dSubRows int dSubCols int dBiasOffset int dBiasWidth void UnSetSubArray int dRows int dCols bool IsSyntheticImageMode void SetSyntheticIma
76. s a PCI lod file into the boards DSP for execution Parameters pszFile The PCI lod file to load includes path relative or full Throws Exception std runtime_error N A Notes Execution of the DSP file begins immediately following upload completion This method does nothing on non PCl boards Usage CArcDevice pArcDev new CArcECI Load a PCI file pArcDev gt LoadDeviceFile C User DSPFiles pci lod CArcDevice Command Syntax int Command int dBoardId int dCommand int dArgl int dArg2 int dArg3 int dArg4 Description Sends an ASCII command to the specified board Parameters dBoardid The board ID PCI_ID TIM_ID or UTIL_ID dCommand A valid ASCII controller command See ArcDefs h for command and reply definitions dArg1 dArg4 Arguments for the command default 1 Throws Exception std runtime_error int The command reply This is command dependent but is typically the ASCII word 0x444F4E DON 0x455252 ERR The command is invalid or failed 0x544F5554 TOUT Timeout occurred while processing the command Usage CArcDevice pArcDev new CArcPCIe A Send a series of Test Data Links TDL to timing board for int i 0 i lt 123 itt int dRetVal pArcDev gt Command TIM ID TDL i if dRetVal i throw runtime error TDL failed
77. sFile etc Where xxx is the path to the ARC_API folder See Header List section for a full list of available headers Include necessary library location On Windows C xxx ARC_API 3 0 Release C xxx ARC_API 2 0 Release On Linux xxx ARC_API 3 0 Release xxx ARC_API 2 0 Release Where xxx is the path to the ARC_API folder User Space User Application ARC API Libraries CArcDevice CDeinterlcace CFitsFile etc Kernel Space AstroPCle Driver AstroPCl Driver Image Buffer Image Buffer Hardware How to Access Devices Class Structure Starting with Version 3 0 device access is accomplished using one of three classes depending on which devices the user wishes to support Current support is for PCI ARC 63 64 and PCle ARC 66 67 All ARC controllers are accessed via these classes ARC API 3 0 Class Hierarchy CArcDevice CArcTools CExplFace C rcPCIBase CConl Face CArcPCI CArcPCle CLog FindDevices Class Method The CArcPCle and CArcPCI classes contain a set of static methods one of which FindDevices must be called before any device can be opened accessed The FindDevices method searches the system for installed devices drivers of the appropriate type Any devices found are maintained in a list that can be used to open a device The set of class methods used for this purpose are FindDevices UseDevices De
78. sSynthetic int dRows int dCols Description Verifies that the data in the image buffer matches the expected pattern for a synthetic image Parameters dRows The number of rows in the image dCols The number of columns in the image Throws Exception std runtime_error N A N A Z O o N Checks that the artificial image pattern generated by the DSP has the following pattern 0 1 2 3 65535 0 1 2 3 65535 0 1 2 3 65535 An exception is thrown on the first mismatched value Cc a D Q EL CArcDevice pArcDev new CArcECIe try pArcDev gt SetSyntheticImageMode true pArcDev gt Expose 0 1024 1200 pArcDev gt VerifyImageAsSynthetic catch exception amp e cerr lt lt e what lt lt endl CArcDevice SetOpenShutter Syntax void SetOpenShutter bool bMode Description Determines whether or not to open the shutter during an exposure Parameters bMode True to open the shutter during exposure false to keep it closed Throws Exception std runtime_error N A Notes N A Usage CArcDevice pArcDev new CArcPCIe pArcDev gt SetOpenShutter true CArcDevice Expose Syntax void Expose float fExpTime int dRows int dCols const bool amp bAbort CExplFace pExplFace bool bOpenShutter Description Starts an image exposure Parameters fExpTime The
79. t i lt lt lt lt pU16Buf i lt lt endl CArcDevice CommonBufferPA Syntax unsigned long CommonBufferPA Description Returns the common buffer physical address Parameters N A Throws Exception N A The buffer base physical address EURE No buffer exists or GetCommonBufferProperties has not been called Notes The physical address is an invalid address for the user application It is only available for reference and validation and should never be called upon The returned address is only valid after calling CArcDevice GetCommonBufferProperties Usage CArcDevice pArcDev new CArcPCIe Open device etc Lh if pArcDev gt GetCommonBufferProperties cout lt lt Image buf virt addr lt lt pArcDev gt CommonBufferVA lt lt endl cout lt lt Image buf phys addr lt lt pArcDev gt CommonBufferPA lt lt endl cout lt lt Image buf size lt lt pArcDev gt CommonBufferSize lt lt endl else cerr lt lt Failed to read buffer properties lt lt endl CArcDevice CommonBufferSize Syntax int CommonBufferSize Description Returns the common buffer size in bytes Parameters N A Throws Exception N A The buffer size in bytes C No buffer exists or GetCommonBufferProperties has not been called Notes The size in bytes of the allocated com
80. t to turn it on lt lt endl CArcDevice IsCCD Syntax bool IsCCD Description Determines if the camera controller is for a CCD or IR system Parameters N A Throws Exception N A The camera controller is for a CCD system false The camera controller is for a IR system Notes This method searches the current controller configuration parameter for the existence of IR boards The method returns true if no IR boards are found Usage CArcPCIe FindDevices CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 dBufferSize pArcDev gt SetupController true true true 1024 1200 if pArcDev gt IsCCD cout lt lt This is a CCD system lt lt endl else cout lt lt This is an IR system lt lt endl Stim Lode Js CArcDevice lsBinningSet Syntax bool IsBinningSet Description Determines if the camera controller is currently set for binning Parameters N A Throws Exception std runtime_error The camera controller is set for binning The camera controller is NOT set for binning Notes N A Usage CArcDevice pArcDev new CArcPCIe Set binning mode to 2x2 a H pArcDev gt SetBinning dRows dCols 2 2 if pArcDev gt IsBinningSet cout lt lt Binning is SET lt lt endl Un Set binning mode 4 pArcDev gt UnSetBinning dRows dCols if p
81. uct ArcCAPIStatus pStatus int ArcCam_IsCCD struct ArcCAPIStatus pStatus int ArcCam_IsBinningSet struct ArcCAPIStatus pStatus void ArcCam SetBinning int dRows int dCols int dRowFactor int dColFactor int pBinRows int pBinCols struct ArcCAPIStatus pStatus void ArcCam UnSetBinning int dRows int dCols struct ArcCAPIStatus pStatus void ArcCam SetSubArray int pOldRows int pOldCols int dRow int dCol int dSubRows int dSubCols int dBiasOffset int dBiasWidth struct ArcCAPIStatus pStatus void ArcCam_UnSetSubArray int dRows int dCols struct ArcCAPIStatus pStatus int ArcCam_IsSyntheticImageMode struct ArcCAPIStatus pStatus void ArcCam SetSyntheticImageMode int dMode struct ArcCAPIStatus pStatus void ArcCam VerifyImageAsSynthetic int dRows int dCols struct ArcCAPIStatus pStatus void void void void void int int int int void int ArcCam SetOpenShutter int dShouldOpen struct ArcCAPIStatus pStatus ArcCam Expose float fExpTime int dRows int dCols int pAbort void ArcCam StopExposure pExposeCall float void pReadCall int int dOpenShutter struct ArcCAPIStatus pStatus struct ArcCAPIStatus pStatus ArcCam Continuous int dRows int dCols int dNumOfFrames float fExpTime int pAbort void pFrameCall int int int int t dOpenShutter struct ArcC
82. viceCount GetDeviceStringList and FreeDeviceStringList See the CArcPCle and CArcPCI method descriptions for details Before calling the Open method on any device the FindDevices method must be called first For example CArcECIe FindDevices if CArcPCle DeviceCount gt 0 CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 dBufferSize Device Class Instantiation The CArcDevice class is abstract and cannot be instantiated directly and should be used to instantiate one of the sub classes CArcPClI or CArcPCle Using the CArcDevice class provides the ability to easily switch between devices without code changes For example the following shows how to access a PCle device CArcDevice pArcDev new CArcPCIe pArcDev gt Open 0 dBufferSize To support both PCI and PCle user applications can reassign a CArcDevice to the desired board during runtime For example suppose the user may select the device as a parameter std string sDev that is passed into the user application The proper device may then be selected as follows CArcDevice pArcDev NULL if sDev PCIe pArcDev new CArcPCIe pArcDev new CArcECI pArcDev gt Open 0 dBufferSize If only one device is required PCle or PCI then the appropriate class may be instantiated directly However it is still recommended that the CArcDevice class be used instead For example if only PCle will be us
83. w size 1200 col size Seim Loa DSP timing file pArcDev gt Expose 1 5f 1024 1200 pArcDev gt Close CArcDevice LoadControllerFile Syntax void LoadControllerFile const char pszFilename bool bValidate const bool amp bAbort Description Loads a DSP timing or utility file onto the camera controller Parameters pszFilename The DSP timing or utility file to load onto the controller Typically tim lod timing board or util lod utility board bValidate True to verify that each data word is written successfully Default true bAbort Reference variable to allow external program to exit this method Default false Throws Exception std runtime_error N A Notes Calling this method will effectively wipe out any existing controller settings This method is called from within the SetupController method Usage CArcDevice pArcDev new CArcPCIe The following is essentially what SetupController does pArcDev gt ResetController for int i 0 i lt 123 i J pArcDev gt TestDataLink if pArcDev gt Command TIM ID TDL 0x123456 0x123456 throw runtime error TIM TDL failed pArcDev gt LoadControllerFile tim lod pArcDev gt Command TIM ID PON pArcDev gt SetImageSize 1024 1200 CArcDevice SetimageSize Syntax void SetImageSize int dRows int dCols Description
Download Pdf Manuals
Related Search
Related Contents
355 - 株式会社トヨトミ Sunbeam Bedding 003108-000-000 User's Manual Method and apparatus for determining the status of a transmission link Lightweight, Standard and Heavy Duty Wheelchairs EVGA 01G-P3-1526-KR NVIDIA GeForce GT 520 1GB graphics card ダウンロード CSR Report 1999 (0.9MB) Insignia NS-BT400 User's Manual Mode d`emploi Engagement de conformité Bio Cohérence Viticulteurs Kambrook Blender KSB8 User's Manual Copyright © All rights reserved.
Failed to retrieve file