Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
47
of
106
5.7.3. Usage
5.7.3.1. RTEMS
5.7.3.1.1. Overview
The RTEMS driver accesses the mass memory by the reference a page number. There are
MASSMEM_BLOCKS blocks starting from block number 0 and
MASSMEM_PAGES_PER_BLOCK pages within each block starting from page 0. Each
page is of size MASSMEM_PAGE_SIZE bytes.
When writing new data into a page, the memory area must be in its reset value. If there is
data that was previously written to a page, the block where the page resides must first be
erased in order to clear the page to its reset value.
Note
that the whole block is erased, not
only the page.
It is the user application’s responsibility to make sure any data the needs to be preserved
after the erase block operation must first be read and rewritten after the erase block
operation, with the new page information.
5.7.3.1.2. Usage
The RTEMS driver must be opened before it can access the mass memory flash device.
Once opened, all provided operations can be used as described in the subchapter 5.7.2.
And, if desired, the access can be closed when not needed.
Figure 5-5 - RTEMS driver usage description
Note!
All calls to RTEMS driver are blocking calls.
5.7.3.2. RTEMS application example
In order to use the mass memory flash driver in RTEMS environment, the following code
structure is suggested to be used: