Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Support
  • About Us
  • Blog
  • Forum
  • Search
    • Contact Us
    • Forum
    • Knowledge Base
    • Web Shop
    • Newsletter
    • RSS
  •   Jobs
  •   Videos
  •   Blog
  •   Sustainability
  • emFile
  • emFile Storage Layer
  • Technology
  • Add-ons
  • Tools

Storage layer

The storage layer of emFile provides direct access to the physical media and can also be used outside of emFile.

Contact us
Downloads
Documentation
SEGGER emFile
  1. 1.Overview
    1. 1.1.Main application areas
  2. 2.How the storage layer works
  3. 3.Storage layer API

Overview

With the emFile storage layer applications can use physical media directly without a file system.All emFile drivers can be used for the application. This includes the NAND and NOR drivers with their high performance and effective wear leveling, as well as RAID support (RAID1/RAID5) or encryption.

Main application areas

  • Storage layer for use with the USB Mass Storage Device class
  • Raw storage interface for direct access by the application
  • Storage layer for third-party file systems
emFile structure

How the storage layer works

The block operations from the file system are handed over to the Storage Layer. SEGGER's Storage Layer is completely agnostic of the file system used to address it. It accepts any page or sector size. This way it can directly be used by emFile, by the application, by a third party file system or by applications passing through operations from a host, as is the case for USB mass storage class devices.

The main purpose of the Storage Layer is to provide access to the device drivers provided by SEGGER. This includes SEGGER's great NAND and NOR flash drivers with their effective wear leveling algorithms. The Storage Layer also handles storage arrays according to RAID1 or RAID5, if desired. Encryption of the storage volume is handled by the Storage Layer as well. The Storage Layer synchronizes accesses to the device driver level. For this purpose it calls a device driver to perform a block operation.

Another task performed by the storage layer is the handling of caches. This also includes mechanisms to control the garbage collection.

Storage layer API

The functions described in this section can be used to access and to manage the data at the logical sector level effectively bypassing the file system. These functions are typically used when the application comes with its own file system or when the storage device has to be mounted as a mass storage device via USB.

FunctionDescription
FS_STORAGE_Clean()Performs garbage collection on the storage device.
FS_STORAGE_CleanOne()Performs a single garbage collection step on the storage device.
FS_STORAGE_FreeSectors()Informs the driver about unused sectors.
FS_STORAGE_GetCleanCnt()Returns the number of clean operations required.
FS_STORAGE_GetCounters()Returns the statistic counters.
FS_STORAGE_GetSectorUsage()Returns the device info.
FS_STORAGE_Init()Initializes the driver and OS if necessary.
FS_STORAGE_ReadSector()Reads a sector from a device.
FS_STORAGE_ReadSectors()Reads multiple sectors from a device.
FS_STORAGE_RefreshSectors()Rewrites a sector with the original data.
FS_STORAGE_ResetCounters()Sets the statistical counters to 0.
FS_STORAGE_Sync()Writes cached data to the storage device.
FS_STORAGE_SyncSectors()Writes cached sector data to storage device.
FS_STORAGE_Unmount()Low-level unmount. Unmounts a volume on driver layer.
FS_STORAGE_WriteSector()Writes a sector to storage device.
FS_STORAGE_WriteSectors()Writes multiple sectors to storage device.

Headquarters

SEGGER Microcontroller GmbH

Ecolab-Allee 5
40789 Monheim am Rhein, Germany
info@segger.com
Tel.: +49-2173-99312-0
Fax: +49-2173-99312-28

Locations

USA: SEGGER Microcontroller Systems LLC

Boston area
101 Suffolk Lane
Gardner, MA 01440, USA
us-east@segger.com
Tel.: +1-978-874-0299
Fax: +1-978-874-0599

Silicon Valley
Milpitas, CA 95035, USA
us-west@segger.com
Tel.: +1-408-767-4068

China: SEGGER Microcontroller China Co., Ltd.

Room 218, Block A, Dahongqiaoguoji
No. 133 Xiulian Road
Minhang District, Shanghai 201199, China
china@segger.com
Tel.: +86-133-619-907-60

ISO 9001 certified

ISO 9001

30+ years of experience

First-class embedded software tools since 1992
  • Imprint
  • Disclaimer
  • Privacy Policy
© 2025 SEGGER - All rights reserved.