2010-05-18 02:58:26 +00:00
|
|
|
#ifndef __DEVICE_ADAPTOR_H__
|
|
|
|
#define __DEVICE_ADAPTOR_H__
|
|
|
|
|
2010-05-23 21:27:11 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2010-05-18 02:58:26 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2010-05-23 21:27:11 +00:00
|
|
|
#include <Device/TrackSector.h>
|
|
|
|
|
2010-05-18 02:58:26 +00:00
|
|
|
namespace Device {
|
|
|
|
|
|
|
|
class Adaptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Adaptor();
|
|
|
|
virtual void readBlock(unsigned block, void *bp) = 0;
|
|
|
|
virtual void writeBlock(unsigned block, const void *bp) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class POAdaptor : public Adaptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
POAdaptor(void *address);
|
2010-05-18 19:59:18 +00:00
|
|
|
virtual void readBlock(unsigned block, void *bp);
|
|
|
|
virtual void writeBlock(unsigned block, const void *bp);
|
2010-05-18 02:58:26 +00:00
|
|
|
private:
|
|
|
|
uint8_t *_address;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DOAdaptor : public Adaptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DOAdaptor(void *address);
|
2010-05-18 19:59:18 +00:00
|
|
|
virtual void readBlock(unsigned block, void *bp);
|
|
|
|
virtual void writeBlock(unsigned block, const void *bp);
|
2010-05-24 11:37:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
static unsigned Map[];
|
|
|
|
|
2010-05-18 02:58:26 +00:00
|
|
|
private:
|
|
|
|
uint8_t *_address;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO -- nibble adaptor.
|
|
|
|
|
2010-05-23 21:27:11 +00:00
|
|
|
|
|
|
|
class NibbleAdaptor : public Adaptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NibbleAdaptor(void *address, unsigned length);
|
|
|
|
virtual ~NibbleAdaptor();
|
|
|
|
|
|
|
|
virtual void readBlock(unsigned block, void *bp);
|
|
|
|
virtual void writeBlock(unsigned block, const void *bp);
|
|
|
|
|
|
|
|
|
|
|
|
virtual void readTrackSector(TrackSector ts, void *bp);
|
|
|
|
virtual void writeTrackSector(TrackSector ts, const void *bp);
|
|
|
|
|
|
|
|
static std::pair<uint8_t, uint8_t>encode44(uint8_t);
|
|
|
|
static uint8_t decode44(uint8_t, uint8_t);
|
|
|
|
|
|
|
|
static uint8_t encode62(uint8_t);
|
|
|
|
static uint8_t decode62(uint8_t);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t *_address;
|
|
|
|
unsigned _length;
|
|
|
|
|
|
|
|
std::vector<unsigned> _index;
|
|
|
|
};
|
2010-05-18 02:58:26 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|