Imported more library files
Not compiling currently
This commit is contained in:
283
inc/BaseApplication.h
Normal file
283
inc/BaseApplication.h
Normal file
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
* Copyright (c) 2019 Google LLC.
|
||||
* 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
|
||||
|
||||
/**********************************************************
|
||||
* Includes
|
||||
*********************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "AppEvent.h"
|
||||
#include <app/clusters/identify-server/identify-server.h>
|
||||
#include <app/server/AppDelegate.h>
|
||||
#include <app/util/config.h>
|
||||
#include <ble/Ble.h>
|
||||
#include <cmsis_os2.h>
|
||||
#include <credentials/FabricTable.h>
|
||||
#include <lib/core/CHIPError.h>
|
||||
#include <platform/CHIPDeviceEvent.h>
|
||||
#include <platform/CHIPDeviceLayer.h>
|
||||
|
||||
#include "LEDWidget.h"
|
||||
|
||||
#ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER
|
||||
#include <app/clusters/identify-server/identify-server.h>
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_ENABLED
|
||||
#include "demo-ui.h"
|
||||
#include "lcd.h"
|
||||
#ifdef QR_CODE_ENABLED
|
||||
#include "qrcodegen.h"
|
||||
#endif // QR_CODE_ENABLED
|
||||
#endif // DISPLAY_ENABLED
|
||||
|
||||
/**********************************************************
|
||||
* Defines
|
||||
*********************************************************/
|
||||
|
||||
// Application-defined error codes in the CHIP_ERROR space.
|
||||
#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
|
||||
#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02)
|
||||
#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03)
|
||||
#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04)
|
||||
#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05)
|
||||
#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06)
|
||||
|
||||
class BaseApplicationDelegate : public AppDelegate, public chip::FabricTable::Delegate
|
||||
{
|
||||
public:
|
||||
bool isCommissioningInProgress() { return isComissioningStarted; }
|
||||
|
||||
private:
|
||||
// AppDelegate
|
||||
bool isComissioningStarted = false;
|
||||
void OnCommissioningSessionStarted() override;
|
||||
void OnCommissioningSessionStopped() override;
|
||||
void OnCommissioningSessionEstablishmentError(CHIP_ERROR err) override;
|
||||
void OnCommissioningWindowClosed() override;
|
||||
void OnCommissioningWindowOpened() override;
|
||||
|
||||
// FabricTable::Delegate
|
||||
void OnFabricCommitted(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) override;
|
||||
void OnFabricRemoved(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) override;
|
||||
};
|
||||
|
||||
/**********************************************************
|
||||
* BaseApplication Declaration
|
||||
*********************************************************/
|
||||
|
||||
class BaseApplication
|
||||
{
|
||||
|
||||
public:
|
||||
BaseApplication() = default;
|
||||
virtual ~BaseApplication(){};
|
||||
static bool sIsProvisioned;
|
||||
static bool sIsFactoryResetTriggered;
|
||||
static LEDWidget * sAppActionLed;
|
||||
static BaseApplicationDelegate sAppDelegate;
|
||||
|
||||
/**
|
||||
* @brief Create AppTask task and Event Queue
|
||||
* If an error occurs during creation, application will hang after printing out error code
|
||||
*
|
||||
* @return CHIP_ERROR CHIP_NO_ERROR if no errors
|
||||
*/
|
||||
CHIP_ERROR StartAppTask(osThreadFunc_t taskFunction);
|
||||
|
||||
/**
|
||||
* @brief Links the application specific led to the baseApplication context
|
||||
* in order to synchronize both LED animations.
|
||||
* Some apps may not have an application led or no animation patterns.
|
||||
*
|
||||
* @param appLed Pointer to the configure LEDWidget for the application defined LED
|
||||
*/
|
||||
void LinkAppLed(LEDWidget * appLed) { sAppActionLed = appLed; }
|
||||
|
||||
/**
|
||||
* @brief Remove the app Led linkage form the baseApplication context
|
||||
*/
|
||||
void UnlinkAppLed() { sAppActionLed = nullptr; }
|
||||
|
||||
/**
|
||||
* @brief PostEvent function that add event to AppTask queue for processing
|
||||
*
|
||||
* @param event AppEvent to post
|
||||
*/
|
||||
|
||||
static void PostEvent(const AppEvent * event);
|
||||
|
||||
/**
|
||||
* @brief Overridable function used to update display on button press
|
||||
*/
|
||||
virtual void UpdateDisplay();
|
||||
|
||||
#ifdef DISPLAY_ENABLED
|
||||
/**
|
||||
* @brief Return LCD object
|
||||
*/
|
||||
static SilabsLCD & GetLCD(void);
|
||||
|
||||
static void UpdateLCDStatusScreen(bool withChipStackLock = true);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Function called to start the LED light timer
|
||||
*/
|
||||
static void StartStatusLEDTimer(void);
|
||||
|
||||
/**
|
||||
* @brief Function to stop LED light timer
|
||||
* Turns off Status LED before stopping timer
|
||||
*/
|
||||
static void StopStatusLEDTimer(void);
|
||||
static bool GetProvisionStatus(void);
|
||||
|
||||
static void StartFactoryResetSequence(void);
|
||||
static void CancelFactoryResetSequence(void);
|
||||
|
||||
#ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER
|
||||
// Idenfiy server command callbacks.
|
||||
static void OnIdentifyStart(Identify * identify);
|
||||
static void OnIdentifyStop(Identify * identify);
|
||||
static void OnTriggerIdentifyEffectCompleted(chip::System::Layer * systemLayer, void * appState);
|
||||
static void OnTriggerIdentifyEffect(Identify * identify);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Updates the static boolean isCommissioned to the desired state
|
||||
*
|
||||
*/
|
||||
static void UpdateCommissioningStatus(bool newState);
|
||||
|
||||
/**
|
||||
* @brief Called when the last Fabric is removed, clears all Fabric related data, including Thread and Wifi provision.
|
||||
* @note This function preserves some NVM3 data that is not Fabric scoped, like Attribute Value or Boot Count.
|
||||
*/
|
||||
static void DoProvisioningReset();
|
||||
|
||||
protected:
|
||||
CHIP_ERROR Init();
|
||||
|
||||
/** @brief
|
||||
* Function to be called at the end of Init to indicate that the application has completed its initialization.
|
||||
* Currently only used for tracing, might want to move logging here as well in the future
|
||||
* @param err CHIP_NO_ERROR on success, corresponding error code on Init failure, note that Init failure leads to an app error so
|
||||
* this is purely to have a trace logged with the error code
|
||||
*/
|
||||
void InitCompleteCallback(CHIP_ERROR err);
|
||||
|
||||
/**
|
||||
* @brief Function called to start the function timer
|
||||
*
|
||||
* @param aTimeoutMs timer duration in ms
|
||||
*/
|
||||
static void StartFunctionTimer(uint32_t aTimeoutMs);
|
||||
|
||||
/**
|
||||
* @brief Function to stop function timer
|
||||
*/
|
||||
static void CancelFunctionTimer(void);
|
||||
|
||||
/**
|
||||
* @brief Function call event callback function for processing
|
||||
*
|
||||
* @param event triggered event to be processed
|
||||
*/
|
||||
void DispatchEvent(AppEvent * event);
|
||||
|
||||
/**
|
||||
* @brief Function Timer finished callback function
|
||||
* Post an FunctionEventHandler event
|
||||
*
|
||||
* @param timerCbArg argument to the timer callback function assigned at timer creation
|
||||
*/
|
||||
static void FunctionTimerEventHandler(void * timerCbArg);
|
||||
|
||||
/**
|
||||
* @brief Timer Event processing function
|
||||
* Trigger factory if Press and Hold duration is respected
|
||||
*
|
||||
* @param aEvent post event being processed
|
||||
*/
|
||||
static void FunctionEventHandler(AppEvent * aEvent);
|
||||
|
||||
/**
|
||||
* @brief PB0 Button event processing function
|
||||
* Press and hold will trigger a factory reset timer start
|
||||
* Press and release will restart BLEAdvertising if not commisionned
|
||||
*
|
||||
* @param aEvent button event being processed
|
||||
*/
|
||||
static void ButtonHandler(AppEvent * aEvent);
|
||||
|
||||
/**
|
||||
* @brief Light Timer finished callback function
|
||||
* Calls LED processing function
|
||||
*
|
||||
* @param timerCbArg argument to the timer callback function assigned at timer creation
|
||||
*/
|
||||
static void LightTimerEventHandler(void * timerCbArg);
|
||||
|
||||
/**
|
||||
* @brief Updates device LEDs
|
||||
*/
|
||||
static void LightEventHandler();
|
||||
|
||||
/**
|
||||
* @brief Activate a set of Led patterns of the Status led
|
||||
* Identify patterns and Trigger effects have priority
|
||||
* If no identification patterns are in progress, we provide
|
||||
* commissioning status feedback.
|
||||
*
|
||||
* @return True if a Led pattern was set, otherwise, returns false.
|
||||
*/
|
||||
static bool ActivateStatusLedPatterns();
|
||||
|
||||
/**
|
||||
* @brief Start the factory Reset process
|
||||
* Almost identical to Server::ScheduleFactoryReset()
|
||||
* but doesn't call GetFabricTable().DeleteAllFabrics(); which deletes Key per key.
|
||||
* With our KVS platform implementation this is a lot slower than deleting the whole kvs section
|
||||
* our silabs nvm3 driver which end up being doing in ConfigurationManagerImpl::DoFactoryReset(intptr_t arg).
|
||||
*/
|
||||
static void ScheduleFactoryReset();
|
||||
|
||||
static void OnPlatformEvent(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t);
|
||||
|
||||
/**
|
||||
* @brief Outputs the QRcode payload and URL to the QR code in the logs
|
||||
* and conditionally on the device LCD.
|
||||
*
|
||||
* @param refreshLCD When true, The LCD of the device will be refreshed to show the QR code
|
||||
*/
|
||||
static void OutputQrCode(bool refreshLCD);
|
||||
|
||||
/**********************************************************
|
||||
* Protected Attributes declaration
|
||||
*********************************************************/
|
||||
bool mSyncClusterToButtonAction;
|
||||
|
||||
private:
|
||||
static void InitOTARequestorHandler(chip::System::Layer * systemLayer, void * appState);
|
||||
};
|
||||
336
inc/FreeRTOSConfig.h
Normal file
336
inc/FreeRTOSConfig.h
Normal file
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020 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.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* # License
|
||||
*
|
||||
* The licensor of this software is Silicon Laboratories Inc. Your use of this
|
||||
* software is governed by the terms of Silicon Labs Master Software License
|
||||
* Agreement (MSLA) available at
|
||||
* www.silabs.com/about-us/legal/master-software-license-agreement. This
|
||||
* software is Third Party Software licensed by Silicon Labs from a third party
|
||||
* and is governed by the sections of the MSLA applicable to Third Party
|
||||
* Software and the additional terms set forth below.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SLI_SI91X_MCU_INTERFACE
|
||||
#include "si91x_device.h"
|
||||
extern uint32_t SystemCoreClock;
|
||||
#if SL_ICD_ENABLED
|
||||
#include "sl_si91x_m4_ps.h"
|
||||
#endif // SL_ICD_ENABLED
|
||||
#else // For EFR32
|
||||
#include "RTE_Components.h"
|
||||
#include CMSIS_device_header
|
||||
|
||||
#include "em_device.h"
|
||||
#include "sl_assert.h"
|
||||
#endif
|
||||
|
||||
#if defined(SL_COMPONENT_CATALOG_PRESENT)
|
||||
#include "sl_component_catalog.h"
|
||||
#endif
|
||||
|
||||
#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT
|
||||
#include "SEGGER_SYSVIEW_FreeRTOS.h"
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* Energy saving modes. */
|
||||
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#elif (SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED)
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 70
|
||||
#define configPRE_SLEEP_PROCESSING(x)
|
||||
#define configPOST_SLEEP_PROCESSING(x)
|
||||
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x)
|
||||
#else
|
||||
#define configUSE_TICKLESS_IDLE 0
|
||||
#endif // SL_CATALOG_POWER_MANAGER_PRESENT
|
||||
|
||||
#define configTICK_RATE_HZ (1024)
|
||||
|
||||
/* Definition used by Keil to replace default system clock source. */
|
||||
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK (1)
|
||||
#define configCHECK_FOR_STACK_OVERFLOW (2)
|
||||
#define configUSE_MALLOC_FAILED_HOOK (1)
|
||||
#define configUSE_IDLE_HOOK (1)
|
||||
|
||||
/* Main functions*/
|
||||
/* Run time stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS (0)
|
||||
|
||||
/* Co-routine related definitions. */
|
||||
#define configUSE_CO_ROUTINES (0)
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES (1)
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS (1)
|
||||
// Keep the timerTask at the highest prio as some of our stacks tasks leverage eventing with timers.
|
||||
#define configTIMER_TASK_PRIORITY (55) /* Highest priority */
|
||||
#define configTIMER_QUEUE_LENGTH (10)
|
||||
#define configTIMER_TASK_STACK_DEPTH (1024)
|
||||
|
||||
#ifdef SLI_SI91X_MCU_INTERFACE
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#undef __NVIC_PRIO_BITS
|
||||
#endif
|
||||
#define configPRIO_BITS 6 /* 6 priority levels. */
|
||||
#endif // SLI_SI91X_MCU_INTERFACE
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY (255)
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#ifdef SLI_SI91X_MCU_INTERFACE
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 20
|
||||
#else
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 48
|
||||
#endif // SLI_SI91X_MCU_INTERFACE
|
||||
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_MPU 0
|
||||
/* FreeRTOS Secure Side Only and TrustZone Security Extension */
|
||||
#ifndef configRUN_FREERTOS_SECURE_ONLY
|
||||
// prevent redefinition with Series 3
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
#endif
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
/* FreeRTOS MPU specific definitions. */
|
||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (0)
|
||||
|
||||
#define configCPU_CLOCK_HZ (SystemCoreClock)
|
||||
#define configUSE_PREEMPTION (1)
|
||||
#define configUSE_TIME_SLICING (1)
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION (0)
|
||||
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
|
||||
#define configMAX_PRIORITIES (56)
|
||||
#define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */
|
||||
|
||||
#ifdef HEAP_MONITORING
|
||||
#define configMAX_TASK_NAME_LEN (24)
|
||||
#else
|
||||
#define configMAX_TASK_NAME_LEN (10)
|
||||
#endif // HEAP_MONITORING
|
||||
|
||||
#define configUSE_16_BIT_TICKS (0)
|
||||
#define configIDLE_SHOULD_YIELD (1)
|
||||
#define configUSE_MUTEXES (1)
|
||||
#define configUSE_RECURSIVE_MUTEXES (1)
|
||||
#define configUSE_COUNTING_SEMAPHORES (1)
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configQUEUE_REGISTRY_SIZE (10)
|
||||
#define configUSE_QUEUE_SETS (0)
|
||||
#define configUSE_NEWLIB_REENTRANT (0)
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY (1)
|
||||
#define configSUPPORT_STATIC_ALLOCATION (1)
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION (1)
|
||||
|
||||
#ifdef PW_RPC_ENABLED
|
||||
#define EXTRA_HEAP_k 10
|
||||
#else
|
||||
#define EXTRA_HEAP_k 0
|
||||
#endif
|
||||
|
||||
#ifndef configTOTAL_HEAP_SIZE
|
||||
#ifdef SL_WIFI
|
||||
#ifdef DIC_ENABLE
|
||||
#ifdef SLI_SI91X_MCU_INTERFACE
|
||||
#define configTOTAL_HEAP_SIZE ((size_t) ((75 + EXTRA_HEAP_k) * 1024))
|
||||
#else
|
||||
#define configTOTAL_HEAP_SIZE ((size_t) ((68 + EXTRA_HEAP_k) * 1024))
|
||||
#endif // SLI_SI91X_MCU_INTERFACE
|
||||
#else
|
||||
#define configTOTAL_HEAP_SIZE ((size_t) ((42 + EXTRA_HEAP_k) * 1024))
|
||||
#endif // DIC
|
||||
#else // SL_WIFI
|
||||
#if SL_CONFIG_OPENTHREAD_LIB == 1
|
||||
#define configTOTAL_HEAP_SIZE ((size_t) ((40 + EXTRA_HEAP_k) * 1024))
|
||||
#else
|
||||
#define configTOTAL_HEAP_SIZE ((size_t) ((38 + EXTRA_HEAP_k) * 1024))
|
||||
#endif // SL_CONFIG_OPENTHREAD_LIB
|
||||
#endif // configTOTAL_HEAP_SIZE
|
||||
#endif // configTOTAL_HEAP_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet (1)
|
||||
#define INCLUDE_uxTaskPriorityGet (1)
|
||||
#define INCLUDE_vTaskDelete (1)
|
||||
#define INCLUDE_vTaskSuspend (1)
|
||||
#define INCLUDE_xResumeFromISR (1)
|
||||
#define INCLUDE_vTaskDelayUntil (1)
|
||||
#define INCLUDE_vTaskDelay (1)
|
||||
#define INCLUDE_xTaskGetSchedulerState (1)
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle (1)
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark (1)
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle (1)
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle (1)
|
||||
#define INCLUDE_pcTaskGetTaskName (1)
|
||||
#define INCLUDE_eTaskGetState (1)
|
||||
#define INCLUDE_xEventGroupSetBitFromISR (1)
|
||||
#define INCLUDE_xEventGroupSetBitsFromISR (1)
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder (1)
|
||||
#define INCLUDE_xTimerPendFunctionCall (1)
|
||||
#define INCLUDE_xTaskGetHandle (1)
|
||||
|
||||
/* Stop if an assertion fails. */
|
||||
#define configASSERT(x) \
|
||||
if ((x) == 0) \
|
||||
{ \
|
||||
taskDISABLE_INTERRUPTS(); \
|
||||
printf("\nFREERTOS ASSERT ( %s )\n", #x); \
|
||||
for (;;) \
|
||||
; \
|
||||
}
|
||||
#define configASSERTNULL(x) \
|
||||
if ((x) == NULL) \
|
||||
{ \
|
||||
taskDISABLE_INTERRUPTS(); \
|
||||
for (;;) \
|
||||
; \
|
||||
}
|
||||
|
||||
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
||||
standard names. */
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
/* Ensure Cortex-M port compatibility. */
|
||||
#define SysTick_Handler xPortSysTickHandler
|
||||
|
||||
/* Thread local storage pointers used by the SDK */
|
||||
|
||||
#ifndef configNUM_USER_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#define configNUM_USER_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||
#endif
|
||||
|
||||
#ifndef configNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#define configNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS 2
|
||||
#endif
|
||||
|
||||
#ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS \
|
||||
(configNUM_USER_THREAD_LOCAL_STORAGE_POINTERS + configNUM_SDK_THREAD_LOCAL_STORAGE_POINTERS + 1)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/* For the linker. */
|
||||
#define fabs __builtin_fabs
|
||||
#endif
|
||||
|
||||
#ifndef configNUM_USER_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#error RC-FRTOS
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
41
inc/LEDWidget.h
Normal file
41
inc/LEDWidget.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
* Copyright (c) 2019 Google LLC.
|
||||
* 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 <stdint.h>
|
||||
|
||||
class LEDWidget
|
||||
{
|
||||
public:
|
||||
static void InitGpio(void);
|
||||
void Init(uint8_t led);
|
||||
void Set(bool state);
|
||||
void Invert(void);
|
||||
void Blink(uint32_t changeRateMS);
|
||||
void Blink(uint32_t onTimeMS, uint32_t offTimeMS);
|
||||
void Animate();
|
||||
|
||||
private:
|
||||
uint64_t mLastChangeTimeMS;
|
||||
uint32_t mBlinkOnTimeMS;
|
||||
uint32_t mBlinkOffTimeMS;
|
||||
uint8_t mLed;
|
||||
bool mLedStatus;
|
||||
};
|
||||
35
inc/MatterConfig.h
Normal file
35
inc/MatterConfig.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
* Copyright (c) 2022 Silabs.
|
||||
* 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/CHIPMem.h>
|
||||
#include <lib/support/CHIPPlatformMemory.h>
|
||||
#include <platform/CHIPDeviceLayer.h>
|
||||
#include <platform/KeyValueStoreManager.h>
|
||||
|
||||
class SilabsMatterConfig
|
||||
{
|
||||
public:
|
||||
static CHIP_ERROR InitMatter(const char * appName);
|
||||
static void AppInit();
|
||||
|
||||
private:
|
||||
static CHIP_ERROR InitOpenThread(void);
|
||||
static CHIP_ERROR InitWiFi(void);
|
||||
};
|
||||
26
inc/MatterShell.h
Normal file
26
inc/MatterShell.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* 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
|
||||
|
||||
namespace chip {
|
||||
|
||||
void NotifyShellProcess();
|
||||
void WaitForShellActivity();
|
||||
void startShellTask();
|
||||
|
||||
} // namespace chip
|
||||
40
inc/MemMonitoring.h
Normal file
40
inc/MemMonitoring.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 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
|
||||
|
||||
#ifdef HEAP_MONITORING
|
||||
|
||||
namespace chip {
|
||||
namespace DeviceLayer {
|
||||
namespace Silabs {
|
||||
|
||||
class MemMonitoring
|
||||
{
|
||||
public:
|
||||
static void StartMonitor();
|
||||
|
||||
private:
|
||||
static void MonitorTask(void * pvParameter);
|
||||
};
|
||||
|
||||
} // namespace Silabs
|
||||
} // namespace DeviceLayer
|
||||
} // namespace chip
|
||||
|
||||
#endif
|
||||
43
inc/OTAConfig.h
Normal file
43
inc/OTAConfig.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 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 <app/clusters/ota-requestor/BDXDownloader.h>
|
||||
#include <app/clusters/ota-requestor/DefaultOTARequestor.h>
|
||||
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
|
||||
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
|
||||
|
||||
#if CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR
|
||||
#include <platform/silabs/multi-ota/OTAMultiImageProcessorImpl.h>
|
||||
#else
|
||||
#include <platform/silabs/OTAImageProcessorImpl.h>
|
||||
#endif
|
||||
|
||||
#if (SL_MATTER_GN_BUILD == 0) && defined(SILABS_OTA_ENABLED)
|
||||
#include "sl_matter_ota_config.h"
|
||||
#endif
|
||||
|
||||
class OTAConfig
|
||||
{
|
||||
public:
|
||||
OTAConfig(){};
|
||||
|
||||
static void Init();
|
||||
static constexpr uint32_t kInitOTARequestorDelaySec = 3;
|
||||
};
|
||||
29
inc/PigweedLogger.h
Normal file
29
inc/PigweedLogger.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 <cmsis_os2.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace PigweedLogger {
|
||||
|
||||
void init(void);
|
||||
int putString(const char * buffer, size_t size);
|
||||
osMutexId_t * GetMutex();
|
||||
|
||||
} // namespace PigweedLogger
|
||||
30
inc/Rpc.h
Normal file
30
inc/Rpc.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 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
|
||||
|
||||
namespace chip {
|
||||
namespace rpc {
|
||||
|
||||
class LightingService;
|
||||
|
||||
void Init();
|
||||
void RunRpcService(void *);
|
||||
|
||||
} // namespace rpc
|
||||
} // namespace chip
|
||||
27
inc/SoftwareFaultReports.h
Normal file
27
inc/SoftwareFaultReports.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021-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.
|
||||
*/
|
||||
|
||||
namespace chip {
|
||||
namespace DeviceLayer {
|
||||
namespace Silabs {
|
||||
|
||||
void OnSoftwareFaultEventHandler(const char * faultRecordString);
|
||||
|
||||
} // namespace Silabs
|
||||
} // namespace DeviceLayer
|
||||
} // namespace chip
|
||||
54
inc/board_config.h
Normal file
54
inc/board_config.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2018, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes dev board compile-time configuration constants for Silabs board.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/// Dev board suppports OQPSK modulation in 2.4GHz band.
|
||||
#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1
|
||||
#define RADIO_CONFIG_915MHZ_OQPSK_SUPPORT 0
|
||||
|
||||
/// The PA(s) is(are) fed from the DCDC
|
||||
#if (BRD4166A)
|
||||
#define RADIO_CONFIG_PA_USES_DCDC 1
|
||||
#else
|
||||
#define RADIO_CONFIG_PA_USES_DCDC 0
|
||||
#endif
|
||||
|
||||
#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
|
||||
#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
|
||||
#endif
|
||||
|
||||
#ifndef RADIO_CONFIG_DMP_SUPPORT
|
||||
#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
|
||||
#endif
|
||||
49
inc/silabs_creds.h
Normal file
49
inc/silabs_creds.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2024 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.
|
||||
*/
|
||||
/**
|
||||
* To enable these credentias, compile the app with option
|
||||
* "chip_build_device_attestation_credentials=true".
|
||||
*/
|
||||
|
||||
#ifndef SL_PROVISION_VERSION_1_0
|
||||
#define SL_PROVISION_VERSION_1_0 0
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_DAC_OFFSET
|
||||
#define SL_CREDENTIALS_DAC_OFFSET 0x0000
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_DAC_SIZE
|
||||
#define SL_CREDENTIALS_DAC_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_PAI_OFFSET
|
||||
#define SL_CREDENTIALS_PAI_OFFSET 0x0200
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_PAI_SIZE
|
||||
#define SL_CREDENTIALS_PAI_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_CD_OFFSET
|
||||
#define SL_CREDENTIALS_CD_OFFSET 0x0400
|
||||
#endif
|
||||
|
||||
#ifndef SL_CREDENTIALS_CD_SIZE
|
||||
#define SL_CREDENTIALS_CD_SIZE 0
|
||||
#endif
|
||||
43
inc/silabs_utils.h
Normal file
43
inc/silabs_utils.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
* Copyright (c) 2022 Silabs.
|
||||
* 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
|
||||
|
||||
// EFR Logging
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void silabsInitLog(void);
|
||||
|
||||
void silabsLog(const char * aFormat, ...);
|
||||
#define SILABS_LOG(...) silabsLog(__VA_ARGS__);
|
||||
void appError(int err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
// Output logs to RTT by defaults
|
||||
#ifndef SILABS_LOG_OUT_UART
|
||||
#define SILABS_LOG_OUT_UART 0
|
||||
#endif
|
||||
|
||||
#include <lib/core/CHIPError.h>
|
||||
void appError(CHIP_ERROR error);
|
||||
#endif
|
||||
80
inc/sl_systemview_config.h
Normal file
80
inc/sl_systemview_config.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Segger System View configuration file.
|
||||
*******************************************************************************
|
||||
* # License
|
||||
* <b>Copyright 2020 Silicon Laboratories Inc.
|
||||
*www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* SPDX-License-Identifier: Zlib
|
||||
*
|
||||
* The licensor of this software is Silicon
|
||||
*Laboratories Inc.
|
||||
*
|
||||
* This software is provided 'as-is', without any
|
||||
*express or implied warranty. In no event will the
|
||||
*authors be held liable for any damages arising from
|
||||
*the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this
|
||||
*software for any purpose, including commercial
|
||||
*applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be
|
||||
*misrepresented; you must not claim that you wrote
|
||||
*the original software. If you use this software in a
|
||||
*product, an acknowledgment in the product
|
||||
*documentation would be appreciated but is not
|
||||
*required.
|
||||
* 2. Altered source versions must be plainly marked
|
||||
*as such, and must not be misrepresented as being the
|
||||
*original software.
|
||||
* 3. This notice may not be removed or altered from
|
||||
*any source distribution.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
// Overwirte SystemView config for GN build, SHOULD NOT BE USED WITH SLC!!!
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT 0
|
||||
#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER 1
|
||||
|
||||
// <o SEGGER_SYSVIEW_TIMESTAMP_SOURCE> Source for the time stamps
|
||||
// <SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT=> DWT Cycle Counter
|
||||
// <SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER=> Sleep Timer
|
||||
// <i> Source for time stamps. Only meaningful when no OS is present. When an OS is present, time stamp is provided by the OS.
|
||||
// <i> SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT is not available on Cortex-M0+ and cannot be selected.
|
||||
// <i> Default: SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER
|
||||
#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER
|
||||
|
||||
// <o SEGGER_SYSVIEW_RTT_BUFFER_SIZE> RTT buffer size (in bytes)
|
||||
// <i> Default: 1024
|
||||
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 8192
|
||||
|
||||
// <o SEGGER_SYSVIEW_RTT_CHANNEL> RTT channel for SystemView
|
||||
// <i> Default: 1
|
||||
#define SEGGER_SYSVIEW_RTT_CHANNEL 1
|
||||
|
||||
// <q SEGGER_SYSVIEW_USE_STATIC_BUFFER> Use static buffer to generate events
|
||||
// <i> Determines if a single static buffer is used to generate the events. If disabled, the buffer is allocated on the stack.
|
||||
// <i> Default: 1
|
||||
#define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1
|
||||
|
||||
// <q SEGGER_SYSVIEW_POST_MORTEM_MODE> Enable post mortem mode
|
||||
// <i> Default: 0
|
||||
#define SEGGER_SYSVIEW_POST_MORTEM_MODE 0
|
||||
|
||||
// <q SEGGER_SYSVIEW_CAN_RESTART> Enable SystemView restart
|
||||
// <i> If enabled, start sequence is sent on every startup. It is not recommended to disabled this feature.
|
||||
// <i> Default: 1
|
||||
#define SEGGER_SYSVIEW_CAN_RESTART 1
|
||||
|
||||
// <q SEGGER_SYSVIEW_ID_SHIFT> Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
|
||||
// <i> Default: 0
|
||||
#define SEGGER_SYSVIEW_ID_SHIFT 0
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
43
inc/uart.h
Normal file
43
inc/uart.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 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 <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void uartConsoleInit(void);
|
||||
int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength);
|
||||
int16_t uartLogWrite(const char * log, uint16_t length);
|
||||
int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead);
|
||||
|
||||
void uartMainLoop(void * args);
|
||||
|
||||
// Implemented by in openthread code
|
||||
#ifndef PW_RPC_ENABLED
|
||||
extern void otPlatUartReceived(const uint8_t * aBuf, uint16_t aBufLength);
|
||||
extern void otPlatUartSendDone(void);
|
||||
extern void otSysEventSignalPending(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
Reference in New Issue
Block a user