Skip to content

andrey-gvrd/ummu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Micro-MMU

This is a very basic memory management unit for flash memories around a MB used mostly in embedded systems.

This MMU was written to save a specific kind of data -- objects > 256B, < 63KB made up of a user-identified header and uniform data. It is heavily tied to the design of flash memory and the API exposed by flash manufacturers.

And example would be a series of measurements. In this case header holds a timestamp, a type of measurement and some kind of ID and data is saved as a byte-array.

Interface

                ┌──────────┐                        ┌──────────┐
                │          │                        │          │
 --->uMMU_Save()│          │---------->Memory_Save()│          │
                │   uMMU   │<----------Memory_Load()│  Memory  │
 <---uMMU_Load()│          │-->Memory_Sector_Erase()│          │
                │          │                        │          │
                └──────────┘                        └──────────┘

uMMU_Save(type, out_buffer)

Type - BT_Header: Initiates a new object.

Type - BT_Data: Appends data to an existing object.

uMMU_Load(type, in_buffer)

Type - BT_Header: Shifts pointer to the next object, returns it's data chunk. Erases previous object.

Type - BT_Data: Returns current object's data chunk.

An example of use:

      ┌─Object 1────┐
      │┌──────┐  ┌┐ │
      ││Header│->││ │
      │└──────┘  └┘ │
      └─────────────┘

      ┌─Object 2───────────────────┐
      │┌──────┐  ┌──────────┬─────┐│
─────>││Header│->│Data      ┆     ││
   ┆  │└──────┘  └──────────┴──^──┘│
   ┆  └────────────────────────┆───┘
-----uMMU_Save(BT_Data, …)-----┘
   ┆
<-uMMU_Load(BT_Header, …)
   ┆
   ┆  ┌─Object 3───────────────────┐
   v  │┌──────┐  ┌──────────┬─────┐│
─────>││Header│->│Data      ┆     ││
      │└──────┘  └──────────┴──^──┘│
      └────────────────────────┆───┘
--uMMU_Save(BT_Data, …)--------┘

Usage

To use this library you will need to:

  1. Supply your own low-level functions for your memory IC:
  • Memory_Save
  • Memory_Load
  • Memory_Sector_Erase
  1. Specify parameters of your memory in the header.

Or use the ones I wrote for M25P80.

About

MMU for data streams

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages