fp@1122: /***************************************************************************** fp@1122: * fp@1122: * $Id$ fp@1122: * fp@1122: ****************************************************************************/ fp@1122: fp@1141: #ifndef __MASTER_DEVICE_H__ fp@1141: #define __MASTER_DEVICE_H__ fp@1122: fp@1122: #include fp@1136: #include fp@1122: using namespace std; fp@1122: fp@1122: #include "../include/ecrt.h" fp@1122: #include "../master/ioctl.h" fp@1122: fp@1122: /****************************************************************************/ fp@1122: fp@1122: class MasterDeviceException: fp@1122: public runtime_error fp@1122: { fp@1136: friend class MasterDevice; fp@1136: fp@1136: protected: fp@1184: /** Constructor with string parameter. */ fp@1184: MasterDeviceException( fp@1184: const string &s /**< Message. */ fp@1184: ): runtime_error(s) {} fp@1184: fp@1141: /** Constructor with stringstream parameter. */ fp@1122: MasterDeviceException( fp@1136: const stringstream &s /**< Message. */ fp@1136: ): runtime_error(s.str()) {} fp@1122: }; fp@1122: fp@1122: /****************************************************************************/ fp@1122: fp@1184: class MasterDeviceSdoAbortException: fp@1184: public MasterDeviceException fp@1184: { fp@1184: friend class MasterDevice; fp@1184: fp@1184: public: fp@1184: uint32_t abortCode; fp@1184: fp@1184: protected: fp@1184: /** Constructor with stringstream parameter. */ fp@1184: MasterDeviceSdoAbortException(uint32_t code): fp@1686: MasterDeviceException("SDO transfer aborted.") { fp@1184: abortCode = code; fp@1184: }; fp@1184: }; fp@1184: fp@1184: /****************************************************************************/ fp@1184: fp@1122: class MasterDevice fp@1122: { fp@1122: public: fp@1122: MasterDevice(); fp@1122: ~MasterDevice(); fp@1122: fp@1122: void setIndex(unsigned int); fp@1166: unsigned int getIndex() const; fp@1122: fp@1122: enum Permissions {Read, ReadWrite}; fp@1122: void open(Permissions); fp@1122: void close(); fp@1122: fp@1122: void getMaster(ec_ioctl_master_t *); fp@1122: void getConfig(ec_ioctl_config_t *, unsigned int); fp@1122: void getConfigPdo(ec_ioctl_config_pdo_t *, unsigned int, uint8_t, fp@1122: uint16_t); fp@1122: void getConfigPdoEntry(ec_ioctl_config_pdo_entry_t *, unsigned int, fp@1122: uint8_t, uint16_t, uint8_t); fp@1122: void getConfigSdo(ec_ioctl_config_sdo_t *, unsigned int, unsigned int); fp@1122: void getDomain(ec_ioctl_domain_t *, unsigned int); fp@1122: void getFmmu(ec_ioctl_domain_fmmu_t *, unsigned int, unsigned int); fp@1122: void getData(ec_ioctl_domain_data_t *, unsigned int, unsigned int, fp@1122: unsigned char *); fp@1122: void getSlave(ec_ioctl_slave_t *, uint16_t); fp@1122: void getSync(ec_ioctl_slave_sync_t *, uint16_t, uint8_t); fp@1122: void getPdo(ec_ioctl_slave_sync_pdo_t *, uint16_t, uint8_t, uint8_t); fp@1122: void getPdoEntry(ec_ioctl_slave_sync_pdo_entry_t *, uint16_t, uint8_t, fp@1122: uint8_t, uint8_t); fp@1122: void getSdo(ec_ioctl_slave_sdo_t *, uint16_t, uint16_t); fp@1122: void getSdoEntry(ec_ioctl_slave_sdo_entry_t *, uint16_t, int, uint8_t); fp@1122: void readSii(ec_ioctl_slave_sii_t *); fp@1122: void writeSii(ec_ioctl_slave_sii_t *); fp@1126: void setDebug(unsigned int); fp@1126: void sdoDownload(ec_ioctl_slave_sdo_download_t *); fp@1126: void sdoUpload(ec_ioctl_slave_sdo_upload_t *); fp@1126: void requestState(uint16_t, uint8_t); fp@1707: void readFoe(ec_ioctl_slave_foe_t *); fp@1707: void writeFoe(ec_ioctl_slave_foe_t *); fp@1122: fp@1122: private: fp@1122: unsigned int index; fp@1122: int fd; fp@1122: }; fp@1122: fp@1122: /****************************************************************************/ fp@1122: fp@1166: inline unsigned int MasterDevice::getIndex() const fp@1166: { fp@1166: return index; fp@1166: } fp@1166: fp@1166: /****************************************************************************/ fp@1166: fp@1122: #endif