libdragon
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
joybus.h File Reference

Joybus Subsystem. More...

Go to the source code of this file.

Macros

#define JOYBUS_PORT_COUNT   5
 Count of Joybus ports.
 
#define joybus_exec_cmd_struct(port, cmd)
 Execute a Joybus command struct synchronously.
 
Joybus payload sizes

#define JOYBUS_BLOCK_SIZE   64
 Size of a Joybus input/output block in bytes.
 
#define JOYBUS_BLOCK_DWORDS   ( JOYBUS_BLOCK_SIZE / sizeof(uint64_t) )
 Size of a Joybus input/output block in double-words.
 
#define JOYBUS_ACCESSORY_DATA_SIZE   32
 Size of a Joybus N64 accessory read/write payload in bytes.
 
Joybus identifier values

#define JOYBUS_IDENTIFIER_UNKNOWN   0x0000
 Joybus identifier for an unknown or malfunctioning device.
 
#define JOYBUS_IDENTIFIER_NONE   0xFFFF
 Joybus identifier for a port with no device connected.
 
#define JOYBUS_IDENTIFIER_N64_VOICE_RECOGNITION   0x0001
 Joybus identifier for the Nintendo 64 voice recognition peripheral (NUS-020).
 
#define JOYBUS_IDENTIFIER_N64_RANDNET_KEYBOARD   0x0002
 Joybus identifier for the Nintendo 64 Randnet keyboard peripheral (RND-001).
 
#define JOYBUS_IDENTIFIER_64GB_LINK_CABLE   0x0003
 Joybus identifier for the unreleased 64GB Link Cable.
 
#define JOYBUS_IDENTIFIER_GBA_LINK_CABLE   0x0004
 Joybus identifier for a Game Boy Advance Link Cable (DOL-011).
 
#define JOYBUS_IDENTIFIER_CART_RTC   0x0010
 Joybus identifier for cartridge-based real-time clock.
 
#define JOYBUS_IDENTIFIER_CART_EEPROM_4KBIT   0x0080
 Joybus identifier for cartridge-based 4Kbit EEPROM save type.
 
#define JOYBUS_IDENTIFIER_CART_EEPROM_16KBIT   0x00C0
 Joybus identifier for cartridge-based 16Kbit EEPROM save type.
 
#define JOYBUS_IDENTIFIER_N64_CONTROLLER   0x0500
 Joybus identifier for a standard Nintendo 64 controller (NUS-005).
 
#define JOYBUS_IDENTIFIER_N64_MOUSE   0x0200
 Joybus identifier for the Nintendo 64 mouse peripheral (NUS-017).
 
Joybus identifier bitfield for GameCube peripherals

Note that for GameCube peripherals, the Joybus identifier is interpreted as a bitfield rather than a single value.

In particular, Wavebird controllers will return a different identifiers depending on wireless state.

To identify a device that acts like a standard GameCube controller, check the JOYBUS_IDENTIFIER_MASK_PLATFORM and the JOYBUS_IDENTIFIER_MASK_GCN_CONTROLLER values.

#define JOYBUS_IDENTIFIER_MASK_PLATFORM   0x1800
 Joybus identifier platform bitfield mask.
 
#define JOYBUS_IDENTIFIER_PLATFORM_GCN   0x0800
 GameCube Joybus identifier platform value.
 
#define JOYBUS_IDENTIFIER_MASK_GCN_CONTROLLER   0x0100
 Joybus identifier GameCube standard controller flag.
 
#define JOYBUS_IDENTIFIER_MASK_GCN_NORUMBLE   0x2000
 Joybus identifier GameCube rumble support flag.
 
#define JOYBUS_IDENTIFIER_MASK_GCN_WIRELESS   0x8000
 Joybus identifier GameCube wireless flag.
 
Joybus identify status values

#define JOYBUS_IDENTIFY_STATUS_ACCESSORY_MASK   0x03
 Joybus identify status byte mask for N64 accessory presence values.
 
#define JOYBUS_IDENTIFY_STATUS_ACCESSORY_UNSUPPORTED   0x00
 Joybus identify status for an N64 controller that does not support accessories.
 
#define JOYBUS_IDENTIFY_STATUS_ACCESSORY_PRESENT   0x01
 Joybus identify status for an N64 controller with an accessory present.
 
#define JOYBUS_IDENTIFY_STATUS_ACCESSORY_ABSENT   0x02
 Joybus identify status for an N64 controller with no accessory present.
 
#define JOYBUS_IDENTIFY_STATUS_ACCESSORY_CHANGED   0x03
 Joybus identify status for an N64 controller with an accessory present that has changed since it was last identified.
 
#define JOYBUS_IDENTIFY_STATUS_VOICE_RECOGNITON_READY   0x01
 Joybus identify status bit for a VRU/VRS that is initialized and ready.
 
#define JOYBUS_IDENTIFY_STATUS_COMMAND_CHECKSUM_ERROR   0x04
 Joybus identify status bit that signifies the previous accessory command had a checksum error.
 
#define JOYBUS_IDENTIFY_STATUS_GCN_RUMBLE_ACTIVE   0x08
 Joybus identify status bit for GameCube controllers that indicates whether the rumble motor is currently active.
 
#define JOYBUS_IDENTIFY_STATUS_EEPROM_BUSY   0x80
 Joybus identify status bit for EEPROM devices that indicates a write is in-progress.
 

Typedefs

typedef uint16_t joybus_identifier_t
 Joypad Identifier type.
 
typedef void(* joybus_callback_t) (uint64_t *out_dwords, void *ctx)
 Callback function signature for joybus_exec_async.
 

Functions

void joybus_exec_async (const void *input, joybus_callback_t callback, void *ctx)
 Execute an asynchronous joybus message.
 
void joybus_exec (const void *input, void *output)
 Write a 64-byte block of data to the PIF and read the 64-byte result.
 
void joybus_exec_cmd (int port, size_t send_len, size_t recv_len, const void *send_data, void *recv_data)
 Execute a Joybus command synchronously on the given port.
 

Detailed Description

Joybus Subsystem.

Author
Christopher Bonhage me@ch.nosp@m.rist.nosp@m.opher.nosp@m.bonh.nosp@m.age.c.nosp@m.om