1#ifndef ALCHEMY_SERIAL_RUNTIME_H
2#define ALCHEMY_SERIAL_RUNTIME_H
115#define SERIAL_RUNTIME (&gSerialRuntime)
DMA channel registers, and the DMA and CPU fills.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
The hardware's I/O registers and their bits, as pret names them.
The hardware's interrupt sources and the interrupt handler table.
volatile u16 gLinkStatus
Link status, updated by the VBlank exchange handler.
volatile u16 gSerialSendSize
volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime....
static s32 SerialRuntime_AddParentFlag(s32 status)
struct SerialRuntime gSerialRuntime
volatile u8 gSerialBlockSequence
volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime....
volatile u16 gSerialReceivedSize
volatile: tagged where it steers, in BattleLink_ReceiveActions (tbs battle.c) and LinkLobby_ReceivePa...
u16 gSerialExchangeActive
static __inline__ void SerialRuntime_ResetTransferState(void)
u8 gSerialPeerPayloads[4][24]
struct SerialTransferState gSerialTransfer
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
A link cable packet: its sequence number, the consoles not yet heard from, its checksum and a 24-byte...
u16 checksum
The complement of the sum of the packet's first 14 halfwords, taken with this field 0.
u8 sequence
SerialRuntime's sequence when the packet was built.
u8 reservedTail[4]
past the 14 halfwords sent; never written
u8 missingMask
The consoles heard from before but not this frame (receivedMask ^ currentMask); a receiver complement...
The link cable's runtime: its mode and phase, the consoles heard from, the send position and the pack...
u8 storage[0x100]
The buffers' memory: two 32-byte send buffers, then 96 bytes a console for its incoming,...
u8 mode
SIOCNT's bits 7 and 3 when this console armed timer 3 to clock the transfers: 8 then,...
u16 * readyBuffer[4]
Each console's last complete packet, swapped in by the interrupt.
u16 * sendBuffer[2]
The packet being built ([0]) and the packet being sent ([1]).
u8 channelFlags[4]
Set by the interrupt for each console and cleared each frame.
s32 sendIndex
The halfword of sendBuffer[1] sent next; -1 between packets, when 0xfefe is sent and the two send buf...
s32 receiveIndex[2]
Each console's next halfword in its incomingBuffer; -1 after an idle 0xfefe.
u8 transferEnabled
Nonzero lets a new packet restart timer 3.
u8 phase
0 looking for the partner, 1 connected
u16 * incomingBuffer[4]
Each console's packet being received; two are used.
u8 currentMask
the consoles heard from this frame
u8 reserved0c[8]
not named by TBS code
u8 reserved20[8]
not named by TBS code
u8 reserved0a
not named by TBS code
u8 sequence
The packet sequence number, counted up each frame once connected.
u16 * pendingBuffer[4]
The packets the frame code checks and copies, swapped with readyBuffer each frame.
u8 isParent
SIOCNT's bit 6, copied by each transfer interrupt; nonzero adds 0x1000 to the link status.
u8 receivedMask
the consoles heard from since the link began
A console's block transfer state, exchanged with the partner each VBlank: its block sequence,...
u8 peerFlags
The send state: 1 a block with more to follow, 2 the last block, 0 idle.
u8 flags
The receive state: 1 receiving, 2 the last block taken, 0 idle.
u8 status
0x80 sending or 0x81 receiving when started; the receiver counts blocks (status + 1,...
u8 payload[20]
one block of the data sent
u8 active
The sequence number of the block in payload; as receiver, the one it expects with bit 7 set to ask fo...
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
The serial data registers read as two words or four halfwords; no TBS code names this union.