Providing persistent storage for non-volatile data, Providing, Persistent storage – Echelon FTXL User Manual
Page 89: Or non-volatile, Data
![background image](/manuals/735717/89/background.png)
FTXL User’s Guide
77
The FTXL OSAL function prototypes are generic, and do not depend on the
operating system’s syntax. For example, to create a binary semaphore, your
application can call the OsalCreateBinarySemaphore() function, which in turn
calls the operating system’s function to create the semaphore. The FTXL OSAL
function assigns a pointer to the created semaphore and returns a status variable
that indicates whether the function was successful.
The FTXL Developer’s Kit includes source code for FTXL OSAL files that use the
syntax of the Micrium μC/OS-II operating system. To use a different operating
system, you must modify the OSAL files to implement the API for that operating
system.
For more information about the FTXL OSAL functions, see
on page 156. For information about configuring the
operating system, see
Configuring the Operating System
on page 160 and see
Configuring the Micrium μC/OS-II Operating System
on page 165.
Providing Persistent Storage for Non-Volatile Data
The FTXL LonTalk protocol stack provides an API for managing non-volatile
data (NVD). Because non-volatile data is stored and managed by the host
processor rather than the FTXL Transciever, the FTXL application must
implement the API’s functions so that both the FTXL LonTalk protocol stack and
the application can read and write NVD to non-volatile memory (typically, flash
memory). Two example implementations, one using a flash file system, and one
using raw flash access (through the HAL flash access routines) are provided in
the FtxlNvdFlashDirect.c and FtxlNvdFlashFs.c files.
The implementations of the NVD-management functions are contained in one of
the following files (all of which are copied to the project directory by the LonTalk
Interface Developer utility):
• FtxlNvdFlashDirect.c for direct-access flash memory management
• FtxlNvdFlashFs.c for file-system flash memory management
• FtxlNvdUserDefined.c for your own flash memory management
Typically, if you select either the direct flash model or the flash file system model,
you need only specify the appropriate value for the non-volatile root in the
LonTalk Interface Developer Utility. This section describes how the FTXL API
uses the non-volatile memory driver, in case you need to implement your own
user-defined non-volatile data driver or modify one of the provided drivers.
Non-volatile data is stored in segments. Two of the segments are used to store
data maintained by the FTXL LonTalk protocol stack, and the third segment is
used to store data maintained by the application. Examples of data maintained
by the FTXL LonTalk protocol stack include network variable configuration and
address tables. Examples of data maintained by the application include
configuration network variable values and persistent memory files (used for
configuration property value files and user files). Each data segment is identified
by an enumeration of type LonNvdSegmentType, defined in the FtxlTypes.h file.
The FTXL LonTalk protocol stack reads non-volatile data (loads it into RAM)
only during device initialization. Included with the data is a header that the
FTXL LonTalk protocol stack uses for validation. Within this header is an
application identifier, generated by the LonTalk Interface Developer utility, that
allows the FTXL LonTalk protocol stack to ensure that the data belongs to the