Generic hardware access library
|
00001 #ifndef __HardwareDeviceInterface 00002 #define __HardwareDeviceInterface 00003 00004 #include <string> 00005 #include <iostream> 00006 00007 #include "hal/AddressTableInterface.hh" 00008 #include "hal/NoSuchItemException.hh" 00009 #include "hal/IllegalOperationException.hh" 00010 #include "hal/IllegalValueException.hh" 00011 #include "hal/VerifyException.hh" 00012 #include "hal/UnsupportedException.hh" 00013 #include "hal/BusAdapterException.hh" 00014 #include "hal/MaskBoundaryException.hh" 00015 #include "hal/TimeoutException.hh" 00016 #include "hal/AddressOutOfLimitsException.hh" 00017 00018 namespace HAL { 00019 00044 enum HalVerifyOption { HAL_NO_VERIFY, HAL_DO_VERIFY }; 00045 00075 enum HalAddressIncrement { HAL_DO_INCREMENT, HAL_NO_INCREMENT }; 00076 00096 enum HalPollMethod { HAL_POLL_UNTIL_EQUAL, HAL_POLL_UNTIL_DIFFERENT }; 00152 class HardwareDeviceInterface { 00153 public: 00154 00155 virtual ~HardwareDeviceInterface() {}; 00156 00164 virtual void unmaskedWrite( std::string item, 00165 uint32_t data, 00166 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00167 uint32_t offset = 0 ) const 00168 throw (NoSuchItemException, 00169 IllegalOperationException, 00170 VerifyException, 00171 BusAdapterException, 00172 AddressOutOfLimitsException) = 0; 00198 virtual void write( std::string item, 00199 uint32_t data, 00200 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00201 uint32_t offset = 0 ) const 00202 throw ( NoSuchItemException, 00203 IllegalOperationException, 00204 VerifyException, 00205 BusAdapterException, 00206 MaskBoundaryException, 00207 AddressOutOfLimitsException ) = 0; 00220 virtual void writePulse( std::string item, 00221 uint32_t offset = 0 ) const 00222 throw (NoSuchItemException, 00223 IllegalOperationException, 00224 BusAdapterException, 00225 AddressOutOfLimitsException) = 0; 00229 virtual void unmaskedRead( std::string item, 00230 uint32_t* result, 00231 uint32_t offset = 0 ) const 00232 throw (NoSuchItemException, 00233 IllegalOperationException, 00234 BusAdapterException, 00235 AddressOutOfLimitsException) = 0; 00243 virtual void read( std::string item, 00244 uint32_t* result, 00245 uint32_t offset = 0 ) const 00246 throw (NoSuchItemException, 00247 IllegalOperationException, 00248 BusAdapterException, 00249 MaskBoundaryException, 00250 AddressOutOfLimitsException) = 0; 00266 virtual bool check( std::string item, 00267 uint32_t expectation, 00268 std::string faultMessage = "", 00269 uint32_t offset = 0, 00270 std::ostream& os = std::cout ) const 00271 throw( NoSuchItemException, 00272 IllegalOperationException, 00273 BusAdapterException, 00274 AddressOutOfLimitsException) = 0; 00275 00282 virtual void readPulse( std::string item, 00283 uint32_t offset = 0 ) const 00284 throw (NoSuchItemException, 00285 IllegalOperationException, 00286 BusAdapterException, 00287 AddressOutOfLimitsException) = 0; 00299 virtual void setBit( std::string item, 00300 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00301 uint32_t offset = 0 ) const 00302 throw (NoSuchItemException, 00303 IllegalOperationException, 00304 VerifyException, 00305 BusAdapterException, 00306 AddressOutOfLimitsException) = 0; 00318 virtual void resetBit( std::string item, 00319 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00320 uint32_t offset = 0 ) const 00321 throw (NoSuchItemException, 00322 IllegalOperationException, 00323 VerifyException, 00324 BusAdapterException, 00325 AddressOutOfLimitsException) = 0; 00331 virtual bool isSet( std::string item, 00332 uint32_t offset = 0 ) const 00333 throw (NoSuchItemException, 00334 IllegalOperationException, 00335 BusAdapterException, 00336 AddressOutOfLimitsException) = 0; 00337 00389 virtual void writeBlock( std::string startItem, 00390 uint32_t length, 00391 char *buffer, 00392 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00393 HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT, 00394 uint32_t offset = 0 ) const 00395 throw ( NoSuchItemException, 00396 IllegalValueException, 00397 UnsupportedException, 00398 VerifyException, 00399 IllegalOperationException, 00400 BusAdapterException, 00401 AddressOutOfLimitsException ) = 0; 00402 00450 virtual void readBlock( std::string startItem, 00451 uint32_t length, 00452 char *buffer, 00453 HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT, 00454 uint32_t offset = 0 ) const 00455 throw (NoSuchItemException, 00456 IllegalValueException, 00457 UnsupportedException, 00458 BusAdapterException, 00459 IllegalOperationException, 00460 AddressOutOfLimitsException) = 0; 00461 00489 virtual void pollItem( std::string item, 00490 uint32_t referenceValue, 00491 uint32_t timeout, 00492 uint32_t *result, 00493 HalPollMethod pollMethod = HAL_POLL_UNTIL_EQUAL, 00494 uint32_t offset = 0 ) const 00495 throw ( NoSuchItemException, 00496 IllegalOperationException, 00497 BusAdapterException, 00498 MaskBoundaryException, 00499 TimeoutException, 00500 AddressOutOfLimitsException ) = 0; 00501 00502 00511 virtual const AddressTableInterface& getAddressTableInterface() const = 0; 00512 00518 virtual void printAddressTable() const = 0; 00519 00520 }; 00521 } /* namespace HAL */ 00522 00523 #endif /*__HardwareDeviceInterface */ 00524