84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
#ifndef FGPAPROGRAMMER_H
|
|
#define FGPAPROGRAMMER_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "fpgaflashengine.h"
|
|
#include "historydb.h"
|
|
|
|
//class FpgaBridgeTftp;
|
|
class BupTFTP;
|
|
|
|
|
|
class FpgaProgrammerDriver
|
|
{
|
|
public:
|
|
virtual bool writeContrl(const void* data, unsigned int len);
|
|
virtual bool writeFifo(const void* data, unsigned int len);
|
|
|
|
virtual bool readControl();
|
|
virtual bool readFifo();
|
|
virtual bool readStatus();
|
|
|
|
virtual int getData(void* buffer, unsigned int len);
|
|
};
|
|
|
|
class FgpaProgrammer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit FgpaProgrammer(QObject *parent = 0);
|
|
|
|
void setDriver(FpgaProgrammerDriver* driver);
|
|
|
|
//void setTftp(FpgaBridgeTftp* tfp);
|
|
void setTftp(BupTFTP* tftp);
|
|
void setHistory(dbHistory *db);
|
|
void setSimulate(bool enable=true);
|
|
void setSRIOMemory(bool enable=false);
|
|
|
|
signals:
|
|
void _writeOk();
|
|
void _readOk();
|
|
void _writeFail();
|
|
void _readFail();
|
|
|
|
void statusChanged(int sts, int progress, const QString& msg);
|
|
|
|
void writeRequest(const QString& a, const void* src, unsigned int len);
|
|
void readRequest(const QString& a, void* dst, unsigned int len);
|
|
|
|
public slots:
|
|
void start(unsigned long write_size, unsigned int sectorSize, unsigned int baseOffset);
|
|
|
|
void start(const FpgaFlashProfile& _profile);
|
|
|
|
void erase(unsigned long write_size, unsigned int sectorSize, unsigned int baseOffset);
|
|
|
|
void reset(const FpgaFlashProfile& _profile);
|
|
|
|
void abort(const FpgaFlashProfile& _profile);
|
|
|
|
void readFlashID(const FpgaFlashProfile& _profile);
|
|
|
|
void readStatusSPI(const FpgaFlashProfile& _profile);
|
|
|
|
void terminate(const FpgaFlashProfile& _profile);
|
|
|
|
void writeCompleted(bool ok);
|
|
|
|
void readCompleted(bool ok);
|
|
|
|
//void eraseCompleted(bool ok, const void* data, unsigned int len);
|
|
|
|
void onWriteRequest(const QString& a, const void* src, unsigned int len);
|
|
|
|
void onReadRequest(const QString& a, void* dst, unsigned int len);
|
|
|
|
private:
|
|
class FpgaProgrammerImplementation;
|
|
FpgaProgrammerImplementation& p_;
|
|
};
|
|
|
|
#endif // FGPAPROGRAMMER_H
|