NRAFS

From PaparazziUAV
Revision as of 11:04, 7 October 2012 by DirkDokter (talk | contribs) (Created page with "= Not Really a File System = == Criteria == * Should be usable on flash memory: don't overwrite the same blocks over and over. * Fast * Should miss at most one block of data wh…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Not Really a File System

Criteria

  • Should be usable on flash memory: don't overwrite the same blocks over and over.
  • Fast
  • Should miss at most one block of data when a write operation is interrupted. (For example when a logger without dedicated battery is disconnected.)
  • Table-like logging: a table header and a rows with data, separated in columns.

Overview

NrafsOverview.png

First block of disk, the "partition table"

The first block (512 Bytes) of the disk only has to be written once. It has an 8-bytes header which indicates that the disk is 'formatted' in NRAFS format. The remaining 504 Bytes are reserved for future use, and will store usage information about the SD-card's blocks.

First block of log, the "table header"

The first block of a log can be seen as a table header. It consists off:

  • A 16-byte header to indicate the block type.
  • 16 bytes containing the airframe's MD5 sum.
  • 1 byte containing the airframe ID.
  • 5 bytes describing the reference (start) time of the log: 4 bytes descibe the time in seconds since Unix Epoch, and 1 byte indicates the 1/255th seconds.

(total 38 bytes)

And per field:

  • 6 bytes describing the name of the field in ASCII.
  • 1 byte describing the data type: 2 bits indicate the size of the field (8/16/24/32 bits); another bit indicates if it is a float or an interger; a fourth bit indicates if it is a signed or unsigned type.
  • 1 byte containing the XOR checksum of this field description.

(total 8 bytes per field description)

When 59 fields are used, this would take 59*8=472 Bytes. As 38 Bytes are used for the header, there are still 512-472-38=2 Bytes available for a CRC checksum of this block.