Alchemy
Loading...
Searching...
No Matches

SerialRuntime Struct Reference

The link cable's runtime: its mode and phase, the consoles heard from, the send position and the packet buffers the interrupt handler fills. More...

#include <system/serial_runtime.h>

Data Fields

u8 mode
 SIOCNT's bits 7 and 3 when this console armed timer 3 to clock the transfers: 8 then, else 0; 8 adds 0x80 to the link status.
u8 phase
 0 looking for the partner, 1 connected
u8 receivedMask
 the consoles heard from since the link began
u8 currentMask
 the consoles heard from this frame
u8 channelFlags [4]
 Set by the interrupt for each console and cleared each frame.
u8 transferEnabled
 Nonzero lets a new packet restart timer 3.
u8 isParent
 SIOCNT's bit 6, copied by each transfer interrupt; nonzero adds 0x1000 to the link status.
u8 reserved0a
 not named by TBS code
u8 sequence
 The packet sequence number, counted up each frame once connected.
u8 reserved0c [8]
 not named by TBS code
s32 sendIndex
 The halfword of sendBuffer[1] sent next; -1 between packets, when 0xfefe is sent and the two send buffers swap.
s32 receiveIndex [2]
 Each console's next halfword in its incomingBuffer; -1 after an idle 0xfefe.
u8 reserved20 [8]
 not named by TBS code
u16 * sendBuffer [2]
 The packet being built ([0]) and the packet being sent ([1]).
u16 * incomingBuffer [4]
 Each console's packet being received; two are used.
u16 * readyBuffer [4]
 Each console's last complete packet, swapped in by the interrupt.
u16 * pendingBuffer [4]
 The packets the frame code checks and copies, swapped with readyBuffer each frame.
u8 storage [0x100]
 The buffers' memory: two 32-byte send buffers, then 96 bytes a console for its incoming, ready and pending packets.

Detailed Description

The link cable's runtime: its mode and phase, the consoles heard from, the send position and the packet buffers the interrupt handler fills.

Definition at line 46 of file serial_runtime.h.

Field Documentation

◆ mode

u8 SerialRuntime::mode

SIOCNT's bits 7 and 3 when this console armed timer 3 to clock the transfers: 8 then, else 0; 8 adds 0x80 to the link status.

Definition at line 49 of file serial_runtime.h.

Referenced by SerialRuntime_EnableTransferTimer(), SerialRuntime_ExchangePayloads(), SerialRuntime_PollAndTransfer(), SerialRuntime_PollStatus(), SerialRuntime_PrepareSendPacket(), and WaitFrames().

◆ phase

u8 SerialRuntime::phase

0 looking for the partner, 1 connected

Definition at line 50 of file serial_runtime.h.

Referenced by SerialRuntime_ExchangePayloads(), SerialRuntime_PollAndTransfer(), and SerialRuntime_PollStatus().

◆ receivedMask

u8 SerialRuntime::receivedMask

◆ currentMask

u8 SerialRuntime::currentMask

◆ channelFlags

u8 SerialRuntime::channelFlags[4]

Set by the interrupt for each console and cleared each frame.

bits: 1 heard while isParent was set | 0 a packet completed

Definition at line 55 of file serial_runtime.h.

Referenced by SerialRuntime_CollectReceivedPayloads().

◆ transferEnabled

u8 SerialRuntime::transferEnabled

Nonzero lets a new packet restart timer 3.

Definition at line 57 of file serial_runtime.h.

Referenced by SerialRuntime_DisableTransfer(), SerialRuntime_EnableTransferTimer(), SerialRuntime_PrepareSendPacket(), and WaitFrames().

◆ isParent

u8 SerialRuntime::isParent

SIOCNT's bit 6, copied by each transfer interrupt; nonzero adds 0x1000 to the link status.

Definition at line 60 of file serial_runtime.h.

Referenced by SerialRuntime_AddParentFlag(), and SerialRuntime_HandleTransferInterrupt().

◆ reserved0a

u8 SerialRuntime::reserved0a

not named by TBS code

Definition at line 61 of file serial_runtime.h.

◆ sequence

u8 SerialRuntime::sequence

The packet sequence number, counted up each frame once connected.

Definition at line 63 of file serial_runtime.h.

Referenced by SerialRuntime_ExchangePayloads(), SerialRuntime_PollAndTransfer(), SerialRuntime_PollStatus(), and SerialRuntime_PrepareSendPacket().

◆ reserved0c

u8 SerialRuntime::reserved0c[8]

not named by TBS code

Definition at line 64 of file serial_runtime.h.

◆ sendIndex

s32 SerialRuntime::sendIndex

The halfword of sendBuffer[1] sent next; -1 between packets, when 0xfefe is sent and the two send buffers swap.

Definition at line 67 of file serial_runtime.h.

Referenced by SerialRuntime_HandleTransferInterrupt(), SerialRuntime_Initialize(), SerialRuntime_PollAndTransfer(), SerialRuntime_PollStatus(), and SerialRuntime_PrepareSendPacket().

◆ receiveIndex

s32 SerialRuntime::receiveIndex[2]

Each console's next halfword in its incomingBuffer; -1 after an idle 0xfefe.

Definition at line 70 of file serial_runtime.h.

◆ reserved20

u8 SerialRuntime::reserved20[8]

not named by TBS code

Definition at line 71 of file serial_runtime.h.

◆ sendBuffer

u16* SerialRuntime::sendBuffer[2]

The packet being built ([0]) and the packet being sent ([1]).

Definition at line 73 of file serial_runtime.h.

Referenced by SerialRuntime_Initialize(), and SerialRuntime_PrepareSendPacket().

◆ incomingBuffer

u16* SerialRuntime::incomingBuffer[4]

Each console's packet being received; two are used.

Definition at line 75 of file serial_runtime.h.

Referenced by SerialRuntime_Initialize().

◆ readyBuffer

u16* SerialRuntime::readyBuffer[4]

Each console's last complete packet, swapped in by the interrupt.

Definition at line 77 of file serial_runtime.h.

Referenced by SerialRuntime_CollectReceivedPayloads(), and SerialRuntime_Initialize().

◆ pendingBuffer

u16* SerialRuntime::pendingBuffer[4]

The packets the frame code checks and copies, swapped with readyBuffer each frame.

Definition at line 80 of file serial_runtime.h.

Referenced by SerialRuntime_CollectReceivedPayloads(), and SerialRuntime_Initialize().

◆ storage

u8 SerialRuntime::storage[0x100]

The buffers' memory: two 32-byte send buffers, then 96 bytes a console for its incoming, ready and pending packets.

Definition at line 83 of file serial_runtime.h.

Referenced by SerialRuntime_Initialize().