mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-23 23:56:34 +11:00
reflow doc comments
This commit is contained in:
parent
ab4089f5f3
commit
a9faaffe46
1 changed files with 26 additions and 23 deletions
|
@ -5,17 +5,18 @@
|
||||||
//! There are, broadly speaking, three different kinds of save media that can be
|
//! There are, broadly speaking, three different kinds of save media that can be
|
||||||
//! found in official Game Carts:
|
//! found in official Game Carts:
|
||||||
//!
|
//!
|
||||||
//! * Battery-Backed SRAM: The simplest kind of save media, which can be accessed
|
//! * Battery-Backed SRAM: The simplest kind of save media, which can be
|
||||||
//! like normal memory. You can have SRAM up to 32KiB, and while there exist a
|
//! accessed like normal memory. You can have SRAM up to 32KiB, and while
|
||||||
//! few variants this does not matter much for a game developer.
|
//! there exist a few variants this does not matter much for a game developer.
|
||||||
//! * EEPROM: A kind of save media based on very cheap chips and slow chips.
|
//! * EEPROM: A kind of save media based on very cheap chips and slow chips.
|
||||||
//! These are accessed using a serial interface based on reading/writing bit
|
//! These are accessed using a serial interface based on reading/writing bit
|
||||||
//! streams into IO registers. This memory comes in 8KiB and 512 byte versions,
|
//! streams into IO registers. This memory comes in 8KiB and 512 byte
|
||||||
//! which unfortunately cannot be distinguished at runtime.
|
//! versions, which unfortunately cannot be distinguished at runtime.
|
||||||
//! * Flash: A kind of save media based on flash memory. Flash memory can be read
|
//! * Flash: A kind of save media based on flash memory. Flash memory can be
|
||||||
//! like ordinary memory, but writing requires sending commands using multiple
|
//! read like ordinary memory, but writing requires sending commands using
|
||||||
//! IO register spread across the address space. This memory comes in 64KiB
|
//! multiple IO register spread across the address space. This memory comes in
|
||||||
//! and 128KiB variants, which can thankfully be distinguished using a chip ID.
|
//! 64KiB and 128KiB variants, which can thankfully be distinguished using a
|
||||||
|
//! chip ID.
|
||||||
//!
|
//!
|
||||||
//! As these various types of save media cannot be easily distinguished at
|
//! As these various types of save media cannot be easily distinguished at
|
||||||
//! runtime, the kind of media in use should be set manually.
|
//! runtime, the kind of media in use should be set manually.
|
||||||
|
@ -39,24 +40,26 @@
|
||||||
//!
|
//!
|
||||||
//! ## Using save media
|
//! ## Using save media
|
||||||
//!
|
//!
|
||||||
//! To access save media, use the [`SaveManager::access`] or [`SaveManager::access_with_timer`] methods to create a new
|
//! To access save media, use the [`SaveManager::access`] or
|
||||||
//! [`SaveData`] object. Its methods are used to read or write save media.
|
//! [`SaveManager::access_with_timer`] methods to create a new [`SaveData`]
|
||||||
|
//! object. Its methods are used to read or write save media.
|
||||||
//!
|
//!
|
||||||
//! Reading data from the savegame is simple. Use [`read`] to copy data from an
|
//! Reading data from the savegame is simple. Use [`read`] to copy data from an
|
||||||
//! offset in the savegame into a buffer in memory.
|
//! offset in the savegame into a buffer in memory.
|
||||||
//!
|
//!
|
||||||
//! Writing to save media requires you to prepare the area for writing by calling
|
//! Writing to save media requires you to prepare the area for writing by
|
||||||
//! the [`prepare_write`] method to return a [`SavePreparedBlock`], which contains
|
//! calling the [`prepare_write`] method to return a [`SavePreparedBlock`],
|
||||||
//! the actual [`write`] method.
|
//! which contains the actual [`write`] method.
|
||||||
//!
|
//!
|
||||||
//! The `prepare_write` method leaves everything in a sector that overlaps the
|
//! The `prepare_write` method leaves everything in a sector that overlaps the
|
||||||
//! range passed to it in an implementation defined state. On some devices it may
|
//! range passed to it in an implementation defined state. On some devices it
|
||||||
//! do nothing, and on others, it may clear the entire range to `0xFF`.
|
//! may do nothing, and on others, it may clear the entire range to `0xFF`.
|
||||||
//!
|
//!
|
||||||
//! Because writes can only be prepared on a per-sector basis, a clear on a range
|
//! Because writes can only be prepared on a per-sector basis, a clear on a
|
||||||
//! of `4000..5000` on a device with 4096 byte sectors will actually clear a range
|
//! range of `4000..5000` on a device with 4096 byte sectors will actually clear
|
||||||
//! of `0..8192`. Use [`sector_size`] to find the sector size, or [`align_range`]
|
//! a range of `0..8192`. Use [`sector_size`] to find the sector size, or
|
||||||
//! to directly calculate the range of memory that will be affected by the clear.
|
//! [`align_range`] to directly calculate the range of memory that will be
|
||||||
|
//! affected by the clear.
|
||||||
//!
|
//!
|
||||||
//! [`read`]: SaveData::read
|
//! [`read`]: SaveData::read
|
||||||
//! [`prepare_write`]: SaveData::prepare_write
|
//! [`prepare_write`]: SaveData::prepare_write
|
||||||
|
@ -78,9 +81,9 @@
|
||||||
//! * Atmel flash chips have a sector size of 128 bytes. Reads to any alignment
|
//! * Atmel flash chips have a sector size of 128 bytes. Reads to any alignment
|
||||||
//! are efficient, however, unaligned writes are extremely slow.
|
//! are efficient, however, unaligned writes are extremely slow.
|
||||||
//! `prepare_write` does not immediately erase any data.
|
//! `prepare_write` does not immediately erase any data.
|
||||||
//! * EEPROM has a sector size of 8 bytes. Unaligned reads and writes are
|
//! * EEPROM has a sector size of 8 bytes. Unaligned reads and writes are slower
|
||||||
//! slower than aligned writes, however, this is easily mitigated by the
|
//! than aligned writes, however, this is easily mitigated by the small sector
|
||||||
//! small sector size.
|
//! size.
|
||||||
|
|
||||||
use crate::save::utils::Timeout;
|
use crate::save::utils::Timeout;
|
||||||
use crate::sync::{Mutex, RawMutexGuard};
|
use crate::sync::{Mutex, RawMutexGuard};
|
||||||
|
|
Loading…
Add table
Reference in a new issue