25 BufferLogger& bufferLogger
27 bufferLogger(bufferLogger),
49 void BufferLogger::File ::
51 const char *
const logFilePrefix,
52 const char *
const logFileSuffix,
53 const U32 maxFileSize,
60 this->prefix = logFilePrefix;
61 this->suffix = logFileSuffix;
62 this->maxSize = maxFileSize;
63 this->sizeOfSize = sizeOfSize;
65 FW_ASSERT(sizeOfSize <=
sizeof(U32), sizeOfSize);
69 void BufferLogger::File ::
75 this->closeAndEmitEvent();
77 this->baseName = baseName;
78 this->fileCounter = 0;
82 void BufferLogger::File ::
90 const U32 projectedByteCount =
91 this->bytesWritten + this->sizeOfSize + size;
92 if (projectedByteCount > this->maxSize) {
93 this->closeAndEmitEvent();
102 (void) this->writeBuffer(data, size);
106 void BufferLogger::File ::
107 closeAndEmitEvent(
void)
112 this->bufferLogger.log_DIAGNOSTIC_BL_LogFileClosed(logStringArg);
120 void BufferLogger::File ::
126 if ((this->baseName.
toChar()[0] ==
'\0') ||
127 (this->sizeOfSize >
sizeof(U32)) ||
128 (this->maxSize <= this->sizeOfSize)) {
129 this->bufferLogger.log_WARNING_HI_BL_NoLogFileOpenInitError();
133 if (this->fileCounter == 0) {
136 this->prefix.toChar(),
137 this->baseName.toChar(),
138 this->suffix.toChar()
144 this->prefix.toChar(),
145 this->baseName.toChar(),
147 this->suffix.toChar()
158 this->bytesWritten = 0;
164 this->bufferLogger.log_WARNING_HI_BL_LogFileOpenError(status,
string);
168 bool BufferLogger::File ::
170 const U8 *
const data,
174 bool status = this->writeSize(size);
176 status = this->writeBytes(data, size);
181 bool BufferLogger::File ::
182 writeSize(
const U32 size)
184 U32 sizeRegister = size;
185 U8 sizeBuffer[this->sizeOfSize];
186 for (
U8 i = 0; i < this->sizeOfSize; ++i) {
187 sizeBuffer[this->sizeOfSize - i - 1] = sizeRegister & 0xFF;
190 const bool status = this->writeBytes(
197 bool BufferLogger::File ::
199 const void *
const data,
208 this->bytesWritten += length;
214 this->bufferLogger.log_WARNING_HI_BL_LogFileWriteError(fileStatus, size, length,
string);
220 void BufferLogger::File ::
225 validatedFile.createHashFile();
229 this->bufferLogger.log_WARNING_HI_BL_LogFileValidationError(
236 bool BufferLogger::File ::
257 void BufferLogger::File ::
262 this->osFile.close();
264 this->writeHashFile();