15#pragma warning( disable: 4251 )
24#include <CArcDeviceDllMain.h>
26#include <CArcStringList.h>
29using namespace std::string_literals;
58 constexpr std::string_view toString(
void );
68 std::uint32_t getCfgSpByte(
const std::uint32_t uiOffset );
75 std::uint32_t getCfgSpWord(
const std::uint32_t uiOffset );
82 std::uint32_t getCfgSpDWord(
const std::uint32_t uiOffset );
89 void setCfgSpByte(
const std::uint32_t uiOffset,
const std::uint32_t uiValue );
96 void setCfgSpWord(
const std::uint32_t uiOffset,
const std::uint32_t uiValue );
103 void setCfgSpDWord(
const std::uint32_t uiOffset,
const std::uint32_t uiValue );
110 void getCfgSp(
void );
118 void getBarSp(
void );
127 static void findDevices(
void );
132 static std::uint32_t deviceCount(
void )
noexcept;
138 static const std::weak_ptr<std::string[]> getDeviceStringList(
void );
143 bool isOpen(
void )
noexcept;
149 void open(
const std::uint32_t uiDeviceNumber = 0 );
157 void open(
const std::uint32_t uiDeviceNumber,
const std::uint32_t uiBytes );
167 void open(
const std::uint32_t uiDeviceNumber,
const std::uint32_t uiRows,
const std::uint32_t uiCols );
182 bool getCommonBufferProperties(
void );
189 void mapCommonBuffer( std::size_t uiBytes = 0 );
194 void unMapCommonBuffer(
void );
199 std::uint32_t getId(
void );
205 std::uint32_t getStatus(
void );
209 void clearStatus(
void );
215 void set2xFOTransmitter(
bool bOnOff );
221 void loadDeviceFile(
const std::filesystem::path& tFile );
233 std::uint32_t command(
const std::initializer_list<const std::uint32_t>& tCmdList );
239 std::uint32_t getControllerId(
void );
244 void resetController(
void );
250 bool isControllerConnected(
void );
259 void stopExposure(
void );
265 bool isReadout(
void );
271 std::uint32_t getPixelCount(
void );
277 std::uint32_t getCRPixelCount(
void );
283 std::uint32_t getFrameCount(
void );
295 void setHCTR(
const std::uint32_t uiVal );
301 std::uint32_t getHSTR(
void );
307 std::uint32_t getHCTR(
void );
314 std::uint32_t PCICommand(
const std::uint32_t uiCommand );
321 static constexpr auto ASTROPCI_GET_HCTR =
static_cast< std::uint32_t
>( 0x01 );
324 static constexpr auto ASTROPCI_GET_PROGRESS =
static_cast< std::uint32_t
>( 0x02 );
327 static constexpr auto ASTROPCI_GET_DMA_ADDR =
static_cast< std::uint32_t
>( 0x03 );
330 static constexpr auto ASTROPCI_GET_HSTR =
static_cast< std::uint32_t
>( 0x04 );
333 static constexpr auto ASTROPCI_MEM_MAP =
static_cast< std::uint32_t
>( 0x05 );
336 static constexpr auto ASTROPCI_GET_DMA_SIZE =
static_cast< std::uint32_t
>( 0x06 );
339 static constexpr auto ASTROPCI_GET_FRAMES_READ =
static_cast< std::uint32_t
>( 0x07 );
343 static constexpr auto ASTROPCI_HCVR_DATA =
static_cast< std::uint32_t
>( 0x10 );
346 static constexpr auto ASTROPCI_SET_HCTR =
static_cast< std::uint32_t
>( 0x11 );
349 static constexpr auto ASTROPCI_SET_HCVR =
static_cast< std::uint32_t
>( 0x12 );
352 static constexpr auto ASTROPCI_PCI_DOWNLOAD =
static_cast< std::uint32_t
>( 0x13 );
355 static constexpr auto ASTROPCI_PCI_DOWNLOAD_WAIT =
static_cast< std::uint32_t
>( 0x14 );
358 static constexpr auto ASTROPCI_COMMAND =
static_cast< std::uint32_t
>( 0x15 );
361 static constexpr auto ASTROPCI_MEM_UNMAP =
static_cast< std::uint32_t
>( 0x16 );
364 static constexpr auto ASTROPCI_ABORT =
static_cast< std::uint32_t
>( 0x17 );
367 static constexpr auto ASTROPCI_CONTROLLER_DOWNLOAD =
static_cast< std::uint32_t
>( 0x19 );
370 static constexpr auto ASTROPCI_GET_CR_PROGRESS =
static_cast< std::uint32_t
>( 0x20 );
373 static constexpr auto ASTROPCI_GET_DMA_LO_ADDR =
static_cast< std::uint32_t
>( 0x21 );
376 static constexpr auto ASTROPCI_GET_DMA_HI_ADDR =
static_cast< std::uint32_t
>( 0x22 );
379 static constexpr auto ASTROPCI_GET_CONFIG_BYTE =
static_cast< std::uint32_t
>( 0x30 );
382 static constexpr auto ASTROPCI_GET_CONFIG_WORD =
static_cast< std::uint32_t
>( 0x31 );
385 static constexpr auto ASTROPCI_GET_CONFIG_DWORD =
static_cast< std::uint32_t
>( 0x32 );
388 static constexpr auto ASTROPCI_SET_CONFIG_BYTE =
static_cast< std::uint32_t
>( 0x33 );
391 static constexpr auto ASTROPCI_SET_CONFIG_WORD =
static_cast< std::uint32_t
>( 0x34 );
394 static constexpr auto ASTROPCI_SET_CONFIG_DWORD =
static_cast< std::uint32_t
>( 0x35 );
401 static constexpr auto HTF_BIT_MASK =
static_cast< std::uint32_t
>( 0x00000038 );
420 enum class ePCIStatus : std::uint32_t
436 static constexpr auto PCI_RESET =
static_cast< std::uint32_t
>( 0x8077 );
439 static constexpr auto ABORT_READOUT =
static_cast< std::uint32_t
>( 0x8079 );
442 static constexpr auto BOOT_EEPROM =
static_cast< std::uint32_t
>( 0x807B );
445 static constexpr auto READ_HEADER =
static_cast< std::uint32_t
>( 0x81 );
448 static constexpr auto RESET_CONTROLLER =
static_cast< std::uint32_t
>( 0x87 );
451 static constexpr auto INITIALIZE_IMAGE_ADDRESS =
static_cast< std::uint32_t
>( 0x91 );
454 static constexpr auto WRITE_COMMAND =
static_cast< std::uint32_t
>( 0xB1 );
462 static constexpr auto HTF_MASK =
static_cast< std::uint32_t
>( 0x200 );
465 static constexpr auto HTF_CLEAR_MASK =
static_cast< std::uint32_t
>( 0xFFFFFCFF );
468 static constexpr auto MAX_PCI_COMM_TEST =
static_cast< std::uint32_t
>( 3 );
471 static constexpr auto PCI_COM_TEST_VALUE =
static_cast< std::uint32_t
>( 0xABC123 );
481 std::uint32_t getContinuousImageSize(
const std::uint32_t uiImageSize );
490 std::uint32_t smallCamDLoad(
const std::uint32_t uiBoardId,
const std::vector<std::uint32_t>* pvData );
500 void loadGen23ControllerFile(
const std::filesystem::path& tFilename,
bool bValidate,
bool* pAbort =
nullptr );
504 void setByteSwapping(
void );
514 const std::string formatPCICommand(
const std::uint32_t uiCmd,
const std::uint64_t uiReply,
const std::uint32_t uiArg =
CArcDevice::NOPARAM,
bool bGetSysErr =
false );
524 const std::string formatPCICommand(
const std::uint32_t uiCmd,
const std::uint64_t uiReply,
const std::initializer_list<const std::uint32_t>& tArgList,
bool bGetSysErr =
false );
531 std::unique_ptr<CArcStringList> getHSTRBitList(
const std::uint32_t uiData,
bool bDrawSeparator =
false );
537 std::function<std::uint32_t(
const std::uint16_t )> m_fnValidDeviceVendorId;
540 static std::unique_ptr<std::vector<arc::gen3::arcDev_t>> m_pvDevList;
543 static std::shared_ptr<std::string[]> m_psDevList;
static constexpr auto NOPARAM
Definition: CArcDevice.h:604
Definition: CArcPCIBase.h:95