2019-09-26 18:29:20 +02:00
|
|
|
#ifndef DEVICE_HPP
|
|
|
|
|
#define DEVICE_HPP
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#include "ftdijtag.hpp"
|
|
|
|
|
|
|
|
|
|
/* GGM: TODO: program must have an optional
|
|
|
|
|
* offset
|
|
|
|
|
* and question: bitstream to load bitstream in SPI mode must
|
|
|
|
|
* be hardcoded or provided by user?
|
|
|
|
|
*/
|
|
|
|
|
class Device {
|
|
|
|
|
public:
|
|
|
|
|
enum prog_mode {
|
|
|
|
|
NONE_MODE = 0,
|
2019-11-18 16:04:29 +01:00
|
|
|
SPI_MODE = 1,
|
|
|
|
|
FLASH_MODE = 1,
|
|
|
|
|
MEM_MODE = 2
|
2019-09-26 18:29:20 +02:00
|
|
|
};
|
2019-09-28 15:26:47 +02:00
|
|
|
Device(FtdiJtag *jtag, std::string filename);
|
|
|
|
|
virtual ~Device();
|
|
|
|
|
virtual void program(unsigned int offset = 0) = 0;
|
|
|
|
|
virtual int idCode() = 0;
|
|
|
|
|
virtual void reset();
|
2019-09-26 18:29:20 +02:00
|
|
|
protected:
|
|
|
|
|
FtdiJtag *_jtag;
|
|
|
|
|
std::string _filename;
|
2019-09-28 15:26:47 +02:00
|
|
|
std::string _file_extension;
|
2019-09-26 18:29:20 +02:00
|
|
|
enum prog_mode _mode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|