--- Cannot embed stylesheet: [Errno 2] No such file or directory: '../../../aros.css' --->
| ObtainBattSemaphore() | ReadBattMem() | ReleaseBattSemaphore() | WriteBattMem() |
void ObtainBattSemaphore();
Gain exclusive access to the battery backed up memory. Reads and writes of related fields have to be bracketed by this and ReleaseBattSemaphore(), so that they are not interleaved with those of another task.
ReadBattMem() and WriteBattMem() are safe to call on their own; the semaphore is only needed to keep a group of them together.
ULONG ReadBattMem(
APTR buffer,
ULONG offset,
ULONG length );
Copy a field out of the battery backed up memory into a buffer.
buffer - where to put the field. It has to be large enough to hold
(length + 7) / 8 bytes.
offset - bit offset of the field within the battery memory.
length - size of the field in BITS, not bytes.
Always zero.
Bit offsets and lengths beyond the end of the battery memory read back as zero rather than failing. See <resources/battmembitsamiga.h> and <resources/battmembitsshared.h> for the assigned fields. A trailing partial byte is right aligned in the last byte written.
void ReleaseBattSemaphore();
Give up the exclusive access to the battery backed up memory gained with ObtainBattSemaphore().
ULONG WriteBattMem(
CONST_APTR buffer,
ULONG offset,
ULONG length );
Copy a field from a buffer into the battery backed up memory.
buffer - the field to store, (length + 7) / 8 bytes. offset - bit offset of the field within the battery memory. length - size of the field in BITS, not bytes.
Always zero.
Writes that run past the end of the battery memory are truncated rather than failing. See <resources/battmembitsamiga.h> and <resources/battmembitsshared.h> for the assigned fields. A trailing partial byte is taken right aligned from the last byte of the buffer.