coastline 0.0.4
Loading...
Searching...
No Matches
controller.h File Reference

The N64 PIF RAM formats of the controller commands, the buffers the commands go through, and the internal routines of the controllers and the Controller Pak. More...

#include <ultra64.h>
Include dependency graph for controller.h:

Go to the source code of this file.

Classes

struct  OSPifRam
 The 64 bytes of the PIF RAM. More...

Macros

#define CONT_CMD_REQUEST_STATUS   0
#define CONT_CMD_READ_BUTTON   1
#define CONT_CMD_READ_MEMPACK   2
#define CONT_CMD_WRITE_MEMPACK   3
#define CONT_CMD_RESET   0xFF
#define CONT_CMD_REQUEST_STATUS_TX   1
#define CONT_CMD_REQUEST_STATUS_RX   3
#define CONT_CMD_READ_BUTTON_TX   1
#define CONT_CMD_READ_BUTTON_RX   4
#define CONT_CMD_READ_MEMPACK_TX   3
#define CONT_CMD_READ_MEMPACK_RX   33
#define CONT_CMD_WRITE_MEMPACK_TX   35
#define CONT_CMD_WRITE_MEMPACK_RX   1
#define CONT_CMD_EXE   1
#define CONT_CMD_NOP   0xFF
#define CONT_CMD_END   0xFE
#define CHNL_ERR(format)
 The error bits of a channel, the top two bits of its receive size, as 0x0 to 0xC.
#define BLOCKSIZE   32
#define PFS_ONE_PAGE   8
#define PFS_ID_0AREA   1
#define PFS_ID_1AREA   3
#define PFS_ID_2AREA   4
#define PFS_ID_3AREA   6
#define PFS_LABEL_AREA   7
#define PFS_BANK_LAPPED_BY   0x400
#define PFS_MAX_BANKS   62
#define PFS_INODE_SIZE_PER_PAGE   128
#define DEF_DIR_PAGES   2
#define PFS_EOF   1
#define PFS_PAGE_NOT_USED   3
#define DIR_STATUS_OCCUPIED   0x02
 The bit of a directory entry that marks a file as written.
#define MOTOR_ADDRESS   0x600
 The address the motor of a Rumble Pak listens at.
#define ERRCK(fn)
 Return the result of a call unless it is 0.
#define SET_ACTIVEBANK_TO_ZERO
 Select bank 0 unless it is already active, returning any error.
#define CONT_CMD_READ_EEPROM   4
#define CONT_CMD_WRITE_EEPROM   5
#define CONT_CMD_READ_EEPROM_TX   2
#define CONT_CMD_READ_EEPROM_RX   8
#define CONT_CMD_WRITE_EEPROM_TX    10
#define CONT_CMD_WRITE_EEPROM_RX   1

Detailed Description

The N64 PIF RAM formats of the controller commands, the buffers the commands go through, and the internal routines of the controllers and the Controller Pak.

Macro Definition Documentation

◆ CONT_CMD_REQUEST_STATUS

#define CONT_CMD_REQUEST_STATUS   0

Request the type and status of a device.

◆ CONT_CMD_READ_BUTTON

#define CONT_CMD_READ_BUTTON   1

Read the buttons and the stick.

◆ CONT_CMD_READ_MEMPACK

#define CONT_CMD_READ_MEMPACK   2

Read a block of the Pak.

◆ CONT_CMD_WRITE_MEMPACK

#define CONT_CMD_WRITE_MEMPACK   3

Write a block of the Pak.

◆ CONT_CMD_RESET

#define CONT_CMD_RESET   0xFF

Reset the device.

◆ CONT_CMD_REQUEST_STATUS_TX

#define CONT_CMD_REQUEST_STATUS_TX   1

The bytes a status request sends.

◆ CONT_CMD_REQUEST_STATUS_RX

#define CONT_CMD_REQUEST_STATUS_RX   3

The bytes a status request receives.

◆ CONT_CMD_READ_BUTTON_TX

#define CONT_CMD_READ_BUTTON_TX   1

The bytes a button read sends.

◆ CONT_CMD_READ_BUTTON_RX

#define CONT_CMD_READ_BUTTON_RX   4

The bytes a button read receives.

◆ CONT_CMD_READ_MEMPACK_TX

#define CONT_CMD_READ_MEMPACK_TX   3

