Skip to content

Commit

Permalink
Remove some unused config options from config.h. (#25164)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jul 20, 2023
1 parent 39ba730 commit 1710420
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
// Prevent multiple inclusion
#pragma once

// User options for plugin Binding Table Library
#define EMBER_BINDING_TABLE_SIZE 10

/**** Network Section ****/
#define EMBER_SUPPORTED_NETWORKS (1)

#define EMBER_APS_UNICAST_MESSAGE_COUNT 10

/**** Cluster endpoint counts ****/
#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (2)
#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
// Prevent multiple inclusion
#pragma once

// User options for plugin Binding Table Library
#define EMBER_BINDING_TABLE_SIZE 10

/**** Network Section ****/
#define EMBER_SUPPORTED_NETWORKS (1)

#define EMBER_APS_UNICAST_MESSAGE_COUNT 10

/**** Cluster endpoint counts ****/
#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1)
#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (2)
Expand Down
155 changes: 8 additions & 147 deletions src/app/util/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,154 +31,15 @@
#include <zap-generated/endpoint_config.h>
#endif

// *******************************************************************
// pre-defined Devices
//
// use these to determine which type of device the current application is.
// do not use the EMBER_* versions from ember-types.h as these are in an
// enum and are not available at preprocessor time. These need to be set
// before the devices are loaded from ha-devices.h and se-devices.h
#define ZA_COORDINATOR 1
#define ZA_ROUTER 2
#define ZA_END_DEVICE 3
#define ZA_SLEEPY_END_DEVICE 4

// This file determines the security profile used, and from that various
// other security parameters.
// #include "app/framework/security/security-config.h"

// *******************************************************************
// Application configuration of RAM for cluster usage
//
// This section defines constants that size the tables used by the cluster
// code.

// This is the max hops that the network can support - used to determine
// the max source route overhead and broadcast radius
// if we havent defined MAX_HOPS then define based on profile ID
#ifndef ZA_MAX_HOPS
#define ZA_MAX_HOPS 12
#endif

// Max PHY size = 128
// -1 byte for PHY length
// -2 bytes for MAC CRC
#define EMBER_AF_MAXIMUM_INTERPAN_LENGTH 125

// The additional overhead required for APS encryption (security = 5, MIC = 4).
#define EMBER_AF_APS_ENCRYPTION_OVERHEAD 9

// The additional overhead required for APS fragmentation.
#define EMBER_AF_APS_FRAGMENTATION_OVERHEAD 2

// The additional overhead required for network source routing (relay count = 1,
// relay index = 1). This does not include the size of the relay list itself.
#define EMBER_AF_NWK_SOURCE_ROUTE_OVERHEAD 2

// The additional overhead required per relay address for network source
// routing. This is in addition to the overhead defined above.
#define EMBER_AF_NWK_SOURCE_ROUTE_PER_RELAY_ADDRESS_OVERHEAD 2

// defines the largest size payload allowed to send and receive. This
// affects the payloads generated from the CLI and the payloads generated
// as responses.
// Maximum payload length.
// User options for plugin Binding Table Library
// TODO: Make this a CHIP_CONFIG value.
#ifndef EMBER_BINDING_TABLE_SIZE
#define EMBER_BINDING_TABLE_SIZE 10
#endif // EMBER_BINDING_TABLE_SIZE

// Legacy definition that we can remove once Scenes is no longer using the
// Zigbee message-writing bits.
#define EMBER_AF_MAXIMUM_SEND_PAYLOAD_LENGTH 1024
#define EMBER_AF_INCOMING_BUFFER_LENGTH 1024

// *******************************************************************
// Application configuration of Flash
//
// This section gives the application options for turning on or off
// features that affect the amount of flash used.

// *******************************************************************
// Defines needed for enabling security
//

// Our stack profile is 2 (ZigBee Pro).
#define EMBER_STACK_PROFILE 2

// *******************************************************************
// Application Handlers
//
// By default, a number of stub handlers are automatically provided
// that have no effect. If the application would like to implement any
// of these handlers itself, it needs to define the appropriate macro

#define EMBER_APPLICATION_HAS_REMOTE_BINDING_HANDLER
#define EMBER_APPLICATION_HAS_ENERGY_SCAN_RESULT_HANDLER
#define EMBER_APPLICATION_HAS_GET_ENDPOINT
#define EMBER_APPLICATION_HAS_TRUST_CENTER_JOIN_HANDLER
#define EMBER_APPLICATION_HAS_BUTTON_HANDLER
#define EMBER_APPLICATION_HAS_ZIGBEE_KEY_ESTABLISHMENT_HANDLER

#define EZSP_APPLICATION_HAS_ENERGY_SCAN_RESULT_HANDLER
#define EZSP_APPLICATION_HAS_INCOMING_SENDER_EUI64_HANDLER
#define EZSP_APPLICATION_HAS_TRUST_CENTER_JOIN_HANDLER
#define EZSP_APPLICATION_HAS_BUTTON_HANDLER
#define EZSP_APPLICATION_HAS_ZIGBEE_KEY_ESTABLISHMENT_HANDLER

#ifndef EMBER_AF_MESSAGE_SENT_CALLBACK_TABLE_SIZE
#define EMBER_AF_MESSAGE_SENT_CALLBACK_TABLE_SIZE EMBER_APS_UNICAST_MESSAGE_COUNT
#endif // EMBER_AF_MESSAGE_SENT_CALLBACK_TABLE_SIZE

#define EMBER_APPLICATION_HAS_COMMAND_ACTION_HANDLER

// *******************************************************************
// Default values for required defines
//

// define the serial port that the application uses to be 1 if this is not set
#ifndef HAL_CONFIG // HAL Config handles serial port allocation
#ifndef APP_SERIAL
#define APP_SERIAL 1
#endif
#ifdef EMBER_TEST
#include "app/util/ezsp/uart-simulation-remap.h"
#endif
#endif

// The address table plugin is enabled by default. If it gets disabled for some
// reason, we still need to define these #defines to some default value.
#ifndef EMBER_AF_PLUGIN_ADDRESS_TABLE
#define EMBER_AF_PLUGIN_ADDRESS_TABLE_SIZE 2
#define EMBER_AF_PLUGIN_ADDRESS_TABLE_TRUST_CENTER_CACHE_SIZE 2
#endif

// The total size of the address table is the size of the section used by the
// application plus the size of section used for the trust center address cache.
// The NCP allows each section to be sized independently, but the SOC requires
// a single configuration for the whole table.
#ifndef EMBER_ADDRESS_TABLE_SIZE
#define EMBER_ADDRESS_TABLE_SIZE (EMBER_AF_PLUGIN_ADDRESS_TABLE_SIZE + EMBER_AF_PLUGIN_ADDRESS_TABLE_TRUST_CENTER_CACHE_SIZE)
#endif

// *******************************************************************
// // Default values for required defines
// //

#ifdef EMBER_AF_DEFAULT_RESPONSE_POLICY_NEVER
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_REQUESTS ZCL_DISABLE_DEFAULT_RESPONSE_MASK
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_RESPONSES ZCL_DISABLE_DEFAULT_RESPONSE_MASK
#elif defined(EMBER_AF_DEFAULT_RESPONSE_POLICY_CONDITIONAL)
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_REQUESTS 0
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_RESPONSES ZCL_DISABLE_DEFAULT_RESPONSE_MASK
#else
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_REQUESTS 0
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_RESPONSES 0
#endif // EMBER_AF_DEFAULT_RESPONSE_POLICY_NEVER

#ifdef EMBER_AF_CUSTOM_NETWORK_INIT_OPTIONS
#ifdef EMBER_AF_USE_STANDARD_NETWORK_INIT
#error "Custom options cannot be used with the standard network init"
#endif
#else
// We always want to store our parent info in a token. This prevents doing an
// orphan scan upon reboot, which can suffer from the multiple-parent-
// responses issue
#define EMBER_AF_CUSTOM_NETWORK_INIT_OPTIONS (EMBER_NETWORK_INIT_PARENT_INFO_IN_TOKEN | Z3_NETWORK_INIT_BEHAVIOR)
#endif // EMBER_AF_CUSTOM_NETWORK_INIT_OPTIONS

/**
* @brief CHIP uses millisecond ticks
Expand Down
19 changes: 1 addition & 18 deletions src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ using namespace chip;
//------------------------------------------------------------------------------
// Globals

#ifdef EMBER_AF_ENABLE_STATISTICS
// a variable containing the number of messages send from the utilities
// since emberAfInit was called.
uint32_t afNumPktsSent;
#endif

const EmberAfClusterName zclClusterNames[] = {
CLUSTER_IDS_TO_NAMES // defined in print-cluster.h
{ kInvalidClusterId, nullptr }, // terminator
Expand Down Expand Up @@ -123,18 +117,7 @@ EmberAfDifferenceType emberAfGetDifference(uint8_t * pData, EmberAfDifferenceTyp
// ****************************************
void emberAfInit()
{
uint8_t i;
#ifdef EMBER_AF_ENABLE_STATISTICS
afNumPktsSent = 0;
#endif

for (i = 0; i < EMBER_SUPPORTED_NETWORKS; i++)
{
// FIXME: Do we need to support more than one network?
// emberAfPushNetworkIndex(i);
emberAfInitializeAttributes(EMBER_BROADCAST_ENDPOINT);
// emberAfPopNetworkIndex();
}
emberAfInitializeAttributes(EMBER_BROADCAST_ENDPOINT);

MATTER_PLUGINS_INIT

Expand Down
9 changes: 0 additions & 9 deletions src/app/zap-templates/templates/app/gen_config.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
// Prevent multiple inclusion
#pragma once

// User options for plugin Binding Table Library
#define EMBER_BINDING_TABLE_SIZE 10

/**** Network Section ****/
#define EMBER_SUPPORTED_NETWORKS (1)


#define EMBER_APS_UNICAST_MESSAGE_COUNT 10

/**** Cluster endpoint counts ****/
{{#all_user_clusters}}
#define EMBER_AF_{{asDelimitedMacro define}}_{{asDelimitedMacro side}}_ENDPOINT_COUNT ({{user_endpoint_count_by_cluster id side}})
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1710420

Please sign in to comment.