class ReadCache

Defined at line 14 of file ../../src/devices/nand/drivers/nand/read_cache.h

The Read Cache is a simple FIFO cache intended to be small in size.

This class is *not* thread-safe.

Public Methods

void ReadCache (uint32_t cache_size, size_t data_size, size_t spare_size)

Instantiate new cache of size `cache_size` with entries with `data_size` bytes for pages and

`spare_size` bytes for spare. `cache_size` must be greater than zero.

Defined at line 12 of file ../../src/devices/nand/drivers/nand/read_cache.cc

void Insert (uint32_t page, const void * data, const void * spare)

Insert an entry for `page` by copying out of `data` and `spare`, neither can be null.

Defined at line 17 of file ../../src/devices/nand/drivers/nand/read_cache.cc

bool GetPage (uint32_t page, void * out_data, void * out_spare)

Looks up a page by `page` number. If the entry is present then the data is

copied to `out_data` and `out_spare`, and returns true. Returns false if entry is not present.

`out_data` and `out_spare` must not be null.

Defined at line 42 of file ../../src/devices/nand/drivers/nand/read_cache.cc

size_t PurgeRange (uint32_t first_page, uint32_t length)

Scans for the pages in the range of `length` starting at `first_page` and purges them from the

cache. Returns the number of pages purged.

Defined at line 53 of file ../../src/devices/nand/drivers/nand/read_cache.cc