@@ -33,6 +33,8 @@ extern "C" {
33
33
// / No error, operation OK
34
34
#define SL_BOOTLOADER_OK 0L
35
35
36
+ static chip::OTAImageProcessorImpl gImageProcessor ;
37
+
36
38
namespace chip {
37
39
38
40
// Define static memebers
@@ -41,6 +43,15 @@ uint32_t OTAImageProcessorImpl::mWriteOffset
41
43
uint16_t OTAImageProcessorImpl::writeBufOffset = 0 ;
42
44
uint8_t OTAImageProcessorImpl::writeBuffer[kAlignmentBytes ] __attribute__((aligned(4 ))) = { 0 };
43
45
46
+ CHIP_ERROR OTAImageProcessorImpl::Init (OTADownloader * downloader)
47
+ {
48
+ ReturnErrorCodeIf (downloader == nullptr , CHIP_ERROR_INVALID_ARGUMENT);
49
+
50
+ gImageProcessor .SetOTADownloader (downloader);
51
+
52
+ return CHIP_NO_ERROR;
53
+ }
54
+
44
55
CHIP_ERROR OTAImageProcessorImpl::PrepareDownload ()
45
56
{
46
57
DeviceLayer::PlatformMgr ().ScheduleWork (HandlePrepareDownload, reinterpret_cast <intptr_t >(this ));
@@ -204,6 +215,7 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context)
204
215
ChipLogProgress (SoftwareUpdate, " HandleApply: started" );
205
216
206
217
// Force KVS to store pending keys such as data from StoreCurrentUpdateInfo()
218
+ // TODO: Make sure this call gets put in MultiOTAImageProcessorImpl::HandleApply
207
219
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl ().ForceKeyMapSave ();
208
220
#if SL_BTLCTRL_MUX
209
221
err = sl_wfx_host_pre_bootloader_spi_transfer ();
@@ -271,6 +283,7 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context)
271
283
imageProcessor->ReleaseBlock ();
272
284
}
273
285
286
+ // TODO: Put this in ProcessInternal for efr32 Application image Processor
274
287
void OTAImageProcessorImpl::HandleProcessBlock (intptr_t context)
275
288
{
276
289
uint32_t err = SL_BOOTLOADER_OK;
@@ -400,4 +413,9 @@ CHIP_ERROR OTAImageProcessorImpl::ReleaseBlock()
400
413
return CHIP_NO_ERROR;
401
414
}
402
415
416
+ OTAImageProcessorImpl & OTAImageProcessorImpl::GetDefaultInstance ()
417
+ {
418
+ return gImageProcessor ;
419
+ }
420
+
403
421
} // namespace chip
0 commit comments