openFPGALoader/src/device.hpp

44 lines
788 B
C++
Raw Normal View History

2019-09-26 18:29:20 +02:00
#ifndef DEVICE_HPP
#define DEVICE_HPP
#include <iostream>
2021-02-18 21:09:34 +01:00
#include <string>
2019-09-26 18:29:20 +02:00
#include "jtag.hpp"
2019-09-26 18:29:20 +02:00
/* 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,
SPI_MODE = 1,
FLASH_MODE = 1,
MEM_MODE = 2
2019-09-26 18:29:20 +02:00
};
2021-02-18 21:09:34 +01:00
typedef enum {
WR_SRAM = 0,
WR_FLASH = 1
} prog_type_t;
Device(Jtag *jtag, std::string filename, int8_t verbose = false);
virtual ~Device();
virtual void program(unsigned int offset = 0) = 0;
virtual int idCode() = 0;
virtual void reset();
2021-02-18 21:09:34 +01:00
2019-09-26 18:29:20 +02:00
protected:
Jtag *_jtag;
2019-09-26 18:29:20 +02:00
std::string _filename;
std::string _file_extension;
2019-09-26 18:29:20 +02:00
enum prog_mode _mode;
2019-11-21 08:38:11 +01:00
bool _verbose;
bool _quiet;
2019-09-26 18:29:20 +02:00
};
#endif