38 lines
880 B
38 lines
880 B
4 years ago
|
#include "stdint.h"
|
||
|
#include <exception>
|
||
|
|
||
|
#include "model/hardware/device/SonoDevice.h"
|
||
|
|
||
|
class myexception: public std::exception
|
||
|
{
|
||
|
private:
|
||
|
char* _message;
|
||
|
public:
|
||
|
myexception(char* message) { _message = message; }
|
||
|
virtual const char* what() const noexcept
|
||
|
{
|
||
|
return _message;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class UltraSoundDevice
|
||
|
{
|
||
|
public:
|
||
|
UltraSoundDevice();
|
||
|
~UltraSoundDevice();
|
||
|
|
||
|
SonoDevice* device;
|
||
|
|
||
|
uint8_t readByte(uint32_t address, uint32_t bar);
|
||
|
uint16_t readShort(uint32_t address, uint32_t bar);
|
||
|
uint32_t readWord(uint32_t address, uint32_t bar);
|
||
|
uint64_t readLong(uint32_t address, uint32_t bar);
|
||
|
|
||
|
void writeByte(uint32_t address, uint32_t bar, uint8_t data);
|
||
|
void writeShort(uint32_t address, uint32_t bar, uint16_t data);
|
||
|
void writeWord(uint32_t address, uint32_t bar, uint32_t data);
|
||
|
void writeLong(uint32_t address, uint32_t bar, uint64_t data);
|
||
|
};
|
||
|
|
||
|
|