![]() |
Cordio Stack and Cordio Profiles
r2p3-02rel0
|
The Wireless Software Foundation (WSF) is a simple OS wrapper, porting layer, and general-purpose software service used by the Cordio embedded software system. The goal of WSF is to stay small and lean, supporting only the basic services required by the system. It consists of the following:
WSF does not define any tasks but defines some interfaces to tasks. It relies on the target OS to implement tasks and manage the timer and event handler services from target OS tasks. WSF can also act as a simple standalone OS in software systems without an existing OS.
WSF defines the following portable data types in file wsf_types.h. These data types are used throughout the software system.
See WSF Data Types for more detail.
The WSF buffer management service is a pool-based dynamic memory allocation service. The buffer service interface is defined in file wsf_buf.h.
See WSF Buffer API for more detail.
WsfBufGetAllocStats() returns a 128-byte array indexed by length. After a device is operational for some time this indexed array will provide a histogram of buffer allocation that will help with sizing buffer pools. Note that for Bluetooth 4.2 and beyond the max PDU has been increased beyond 128 bytes and therefore may need to be resized accordingly.
The WSF buffer pool statistics allow for the “tuning” of buffer pools to optimize memory use on a device. When WSF_BUF_STATS == TRUE the wsfBufPool_t structure tracks the number of current allocations, the maximum buffer allocations from a specific pool at any given time, and the maximum request length from that pool. By analyzing these statistics against a device’s WSF buffer pool configuration you can re-size and optimize the number of buffers allocated for individual pools.
The maxAlloc gives you the maximum buffers allocated from an individual pool while operational. We recommend ensuring that the number of allocated pools is chosen to ensure that this maximum can be supported, with some additional buffers available for more resource intensive use cases. Note that in the case that a buffer pool overflows, buffers will be utilized from the next highest pool size. This occurs when the maxAlloc reaches the number of allocated buffers for that pool, and will affect the number of allocated buffers for larger pools. Because of this we recommend performing size optimizations starting with the smallest buffer pool.
The maxReqLen is the maximum length buffer requested from that allocation pool. This can be used (along with WsfBufGetAllocStats()) to optimize the size of buffer pools. For example if a 128 byte buffer pool is configured but the maximum size buffer ever allocated from this pool is 64 bytes than you may consider resizing to the maximum so the additional memory required for the larger buffers are not wasted.
The WSF queue service is a general purpose queue service that is used throughout the software system.
The queue service interface is defined in function wsf_queue.h.
See WSF Queue API for more detail.
The WSF message service is used to pass messages to WSF event handlers.
The WSF message service is defined in file wsf_msg.h.
See WSF Message API for more detail.
The WSF timer service is used by WSF event handlers.
When a timer expires, the event handler associated with that timer is executed.
The WSF timer service is defined in file wsf_timer.h.
See WSF Timer API for more detail.
WSF event handlers receive WSF events, messages, and timer expirations from other components in the software system. Event handlers are used by the main protocol subsystems of the stack.
The event handler interface is defined in file wsf_os.h.
See WSF OS API for more detail.
WSF provides critical section macros that are used in code which might be executed in interrupt context to protect global data.
The critical section interface is defined in file wsf_cs.h.
See WSF Critical Section API for more detail.
WSF provides interfaces for locking and unlocking task scheduling. This allows for operation in pre-emptive multi-tasking environments.
The task schedule locking interface is defined in file wsf_os.h.
See WSF OS API for more detail.
WSF defines assert macros that are used for testing and debugging purposes.
The assert interface is defined in file wsf_assert.h.
See WSF Assert API for more detail.
WSF defines trace macros that are used throughout the software system for diagnostic purposes. A separate set of trace macros is used for each software subsystem (for example, WSF, HCI, DM, and ATT). This allows trace messages to be compiled in/out for each subsystem. Within each set of subsystem trace macros there are separate macros for different types of trace messages:
The trace interface is define in file wsf_trace.h.
See WSF Trace API for more detail.
The Embedded File System (EFS) provides applications with a simple interface for storing data in non-volatile and volatile memory. The Embedded File System (EFS) works in conjunctions with ARM’s proprietary Wireless Data Exchange Profile (WDXS) to provide wireless access to the Embedded File System.
The EFS is defined in file wsf_efs.h.
See WSF Embedded File System API for more detail.
The Embedded File System (EFS) provides a simple API for file storage in ExactLE applications. The EFS provides a common interface for storing files in Flash, EEPROM, RAM, and other forms of volatile and non-volatile storage. The EFS is compatible with the ARN’s proprietary Wireless Data Exchange Profile (WDXS) for allowing wireless access to the file system.
The EFS is implemented in two layers: The File Access Layer and The Media Access Layer.
This section contains the Applications Interface for the File Access Layer. The file Access layer access to files on the file system.
The File Access Layer provides the Wireless Data Exchange Profile (WDXS) and BTLE Applications access to the File System. The File Access Layer provides functions for performing the following operations:
The File Access Layer makes calls into the File Media Layer to access the physical storage medium.
This section documents the Application Interface for the File Media Layer. The File Media Layer operates a glue layer between the File Access Layer and the drivers that drive the physical storage on the target hardware (Flash, EEPROM, etc.).
The File Media Layer provides an abstraction layer between the File Access Layer and physical storage medium such as RAM, Flash, and EEPROM. Callback functions to perform the following operations on the physical medium are registered with the EFS by the application:
WSF provides utility functions and macros for a variety of use cases. This includes Bluetooth device address parsing, memory access and mutation, CRC, string formatting and terminal interfacing.
See WSF Utility API for more detail.