13 #include <epicsTypes.h> 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);
void read(epicsUInt32 start, std::vector< epicsUInt8 > &in)
Attempt to read out the header of a Xilinx bitstream file.
Handling for Common Flash Interfafce compliant chips.
epicsUInt32 sectorSize
SECTOR ERASE (0xd8) size in bytes. Always a power of 2.
void write(epicsUInt32 start, const std::vector< epicsUInt8 > &out, bool strict=true)
std::vector< epicsUInt8 > SN
Adapt CFIFlash for use with std::istream.