Editing Hardware Registers
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
On the PSP, except interruptions, almost all the interaction with the hardware is done through memory accesses to "hardware registers" located at the 0xBC000000~0xBFFFFFFF range (actually 0x1C000000~0x1FFFFFFF to which we add the 0x4 uncached flag and the 0x8 kernel flag). Which is the reason why documenting this is vital to understand the PSP hardware. | |||
= 0xA7F00000: L2 cache = | = 0xA7F00000: L2 cache = | ||
Line 451: | Line 451: | ||
Bits 6-11 = UART 0-5 | Bits 6-11 = UART 0-5 | ||
Bits 12-15 = APB ( | Bits 12-15 = APB (?) 0-3 | ||
Bits 16-17 = Audio 0-1 | Bits 16-17 = Audio 0-1 | ||
Bits | Bits 19-21 = ? | ||
Bit 22 = SIRCS (?) | |||
Bit 22 = SIRCS ( | |||
Bit 23 = GPIO | Bit 23 = GPIO | ||
Line 498: | Line 492: | ||
| 0xBC100064 || 4 || RW || SPI clock select | | 0xBC100064 || 4 || RW || SPI clock select | ||
|- | |- | ||
| 0xBC100068 || 4 || RW || | | 0xBC100068 || 4 || RW || 0xF - PLL get/set out select (PLL frequency?) | ||
|- | |- | ||
| 0xBC100070 || 4 || RW || Set Avc power | | 0xBC100070 || 4 || RW || Set Avc power | ||
Line 506: | Line 498: | ||
| 0xBC100074 || 4 || RW || Unknown | | 0xBC100074 || 4 || RW || Unknown | ||
|- | |- | ||
| 0xBC100078 || 4 || RW || I/O enable | | 0xBC100078 || 4 || RW || I/O enable (?) (TODO: verify indices) | ||
Bit 0 = NAND | |||
Bit | Bit 1 = USB | ||
Bit 2 = ATA | |||
Bits 3-4 = Memstick Interface | |||
Bit | Bit 5 = LCDC | ||
Bit | Bit 6-7 = Audio | ||
Bit | Bit 8 = IIC | ||
Bit | Bit 9 = SIRCS | ||
Bit | Bit 10 = Audio? | ||
Bit | Bit 11 = KEY | ||
Bit 12 = PWM | |||
Bits | Bits 13-18 = UART | ||
Bits 19-24 = SPI | |||
|- | |- | ||
| 0xBC10007C || 4 || RW || Either GPIO pin enable, or GPIO pin direction | | 0xBC10007C || 4 || RW || Either GPIO pin enable, or GPIO pin direction | ||
Line 873: | Line 856: | ||
|- | |- | ||
|} | |} | ||
= 0xBC700000: ? = | |||
= 0xBC800000: DMACPlus = | = 0xBC800000: DMACPlus = | ||
Line 1,360: | Line 1,345: | ||
R bit 0x200: 1 = is at depth 2 of calls | R bit 0x200: 1 = is at depth 2 of calls | ||
|- | |- | ||
| 0xBD400104 || 4 || RW? || | | 0xBD400104 || 4 || RW? || Unknown (accessible through sceGeSet/GetReg() but unused) | ||
|- | |- | ||
| 0xBD400108 || 4 || RW || Address of the display list currently being run | | 0xBD400108 || 4 || RW || Address of the display list currently being run | ||
Line 1,384: | Line 1,369: | ||
| 0xBD400300 || 4 || RW || Unknown (accessible through sceGeSet/GetReg() but unused) | | 0xBD400300 || 4 || RW || Unknown (accessible through sceGeSet/GetReg() but unused) | ||
|- | |- | ||
| 0xBD400304 || 4 || | | 0xBD400304 || 4 || R || Current interrupt status? | ||
|- | |- | ||
| 0xBD400308 || 4 || RW || | | 0xBD400308 || 4 || RW || Currently accepted interrupts? (1 = SIGNAL, 2 = END, 4 = FINISH, 8 = ERROR) | ||
|- | |- | ||
| 0xBD40030C || 4 || W || | | 0xBD40030C || 4 || W? || Set to the value of 0xBD400308 on init & reset | ||
|- | |- | ||
| 0xBD400310 || 4 || W || | | 0xBD400310 || 4 || W? || Set current interrupt status? Set to the value of 0xBD400308 on init & reset | ||
|- | |- | ||
| 0xBD400400 || 4 || RW || Set to 4 when the used edram size is 0x00200000 and 2 when it's 0x00400000 (!) | | 0xBD400400 || 4 || RW || Set to 4 when the used edram size is 0x00200000 and 2 when it's 0x00400000 (!) | ||
Line 1,444: | Line 1,429: | ||
= 0xBD600000: ATA/UMD = | = 0xBD600000: ATA/UMD = | ||
= 0xBD700000: ATA/UMD = | |||
= 0xBD800000: USB = | |||
= 0xBDE00000: KIRK = | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,452: | Line 1,443: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0xBDE00000 || 4 || R || KIRK signature 'KIRK' (or 1?) | ||
|- | |- | ||
| | | 0xBDE00004 || 4 || R || KIRK version '0010' (or 1?) | ||
|- | |- | ||
| | | 0xBDE00008 || 4 || RW || Set to 1 on error by the command subroutine | ||
|- | |- | ||
| | | 0xBDE0000C || 4 || RW || Set to 1 to start processing | ||
|- | |- | ||
| | | 0xBDE00010 || 4 || RW || KIRK command | ||
= | 0x01 = Private decrypt | ||
0x02 = Encrypt (type2) | |||
0x03 = Decrypt (type2) | |||
0x04 = Encrypt (type3) (IV = 0) | |||
0x05 = Encrypt (type3) (IV = Fuse) | |||
0x06 = Encrypt (type3) (IV = User) | |||
0x07 = Decrypt (type3) (IV = 0) | |||
0x08 = Decrypt (type3) (IV = Fuse) | |||
0x09 = Decrypt (type3) (IV = User) | |||
0x0A = Private Signature Check | |||
0x0B = SHA-1 Hash | |||
0x0C = ECDSA Key Generate | |||
0x0D = ECDSA Point Multiply | |||
0x0E = Pseudo-random Number Generator | |||
0x0F = PRNG Seed? Init? | |||
0x10 = ECDSA Sign | |||
0x11 = ECDSA Signature Check | |||
|- | |||
| 0xBDE00014 || 4 || RW || Result of the command | |||
|- | |||
| 0xBDE00018 || 4 || RW || Unknown | |||
|- | |||
| 0xBDE0001C || 4 || RW || KIRK status | |||
Bit 0 = phase finish | |||
Bit 1 = phase error? | |||
Bit 4 = phase 2 needed | |||
Bit 5 = ? (phase 1 error maybe?) | |||
This should be used for checking processing status, and will notify when the processing has finished. | |||
All bits are 0 while execution is still in progress. | |||
If the command has two phases, Phase 2 Needed will be set when Phase Finish gets set. | |||
Bit1 and bit5 are not well known, but it seems that bit1 is Error for Phase 1, and Success for Phase 2? Bit5 is only checked for Phase 1, and leads to the same error codepath as bit1. | |||
|- | |||
| 0xBDE00020 || 4 || RW || Unknown | |||
|- | |||
| 0xBDE00024 || 4 || RW || Unknown | |||
|- | |||
| 0xBDE00028 || 4 || RW || Set to the value of 0xBDE0001C at the end of the command subroutine | |||
|- | |||
| 0xBDE0002C || 4 || RW || KIRK source buffer (physical address) | |||
|- | |||
| 0xBDE00030 || 4 || RW || KIRK destination buffer (physical address) | |||
|- | |- | ||
| | | 0xBDE0004C || 4 || RW || Unknown | ||
|- | |- | ||
| | | 0xBDE00050 || 4 || RW || Unknown | ||
|- | |- | ||
|} | |} | ||
= | = 0xBDF00000: UMD? = | ||
= 0xBE000000: Audio = | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,557: | Line 1,533: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0xBE000000 || 4 || W? || Audio init/reset? | ||
|- | |||
| 0xBE000004 || 4 || W? || Enable audio input/output? | |||
Bit | Bit 0: enable output | ||
Bit | Bit 1: enable SRC output (?) | ||
Bit 2: enable audio input | |||
Bit | Bit 3: ?? | ||
|- | |- | ||
| | | 0xBE000008 || 4 || W? || Same as 0xBE000004 but with reversed bits; maybe stop/empty buffer? | ||
|- | |- | ||
| | | 0xBE00000C || 4 || R? || Seems to contain the current value for 0xBE000004 (ie the current enabled input/outputs) | ||
|- | |- | ||
| | | 0xBE000010 || 4 || W? || Similar to 0xBE000004 but set only when starting playing something, and input bit is set only for loopback test? | ||
|- | |- | ||
| | | 0xBE000014 || 4 || W? || Unknown, set to 0x1208 = 4616 during initialization | ||
|- | |- | ||
| | | 0xBE000018 || 4 || W? || Unknown, set to 0 during initialization | ||
|- | |- | ||
| | | 0xBE00001C || 4 || R? || Similar to 0xBE000004; possibly bits which finished execution? | ||
|- | |- | ||
| | | 0xBE000020 || 4 || W? || Another similar set of flags | ||
|- | |- | ||
| | | 0xBE000024 || 4 || W? || Another similar set of flags | ||
|- | |- | ||
| | | 0xBE000028 || 4 || W? || Another similar set of flags | ||
|- | |- | ||
| | | 0xBE00002C || 4 || W? || Another similar set of flags | ||
|- | |- | ||
| | | 0xBE000038 || 4 || W? || Set to 256 when frequency in 48kHz, 128 when it is 44.1kHz or during SRC output | ||
|- | |- | ||
| | | 0xBE00003C || 4 || W? || Same as above, but not set at initialization time | ||
|- | |- | ||
| | | 0xBE000040 || 4 || RW || Frequency-related?? | ||
|- | |- | ||
| | | 0xBE000044 || 4 || W? || Frequency-related?? | ||
|- | |- | ||
| | | 0xBE000050 || 4 || RW || Volume? | ||
|- | |- | ||
| | | 0xBE000060 || 4 || ? || ?? | ||
|- | |||
| 0xBE000070 || 4 || ? || ?? | |||
|- | |||
| 0xBE000080 || 4 || ? || ?? | |||
|- | |- | ||
| | | 0xBE0000D0 || 4 || ? || ?? | ||
|- | |- | ||
| | |} | ||
= 0xBE100000: MagicGate hardware for memory stick? = | |||
= 0xBE140000: LCDC = | |||
{| class="wikitable" | |||
|- | |- | ||
! Address | |||
! Size | |||
! Read/write | |||
! Description | |||
|- | |- | ||
| | | 0xBE140000 || 4 || RW || First LCDC controller enable | ||
Bits 0-1 = 3 to enable first LCDC controller (tachyon version < 0x800000; otherwise it's set to 0) | |||
|- | |- | ||
| | | 0xBE140004 || 4 || RW || Synchronization difference: (xsync / zoom) - ysync | ||
|- | |- | ||
| | | 0xBE140008 || 4 || RW || Unknown (fourth argument of sceLcdcCheckMode and sceLcdcSetMode) | ||
|- | |- | ||
| | | 0xBE140010 || 4 || RW || X back porch | ||
|- | |- | ||
| | | 0xBE140014 || 4 || RW || X sync width | ||
|- | |- | ||
| | | 0xBE140018 || 4 || RW || X front porch | ||
|- | |- | ||
| | | 0xBE14001C || 4 || RW || X resolution | ||
|- | |- | ||
| | | 0xBE140020 || 4 || RW || Y back porch | ||
|- | |- | ||
| | | 0xBE140024 || 4 || RW || Y sync width | ||
|- | |- | ||
| 0xBE140028 || 4 || RW || Y front porch | |||
|- | |- | ||
| | | 0xBE14002C || 4 || RW || Y resolution | ||
|- | |- | ||
| | | 0xBE140030 || 4 || R || HPC (?), returned by sceLcdcReadHPC() | ||
|- | |- | ||
| | | 0xBE140034 || 4 || R || VPC (?), returned by sceLcdcReadVPC() | ||
|- | |- | ||
| | | 0xBE140040 || 4 || RW || Y shift (between hardware & software resolution) | ||
|- | |- | ||
| | | 0xBE140044 || 4 || RW || X shift (between hardware & software resolution) | ||
|- | |- | ||
| | | 0xBE140048 || 4 || RW || Scaled X resolution | ||
|- | |- | ||
| | | 0xBE14004C || 4 || RW || Scaled Y resolution (same as the physical Y resolution) | ||
|- | |- | ||
| | | 0xBE140050 || 4 || RW || Unknown, set to 1, maybe used by sceLcdcReadUnderflow (to be verified) | ||
|- | |- | ||
| | | 0xBE140070 || 4 || W || Set to 1 when running sceLcdcResume() or sceLcdcInit() on tachyon version >= 0x5000000 | ||
|- | |- | ||
|} | |} | ||
= | The exact same registers are at 0xBE1401.., these ones being used for tachyon version >= 0x8000000 (PSP Go?). <br> | ||
These registers are only set on tachyo version >= 0x8000000: | |||
= | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,687: | Line 1,648: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0xBE140180 || 4 || RW || Always set to 1 when 0xBE140184 - 0xBE140198 are used | ||
|- | |- | ||
| | | 0xBE140184 || 4 || RW || Scaled X resolution (read instead of the (real) X resolution above when enabled) | ||
|- | |- | ||
| | | 0xBE140188 || 4 || RW || Y resolution (read instead of the (real) Y resolution above when enabled) | ||
|- | |- | ||
| | | 0xBE14018C || 4 || RW || Unknown (0x580 - 0x678) | ||
|- | |- | ||
| | | 0xBE140190 || 4 || RW || Unknown (0x4C4 - 0x71C) | ||
|- | |- | ||
| | | 0xBE140194 || 4 || RW || Unknown (0xAFC - 0xCEC) | ||
|- | |- | ||
| | | 0xBE140198 || 4 || RW || Unknown (0x910 - 0xE38) | ||
|- | |- | ||
| | | 0xBE140200 || 4 || W || Set to 1 on initialization | ||
|- | |- | ||
|} | |} | ||
= | = 0xBE200000: I2c = | ||
= 0xBE240000: GPIO = | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,721: | Line 1,677: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0xBE240000 || 4 || RW || Unknown | ||
|- | |- | ||
| | | 0xBE240004 || 4 || R || GPIO read pin (1 bit = 1 pin) | ||
|- | |- | ||
| | | 0xBE240008 || 4 || W || GPIO set pin (1 bit = 1 pin) | ||
|- | |||
| 0xBE24000C || 4 || W|| GPIO clear pin (1 bit = 1 pin) | |||
|- | |||
| 0xBE240010 || 4 || ? || Unknown | |||
|- | |||
| 0xBE240014 || 4 || ? || Unknown | |||
|- | |||
| 0xBE240018 || 4 || ? || Unknown | |||
|- | |||
| 0xBE24001C || 4 || ? || Unknown | |||
|- | |||
| 0xBE240020 || 4 || ? || Unknown | |||
|- | |||
| 0xBE240030 || 4 || ? || Unknown | |||
|- | |||
| 0xBE240040 || 4 || ? || Unknown | |||
|- | |- | ||
| | | 0xBE240048 || 4 || ? || Unknown | ||
|- | |- | ||
| | |} | ||
= 0xBE300000: Power management? = | |||
= 0xBE400000 & 0xBE500000: UART = | |||
The second 'xx' bytes of the addresses can be 0x40, 0x44, 0x48, 0x4C, 0x50, 0x54, 0x58, 0x5C for the different UART ports (1-8, in that order). | |||
Note that: | |||
* UART1 = ? | |||
* UART2 = ? | |||
* UART3 = ? | |||
* UART4 = ? | |||
* UART5 = Headphone/remote SIO | |||
* UART6 = Infrared | |||
* UART7 = Syscon | |||
* UART8 = PSP 2k+ display-related | |||
{| class="wikitable" | |||
|- | |||
! Address | |||
! Size | |||
! Read/write | |||
! Description | |||
|- | |||
| 0xBExx0000 || 4 || RW || Read/write FIFO of the UART port | |||
Bits 0-7 = data | |||
Writing writes a byte to the Tx buffer and advances the write position. | |||
Reading reads a byte from the Rx buffer and advances the read position. | |||
The FIFO is 32(?) bytes long. | |||
Writing writes a byte to the Tx buffer and advances the write position. | |||
Reading reads a byte from the Rx buffer and advances the read position. | |||
The FIFO is 32(?) bytes long. | |||
|- | |- | ||
| | | 0xBExx0018 || 4 || RW || Port status | ||
= | Bit 4 = Rx buffer status is empty | ||
Bit 5 = Tx buffer status is full | |||
|- | |- | ||
| 0xBExx0024 || 4 || W || Upper bits of baudrate divisor, ie (96000000 / baudrate) >> 6 | |||
|- | |- | ||
| | | 0xBExx0028 || 4 || W || Lower bits of baudrate divisor, ie (96000000 / baudrate) & 0x3f | ||
|- | |- | ||
| | | 0xBExx002C || 4 || W || Set bits 5-6 to set the baud rate? | ||
|- | |- | ||
|} | |} | ||
= | = 0xBE600000: ? = | ||
= 0xBE700000: Display = | |||
= 0xBFC00000: MIPS Reset Vector = | |||
= 0xBFF00000: NAND DMA buffer = | = 0xBFF00000: NAND DMA buffer = | ||
Line 2,350: | Line 1,773: | ||
= References = | = References = | ||
* [http://daifukkat.su/docs/psptek/ PSPTEK] | * [http://daifukkat.su/docs/psptek/ PSPTEK] (done) | ||
* [https://gigawiz.github.io/yapspd/html_chapters_split/chap8.html yapspd] | * [https://gigawiz.github.io/yapspd/html_chapters_split/chap8.html yapspd] (done) | ||
* [https://github.com/uofw/uofw uOFW] | * [https://github.com/uofw/uofw uOFW] (todo: some more info to grab in some modules) | ||
* [https://github.com/jpcsp/jpcsp Jpcsp] | * [https://github.com/jpcsp/jpcsp Jpcsp] (todo: contains a lot of stuff) |