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);
157 unsigned int fileSize = (
unsigned int)file.tellg();
158 CRL_EXCEPTION(
"%s failed @ %d/%d bytes", opNameP, fileSize, fileLength);
164 int progress =
static_cast<int> ((100 * op.
start_address) / fileLength);
165 if (progress != prevProgress && 0 == (progress % 5))
166 CRL_DEBUG(
"%s... %3d%%\n", opNameP, progress);
171 prevProgress = progress;
174 }
while (!file.eof());
190 std::ifstream file(filename.c_str(),
191 std::ios::in | std::ios::binary);
202 }
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()
#define CRL_EXCEPTION_RAW(fmt)
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)