Initialize and Shutdown

Initialization and Shutdown

To initialize and shutdown the FS library, the following APIs are available:

FSInit Initialization
FSShutdownShutdown

FSInit must be called before calling any other API in the FS library. Also, it is necessary to call it before initializing the SAVE library that handles the FS library internally.

Although it is acceptable to call this API multiple times, nothing will be performed after the second and subsequent calls.

FSShutdown does nothing internally. During the application shutdown, the system shuts down automatically.

When the application implements a software reset on its own, it is acceptable to call FSShutdown and FSInit again. However, memory allocated for the FS library will never be released. Specifically, as long as the application is running, it is necessary for the application to manage FSClients.

FSClient Management

Many features in the FS library require FSClients. Because the number of FSClients available for the application to use has a limit, the application should manage not to exceed the maximum number.

The following APIs are available to manage FSClients.

FSAddClientAdd a FSClient.
FSDelClient Delete a FSClient.
FSGetClientNum Obtain the number of currently valid FSClients.

The maximum number of FSClients (FS_MAX_CLIENTS) that the application can add is 63. However, some of the libraries and middleware call FSAddClient internally; adding such instances together, the application can use up to 63 FSClients.

Information as to which API in which library is calling FSAddClient internally will be available in the future; under existing conditions, instead of implementing a FSClient counter in the application itself, use either one of the methods below:

if( FSGetClientNum() < FS_MAX_CLIENTS )
{
    FSAddClient( pClient, FS_RET_NO_ERROR );
}
else
{
    // FSClient num max
}
FSStatus state;
state = FSAddClient( pClient, FS_RET_MAX );
if( state != FS_STATUS_OK )
{
    if( state == FS_STATUS_MAX )
    {
        // FSClient num max
    }
    else
    {
        // No need to handle
    }
}
else
{
    // FSAddClient success
}
WARNING:
Because the system may not be stable, it is recommended to design with some room in the number of FSClients. For example, it is safe to keep the value that returns from FSGetClientNum within 60.

Revision History

2013/05/08 Automated cleanup pass.
2012/10/05 Initial version.


CONFIDENTIAL