AllocPotBits()
Synopsis
UWORD AllocPotBits(
UWORD bits );
Function
Reserve the currently unallocated bits from a requested POTGO bit
mask. Partial allocation is possible: bits already reserved by
other callers are excluded from the returned mask.
Result
The mask of bits actually reserved, which may be a proper subset
of bits or zero. If the caller requires the entire mask, compare
the result with bits and release any partial allocation with
FreePotBits().
Notes
Allocation tracks bits, not task ownership. Release the returned
mask with FreePotBits() when finished. Allocation does not write
the hardware register.
This describes the native Amiga implementation. The allocation
bitmap is updated without an internal critical section. Callers
must serialize competing allocation and release operations; the
function itself does not wait.
Bugs
The implementation does not implement special allocation rules
for the START bit; it treats it like any other requested bit.
FreePotBits()
Synopsis
void FreePotBits(
UWORD allocated );
Function
Release the specified POTGO bits. The bits are cleared in both
the allocation bitmap and the resource's saved output value, and
the updated output value is immediately written to POTGO.
Notes
Releasing bits changes their hardware output state; this is not
merely an allocation operation. The resource does not track task
ownership or reject bits allocated by another caller.
This describes the native Amiga implementation. No internal
critical section protects the bitmap, saved output value or
hardware write. Callers must serialize competing operations; the
function itself does not wait.
WritePotgo()
Synopsis
void WritePotgo(
UWORD word,
UWORD mask );
Function
Update the saved POTGO output value and write it to the Amiga
custom chip. For output bits 8 through 15, mask selects the bits
to replace and word supplies their new values. Unselected output
bits retain the resource's saved values.
Bit 0 of word is the START command. When set, it is included in
the hardware write independently of mask and is not latched in
the saved output value. Bits 1 through 7 of word are ignored.
Notes
The resource does not check mask against its allocation bitmap
or track task ownership. Setting START requires coordination with
other users even when mask is zero. Direct writes to POTGO do not
update the resource's saved output value and can be overwritten
by subsequent resource calls.
This describes the native Amiga implementation. No internal
critical section protects the saved value or hardware write.
Callers must serialize competing operations.