![]() |
Synergy Software Package User's Manual
|
The Block Media Framework Module can implement the file system on RAM for reading from, writing to and controlling the read/write region of the RAM memory. The framework has all the functionality needed to interface with a file system through a block media interface.
The Block Media RAM Framework module implements APIs to open, read from, write to and close the module. A complete list of the available APIs, an example API call and a short description of each can be found in the following table. A table of status return values follows the API summary table.
Block Media RAM Framework Module API Summary
| Function Name | Example API Call and Description |
|---|---|
| open | g_sf_block_media_ram0.p_api->open (g_sf_block_media_ram0.p_ctrl, g_sf_block_media_ram0.p_cfg);Open device for read, write and control. |
| read | g_sf_block_media_ram0.p_api->read (g_sf_block_media_ram0.p_ctrl, p_dest, start_block, block_count);Read data from RAM buffer. |
| write | g_sf_block_media_ram0.p_api->write (g_sf_block_media_ram0.p_ctrl, p_source, start_block, block_count);Write data to RAM buffer. |
| ioctl | g_sf_block_media_ram0.p_api->ioctl (g_sf_block_media_ram0.p_ctrl, command, p_data);Send control commands to and receive status of RAM buffer. |
| close | g_sf_block_media_ram0.p_api->close (g_sf_block_media_ram0.p_ctrl);Close the framework. |
| versionGet | g_sf_block_media_ram0.p_api->versionGet(&version);Retrieve the API version with the version pointer. |
Status Return Values
| Name | Description |
|---|---|
| SSP_SUCCESS | API Call Successful. |
| SSP_ERR_UNSUPPORTED | Command not supported. |
| SSP_ERR_NOT_OPEN | Unit is not open. |
| SSP_ERR_ASSERTION | A parameter is NULL. |
| SSP_ERR_IN_USE | Framework is already open. |
| SSP_ERR_INVALID_BLOCKS | Invalid block passed. |
The Block Media Framework Interface is simply an abstract interface using function pointers instead of direct function calls. Functions are called between the FileX and the SSP block media drivers, such as the SDMMC, SPI Flash and SDRAM/RAM. The interface remains the same for any media driver, so all media drivers appear functionally identical at the file I/O layer and can be interchanged with one another without changing code. Device adaptation drivers, such as the sf_block_media_ram, are accessed through the Block Media Framework Interface and provide device specific code needed to perform media I/O operations. Configuration and control structures passed through block media function calls are generally device specific as well.
The media must be formatted before you can open the media and begin creating, writing to and reading from files. The memory area used must be directly readable and writable by the core. Internal SRAM or SDRAM size should be sufficient for the Block Media RAM and there will be no persistence of data across the power cycles. Block count must be assigned by considering the boot record, FAT area, root directory and directory sector. If the File System is used on RAM then the minimum block count must be 4, as the first 3 sectors are reserved for boot record, FAT area and root directory and the 4th sector is used for data sector. The "Format media during initialization" property needs to be enabled to use RAM for FileX. The "File System is on block media" property needs to be true inorder to configure the block count and block size from the block media RAM.
Refer to the most recent SSP Release Notes for any additional operational limitations for this module.
This section describes how to include the Block Media RAM Framework Module in an application using the SSP configurator.
To add the Block Media RAM Framework to an application, simply add it to a thread using the stacks selection sequence given in the following table. (The default name for the Block Media RAM Framework is g_sf_block_media_ram0. This name can be changed in the associated Properties window.)
Block Media RAM Framework Module Selection Sequence
| Resource | ISDE Tab | Stacks Selection Sequence |
|---|---|---|
| g_sf_block_media_ram0 Block Media Framework on sf_block_media_ram | Threads | New Stack> Framework> File System> Block Media Framework on sf_block_media_ram |
When the Block Media RAM Framework on sf_block_media_ram is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower‑level modules. Any modules needing additional configuration information have the box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Modules with a Blue band are shared or common; they need only be added once and can be used by multiple stacks. Modules with a Pink band can require the selection of lower-level modules; these are either optional or recommended. (This is indicated in the block with the inclusion of this text.) If the addition of lower-level modules is required, the module description includes Add in the text. Clicking on any Pink banded modules brings up the New icon and displays possible choices.
The Block Media RAM Framework Module must be configured by the user for the desired operation. The available configuration settings and defaults for all the user-accessible properties are given in the properties tab within the SSP configurator and are shown in the following tables for easy reference. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and not available for changes and are identified with a lock icon for the locked property in the Properties window in the ISDE. This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the Properties tab within the SSP Configurator and are shown in the following tables for easy reference.
Configuration Settings for the Block Media RAM Framework Module on sf_block_media_ram
| ISDE Property | Value | Description |
|---|---|---|
| Parameter Checking | BSP, Enabled, Disabled Default: BSP | Enable or disable the parameter checking. |
| Name | g_sf_block_media_ram0 | Module name. |
| Block size of media in bytes | 512 | Block size of media in bytes selection. |
| Number of blocks to allocate | 16 | To make use of file system, block count must be assigned by considering the boot record, FAT area and root directory. |
| Enter the valid section for RAM buffer allocation | noinit | Enter the valid section for RAM buffer allocation. |
The Block Media RAM Framework module uses the ICLK as the source for the internal RAM.
The Block Media RAM Framework module uses internal RAM so no external pins are required.
The steps in using the Block Media RAM Framework module on sf_block_media_ram in a typical application are:
fx_system_initialize (sf_el_fx calls it automatically).fx_media_format (sf_el_fx calls it automatically if "Format media during initialization" property is set to Enabled). This Format media is optional if media has already been formatted. Anything on the media will erase while media is formatted. (Optional)fx_media_open (sf_el_fx opens the media automatically).fx_media_read(), fx_file_read().fx_media_write(), fx_file_write().These common steps are illustrated in a typical operational flow diagram in the following figure: