44 static unsigned noSetLocCollect(NoSetLocEvent*
events,
unsigned count,
unsigned max,
unsigned wantData) {
45 unsigned dataReady = 0;
46 while ((
count < max) && (dataReady < wantData)) {
48 if (!waitCDRomIRQWithTimeout(&
timeout))
break;
55 e->header[0] =
e->header[1] =
e->header[2] =
e->header[3] = 0;
70 static int noSetLocPauseAndDrain() {
75 if (!waitCDRomIRQWithTimeout(&
timeout))
return 0;
78 if (
cause == 2)
return 1;
84 for (
unsigned i = 0;
i <
count;
i++) {
96 static uint32_t noSetLocHeaderLBA(
const NoSetLocEvent*
e) {
97 return MSF2LBA(
btoi(
e->header[0]),
btoi(
e->header[1]),
btoi(
e->header[2]));
101 static uint32_t noSetLocLastLBA(
const NoSetLocEvent*
events,
unsigned from,
unsigned to) {
103 for (
unsigned i = from;
i < to;
i++) {
110 static uint32_t noSetLocFirstLBA(
const NoSetLocEvent*
events,
unsigned from,
unsigned to) {
111 for (
unsigned i = from;
i < to;
i++) {
120 int ok = resetCDRom() && setMode(0x20) && setLoc(0, 0x02, 0x16);
151 int ok = resetCDRom() && setMode(0x20) && setLoc(0, 0x02, 0x16);
160 unsigned count = noSetLocCollect(
events, 0, 24, 6);
166 while ((
count < 24) && !paused) {
167 unsigned prev =
count;
169 if (
count == prev)
break;
175 while (updateTime() < 100000);
181 int drained = noSetLocPauseAndDrain();
CESTER_TEST(cddaLevelHalf, test_instances, static const uint8_t atv[4]={0x40, 0x00, 0x40, 0x00};unsigned changes=0;int peak=cddaPeak(atv, 1, &changes);ramsyscall_printf("CD-DA level at half ATV: peak %i, %u sign changes\n", peak, changes);cester_assert_int_ge(peak, 11300);cester_assert_int_le(peak, 11800);cester_assert_uint_ge(changes, 4);) CESTER_TEST(cddaLevelClipped
test_instances
Definition cdda.c:214
uint8_t response[16]
Definition cdlgetlocl.c:84
uint32_t timeout
Definition cdlid.c:94
int ok
Definition cdlstop.c:75
uint8_t cause
Definition cdltest.c:207
ramsyscall_printf("T21 phase=%s t=%u v=%02x cause=%u size=%u stat=%02x\n", phase, t/1000, response[0], cause, size,(nopCause==3 &&nopSize >=1) ? stat[0] :0xff)
uint32_t time
Definition cdltest.c:208
@ CDL_READS
Definition cdrom.h:69
@ CDL_PAUSE
Definition cdrom.h:51
#define CDROM_REG3
Definition cdrom.h:34
#define CDROM_REG2
Definition cdrom.h:33
struct EventInfo * events
Definition globals.h:49
int i
Definition gte-regio.c:299
constexpr uint8_t btoi(uint8_t b)
Definition msf.hh:35
CDROM_REG0
Definition readnosetloc.c:127
printNoSetLocEvents("ReadS at 00:02:16, six sectors, ReadS again with no Setloc", events, count, split)
CESTER_BODY(typedef struct { uint32_t time;uint8_t cause;uint8_t status;uint8_t header[4];} NoSetLocEvent;static unsigned noSetLocCollect(NoSetLocEvent *events, unsigned count, unsigned max, unsigned wantData) { unsigned dataReady=0;while((count< max) &&(dataReady< wantData)) { uint32_t timeout=3000000;if(!waitCDRomIRQWithTimeout(&timeout)) break;NoSetLocEvent *e=&events[count++];e->time=timeout;e->cause=ackCDRomCause();uint8_t response[16];readResponse(response);e->status=response[0];e->header[0]=e->header[1]=e->header[2]=e->header[3]=0;if(e->cause==1) { CDROM_REG0=0;CDROM_REG3=0x80;while((CDROM_REG0 &0x40)==0);for(unsigned i=0;i< 4;i++) e->header[i]=CDROM_REG2;CDROM_REG3=0;dataReady++;} } return count;} static int noSetLocPauseAndDrain() { CDROM_REG0=0;CDROM_REG1=CDL_PAUSE;while(1) { uint32_t timeout=3000000;if(!waitCDRomIRQWithTimeout(&timeout)) return 0;uint8_t cause=ackCDRomCause();discardResponse();if(cause==2) return 1;} } static void printNoSetLocEvents(const char *name, const NoSetLocEvent *events, unsigned count, unsigned split) { ramsyscall_printf("%s, %u events:", name, count);for(unsigned i=0;i< count;i++) { const NoSetLocEvent *e=&events[i];if(i==split) ramsyscall_printf(" |");ramsyscall_printf(" [%ius int%u stat %02x", e->time, e->cause, e->status);if(e->cause==1) { ramsyscall_printf(" hdr %02x:%02x:%02x m%u", e->header[0], e->header[1], e->header[2], e->header[3]);} ramsyscall_printf("]");} ramsyscall_printf("\n");} static uint32_t noSetLocHeaderLBA(const NoSetLocEvent *e) { return MSF2LBA(btoi(e->header[0]), btoi(e->header[1]), btoi(e->header[2]));} static uint32_t noSetLocLastLBA(const NoSetLocEvent *events, unsigned from, unsigned to) { uint32_t lba=0;for(unsigned i=from;i< to;i++) { if(events[i].cause==1) lba=noSetLocHeaderLBA(&events[i]);} return lba;} static uint32_t noSetLocFirstLBA(const NoSetLocEvent *events, unsigned from, unsigned to) { for(unsigned i=from;i< to;i++) { if(events[i].cause==1) return noSetLocHeaderLBA(&events[i]);} return 0;})
Definition readnosetloc.c:34
cester_assert_uint_eq(before+1, after)
cester_assert_uint_ne(0, before)
uint32_t before
Definition readnosetloc.c:138
cester_assert_true(drained)
CDROM_REG1
Definition readnosetloc.c:128
int drained
Definition readnosetloc.c:135
unsigned count
Definition readnosetloc.c:129
unsigned split
Definition readnosetloc.c:130
uint32_t after
Definition readnosetloc.c:139
char e[1]
Definition string.c:119