#define ID_VERSION_STATUS_REQ 0x0012 // not defined in SDK header
#define ID_SYSTEM_STATUS_REQ 0x0013
#define ID_SLOT_STATUS_REQ 0x0014 // not defined in SDK header
#define ID_CONFIG_STATUS_REQ 0x0015 // not defined in SDK header
#define ID_GAME_CONFIG_REQ 0x0016
#define ID_SYSTEM_CONFIG_REQ 0x0017
#define ID_SC_START_REQ 0x0019
#define ID_SC_POLL_REQ 0x001a
#define ID_SC_END_REQ 0x001b
#define ID_SP_START_REQ 0x001c
#define ID_SP_POLL_REQ 0x001d
#define ID_SP_END_REQ 0x001e
#define ID_CP_START_REQ 0x001f
#define ID_CP_POLL_REQ 0x0020
#define ID_CP_END_REQ 0x0021
#define ID_DATA_TX_REQ 0x0024
#define ID_DATA_TX_AND_CHANGE_REQ 0x0025
#define ID_DATA_RX_REQ 0x0026
#define ID_MS_CHANGE_REQ 0x0027 // When returned by the REQ callback, this ID indicates that execution of rfu_REQ_changeMasterSlave has finished.
// This ID is returned by both the REQ callback and the MSC callback.
// When returned by the MSC callback, this is notification that after the AGB has been made into the clock slave, the MC_Timer expired and the RFU returned the AGB to be the clock master.
#define ID_DISCONNECT_REQ 0x0030
#define ID_TEST_MODE_REQ 0x0031 // not defined in SDK header
#define ID_CPR_START_REQ 0x0032
#define ID_CPR_POLL_REQ 0x0033
#define ID_CPR_END_REQ 0x0034
#define ID_UNK35_REQ 0x0035 // not defined in SDK header
#define ID_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA_REQ 0x00ff // When the AGB is the clock slave, the RFU generates an informational notice, and an automatically started DMA, such as HDMA, is generated at the instant the AGB is being returned as the clock master. This ID is notified by a REQ callback when the exchange of this information (REQ command) fails.
#define RFU_API_BUFF_SIZE_RAM 0x0e64 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM)
#define RFU_API_BUFF_SIZE_ROM 0x0504 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM)
// #define RC_STATUS_SEARCHING_PARENT 0x02 // Searching for parent device
// #define RC_STATUS_UNKNOWN 0xff // Cannot read status due to REQ-API execution error
// Value of u8 *linkLossReason argument for rfu_REQBN_watchLink (Reason for Link Loss)
#define REASON_DISCONNECTED 0x00 // State of complete disconnection with rfuLL_disconnect and no possibility of restoring the link (can detect only child device)
#define REASON_LINK_LOSS 0x01 // State of link loss that allows for the possibility for the link to be restored
// Error codes returned by u16 REQ_result with a REQ callback when a REQ-API function is executed
#define ERR_REQ_CMD 0x0000
#define ERR_REQ_CMD_CLOCK_DRIFT (ERR_REQ_CMD | 0x0001) // Clock drift occurs when a REQ command is sent
#define ERR_REQ_CMD_SENDING (ERR_REQ_CMD | 0x0002) // The next command cannot be issued because a REQ command is being sent
#define ERR_REQ_CMD_ACK_REJECTION (ERR_REQ_CMD | 0x0003) // The REQ command was refused when issued
#define ERR_REQ_CMD_CLOCK_SLAVE (ERR_REQ_CMD | 0x0004) // Issuing the REQ command was attempted but failed because the AGB is the clock slave
#define ERR_REQ_CMD_IME_DISABLE (ERR_REQ_CMD | 0x0006) // Issuing the REQ command was attempted but failed because the IME register is 0
#define ERR_PID_NOT_FOUND 0x0100 // The specified PID does not exist in the gRfuLinkStatus->partner[0-3].id list
// Error code returned by the return value of rfu_initializeAPI
#define ERR_RFU_API_BUFF_SIZE 0x0001
#define ERR_RFU_API_BUFF_ADR 0x0002
// Error codes returned by return values for rfu_REQBN_softReset_and_checkID
#define ERR_ID_CHECK_IME_DISABLE 0xffffffff // ID check could not be executed because REG_IME=0 when executing rfu_REQBN_softReset_and_checkID
// Error codes returned by rfu_getConnectParentStatus and rfu_CHILD_getConnectRecoveryStatus
#define ERR_REQ_CMD_ID (ERR_REQ_CMD | 0x0010) // A required REQ command was not executed within this function execution
// Error codes returned by rfu_NI_setSendData, rfu_UNI_setSendData, and rfu_NI_CHILD_setSendGameName
#define ERR_MODE 0x0300
#define ERR_MODE_NOT_PARENT (ERR_MODE | 0x0000) // not in SDK
#define ERR_MODE_NOT_CONNECTED (ERR_MODE | 0x0001) // RFU is not in connection mode (parent or child)
#define ERR_SLOT 0x0400
#define ERR_SLOT_NO (ERR_SLOT | 0x0000) // The specified slot number is not right
#define ERR_SLOT_NOT_CONNECTED (ERR_SLOT | 0x0001) // The specified slot is not connected
#define ERR_SLOT_BUSY (ERR_SLOT | 0x0002) // The specified slot is already communicating
#define ERR_SLOT_NOT_SENDING (ERR_SLOT | 0x0003) // The specified slot is not currently sending (Note: This is returned by rfu_UNI_re_setSendData)
#define ERR_SLOT_TARGET (ERR_SLOT | 0x0004) // The specified target slot is not right
#define ERR_SUBFRAME_SIZE 0x0500 // The specified subframe size is either larger than the remaining communication frame size or smaller than the link layer subframe header size
// Error code returned by rfu_clearSlot, rfu_setRecvBuffer, and rfu_changeSendTarget
#define ERR_COMM_TYPE 0x0600 // The specified communication format is not right
// Error code returned by rfu_REQ_recvData (when receiving NI-type or UNI-type data)
#define ERR_DATA_RECV 0x0700 // Error notification is issued in the following format.
// "ERR_DATA_RECV | (slot number issuing error with 0x0010<<UNI) | (slot number issuing error with 0x0001<<NI)"
// The actual error code is stored in gRfuSlotStatusNI or gRfuSlotStatusUNI[x]->recv.errorCode.
// Error code during NI-type communication (code entered into gRfuSlotStatusNI[x]->recv.errorCode)
#define ERR_RECV_BUFF_OVER (ERR_DATA_RECV | 0x0001) // The receive data size is larger than the receive buffer (Note: This error is used for both NI and UNI)
#define ERR_RECV_REPLY_SUBFRAME_SIZE (ERR_DATA_RECV | 0x0002) // All frames are already in use by other communications, and a subframe for reception response could not be secured
// Error code during UNI-type communication (code entered into gRfuSlotStatusUNI[x]->recv.errorCode)
#define ERR_RECV_DATA_OVERWRITED (ERR_DATA_RECV | 0x0008) // Received new data when gRfuSlotStatusUNI[x]->recv.newDataFlag=1
#define SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN (SLOT_RECV_FLAG | 0x008) // The data was received successful, but because the end of the communication was incomplete, whether the transmission side status is successful or failed is unknown
#define SLOT_STATE_RECV_IGNORE ( SLOT_RECV_FLAG | 0x009) // Ignore reception (refer to gRfuSlotStatusNI[x]->recv.errorCode for reason for ignoring)
// Status data for UNI-type communication (refer to gRfuSlotStatusUNI[x]->send.state)
u16failCounter;// Count of failed transmissions/receptions (Count is increased when transmission/reception of data does not succeed within 1PF=16.7 ms)
constu8*now_p[WINDOW_COUNT];// Address of current send/receive (The data is divided into WINDOW_COUNT blocks and sent in payloadSize units.)
u8bmSlot;// Expresses the current communication slot in bits
// (When sending from the Master, because multiple slaves can be specified with bmSlot, communications are terminated based on the failCounter for each child device)
// Parameters used inside the Library
u8recvAckFlag[WINDOW_COUNT];
u8ack;
u8phase;
u8n[WINDOW_COUNT];
// Parameters indicating the current communication content
constvoid*src;// Start address transmission data (valid only for transmitting device)
u8bmSlotOrg;// Expresses the communication source slot at the beginning of the transmission in bits (valid only for transmitting device)
u8dataType;// Transmission/reception data type (0: User data; 1: Game identification information)
u16payloadSize;// Payload size for one transmission
u32dataSize;// Size of transmission/reception data
// Calculated by subtracting link layer header size from subFrameSize specified by the rfu_NI_setSendData function
u8parentChild;// Connection status (0x01:MODE_PARENT 0x00:MODE_CHILD 0xff:MODE_NEUTRAL)
u8connCount;// Number of connections
u8connSlotFlag;// Flag to indicate in bits the connection slot (0x01<<Connection slot number)
u8linkLossSlotFlag;// Flag to indicate in bits the slot where the link loss was generated (")
u8sendSlotNIFlag;// Flag to indicate in bits the slot where NI-type send is occurring (")
u8recvSlotNIFlag;// Flag to indicate in bits the slot where NI-type receive is occurring (")
u8sendSlotUNIFlag;// Flag to indicate in bits the slot where UNI-type send is occurring (")
u8getNameFlag;// Parent: Flag to indicate whether or not game identification information was obtained from the child connected to this slot (")
// Child: Flag to indicate whether or not game identification information was sent to the parent connected to this slot (")
u8findParentCount;// Number of parent candidates discovered with rfu_REQ_xxxSearchParent, valid only with a child device
u8watchInterval;// Link monitor execution interval (16.7 ms unit AGB picture frame)
u8strength[RFU_CHILD_MAX];// Link strength value (0x00 - 0xff; 0x00 is link loss. Updates with rfu_REQBN_watchLink)
vu8LLFReadyFlag;// Indicates whether the link layer frame to send next has be constructed (Flag is on when calling rfu_constructLLFrame, flag is cleared when sending by rfu_REQ_sendData.)
u8remainLLFrameSizeParent;// Remaining size of the link layer communication frame for the parent device
u8remainLLFrameSizeChild[RFU_CHILD_MAX];// Remaining size of the link layer communication frame for each slot for child device
structRfuTgtDatapartner[RFU_CHILD_MAX];// Parent, Child: When there is a connection, the matrix element corresponding to the number of the connected slot
// stores the game identification information for the connection partner.
// Child: Stores the game identification information for the parent candidate discovered when executing rfu_REQ_xxxxSearchParent.
structRfuTgtDatamy;// The device's own game identification information (unrelated to the element slot value)
// Used only by parent device. At the beginning of a MSC Callback that received notification that the data transmission completed, an ACK flag is obtained.
u16rfu_UNI_PARENT_getDRAC_ACK(u8*ackFlag);
// Clear the flag that indicates newly arrived reception data
// Used only by child device. After establishing connection at the RFU level, configure transmission of child device game identification information in order to authenticate connection