Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
cdlforward.c
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2026 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27// clang-format off
28
29// Forward and Backward only work while playing audio. Anywhere else the drive
30// answers INT5 with stat|1 and error code 0x80.
31
32CESTER_TEST(cdlForwardWhileIdle, test_instance,
33 int resetDone = resetCDRom();
34 if (!resetDone) {
36 return;
37 }
38
40
41 CDROM_REG0 = 0;
43
45 uint8_t cause1 = ackCDRomCause();
46 uint8_t response1[16];
48 CDROM_REG0 = 1;
49 uint8_t cause1b = CDROM_REG3_UC;
50
56 ramsyscall_printf("Forward while idle: errored in %ius\n", errorTime);
57)
58
59CESTER_TEST(cdlBackwardWhileIdle, test_instance,
60 int resetDone = resetCDRom();
61 if (!resetDone) {
63 return;
64 }
65
67
70
72 uint8_t cause1 = ackCDRomCause();
73 uint8_t response1[16];
75 CDROM_REG0 = 1;
77
83 ramsyscall_printf("Backward while idle: errored in %ius\n", errorTime);
84)
uint8_t response1[16]
Definition cdlforward.c:73
CDROM_REG0
Definition cdlforward.c:68
CESTER_TEST(cdlForwardWhileIdle, test_instance, int resetDone=resetCDRom();if(!resetDone) { cester_assert_true(resetDone);return;} initializeTime();CDROM_REG0=0;CDROM_REG1=CDL_FORWARD;uint32_t errorTime=waitCDRomIRQ();uint8_t cause1=ackCDRomCause();uint8_t response1[16];uint8_t responseSize1=readResponse(response1);CDROM_REG0=1;uint8_t cause1b=CDROM_REG3_UC;cester_assert_uint_eq(5, cause1);cester_assert_uint_eq(0xe0, cause1b);cester_assert_uint_eq(3, response1[0]);cester_assert_uint_eq(0x80, response1[1]);cester_assert_uint_eq(2, responseSize1);ramsyscall_printf("Forward while idle: errored in %ius\n", errorTime);) CESTER_TEST(cdlBackwardWhileIdle
uint8_t responseSize1
Definition cdlforward.c:74
int resetDone
Definition cdlforward.c:60
test_instance
Definition cdlforward.c:59
uint8_t cause1
Definition cdlforward.c:72
uint32_t errorTime
Definition cdlforward.c:71
cester_assert_uint_eq(5, cause1)
uint8_t cause1b
Definition cdlforward.c:76
initializeTime()
CDROM_REG1
Definition cdlforward.c:69
waitCDRomIRQ()
cester_assert_true((error==0x10)||(error==0x04))
readResponse(response)
ackCDRomCause()
@ CDL_BACKWARD
Definition cdrom.h:47
@ CDL_FORWARD
Definition cdrom.h:46
#define CDROM_REG3_UC
Definition cdrom.h:39
ramsyscall_printf("=== e01_kseg1_reads_no_fill ===\n")
void uint32_t(classId, spec)