libdragon
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
joybus_accessory_internal.h File Reference

Joybus accessory internal utilities. More...

Go to the source code of this file.

Data Structures

union  joybus_transfer_pak_status_t
 Joybus N64 Transfer Pak Status wrapper. More...
 

Macros

#define JOYBUS_ACCESSORY_TRANSFER_BANK_SIZE   0x4000
 Size of Transfer Pak bank area in bytes.
 
#define JOYBUS_ACCESSORY_TRANSFER_BANK_MASK   0x3FFF
 Mask for Transfer Pak bank area address.
 
Joybus N64 accessory address masks

#define JOYBUS_ACCESSORY_ADDR_MASK_OFFSET   0xFFE0
 Mask for Joybus N64 accessory read/write address offset.
 
#define JOYBUS_ACCESSORY_ADDR_MASK_CHECKSUM   0x001F
 Mask for Joybus N64 accessory read/write address checksum.
 
Joybus N64 accessory known address values

#define JOYBUS_ACCESSORY_ADDR_LABEL   0x0000
 Controller Pak label address.
 
#define JOYBUS_ACCESSORY_ADDR_PROBE   0x8000
 Accessory probe address.
 
#define JOYBUS_ACCESSORY_ADDR_RUMBLE_MOTOR   0xC000
 Rumble Pak motor control address.
 
#define JOYBUS_ACCESSORY_ADDR_BIO_PULSE   0xC000
 Bio Sensor pulse read address.
 
#define JOYBUS_ACCESSORY_ADDR_SNAP_STATE   0xC000
 Pokemon Snap Station state address.
 
#define JOYBUS_ACCESSORY_ADDR_TRANSFER_BANK   0xA000
 Transfer Pak bank selection address.
 
#define JOYBUS_ACCESSORY_ADDR_TRANSFER_STATUS   0xB000
 Transfer Pak status registers address.
 
#define JOYBUS_ACCESSORY_ADDR_TRANSFER_CART   0xC000
 Transfer Pak GB cartridge read/write address.
 
Joybus N64 accessory probe values

#define JOYBUS_ACCESSORY_PROBE_ABSENT   0x00
 Absent accessory identifier value.
 
#define JOYBUS_ACCESSORY_PROBE_RUMBLE_PAK   0x80
 Rumble Pak identifier value.
 
#define JOYBUS_ACCESSORY_PROBE_BIO_SENSOR   0x81
 Bio Sensor identifier value.
 
#define JOYBUS_ACCESSORY_PROBE_TRANSFER_PAK_ON   0x84
 Transfer Pak power-on identifier value.
 
#define JOYBUS_ACCESSORY_PROBE_SNAP_STATION   0x85
 Pokemon Snap Station identifier value.
 
#define JOYBUS_ACCESSORY_PROBE_TRANSFER_PAK_OFF   0xFE
 Transfer Pak power-off identifier value.
 
Joybus N64 Snap Station state values

#define JOYBUS_SNAP_STATION_STATE_IDLE   0x00
 Snap Station "Idle" state.
 
#define JOYBUS_SNAP_STATION_STATE_PRE_SAVE   0xCC
 Snap Station "Pre-Save" state.
 
#define JOYBUS_SNAP_STATION_STATE_POST_SAVE   0x33
 Snap Station "Post-Save" state.
 
#define JOYBUS_SNAP_STATION_STATE_RESET_CONSOLE   0x5A
 Snap Station "Reset Console" state.
 
#define JOYBUS_SNAP_STATION_STATE_PRE_ROLL   0x01
 Snap Station "Pre-Roll" state.
 
#define JOYBUS_SNAP_STATION_STATE_CAPTURE_PHOTO   0x02
 Snap Station "Capture Photo" state.
 
#define JOYBUS_SNAP_STATION_STATE_POST_ROLL   0x04
 Snap Station "Post-Roll" state.
 
#define JOYBUS_SNAP_STATION_STATE_BUSY   0x08
 Snap Station "Busy" state.
 
Joybus N64 Transfer Pak status flags

#define JOYBUS_TRANSFER_PAK_STATUS_ACCESS   (1<<0)
 Transfer Pak "Access" status bit.
 
#define JOYBUS_TRANSFER_PAK_STATUS_BOOTING   (1<<2)
 Transfer Pak "Booting" status bit.
 
#define JOYBUS_TRANSFER_PAK_STATUS_RESET   (1<<3)
 Transfer Pak "Reset" status bit.
 
#define JOYBUS_TRANSFER_PAK_STATUS_CART_PULLED   (1<<6)
 Transfer Pak "Cart Pulled" status bit.
 
#define JOYBUS_TRANSFER_PAK_STATUS_POWER   (1<<7)
 Transfer Pak "Powered-On" status bit.
 

Functions

uint16_t joybus_accessory_calculate_addr_checksum (uint16_t addr)
 Applies the checksum to a Joybus N64 accessory read/write address.
 
uint8_t joybus_accessory_calculate_data_crc (const uint8_t *data)
 Calculates the CRC8 checksum for a Joybus N64 accessory read/write data block.
 
joybus_accessory_io_status_t joybus_accessory_compare_data_crc (const uint8_t *data, uint8_t data_crc)
 Calculates the CRC8 checksum for an accessory read/write data block and compares it against the provided checksum.
 
void joybus_accessory_read_async (int port, uint16_t addr, joybus_callback_t callback, void *ctx)
 Asynchronously perform a Joybus N64 accessory read command.
 
void joybus_accessory_write_async (int port, uint16_t addr, const uint8_t *data, joybus_callback_t callback, void *ctx)
 Asynchronously perform a Joybus N64 accessory write command.
 

Detailed Description

Joybus accessory internal utilities.

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