battmem
| ObtainBattSemaphore() | ReadBattMem() | ReleaseBattSemaphore() | WriteBattMem() |
ObtainBattSemaphore()
Synopsis
void ObtainBattSemaphore();
Function
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.
Notes
ReadBattMem() and WriteBattMem() are safe to call on their own; the semaphore is only needed to keep a group of them together.
See also
ReadBattMem()
Synopsis
ULONG ReadBattMem(
APTR buffer,
ULONG offset,
ULONG length );
Function
Copy a field out of the battery backed up memory into a buffer.
Inputs
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.
Result
Always zero.
Notes
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.
See also
ReleaseBattSemaphore()
Synopsis
void ReleaseBattSemaphore();
Function
Give up the exclusive access to the battery backed up memory gained with ObtainBattSemaphore().
See also
WriteBattMem()
Synopsis
ULONG WriteBattMem(
CONST_APTR buffer,
ULONG offset,
ULONG length );
Function
Copy a field from a buffer into the battery backed up memory.
Inputs
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.
Result
Always zero.
Notes
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.