The bytes a Pak read sends.

◆ CONT_CMD_READ_MEMPACK_RX

#define CONT_CMD_READ_MEMPACK_RX   33

The bytes a Pak read receives: a block and its CRC.

◆ CONT_CMD_WRITE_MEMPACK_TX

#define CONT_CMD_WRITE_MEMPACK_TX   35

The bytes a Pak write sends: an address and a block.

◆ CONT_CMD_WRITE_MEMPACK_RX

#define CONT_CMD_WRITE_MEMPACK_RX   1

The bytes a Pak write receives: the CRC of the block.

◆ CONT_CMD_EXE

#define CONT_CMD_EXE   1

The flag that starts the commands of the PIF RAM.

◆ CONT_CMD_NOP

#define CONT_CMD_NOP   0xFF

A byte that skips to the next.

◆ CONT_CMD_END

#define CONT_CMD_END   0xFE

The end of the commands.

◆ CHNL_ERR

#define CHNL_ERR ( format)
Value:
(((format).rxsize & 0xC0) >> 4)

The error bits of a channel, the top two bits of its receive size, as 0x0 to 0xC.

◆ BLOCKSIZE

#define BLOCKSIZE   32

The bytes of a block.

◆ PFS_ONE_PAGE

#define PFS_ONE_PAGE   8

The blocks of a page.

◆ PFS_ID_0AREA

#define PFS_ID_0AREA   1

The block of the first copy of the identity.

◆ PFS_ID_1AREA

#define PFS_ID_1AREA   3

The block of the second copy of the identity.

◆ PFS_ID_2AREA

#define PFS_ID_2AREA   4

The block of the third copy of the identity.

◆ PFS_ID_3AREA

#define PFS_ID_3AREA   6

The block of the fourth copy of the identity.

◆ PFS_LABEL_AREA

#define PFS_LABEL_AREA   7

The block of the label.

◆ PFS_BANK_LAPPED_BY

#define PFS_BANK_LAPPED_BY   0x400

The blocks after which a bank wraps around.

◆ PFS_MAX_BANKS

#define PFS_MAX_BANKS   62

The most banks a Pak may have.

◆ PFS_INODE_SIZE_PER_PAGE

#define PFS_INODE_SIZE_PER_PAGE   128

The entries of a page of the page table.

◆ DEF_DIR_PAGES

#define DEF_DIR_PAGES   2

The pages of the directory.

◆ PFS_EOF

#define PFS_EOF   1

The last page of a file.

◆ PFS_PAGE_NOT_USED

#define PFS_PAGE_NOT_USED   3

A free page.

◆ DIR_STATUS_OCCUPIED

#define DIR_STATUS_OCCUPIED   0x02

The bit of a directory entry that marks a file as written.

◆ MOTOR_ADDRESS

#define MOTOR_ADDRESS   0x600

The address the motor of a Rumble Pak listens at.

◆ ERRCK

#define ERRCK ( fn)
Value:
ret = (fn); \
if (ret != 0) { \
return ret; \
}

Return the result of a call unless it is 0.

◆ SET_ACTIVEBANK_TO_ZERO

#define SET_ACTIVEBANK_TO_ZERO
Value:
if (pfs->activebank != 0) { \
pfs->activebank = 0; \
ERRCK(__osPfsSelectBank(pfs)); \
}

Select bank 0 unless it is already active, returning any error.

◆ CONT_CMD_READ_EEPROM

#define CONT_CMD_READ_EEPROM   4

Read a block of the EEPROM.

◆ CONT_CMD_WRITE_EEPROM

#define CONT_CMD_WRITE_EEPROM   5

Write a block of the EEPROM.

◆ CONT_CMD_READ_EEPROM_TX

#define CONT_CMD_READ_EEPROM_TX   2

The bytes a read sends: the command and the address.

◆ CONT_CMD_READ_EEPROM_RX

#define CONT_CMD_READ_EEPROM_RX   8

The bytes a read receives: a block.

◆ CONT_CMD_WRITE_EEPROM_TX

#define CONT_CMD_WRITE_EEPROM_TX    10

The bytes a write sends: the command, address, and \ block.

◆ CONT_CMD_WRITE_EEPROM_RX

#define CONT_CMD_WRITE_EEPROM_RX   1

The bytes a write receives: the status.