Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
misc.c
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2022 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// These tests cannot be easily automated.
30
32 int resetDone = resetCDRom();
33 if (!resetDone) {
35 return;
36 }
37
38 int seekDone = seekPTo(0x70, 0x19, 0x73);
39 if (!seekDone) {
41 return;
42 }
43
44 ramsyscall_printf("Waiting for door to open...\n");
45
48 uint8_t cause1 = ackCDRomCause();
49 uint8_t ctrl1 = CDROM_REG0 & ~3;
50 uint8_t response[16];
52 uint8_t ctrl2 = CDROM_REG0 & ~3;
53 CDROM_REG0 = 1;
54 uint8_t cause1b = CDROM_REG3_UC;
55
62)
63
64CESTER_SKIP_TEST(doorOpenedOrMissingDisc, test_instances,
65 int resetDone = resetCDRom();
66 if (!resetDone) {
68 return;
69 }
70
73
76 uint8_t cause1 = ackCDRomCause();
77 uint8_t ctrl1 = CDROM_REG0 & ~3;
78 uint8_t response[16];
80 uint8_t ctrl2 = CDROM_REG0 & ~3;
81 CDROM_REG0 = 1;
83
90)
int seekDone
Definition cdlgetlocl.c:72
waitCDRomIRQ()
@ CDL_GETLOCP
Definition cdrom.h:59
#define CDROM_REG3_UC
Definition cdrom.h:39
ramsyscall_printf("=== e01_kseg1_reads_no_fill ===\n")
ackCDRomCause()
cester_assert_true(seekDone)
readResponse(response)
void uint32_t(classId, spec)
CDROM_REG0
Definition misc.c:71
uint8_t responseSize
Definition misc.c:79
uint32_t ackTime
Definition misc.c:75
uint8_t response[16]
Definition misc.c:78
int resetDone
Definition misc.c:65
test_instances
Definition misc.c:64
uint8_t ctrl2
Definition misc.c:80
uint8_t cause1
Definition misc.c:76
cester_assert_uint_eq(5, cause1)
uint8_t cause1b
Definition misc.c:82
CESTER_SKIP_TEST(waitForDoor, test_instances, int resetDone=resetCDRom();if(!resetDone) { cester_assert_true(resetDone);return;} int seekDone=seekPTo(0x70, 0x19, 0x73);if(!seekDone) { cester_assert_true(seekDone);return;} ramsyscall_printf("Waiting for door to open...\n");initializeTime();uint32_t ackTime=waitCDRomIRQ();uint8_t cause1=ackCDRomCause();uint8_t ctrl1=CDROM_REG0 &~3;uint8_t response[16];uint8_t responseSize=readResponse(response);uint8_t ctrl2=CDROM_REG0 &~3;CDROM_REG0=1;uint8_t cause1b=CDROM_REG3_UC;cester_assert_uint_eq(5, cause1);cester_assert_uint_eq(0x38, ctrl1);cester_assert_uint_eq(0x18, ctrl2);cester_assert_uint_eq(0x16, response[0]);cester_assert_uint_eq(8, response[1]);cester_assert_uint_eq(2, responseSize);) CESTER_SKIP_TEST(doorOpenedOrMissingDisc
uint8_t ctrl1
Definition misc.c:77
initializeTime()
CDROM_REG1
Definition misc.c:72