13 #include <epicsTypes.h>
16 #include <mrfCommon.h>
26 explicit CFIFlash(
const SPIDevice& dev);
37 const char *vendorName;
42 std::vector<epicsUInt8> SN;
48 inline bool writable() { check();
return info.pageSize>0 && info.sectorSize>0; }
50 inline epicsUInt32 alignement() { check();
return (info.pageSize-1)|(info.sectorSize-1); }
52 inline epicsUInt32 blockSize() {
return alignement()+1u; }
53 inline epicsUInt32 pageSize() { check();
return info.pageSize; }
54 inline epicsUInt32 sectorSize() { check();
return info.sectorSize; }
56 void read(epicsUInt32 start, epicsUInt32 count, epicsUInt8 *in);
57 inline void read(epicsUInt32 start, std::vector<epicsUInt8>& in)
58 { read(start, in.size(), &in[0]); }
60 void write(epicsUInt32 start, epicsUInt32 count,
const epicsUInt8 *out,
bool strict =
true);
61 void write(epicsUInt32 start,
const std::vector<epicsUInt8>& out,
bool strict =
true)
62 { write(start, out.size(), &out[0], strict); }
64 void erase(epicsUInt32 start, epicsUInt32 count,
bool strict =
true);
73 void writeEnable(
bool e);
74 void busyWait(
double timeout,
unsigned n=10);
79 explicit WriteEnabler(
CFIFlash& dev) : dev(dev)
82 { dev.writeEnable(
true); }
84 { dev.writeEnable(
false); }
93 std::vector<char> buf;
97 virtual int_type underflow() OVERRIDE FINAL;
99 virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode mode) OVERRIDE FINAL;
100 virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode) OVERRIDE FINAL;
108 bool read(std::istream& strm);
110 std::string project, part, date;
Handling for Common Flash Interfafce compliant chips.
Definition: flash.h:24
Adapt CFIFlash for use with std::istream.
Definition: flash.h:90
Attempt to read out the header of a Xilinx bitstream file.
Definition: flash.h:105