46
46
#include " wfx_rsi.h"
47
47
#endif /* SLI_SI91X_MCU_INTERFACE */
48
48
49
- using namespace ::chip;
50
- using namespace ::chip::Inet;
51
- using namespace ::chip::DeviceLayer;
52
-
53
49
#include < crypto/CHIPCryptoPAL.h>
54
50
// If building with the EFR32-provided crypto backend, we can use the
55
51
// opaque keystore
@@ -75,6 +71,36 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys
75
71
#include < performance_test_commands.h>
76
72
#endif
77
73
74
+ #include < AppTask.h>
75
+
76
+ #include < DeviceInfoProviderImpl.h>
77
+ #include < app/server/Server.h>
78
+ #include < credentials/DeviceAttestationCredsProvider.h>
79
+ #include < examples/platform/silabs/SilabsDeviceAttestationCreds.h>
80
+
81
+ #include < platform/silabs/platformAbstraction/SilabsPlatform.h>
82
+
83
+ #include " FreeRTOSConfig.h"
84
+ #include " event_groups.h"
85
+ #include " task.h"
86
+
87
+ /* *********************************************************
88
+ * Defines
89
+ *********************************************************/
90
+
91
+ #define MAIN_TASK_STACK_SIZE (1024 * 5 )
92
+ #define MAIN_TASK_PRIORITY (configMAX_PRIORITIES - 1 )
93
+
94
+ using namespace ::chip;
95
+ using namespace ::chip::Inet;
96
+ using namespace ::chip::DeviceLayer;
97
+ using namespace ::chip::Credentials::Silabs;
98
+ using namespace chip ::DeviceLayer::Silabs;
99
+
100
+ TaskHandle_t main_Task;
101
+ volatile int apperror_cnt;
102
+ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider ;
103
+
78
104
#if CHIP_ENABLE_OPENTHREAD
79
105
#include < inet/EndPointStateOpenThread.h>
80
106
#include < openthread/cli.h>
@@ -129,6 +155,44 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
129
155
}
130
156
#endif // CHIP_ENABLE_OPENTHREAD
131
157
158
+ namespace {
159
+ void application_start (void * unused)
160
+ {
161
+ CHIP_ERROR err = SilabsMatterConfig::InitMatter (BLE_DEV_NAME);
162
+ if (err != CHIP_NO_ERROR)
163
+ appError (err);
164
+
165
+ gExampleDeviceInfoProvider .SetStorageDelegate (&chip::Server::GetInstance ().GetPersistentStorage ());
166
+ chip::DeviceLayer::SetDeviceInfoProvider (&gExampleDeviceInfoProvider );
167
+
168
+ chip::DeviceLayer::PlatformMgr ().LockChipStack ();
169
+ // Initialize device attestation config
170
+ SetDeviceAttestationCredentialsProvider (Credentials::Silabs::GetSilabsDacProvider ());
171
+ chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
172
+
173
+ SILABS_LOG (" Starting App Task" );
174
+ err = AppTask::GetAppTask ().StartAppTask ();
175
+ if (err != CHIP_NO_ERROR)
176
+ appError (err);
177
+
178
+ vTaskDelete (main_Task);
179
+ }
180
+ } // namespace
181
+
182
+ void SilabsMatterConfig::AppInit ()
183
+ {
184
+ GetPlatform ().Init ();
185
+
186
+ xTaskCreate (application_start, " main_task" , MAIN_TASK_STACK_SIZE, NULL , MAIN_TASK_PRIORITY, &main_Task);
187
+ SILABS_LOG (" Starting scheduler" );
188
+ GetPlatform ().StartScheduler ();
189
+
190
+ // Should never get here.
191
+ chip::Platform::MemoryShutdown ();
192
+ SILABS_LOG (" Start Scheduler Failed" );
193
+ appError (CHIP_ERROR_INTERNAL);
194
+ }
195
+
132
196
#if SILABS_OTA_ENABLED
133
197
void SilabsMatterConfig::InitOTARequestorHandler (System::Layer * systemLayer, void * appState)
134
198
{
0 commit comments