• No results found

size LARGE_BUFFER_SIZE If this scheme is not proper applied, memory corruption may occur.

4.3 Configuration files

The stack contains a variety of configuration files, which allow:

• The stack to configure the required stack resources according to the application needs based on the required functionality, and

• The application to configure its own resources

Throughout the various layers and thus directories within the software package the following configuration files are available:

• app_config.h • stack_config.h • pal_config.h • tal_config.h • mac_config.h • mac_build_config.h • mac_user_build_config.h

The meaning of these configuration files are described in more detail in the following sections.

The following picture shows the “#include”-hierarchy (#include “file_name.h”) for these configuration files.

Figure 4-9. Configuration file #include-hierarchy.

app_config.h

mac_user_build_config.h

stack_config.h

nwk_config.h

mac_config.h

tal_config.h

+

mac_build_config.h

Application Domain

Stack Domain

4.3.1 Application resource configuration – app_config.h

Each application is required to provide its own configuration file app_config.h usually located in Inc directory of the application.

This configuration file defines the following items:

• Timers required only within the application domain (independent from the timers used within the stack): Here the number of application timers and their timer IDs are defined

• Large and small buffers required only within the application domain (independent from the buffers used within the stack)

• Additional settings regarding the buffer size of USB or UART buffers • Any other resources as required

In order to allow for proper resource configuration (for example, to calculate the overall number of timers) app_config.h includes the file stack_config.h which contains resource definitions from the stack domain (without the application).

This file can be adjusted by the end user according to its own needs. 4.3.2 Stack resources configuration – stack_config.h

The stack uses its own configuration file stack_config.h located in directory Include. This configuration file defines the following items:

• IDs of the currently known stack layers (PAL up to NWK) • Size of large and small buffers

• Total number of buffers and timers

Depending on the setting of the build switch HIGHEST_STACK_LAYER the configuration file of the highest layer of the stack (tal_config.h, mac_config.h, etc.) is included in order to calculate the resource requirements at compile time.

IMPORTANT

This file must not be changed by the end user.

4.3.3 PAL resource configuration – pal_config.h

The PAL layer does not require own resources such as timer or buffers, so this does not need to be taken into consideration in the resource calculation for the application. Nevertheless there exists a unique pal_config.h file for each platform type (for example, for each board) which can be found in the directories PAL/pal_generic_type_name/pal_type_name/Boards/board_type_name, for example PAL/AVR/ATMEGA1281/Boards/REB_4_0_231. These pal_config.h files define all platform specific hardware components.

4.3.4 TAL resource configuration – tal_config.h

The TAL layer uses its own configuration file tal_config.h located in directory TAL/trx_name/Inc, that is, each transceiver (and thus each TAL implementing code for a specific transceiver) has its own TAL configuration file:

• TAL/ ATMEGARF_TAL_1/Inc (for ATmega128RFA1) • TAL/AT86RF212/Inc

• TAL/AT86RF230B/Inc • TAL/AT86RF231/Inc • TAL/AT86RF232/Inc

• Etc.

These configuration files define the following items:

• Transceiver dependent values required by any upper layer (radio wake-up time) • Timers and their IDs used within this particular TAL implementation

• The capacity of the TAL-Incoming-Frame-Queue

If the build switch HIGHEST_STACK_LAYER is set to TAL, the proper tal_config.h file (depending on build switch TAL_TYPE) is directly included into file stack_config.h since there are no further stack layers defined.

IMPORTANT

These files must not be changed by the end user.

4.3.5 MAC resource configuration – mac_config.h

The MAC layer uses its own configuration file mac_config.h located in directory MAC/Inc.

This configuration file defines the following items:

• Timers and their IDs used within the MAC layer based on the current build configuration

• The capacity of certain MAC specific queues

If the build switch HIGHEST_STACK_LAYER is set to MAC, mac_config.h is directly included into file stack_config.h since there is no upper stack layer defined.

IMPORTANT

This file must not be changed by the end user.

4.3.6 NWK resource configuration – nwk_config.h

Once a network layer (NWK) is provided as part of the stack on top to the MAC, the network layer uses its own configuration file nwk_config.h located in directory NWK/Inc.

If the build switch HIGHEST_STACK_LAYER is set to NWK, nwk_config.h is directly included into file stack_config.h since there is no upper stack layer defined.

IMPORTANT

This file must not be changed by the end user.

4.3.7 Build configuration file – mac_build_config.h

File mac_build_config.h located in directory /Include defines the MAC features required for specific build configurations. See Section 6.2.1 for more information about mac_build_config.h.

IMPORTANT

This file must not be changed by the end user.

4.3.8 User build configuration file – mac_user_build_config.h

Each application may provide its own user build configuration file mac_user_build_config.h usually located in Inc directory of the application, although this is not required. This configuration file defines the actual MAC components used for the end user application and can actually reduce resource requirements drastically.

If the application wants to use its own user build configuration the build switch MAC_USER_BUILD_CONFIG needs to be set. See Section 6.2.2 for more information about mac_user_build_config.h.

For more information about user build configurations and its utilization please refer to Section 4.4 and Section 6.2.2.

An example for an application using the configuration file mac_user_build_config.h to create an application defined stack can be found in Section 9.2.1.3.