[Lapetus-cvs] lapetus/tests/regtest cdb.c,1.2,1.3 cdb.h,1.2,1.3
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2008-02-17 15:56:28
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31821 Modified Files: cdb.c cdb.h Log Message: -Added a bunch of cd command tests. Need finishing Index: cdb.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/cdb.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cdb.c 8 Jan 2008 09:28:40 -0000 1.2 +++ cdb.c 17 Feb 2008 15:56:24 -0000 1.3 @@ -49,6 +49,61 @@ void cdcmdtest() { + InterruptSetLevelMask(0xF); + + InitLapetus(RES_320x224); + VdpRBG0Init(&testdispsettings); + VdpSetDefaultPalette(); + + // Verify that the user has a disc inserted here + + // Display On + VdpDispOn(); + + UnregisterAllTests(); +// RegisterTest(&TestCMDCDStatus, "CD Status"); + RegisterTest(&TestCMDGetHWInfo, "Get Hardware Info"); +// RegisterTest(&TestCMDGetTOC, "Get TOC"); + RegisterTest(&TestCMDGetSessionInfo, "Get Session Info"); +// RegisterTest(&TestCMDInitCD, "Initialize CD System"); +// RegisterTest(&TestCMDOpenTray, "Open Tray"); +// RegisterTest(&TestCMDEndDataTransfer, "End Data Transfer"); +// RegisterTest(&TestCMDPlayDisc, "Play Disc"); +// RegisterTest(&TestCMDSeekDisc, "Seek Disc"); +// RegisterTest(&TestCMDScanDisc, "Scan Disc"); +// RegisterTest(&TestCMDGetSubcodeQRW, "Get Subcode Q/RW"); + RegisterTest(&TestCMDSetCDDevCon, "Set CD Device Connection"); + RegisterTest(&TestCMDGetCDDevCon, "Get CD Device Connection"); + RegisterTest(&TestCMDGetLastBuffer, "Get Last Buffer Dest"); + RegisterTest(&TestCMDSetFilterRange, "Set Filter Range"); + RegisterTest(&TestCMDGetFilterRange, "Get Filter Range"); + RegisterTest(&TestCMDSetFilterSHCond, "Set Filter SH Conditions"); + RegisterTest(&TestCMDGetFilterSHCond, "Get Filter SH Conditions"); + RegisterTest(&TestCMDSetFilterMode, "Set Filter Mode"); + RegisterTest(&TestCMDGetFilterMode, "Get Filter Mode"); + RegisterTest(&TestCMDSetFilterCon, "Set Filter Connection"); + RegisterTest(&TestCMDGetFilterCon, "Get Filter Connection"); +// RegisterTest(&TestCMDResetSelector, "Reset Selector"); +// RegisterTest(&TestCMDGetBufferSize, "Get Buffer Size"); +// RegisterTest(&TestCMDGetSectorNumber, "Get Sector Number"); +// RegisterTest(&TestCMDCalculateActualSize, "Calculate Actual Size"); +// RegisterTest(&TestCMDGetActualSize, "Get Actual Size"); +// RegisterTest(&TestCMDGetSectorInfo, "Get Sector Info"); + RegisterTest(&TestCMDSetSectorLength, "Set Sector Length"); +// RegisterTest(&TestCMDGetSectorData, "Get Sector Data"); +// RegisterTest(&TestCMDDelSectorData, "Delete Sector Data"); +// RegisterTest(&TestCMDGetThenDelSectorData, "Get Then Delete Sector Data"); +// RegisterTest(&TestCMDPutSectorData, "Put Sector Data"); +// RegisterTest(&TestCMDCopySectorData, "Copy Sector Data"); +// RegisterTest(&TestCMDMoveSectorData, "Move Sector Data"); +// RegisterTest(&TestCMDGetCopyError, "Get Copy Error"); +// RegisterTest(&TestCMDChangeDirectory, "Change Directory"); +// RegisterTest(&TestCMDReadDirectory, "Read Directory"); +// RegisterTest(&TestCMDGetFileSystemScope, "Get File System Scope"); +// RegisterTest(&TestCMDGetFileInfo, "Get File Info"); +// RegisterTest(&TestCMDReadFile, "Read File"); +// RegisterTest(&TestCMDAbortFile, "Abort File"); + DoTests("CD Commands tests", 0, 0); } ////////////////////////////////////////////////////////////////////////////// @@ -65,3 +120,284 @@ ////////////////////////////////////////////////////////////////////////////// +void TestCMDCDStatus() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetHWInfo() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x0100; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(0, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Verify that the data returned is correct here + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetTOC() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x0200; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_DRDY, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Verify that the data returned is correct here + + // Read out TOC and verify + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetSessionInfo() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x0300; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(0, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Verify that the data returned is correct here + + // Test individual sessions here + + // Verify that the data returned is correct here + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetCDDevCon() +{ + int ret; + + if ((ret = CDConnectCDToFilter(3)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetCDDevCon() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x3100; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + if ((cdcmdrs.CR3 >> 8) != 0x03) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetLastBuffer() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x3200; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(0, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Check returned status to see if it's right here + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetFilterRange() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x4000; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetFilterRange() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x4100; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Check returned status to see if it's right here + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetFilterSHCond() +{ + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetFilterSHCond() +{ + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetFilterMode() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x447F; + cdcmd.CR3 = 0x0300; + cdcmd.CR2 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetFilterMode() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x4500; + cdcmd.CR3 = 0x0300; + cdcmd.CR2 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + if ((cdcmdrs.CR1 & 0xFF) != 0x7F) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetFilterCon() +{ + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDGetFilterCon() +{ + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + +void TestCMDSetSectorLength() +{ + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + int ret; + + cdcmd.CR1 = 0x6000; + cdcmd.CR2 = cdcmd.CR3 = cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(HIRQ_ESEL, &cdcmd, &cdcmdrs)) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } + + // Should grab a sector to verify it's the right size, etc. here + + stagestatus = STAGESTAT_DONE; +} + +////////////////////////////////////////////////////////////////////////////// + Index: cdb.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/cdb.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cdb.h 8 Jan 2008 09:28:40 -0000 1.2 +++ cdb.h 17 Feb 2008 15:56:24 -0000 1.3 @@ -25,4 +25,23 @@ void mpegcmdtest(); void misccdtest(); +void TestCMDCDStatus(); +void TestCMDGetHWInfo(); +void TestCMDGetTOC(); +void TestCMDGetSessionInfo(); + +void TestCMDSetCDDevCon(); +void TestCMDGetCDDevCon(); +void TestCMDGetLastBuffer(); +void TestCMDSetFilterRange(); +void TestCMDGetFilterRange(); +void TestCMDSetFilterSHCond(); +void TestCMDGetFilterSHCond(); +void TestCMDSetFilterMode(); +void TestCMDGetFilterMode(); +void TestCMDSetFilterCon(); +void TestCMDGetFilterCon(); + +void TestCMDSetSectorLength(); + #endif |