Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk] matter restructure #194

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions MATTER.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,16 @@ Make sure ambz2_matter and connectedhomeip are on the same directory level
### lighting-app

cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE

make light

### switch-app

cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE

make switch

### ota-requestor-app

cd ambz2_matter/project/realtek_amebaz2_v0_example/GCC-RELEASE

make otar

### CHIP core (generated by GN/ninja in connectedhomeip. Configured by [lib_chip.mk](https://github.com/ambiot/ambz2_matter/blob/main/project/realtek_amebaz2_v0_example/GCC-RELEASE/lib_chip.mk))
Expand Down
4 changes: 2 additions & 2 deletions component/common/api/at_cmd/log_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern void at_isp_init(void);
(defined(CONFIG_RSC) && CONFIG_RSC))
extern void at_cloud_init(void);
#endif
#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
extern void at_matter_init(void);
#endif
void at_log_init(void);
Expand Down Expand Up @@ -112,7 +112,7 @@ log_init_t log_init_table[] = {
at_cloud_init,
#endif

#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
at_matter_init,
#endif
};
Expand Down
8 changes: 4 additions & 4 deletions component/common/api/lwip_netconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ uint8_t LwIP_DHCP6(uint8_t idx, uint8_t dhcp6_state)
uint8_t DHCP6_state;
struct netif *pnetif = NULL;
struct dhcp6 *dhcp6 = NULL;
#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
int dhcp6_handler_trigger = 0;
#endif
err_t err;
Expand Down Expand Up @@ -586,7 +586,7 @@ uint8_t LwIP_DHCP6(uint8_t idx, uint8_t dhcp6_state)
ip6_addr_t zero_address;
ip6_addr_set_any(&zero_address);

