45 namespace multisense {
77 const double ERASE_TIMEOUT = 210.0;
81 int prevProgress = -1;
109 CRL_EXCEPTION(
"erase op timed out after %.0f seconds", ERASE_TIMEOUT);
122 file.seekg(0, file.end);
123 std::streamoff fileLength = file.tellg();
124 file.seekg(0, file.beg);
129 int prevProgress = -1;
155 CRL_EXCEPTION(
"SysFlashOp (%s) failed: %d", opNameP, status);
158 file.tellg(), fileLength);
163 int progress =
static_cast<int> ((100 * op.
start_address) / fileLength);
164 if (progress != prevProgress && 0 == (progress % 5))
165 CRL_DEBUG(
"%s... %3d%%\n", opNameP, progress);
170 prevProgress = progress;
173 }
while (!file.eof());
189 std::ifstream file(filename.c_str(),
190 std::ios::in | std::ios::binary);
201 }
catch (
const std::exception& e) {
static CRL_CONSTEXPR uint32_t OP_PROGRAM
#define CRL_EXCEPTION(fmt,...)
static CRL_CONSTEXPR uint32_t OP_ERASE
static CRL_CONSTEXPR uint32_t STATUS_SUCCESS
static CRL_CONSTEXPR uint32_t MAX_LENGTH
void eraseFlashRegion(uint32_t region)
static TimeStamp getCurrentTime()
static CRL_CONSTEXPR uint32_t OP_VERIFY
static CRL_CONSTEXPR uint32_t STATUS_IDLE
static CRL_CONSTEXPR Status Status_Ok
static CRL_CONSTEXPR uint32_t STATUS_ERASE_IN_PROGRESS
#define CRL_DEBUG(fmt,...)
static CRL_CONSTEXPR Status Status_Exception
Status waitData(const T &command, U &data, const double &timeout=DEFAULT_ACK_TIMEOUT(), int32_t attempts=DEFAULT_ACK_ATTEMPTS)
void programOrVerifyFlashRegion(std::ifstream &file, uint32_t operation, uint32_t region)
Status doFlashOp(const std::string &filename, uint32_t operation, uint32_t region)