forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changes for the multi OTA 917 NCP
- Loading branch information
Showing
12 changed files
with
626 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/platform/silabs/multi-ota/917NCP/OTAFirmwareProcessor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <platform/internal/CHIPDeviceLayerInternal.h> | ||
#include <platform/silabs/multi-ota/OTAMultiImageProcessorImpl.h> | ||
#include <platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.h> | ||
|
||
#include <app/clusters/ota-requestor/OTARequestorInterface.h> | ||
#include "wfx_host_events.h" | ||
#include <platform/silabs/SilabsConfig.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#include "sl_si91x_driver.h" | ||
#ifdef SLI_SI91X_MCU_INTERFACE | ||
#include "sl_si91x_hal_soc_soft_reset.h" | ||
#endif | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
// TODO: more descriptive error codes | ||
#define SL_OTA_ERROR 1L | ||
|
||
namespace chip { | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::Init() | ||
{ | ||
ReturnErrorCodeIf(mCallbackProcessDescriptor == nullptr, CHIP_OTA_PROCESSOR_CB_NOT_REGISTERED); | ||
return OTAUtilityFirmwareProcessor::getInstance()->Init(); | ||
} | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::Clear() | ||
{ | ||
OTATlvProcessor::ClearInternal(); | ||
return OTAUtilityFirmwareProcessor::getInstance()->Clear(); | ||
} | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::ProcessInternal(ByteSpan & block) | ||
{ | ||
return OTAUtilityFirmwareProcessor::getInstance()->ProcessInternal917(block); | ||
} | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::ProcessDescriptor(ByteSpan & block) | ||
{ | ||
OTADataAccumulator *mAccumulator = &OTAUtilityFirmwareProcessor::getInstance()->mAccumulator; | ||
ReturnErrorOnFailure(mAccumulator->Accumulate(block)); | ||
ReturnErrorOnFailure(mCallbackProcessDescriptor(static_cast<void *>(mAccumulator->data()))); | ||
return OTAUtilityFirmwareProcessor::getInstance()->ProcessDescriptor(block); | ||
} | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::ApplyAction() | ||
{ | ||
return OTAUtilityFirmwareProcessor::getInstance()->ApplyAction917(); | ||
} | ||
|
||
CHIP_ERROR OTAFirmwareProcessor::FinalizeAction() | ||
{ | ||
return OTAUtilityFirmwareProcessor::getInstance()->FinalizeAction917(); | ||
} | ||
|
||
} // namespace chip |
46 changes: 46 additions & 0 deletions
46
src/platform/silabs/multi-ota/917NCP/OTAFirmwareProcessor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <lib/support/Span.h> | ||
#include <platform/silabs/multi-ota/OTATlvProcessor.h> | ||
#include "OTAUtilityFirmwareProcessor.h" | ||
|
||
namespace chip { | ||
|
||
class OTAFirmwareProcessor : public OTATlvProcessor | ||
{ | ||
public: | ||
struct Descriptor | ||
{ | ||
uint32_t version; | ||
char versionString[kVersionStringSize]; | ||
char buildDate[kBuildDateSize]; | ||
}; | ||
|
||
CHIP_ERROR Init() override; | ||
CHIP_ERROR Clear() override; | ||
CHIP_ERROR ApplyAction() override; | ||
CHIP_ERROR FinalizeAction() override; | ||
private: | ||
CHIP_ERROR ProcessInternal(ByteSpan & block) override; | ||
CHIP_ERROR ProcessDescriptor(ByteSpan & block); | ||
}; | ||
|
||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <include/platform/CHIPDeviceLayer.h> | ||
#include <platform/silabs/multi-ota/OTAMultiImageProcessorImpl.h> | ||
|
||
#include <app/clusters/ota-requestor/OTARequestorInterface.h> | ||
|
||
#include <platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.h> | ||
|
||
CHIP_ERROR chip::OTAMultiImageProcessorImpl::ProcessDescriptor(void * descriptor) | ||
{ | ||
auto desc = static_cast<chip::OTAFirmwareProcessor::Descriptor *>(descriptor); | ||
ChipLogDetail(SoftwareUpdate, "Descriptor: %ld, %s, %s", desc->version, desc->versionString, desc->buildDate); | ||
|
||
return CHIP_NO_ERROR; | ||
} | ||
|
||
CHIP_ERROR chip::OTAMultiImageProcessorImpl::OtaHookInit() | ||
{ | ||
static chip::OTAFirmwareProcessor sApplicationProcessor; | ||
|
||
sApplicationProcessor.RegisterDescriptorCallback(ProcessDescriptor); | ||
|
||
auto & imageProcessor = chip::OTAMultiImageProcessorImpl::GetDefaultInstance(); | ||
ReturnErrorOnFailure(imageProcessor.RegisterProcessor(6, &sApplicationProcessor)); | ||
|
||
return CHIP_NO_ERROR; | ||
} |
Oops, something went wrong.