Alchemy
Loading...
Searching...
No Matches

serial_runtime.h File Reference

The link cable's runtime: serial packets, registers and transfer state. More...

Go to the source code of this file.

Data Structures

struct  SerialPacket
 A link cable packet: its sequence number, the consoles not yet heard from, its checksum and a 24-byte payload. More...
union  SerialDataRegisters
 The serial data registers read as two words or four halfwords; no TBS code names this union. More...
struct  SerialRuntime
 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...
struct  SerialTransferState
 A console's block transfer state, exchanged with the partner each VBlank: its block sequence, its status and flags, and a 20-byte block. More...

Macros

#define SERIAL_RUNTIME   (&gSerialRuntime)

Functions

 STATIC_ASSERT (sizeof(struct SerialPacket)==32)
 STATIC_ASSERT (offsetof(struct SerialPacket, sequence)==0)
 STATIC_ASSERT (offsetof(struct SerialPacket, missingMask)==1)
 STATIC_ASSERT (offsetof(struct SerialPacket, checksum)==2)
 STATIC_ASSERT (offsetof(struct SerialPacket, payload)==4)
 STATIC_ASSERT (offsetof(struct SerialPacket, reservedTail)==28)
 STATIC_ASSERT (sizeof(struct SerialRuntime)==0x160)
 STATIC_ASSERT (offsetof(struct SerialRuntime, mode)==0)
 STATIC_ASSERT (offsetof(struct SerialRuntime, transferEnabled)==8)
 STATIC_ASSERT (offsetof(struct SerialRuntime, sendIndex)==0x14)
 STATIC_ASSERT (offsetof(struct SerialRuntime, storage)==0x60)
 STATIC_ASSERT (sizeof(struct SerialTransferState)==24)
 STATIC_ASSERT (offsetof(struct SerialTransferState, active)==0)
 STATIC_ASSERT (offsetof(struct SerialTransferState, status)==1)
 STATIC_ASSERT (offsetof(struct SerialTransferState, flags)==2)
 STATIC_ASSERT (offsetof(struct SerialTransferState, peerFlags)==3)
 STATIC_ASSERT (offsetof(struct SerialTransferState, payload)==4)
static s32 SerialRuntime_AddParentFlag (s32 status)
static __inline__ void SerialRuntime_ResetTransferState (void)

Variables

struct SerialTransferState gSerialTransfer
struct SerialRuntime gSerialRuntime
u16 gSerialExchangeActive
s32 gSerialSendSource
volatile u16 gSerialSendSize
 volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime.c)
s32 gSerialReceiveDest
volatile u16 gSerialReceivedSize
 volatile: tagged where it steers, in BattleLink_ReceiveActions (tbs battle.c) and LinkLobby_ReceivePartyRecords (tbs lobby.c)
u8 gSerialPeerPayloads [4][24]
volatile u8 gSerialBlockSequence
 volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime.c)
u8 gLinkExchangeState
volatile u16 gLinkStatus
 Link status, updated by the VBlank exchange handler.

Detailed Description

The link cable's runtime: serial packets, registers and transfer state.

Definition in file serial_runtime.h.

Macro Definition Documentation

◆ SERIAL_RUNTIME

#define SERIAL_RUNTIME   (&gSerialRuntime)

Definition at line 115 of file serial_runtime.h.

Referenced by SerialRuntime_PrepareSendPacket().

Function Documentation

◆ STATIC_ASSERT() [1/17]

STATIC_ASSERT ( sizeof(struct SerialPacket) = =32)

◆ STATIC_ASSERT() [2/17]

STATIC_ASSERT ( offsetof(struct SerialPacket, sequence) = =0)

◆ STATIC_ASSERT() [3/17]

STATIC_ASSERT ( offsetof(struct SerialPacket, missingMask) = =1)

◆ STATIC_ASSERT() [4/17]

STATIC_ASSERT ( offsetof(struct SerialPacket, checksum) = =2)

◆ STATIC_ASSERT() [5/17]

STATIC_ASSERT ( offsetof(struct SerialPacket, payload) = =4)

◆ STATIC_ASSERT() [6/17]

STATIC_ASSERT ( offsetof(struct SerialPacket, reservedTail) = =28)

◆ STATIC_ASSERT() [7/17]

STATIC_ASSERT ( sizeof(struct SerialRuntime) = =0x160)

◆ STATIC_ASSERT() [8/17]

STATIC_ASSERT ( offsetof(struct SerialRuntime, mode) = =0)

◆ STATIC_ASSERT() [9/17]

STATIC_ASSERT ( offsetof(struct SerialRuntime, transferEnabled) = =8)

◆ STATIC_ASSERT() [10/17]

STATIC_ASSERT ( offsetof(struct SerialRuntime, sendIndex) = =0x14)

◆ STATIC_ASSERT() [11/17]

STATIC_ASSERT ( offsetof(struct SerialRuntime, storage) = =0x60)

◆ STATIC_ASSERT() [12/17]

STATIC_ASSERT ( sizeof(struct SerialTransferState) = =24)

◆ STATIC_ASSERT() [13/17]

STATIC_ASSERT ( offsetof(struct SerialTransferState, active) = =0)

◆ STATIC_ASSERT() [14/17]

STATIC_ASSERT ( offsetof(struct SerialTransferState, status) = =1)

◆ STATIC_ASSERT() [15/17]

STATIC_ASSERT ( offsetof(struct SerialTransferState, flags) = =2)

◆ STATIC_ASSERT() [16/17]

STATIC_ASSERT ( offsetof(struct SerialTransferState, peerFlags) = =3)

◆ STATIC_ASSERT() [17/17]

STATIC_ASSERT ( offsetof(struct SerialTransferState, payload) = =4)

◆ SerialRuntime_AddParentFlag()

s32 SerialRuntime_AddParentFlag ( s32 status)
inlinestatic

◆ SerialRuntime_ResetTransferState()

__inline__ void SerialRuntime_ResetTransferState ( void )
static

Variable Documentation

◆ gSerialTransfer

◆ gSerialRuntime

◆ gSerialExchangeActive

◆ gSerialSendSource

◆ gSerialSendSize

volatile u16 gSerialSendSize
extern

volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime.c)

Referenced by SerialRuntime_BeginSend(), SerialRuntime_Initialize(), SerialRuntime_ResetTransferState(), and SerialRuntime_StepBlockTransfer().

◆ gSerialReceiveDest

◆ gSerialReceivedSize

volatile u16 gSerialReceivedSize
extern

volatile: tagged where it steers, in BattleLink_ReceiveActions (tbs battle.c) and LinkLobby_ReceivePartyRecords (tbs lobby.c)

Referenced by BattlePresentation_AppendLinkedActions(), LinkLobby_ReceivePartyRecords(), SerialRuntime_BeginReceive(), SerialRuntime_Initialize(), SerialRuntime_ResetTransferState(), and SerialRuntime_StepBlockTransfer().

◆ gSerialPeerPayloads

u8 gSerialPeerPayloads[4][24]
extern

◆ gSerialBlockSequence

volatile u8 gSerialBlockSequence
extern

volatile: tagged where it steers, in SerialRuntime_StepBlockTransfer (tbs runtime.c)

Referenced by SerialRuntime_BeginReceive(), SerialRuntime_BeginSend(), and SerialRuntime_StepBlockTransfer().

◆ gLinkExchangeState

u8 gLinkExchangeState
extern

◆ gLinkStatus