#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
if (ip6_addr_isvalid(netif_ip6_addr_state(pnetif, 0)) && (dhcp6_handler_trigger == 0))
{
wifi_indication(WIFI_EVENT_DHCP6_DONE, NULL, 0, 0);
Expand All @@ -609,7 +609,7 @@ uint8_t LwIP_DHCP6(uint8_t idx, uint8_t dhcp6_state)

/*Todo: error_flag for DHCPv6*/

#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
if (!dhcp6_handler_trigger)
wifi_indication(WIFI_EVENT_DHCP6_DONE, NULL, 0, 0);
#endif
Expand All @@ -631,7 +631,7 @@ uint8_t LwIP_DHCP6(uint8_t idx, uint8_t dhcp6_state)
if(idx == NET_IF_NUM -1) // This is the ethernet interface, set it up for static ip address
netif_set_up(pnetif);
#endif
#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
if (!dhcp6_handler_trigger)
wifi_indication(WIFI_EVENT_DHCP6_DONE, NULL, 0, 0);
#endif
Expand Down
49 changes: 3 additions & 46 deletions component/common/api/network/include/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ a lot of data that needs to be copied, this should be set high. */
/* Support Multicast */
#define LWIP_IGMP 1
#define LWIP_RAND() rand()
#ifndef CHIP_PROJECT
#ifndef CONFIG_MATTER
extern unsigned int sys_now(void);
#endif
#define LWIP_SRAND() srand(sys_now())
Expand Down Expand Up @@ -424,51 +424,8 @@ CONFIG_EXAMPLE_COAP_SERVER and CONFIG_EXAMPLE_COAP_CLIENT is defined in platform
#define LWIP_NETIF_HOSTNAME 1
#endif

#ifdef CHIP_PROJECT
#undef LWIP_TCPIP_CORE_LOCKING
#define LWIP_TCPIP_CORE_LOCKING 1
#undef LWIP_COMPAT_MUTEX_ALLOWED
#define LWIP_COMPAT_MUTEX_ALLOWED 1
#undef LWIP_IPV6_ND
#define LWIP_IPV6_ND 1
#undef LWIP_IPV6_SCOPES
#define LWIP_IPV6_SCOPES 0
#undef LWIP_PBUF_FROM_CUSTOM_POOLS
#define LWIP_PBUF_FROM_CUSTOM_POOLS 0
#undef ERRNO
#define ERRNO 1
#undef LWIP_SO_SNDTIMEO
#define LWIP_SO_SNDTIMEO 1
#undef LWIP_SOCKET_SET_ERRNO
#define LWIP_SOCKET_SET_ERRNO 1

#undef LWIP_IPV6
#define LWIP_IPV6 1
#if LWIP_IPV6
#undef LWIP_IPV6_MLD
#define LWIP_IPV6_MLD 1
#undef LWIP_IPV6_AUTOCONFIG
#define LWIP_IPV6_AUTOCONFIG 1
#undef LWIP_ICMP6
#define LWIP_ICMP6 1
#undef MEMP_NUM_SYS_TIMEOUT
#define MEMP_NUM_SYS_TIMEOUT 14
#if LWIP_VERSION_MAJOR >= 2 && LWIP_VERSION_MINOR >= 1
#undef LWIP_IPV6_DHCP6
#define LWIP_IPV6_DHCP6 1
#endif
#endif

/* ---------- Hook options --------- */
#define LWIP_HOOK_FILENAME "lwip_default_hooks.h"
#undef PBUF_POOL_SIZE
#define PBUF_POOL_SIZE 40
#undef PBUF_POOL_BUFSIZE
#define PBUF_POOL_BUFSIZE 1500
#undef MEMP_NUM_UDP_PCB
#define MEMP_NUM_UDP_PCB 10
#undef MEMP_NUM_MLD6_GROUP
#define MEMP_NUM_MLD6_GROUP 6
#if defined(CONFIG_MATTER) && CONFIG_MATTER
#include "lwipopts_matter.h"
#endif

#endif /* LWIP_HDR_LWIPOPTS_H */
16 changes: 2 additions & 14 deletions component/common/api/wifi/wifi_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,11 @@ extern int rltk_set_mode_posthandle(rtw_mode_t curr_mode, rtw_mode_t next_mode,
#ifdef CONFIG_PMKSA_CACHING
extern int wifi_set_pmk_cache_enable(unsigned char value);
#endif
#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
extern u8 matter_wifi_trigger;
extern void matter_wifi_autoreconnect_hdl(rtw_security_t security_type, char *ssid, int ssid_len, char *password, int password_len, int key_id);
#endif

#ifdef CHIP_PROJECT
#ifndef IN
#define IN
#endif
#endif

//----------------------------------------------------------------------------//
static int wifi_connect_local(rtw_network_info_t *pWifi)
{
Expand Down Expand Up @@ -3355,7 +3349,7 @@ int wifi_config_autoreconnect(__u8 mode, __u8 retry_times, __u16 timeout)
{
if(mode == RTW_AUTORECONNECT_DISABLE)
p_wlan_autoreconnect_hdl = NULL;
#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
else if (matter_wifi_trigger)
p_wlan_autoreconnect_hdl = matter_wifi_autoreconnect_hdl;
#endif
Expand Down Expand Up @@ -3879,10 +3873,4 @@ void wifi_enable_ccx_txrpt(const char *ifname, int enable)
}
#endif

#ifdef CHIP_PROJECT
#ifdef IN
#undef IN
#endif
#endif

#endif //#if CONFIG_WLAN
12 changes: 0 additions & 12 deletions component/common/api/wifi/wifi_simple_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ RTW_PACK_STRUCT_END
#include "pack_end.h"
#endif

#ifdef CHIP_PROJECT
#ifndef IN
#define IN
#endif
#endif

static void set_device_name(char *device_name, int max_size)
{
int pos = 0;
Expand Down Expand Up @@ -2056,10 +2050,4 @@ void cmd_simple_config(int argc, char **argv){
#endif
}

#ifdef CHIP_PROJECT
#ifdef IN
#undef IN
#endif
#endif

#endif //#if CONFIG_WLAN
13 changes: 7 additions & 6 deletions component/common/application/matter/common/atcmd/atcmd_matter.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <platform_stdlib.h>
#include <platform_opts.h>

#ifdef CHIP_PROJECT
#if defined(CONFIG_MATTER) && CONFIG_MATTER
#include <main.h>
#include <sys_api.h>
#include "log_service.h"
extern void ChipTest(void);
Expand Down Expand Up @@ -75,10 +76,10 @@ void fATmattershell(void *arg)
log_item_t at_matter_items[] = {
#ifndef CONFIG_INIC_NO_FLASH
#if ATCMD_VER == ATVER_1
{"ATM$", fATchipapp, {NULL,NULL}},
{"ATM%", fATchipapp1, {NULL, NULL}},
{"ATM^", fATchipapp2, {NULL, NULL}},
{"ATMS", fATmattershell, {NULL, NULL}},
{"ATM$", fATchipapp},
{"ATM%", fATchipapp1},
{"ATM^", fATchipapp2},
{"ATMS", fATmattershell},
#endif // end of #if ATCMD_VER == ATVER_1
#endif
};
Expand All @@ -93,4 +94,4 @@ void at_matter_init(void)
log_module_init(at_matter_init);
#endif

#endif /* CHIP_PROJECT */
#endif /* CONFIG_MATTER */
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* FreeRTOS Kernel V10.2.0
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/

/******************************************************************************
See http://www.freertos.org/a00110.html for an explanation of the
definitions contained in this file.
******************************************************************************/

#ifndef FREERTOS_CONFIG_MATTER_H
#define FREERTOS_CONFIG_MATTER_H

#if defined(CONFIG_PLATFORM_8710C)
#undef configUSE_TRACE_FACILITY
#undef configRECORD_STACK_HIGH_ADDRESS
#undef INCLUDE_uxTaskGetStackSize
#undef INCLUDE_uxTaskGetFreeStackSize

#define configUSE_TRACE_FACILITY 1
#define configRECORD_STACK_HIGH_ADDRESS 1
#define INCLUDE_uxTaskGetStackSize 1
#define INCLUDE_uxTaskGetFreeStackSize 1
#endif

#endif /* FREERTOS_CONFIG_MATTER_H */
Loading
Loading