Mario Kart 64
Loading...
Searching...
No Matches
hardware.h
Go to the documentation of this file.
1#ifndef _HARDWARE_H_
2#define _HARDWARE_H_
3
4#define HW_REG(reg, type) *(volatile type*) (uintptr_t) (reg | 0xa0000000)
5
6#define AI_DRAM_ADDR_REG 0x04500000
7#define AI_LEN_REG 0x04500004
8#define AI_CONTROL_REG 0x04500008
9#define AI_STATUS_REG 0x0450000C
10#define AI_STATUS_AI_FULL (1 << 31)
11#define AI_STATUS_AI_BUSY (1 << 30)
12#define AI_DACRATE_REG 0x04500010
13#define AI_BITRATE_REG 0x04500014
14
15#define VI_STATUS_REG 0x04400000
16#define VI_CONTROL_REG 0x04400000
17#define VI_ORIGIN_REG 0x04400004
18#define VI_DRAM_ADDR_REG 0x04400004
19#define VI_WIDTH_REG 0x04400008
20#define VI_H_WIDTH_REG 0x04400008
21#define VI_INTR_REG 0x0440000C
22#define VI_V_INTER_REG 0x0440000C
23#define VI_CURRENT_REG 0x04400010
24#define VI_V_CURRENT_LINE_REG 0x04400010
25#define VI_BURST_REG 0x04400014
26#define VI_TIMING_REG 0x04400014
27#define VI_V_SYNC_REG 0x04400018 // VI vertical sync
28#define VI_H_SYNC_REG 0x0440001C // VI horizontal sync
29#define VI_LEAP_REG 0x04400020 // VI horizontal sync leap
30#define VI_H_SYNC_LEAP_REG 0x04400020
31#define VI_H_START_REG 0x04400024 // VI horizontal video
32#define VI_H_VIDEO_REG 0x04400024
33#define VI_V_START_REG 0x04400028 // VI vertical video
34#define VI_V_VIDEO_REG 0x04400028
35#define VI_V_BURST_REG 0x0440002C // VI vertical burst
36#define VI_X_SCALE_REG 0x04400030 // VI x-scale
37#define VI_Y_SCALE_REG 0x04400034 // VI y-scale
38
39#define SP_IMEM_START 0x04001000
40#define SP_DMEM_START 0x04000000
41
42#define SP_MEM_ADDR_REG 0x04040000
43#define SP_DRAM_ADDR_REG 0x04040004
44#define SP_RD_LEN_REG 0x04040008
45#define SP_WR_LEN_REG 0x0404000C
46#define SP_STATUS_REG 0x04040010
47#define SP_PC_REG 0x04080000
48
49#define PI_DRAM_ADDR_REG 0x04600000 // PI DRAM address
50#define PI_CART_ADDR_REG 0x04600004 // PI pbus (cartridge) address
51#define PI_RD_LEN_REG 0x04600008 // PI read length
52#define PI_WR_LEN_REG 0x0460000C // PI write length
53#define PI_STATUS_REG 0x04600010 // PI status
54#define PI_BSD_DOM1_LAT_REG 0x04600014 // PI dom1 latency
55#define PI_DOMAIN1_REG 0x04600014
56#define PI_BSD_DOM1_PWD_REG 0x04600018 // PI dom1 pulse width
57#define PI_BSD_DOM1_PGS_REG 0x0460001C // PI dom1 page size
58#define PI_BSD_DOM1_RLS_REG 0x04600020 // PI dom1 release
59#define PI_BSD_DOM2_LAT_REG 0x04600024 // PI dom2 latency
60#define PI_DOMAIN2_REG 0x04600024
61#define PI_BSD_DOM2_PWD_REG 0x04600028 // PI dom2 pulse width
62#define PI_BSD_DOM2_PGS_REG 0x0460002C // PI dom2 page size
63#define PI_BSD_DOM2_RLS_REG 0x04600030 // PI dom2 release
64
65#define PI_STATUS_BUSY 0x1
66#define PI_STATUS_IOBUSY 0x2
67#define PI_STATUS_ERROR 0x3
68
69#define PI_STATUS_RESET_CONTROLLER 0x1
70#define PI_STATUS_CLEAR_INTR 0x2
71
72#define SI_DRAM_ADDR_REG 0x04800000
73#define SI_PIF_ADDR_RD64B_REG 0x04800004
74#define SI_PIF_ADDR_WR64B_REG 0x04800010
75#define SI_STATUS_REG 0x04800018
76
77#define SI_STATUS_DMA_BUSY 0x1
78#define SI_STATUS_IO_READ_BUSY 0x2
79#define SI_STATUS_DMA_ERROR 0x8
80#define SI_STATUS_INTERRUPT (1 << 12)
81
82#define MI_INIT_MODE_REG 0x04300000
83#define MI_MODE_REG MI_INIT_MODE_REG
84#define MI_VERSION_REG 0x04300004
85#define MI_INTR_REG 0x04300008
86#define MI_INTR_MASK_REG 0x0430000C
87
88// https://github.com/LuigiBlood/64dd/wiki/Registers
89#define ASIC_STATUS 0x05000508
90
91#define DATA_REQUEST 0x40000000
92#define C2_TRANSFER 0x10000000
93#define BUFFER_MANAGER_ERROR 0x08000000
94#define BUFFER_MANAGER_INTERRUPT 0x04000000
95#define MECHANIC_INTERRUPT 0x02000000
96#define DISK_PRESENT 0x01000000
97#define BUSY_STATE 0x00800000
98#define RESET_STATE 0x00400000
99#define MOTOR_NOT_SPINNING 0x00100000
100#define HEAD_RETRACTED 0x00080000
101#define WRITE_PROTECT_ERROR 0x00040000
102#define MECHANIC_ERROR 0x00020000
103#define DISK_CHANGE 0x00010000
104
105#define _64DD_PRESENT_MASK 0xFFFF
106
107// ro
108#define ASIC_BM_STATUS 0x05000510
109
110#define MICRO_STATUS 0x02000000
111#define C1_DOUBLE 0x00400000
112#define C1_SINGLE 0x00200000
113
114// wo
115#define ASIC_BM_CTL 0x05000510
116#define BUFFER_MANAGER_RESET 0x10000000
117#define MECHANIC_INTERRUPT_RESET 0x01000000
118/*- Start Buffer Manager (0x80000000)
119- Buffer Manager Mode (0x40000000)
120- BM Interrupt Mask (0x20000000)
121- Buffer Manager Reset (0x10000000)
122- Disable OR Check? (0x08000000)
123- Disable C1 Correction (0x04000000)
124- Block Transfer (0x02000000)
125- Mechanic Interrupt Reset (0x01000000)*/
126#endif