Files
beaglefw/interfaces.hh
Matthias Blankertz 76cc09a168 - WIP: OMAP35x SD/MMC controller driver
- WIP: Pagecache
- Added sleep() and usleep() functions
2013-07-19 19:51:40 +02:00

37 lines
1.3 KiB
C++

#ifndef _INTERFACES_HH_
#define _INTERFACES_HH_
#include <cstdint>
class ICharacterDevice {
public:
virtual void write(char const* data, int const& len) = 0;
virtual int read(char *buf, int const& len) = 0;
};
class IBlockDevice {
public:
// Get the (logical) block size of the device
virtual unsigned getBlockSize() const = 0;
// Write getBlockSize()*'count' bytes of data from 'data' to the device starting at block 'pos'
/* Throw an Error on error, containing the errno describing the error. The contents of the block
device from 'pos' to 'pos'+'count' are undefined after an exception */
virtual void write(unsigned pos, char const* data, unsigned count) = 0;
// Read getBlockSize()*'count' bytes of data from the device starting at block 'pos' to 'data'
/* Throw an Error on error, containing the errno describing the error. The contents of 'data'
are undefined after an exception */
virtual void read(unsigned pos, char *data, unsigned count) = 0;
};
class II2C {
public:
virtual void reg_write(uint8_t slaveid, uint8_t reg, uint8_t value) = 0;
virtual uint8_t reg_read(uint8_t slaveid, uint8_t reg) = 0;
virtual void reg_write16(uint8_t slaveid, uint8_t reg, uint16_t value) = 0;
virtual uint16_t reg_read16(uint8_t slaveid, uint8_t reg) = 0;
};
#endif