lapetus-cvs Mailing List for Lapetus
Status: Inactive
Brought to you by:
cyberwarriorx
You can subscribe to this list here.
2007 |
Jan
|
Feb
(6) |
Mar
(23) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(26) |
Feb
(9) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:51
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30967 Modified Files: smpc.h Log Message: -A couple of tweaks Index: smpc.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/smpc.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- smpc.h 10 Jan 2008 21:09:14 -0000 1.3 +++ smpc.h 3 Jun 2009 01:32:18 -0000 1.4 @@ -61,20 +61,17 @@ { // Wait until SF register is cleared while(SMPC_REG_SF & 0x1) { } - - // Set SF register so that no other command can be issued. - SMPC_REG_SF = 1; } ////////////////////////////////////////////////////////////////////////////// static inline void SmpcIssueCommand(u8 cmd) { + // Set SF register so that no other command can be issued. + SMPC_REG_SF = 1; + // Writing COMREG starts execution SMPC_REG_COMREG = cmd; - - // Wait till command is finished -// while(SMPC_REG_SF & 0x1) {} } ////////////////////////////////////////////////////////////////////////////// |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:50
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31264 Modified Files: font.c Log Message: -Added NBG support for font stuff Index: font.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/font.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- font.c 9 Jan 2008 04:45:54 -0000 1.2 +++ font.c 3 Jun 2009 01:34:23 -0000 1.3 @@ -19,6 +19,8 @@ #include "lapetus.h" +extern vdp2settings_struct vdp2settings; + ////////////////////////////////////////////////////////////////////////////// int DrawCharVdp1(font_struct *font, int x, int y, int color, int charnum) @@ -88,6 +90,23 @@ { font->lineinc = 512; // fix me(should be detected) font->drawchar = DrawCharBitmap1bppTo8bpp; + font->out = (u8 *)0x25E00000; + switch (screen) + { + case SCREEN_NBG0: + font->out += ((u32)vdp2settings.MPOFN.part.n0mp << 17); + break; + case SCREEN_NBG1: + font->out += ((u32)vdp2settings.MPOFN.part.n1mp << 17); + break; + case SCREEN_NBG2: + font->out += ((u32)vdp2settings.MPOFN.part.n2mp << 17); + break; + case SCREEN_NBG3: + font->out += ((u32)vdp2settings.MPOFN.part.n3mp << 17); + break; + default: break; + } } font->screen = screen; |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:49
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30906 Added Files: debug.c debug.h dmascu.c dmash2.c install.bat localex.s remoteex.s ubc.s Log Message: -Added dma stuff -Added exception handler code(local is finish, remote still needs work) -Added early ubc code -Other stuff --- NEW FILE: ubc.s --- ! Copyright 2007 Theo Berkau ! ! This file is part of Lapetus. ! ! Lapetus is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! Lapetus is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with Lapetus; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .section .text ! UbcSetCodeBreakpoint !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .global _UbcSetCodeBreakpoint ! R4 = slot, R5 = address, returns LAPETUS_ERR_OK if no problems _UbcSetCodeBreakpoint: mov.l r1, @-r15 cmp/eq r4, #0 ! 0 = Breakpoint A, 1 = Breakpoint B bf bpb ! Breakpoint A !set break address mov.l BARA, r1 mov.l r5, @r1 !set address mask mov.l BAMRA, r1 mov #0, r0 mov.l r0, @r1 !set break conditions mov.l BBRA, r1 mov.w COND, r0 ! Break on CPU cycles, Break only on instruction fetch cycles, break only on read cycles mov.w r0, @r1 !set break control mov.l BRCR, r1 mov.w CTRLA, r0 ! SH7604 mode, break before instruction execution mov.w r0, @r1 mov #0, r0 bra done nop bpb: ! Breakpoint B !set break address mov.l BARB, r1 mov.l r5, @r1 !set address mask mov.l BAMRA, r1 mov #0, r0 mov.l r0, @r1 !set break conditions mov.l BBRB, r1 mov.w COND, r0 ! Break on CPU cycles, Break only on instruction fetch cycles, break only on read cycles mov.w r0, @r1 !set break control mov.l BRCR, r1 ! mov.w CTRLB, r0 ! FIXME mov.w r0, @r1 mov #0, r0 done: mov.l @r15+, r1 rts nop COND: .word 0x0054 CTRLA: .word 0x1000 CTRLB: .word 0x1000 .align 4 BARA: .long 0xFFFFFF40 BAMRA: .long 0xFFFFFF44 BBRA: .long 0xFFFFFF48 BARB: .long 0xFFFFFF60 BAMRB: .long 0xFFFFFF64 BBRB: .long 0xFFFFFF68 BRCR: .long 0xFFFFFF78 ! UbcSetMemoryBreakpoint !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .global _UbcSetMemoryBreakpoint ! R4 = slot, R5 = address, R6 = type, returns LAPETUS_ERR_OK if no problems _UbcSetMemoryBreakpoint: rts nop ! BreakpointHandler !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .global _UBCIntHandler _UBCIntHandler: ! Save all registers to stack stc.l SR, @-r15 stc.l GBR, @-r15 stc.l VBR, @-r15 sts.l MACH, @-r15 sts.l MACL, @-r15 sts.l PR, @-r15 mov.l r0, @-r15 mov.l r1, @-r15 mov.l r2, @-r15 mov.l r3, @-r15 mov.l r4, @-r15 mov.l r5, @-r15 mov.l r6, @-r15 mov.l r7, @-r15 mov.l r8, @-r15 mov.l r9, @-r15 mov.l r10, @-r15 mov.l r11, @-r15 mov.l r12, @-r15 mov.l r13, @-r15 mov.l r14, @-r15 mov.l r15, @-r15 ! Copy all registers to work buffer mov.l WORKBUFADDR, r0 add #4, r0 mov.l r15, r1 add #?, r1 ! I need to calculate how much this needs to be adjusted by copylp: mov.l @r1+, r2 mov.l r2, @r0 add #4, r0 ! cmp/ge r15, r1 !double check to make sure this is right bf copylp ! Let PC know we're ready to transfer data mov.l WORKBUFADDR, r0 mov.l READY, r1 mov.l r1, @r0 ! Go into endless loop waiting for PC's response mov.l DONE, r1 waitlp: !trapa ! this needs work(the idea is it's supposed to latch onto the ar's commlink functions mov.l @r0, r2 cmp/eq r2, r1 bf waitlp ! Restore registers back to their original state mov.l @r15+, r15 mov.l @r15+, r14 mov.l @r15+, r13 mov.l @r15+, r12 mov.l @r15+, r11 mov.l @r15+, r10 mov.l @r15+, r9 mov.l @r15+, r8 mov.l @r15+, r7 mov.l @r15+, r6 mov.l @r15+, r5 mov.l @r15+, r4 mov.l @r15+, r3 mov.l @r15+, r2 mov.l @r15+, r1 mov.l @r15+, r0 lds.l @r15+, PR lds.l @r15+, MACL lds.l @r15+, MACH ldc.l @r15+, VBR ldc.l @r15+, GBR ldc.l @r15+, SR rte nop .align 4 DONE: .long 0x5A5A5A5A READY: .long 0xA5A5A5A5 WORKBUFADDR: .long 0x00000000 --- NEW FILE: debug.h --- /* Copyright 2009 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DEBUG_H #define DEBUG_H int RemoteDebuggerStart(void *addr); int RemoteDebuggerStop(void); int DebuggerStart(void); void DebuggerSetCodeBreakpoint(u32 addr); void DebuggerClearCodeBreakpoint(); void DebuggerSetMemoryBreakpoint(u32 addr, u32 val, u32 valmask, int rw, int size); void DebuggerClearMemoryBreakpoint(u32 addr); int DebuggerStop(void); #endif --- NEW FILE: install.bat --- copy liblapetus.a C:\PROGRA~3\KPITCU~1\GNUSHV~1\sh-coff\sh-coff\lib copy *.h C:\PROGRA~3\KPITCU~1\GNUSHV~1\sh-coff\sh-coff\include --- NEW FILE: dmash2.c --- /* Copyright 2007 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lapetus.h" #define SAR0 (*(volatile u32 *)0xFFFFFF80) #define DAR0 (*(volatile u32 *)0xFFFFFF84) #define TCR0 (*(volatile u32 *)0xFFFFFF88) #define CHCR0 (*(volatile u32 *)0xFFFFFF8C) #define VCRDMA0 (*(volatile u32 *)0xFFFFFFA0) #define DRCR0 (*(volatile u8 *)0xFFFFFE71) #define SAR1 (*(volatile u32 *)0xFFFFFF90) #define DAR1 (*(volatile u32 *)0xFFFFFF94) #define TCR1 (*(volatile u32 *)0xFFFFFF98) #define CHCR1 (*(volatile u32 *)0xFFFFFF9C) #define VCRDMA1 (*(volatile u32 *)0xFFFFFFA8) #define DRCR1 (*(volatile u8 *)0xFFFFFE72) #define DMAOR (*(volatile u32 *)0xFFFFFFB0) ////////////////////////////////////////////////////////////////////////////// int Sh2DMAInit(void) { Sh2DMAStopAll(); CHCR0 = 0; CHCR1 = 0; return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// int Sh2DMAStart(int chan, void *src, void *dst, u32 size, u32 mode) { if (chan == 0) { // Set Source SAR0 = (u32)src; // Set Destination DAR0 = (u32)dst; // Set Transfer Count TCR0 = size; // Use external request DRCR0 = 0; // Set the Mode and Enable DMA CHCR0 = (CHCR0 & 0x0) | mode | 0x1; return LAPETUS_ERR_OK; } else if (chan == 1) { // Set Source SAR1 = (u32)src; // Set Destination DAR1 = (u32)dst; // Set Transfer Count TCR1 = size; // Use external request DRCR1 = 0; // Set the Mode and Enable DMA CHCR1 = (CHCR1 & 0x0) | mode | 0x1; return LAPETUS_ERR_OK; } return LAPETUS_ERR_INVALIDARG; } ////////////////////////////////////////////////////////////////////////////// BOOL IsSh2DMARunning(int chan) { // if (DMAOR & 0x1) { // Check if transfer end flag is set if (chan == 0 && !(CHCR0 & 0x2)) return TRUE; else if (chan == 1 && !(CHCR1 & 0x2)) return TRUE; } return FALSE; } ////////////////////////////////////////////////////////////////////////////// void Sh2DMAStopAll(void) { DMAOR = DMAOR & 0xE; } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: dmascu.c --- /* Copyright 2007 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lapetus.h" #define SCUREG_D0R (*(volatile u32 *)0x25FE0000) #define SCUREG_D0W (*(volatile u32 *)0x25FE0004) #define SCUREG_D0C (*(volatile u32 *)0x25FE0008) #define SCUREG_D0AD (*(volatile u32 *)0x25FE000C) #define SCUREG_D0EN (*(volatile u32 *)0x25FE0010) #define SCUREG_D0MD (*(volatile u32 *)0x25FE0014) #define SCUREG_D1R (*(volatile u32 *)0x25FE0020) #define SCUREG_D1W (*(volatile u32 *)0x25FE0024) #define SCUREG_D1C (*(volatile u32 *)0x25FE0028) #define SCUREG_D1AD (*(volatile u32 *)0x25FE002C) #define SCUREG_D1EN (*(volatile u32 *)0x25FE0030) #define SCUREG_D1MD (*(volatile u32 *)0x25FE0034) #define SCUREG_D2R (*(volatile u32 *)0x25FE0040) #define SCUREG_D2W (*(volatile u32 *)0x25FE0044) #define SCUREG_D2C (*(volatile u32 *)0x25FE0048) #define SCUREG_D2AD (*(volatile u32 *)0x25FE004C) #define SCUREG_D2EN (*(volatile u32 *)0x25FE0050) #define SCUREG_D2MD (*(volatile u32 *)0x25FE0054) #define SCUREG_T0C (*(volatile u32 *)0x25FE0090) #define SCUREG_T1S (*(volatile u32 *)0x25FE0094) #define SCUREG_T1MD (*(volatile u32 *)0x25FE0098) #define SCUREG_IMS (*(volatile u32 *)0x25FE00A0) #define SCUREG_IST (*(volatile u32 *)0x25FE00A4) #define SCUREG_AIACK (*(volatile u32 *)0x25FE00A8) #define SCUREG_ASR0 (*(volatile u32 *)0x25FE00B0) #define SCUREG_ASR1 (*(volatile u32 *)0x25FE00B4) #define SCUREG_RSEL (*(volatile u32 *)0x25FE00C4) #define SCUREG_VER (*(volatile u32 *)0x25FE00C8) ////////////////////////////////////////////////////////////////////////////// int ScuDMAInit(void) { ScuDMAStopAll(); SCUREG_D0EN = 0; SCUREG_D1EN = 0; SCUREG_D2EN = 0; return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// int ScuDMAStart(int chan, void *src, void *dst, u32 size, u32 add, u32 mode) { // Check first to make sure the channel has no pending DMA operation going switch (chan) { case 0: // Make sure everything is disabled SCUREG_D0EN = 0; // Write the read address SCUREG_D0R = (u32)src; // Write the write address SCUREG_D0W = (u32)dst; // Write the transfer number SCUREG_D0C = size; SCUREG_D0AD = add; SCUREG_D0MD = mode; if ((mode & 0x7) == 0x7) SCUREG_D0EN = 0x101; else SCUREG_D0EN = 0x100; break; case 1: // Make sure everything is disabled SCUREG_D1EN = 0; // Write the read address SCUREG_D1R = (u32)src; // Write the write address SCUREG_D1W = (u32)dst; // Write the transfer number SCUREG_D1C = size; SCUREG_D1AD = add; SCUREG_D1MD = mode; if ((mode & 0x7) == 0x7) SCUREG_D1EN = 0x101; else SCUREG_D1EN = 0x100; break; case 2: // Make sure everything is disabled SCUREG_D2EN = 0; // Write the read address SCUREG_D2R = (u32)src; // Write the write address SCUREG_D2W = (u32)dst; // Write the transfer number SCUREG_D2C = size; SCUREG_D2AD = add; SCUREG_D2MD = mode; if ((mode & 0x7) == 0x7) SCUREG_D2EN = 0x101; else SCUREG_D2EN = 0x100; break; default: return LAPETUS_ERR_INVALIDARG; } return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// BOOL IsScuDMARunning(int chan) { switch (chan) { case 0: // if (SCUREG_DSTA & ?) // return LAPETUS_ERR_BUSY; case 1: case 2: default: return FALSE; } } ////////////////////////////////////////////////////////////////////////////// void ScuDMAStopAll(void) { SCUREG_DSTP = 1; } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: remoteex.s --- ! Copyright 2007 Theo Berkau ! ! This file is part of Lapetus. ! ! Lapetus is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! Lapetus is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with Lapetus; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA .section .text _RemoteDebugStart: .long ExchangeByte _RemoteDebugSize: .long endofcode-ExchangeByte _RemoteExGeneralIllegalInstruction: .long RemoteExGeneralIllegalInstruction-ExchangeByte _RemoteExSlotIllegalInstruction: .long RemoteExSlotIllegalInstruction-ExchangeByte _RemoteExCPUAddressError: .long RemoteExCPUAddressError-ExchangeByte _RemoteExDMAAddressError: .long RemoteExDMAAddressError-ExchangeByte _RemoteUBCHandler: .long RemoteUBCHandler-ExchangeByte !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ExchangeByte: mov.l R1, @-R15 mov.l STATPORT, r1 ! Keep reading the status port until there's data ready statloop: mov.b @R1, R0 cmp/eq #1, R0 bf statloop ! Alright, there's finally data ready. Let's do a byte exchange mov.l INPORT, R0 ! retrieve from inport mov.b @R0, R0 extu.b R0, R0 mov.l OUTPORT, R1 ! Write to outport mov.b R4, @R1 ! Ok, we're done, time to cleanup rts mov.l @r15+, r1 .align 4 OUTPORT: .long 0x22080001 STATPORT: .long 0x22100001 INPORT: .long 0x22180001 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SendLong: sts.l pr, @-R15 mov.l R1, @-R15 mov R4, R1 ! Send highest byte shlr16 R4 bsr ExchangeByte shlr8 R4 ! Send second-highest byte mov R1, R4 bsr ExchangeByte shlr16 R4 ! Send second-lowest byte mov R1, R4 bsr ExchangeByte shlr8 R4 ! Send lowest byte bsr ExchangeByte mov R1, R4 ! Alright, we're done mov.l @r15+, r1 rts lds.l @r15+, pr .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! saveregisters: stc.l SR, @-r15 stc.l GBR, @-r15 stc.l VBR, @-r15 sts.l MACH, @-r15 sts.l MACL, @-r15 mov.l r0, @-r15 mov.l r1, @-r15 mov.l r2, @-r15 mov.l r3, @-r15 mov.l r4, @-r15 mov.l r5, @-r15 mov.l r6, @-r15 mov.l r7, @-r15 mov.l r8, @-r15 mov.l r9, @-r15 mov.l r10, @-r15 mov.l r11, @-r15 mov.l r12, @-r15 mov.l r13, @-r15 mov.l r14, @-r15 rts mov.l r15, @-r15 ! this can't be right .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SendExceptionData: sts PR, R8 mov R4, R0 ! Send the data back to computer(use 0x01 return command) bsr ExchangeByte mov #1, R4 ! exception type bsr ExchangeByte mov R0, R4 ! Send all Registers to computer mov #21, r1 genregloop: bsr SendLong mov.l @r15+, r4 cmp/pl r1 bf/s genregloop add #-1, R1 lds R8, PR rts nop .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RemoteExGeneralIllegalInstruction: ! Save all registers to stack sts.l PR, @-r15 bsr saveregisters nop ! Now that we've insured that we have the previous program's state at crash ! Let's start doing our own thing ! Send the initial exception data bsr SendExceptionData mov #0, R4 ! Wait in a loop until the computer tells us what to do giloop: bra giloop nop !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RemoteExSlotIllegalInstruction: ! Save all registers to stack sts.l PR, @-r15 bsr saveregisters nop ! Now that we've insured that we have the previous program's state at crash ! Let's start doing our own thing ! Send the initial exception data bsr SendExceptionData mov #1, R4 ! Wait in a loop until the computer tells us what to do siloop: bra siloop nop .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RemoteExCPUAddressError: ! Save all registers to stack sts.l PR, @-r15 bsr saveregisters nop ! Now that we've insured that we have the previous program's state at crash ! Let's start doing our own thing ! Send the initial exception data bsr SendExceptionData mov #1, R4 ! Wait in a loop until the computer tells us what to do caloop: bra caloop nop .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RemoteExDMAAddressError: ! Save all registers to stack sts.l PR, @-r15 bsr saveregisters nop ! Now that we've insured that we have the previous program's state at crash ! Let's start doing our own thing ! Send the initial exception data bsr SendExceptionData mov #1, R4 ! Wait in a loop until the computer tells us what to do daloop: bra daloop nop .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RemoteUBCHandler: ! Save all registers to stack sts.l PR, @-r15 bsr saveregisters nop ! Now that we've insured that we have the previous program's state at crash ! Let's start doing our own thing ubcloop: bra ubcloop nop .align 4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! endofcode: --- NEW FILE: debug.c --- // Almost everything is done here. I just need to finish the AR polling code // which should use the UBC. Also the UBC handler needs to be implemented // (in remoteex.s). I think I may remove the Local debugger altogether // I may also consider adding some profiler code #include <lapetus.h> #define BARA (*(volatile u32 *)0xFFFFFF40) #define BAMRA (*(volatile u32 *)0xFFFFFF44) #define BBRA (*(volatile u16 *)0xFFFFFF48) #define BARB (*(volatile u32 *)0xFFFFFF60) #define BAMRB (*(volatile u32 *)0xFFFFFF64) #define BBRB (*(volatile u16 *)0xFFFFFF68) #define BDRB (*(volatile u32 *)0xFFFFFF70) #define BDMRB (*(volatile u32 *)0xFFFFFF74) #define BRCR (*(volatile u16 *)0xFFFFFF78) #if 0 extern u32 RemoteDebugStart; extern u32 RemoteDebugSize; extern u32 RemoteExGeneralIllegalInstruction; extern u32 RemoteExSlotIllegalInstruction; extern u32 RemoteExCPUAddressError; extern u32 RemoteExDMAAddressError; extern u32 RemoteUBCHandler; //void RemoteUBCHandler(void) __attribute__ ((interrupt_handler)); #endif void ExGeneralIllegalInstruction(void); void ExSlotIllegalInstruction(void); void ExCPUAddressError(void); void ExDMAAddressError(void); void UBCHandler(void) __attribute__ ((interrupt_handler)); #if 0 /* ////////////////////////////////////////////////////////////////////////////// // This will be move to asm void RemoteUBCHandler(void) { // Let's establish which interrupt was triggered if (BRCR & 0x8000) { // Channel A(Code Breakpoint) // Send data back to computer notifying it that we're in a breakpoint(use 0x02 return command) } else if (BRCR & 0x80) { // Channel B(Memory Breakpoint) // Send data back to computer notifying it that we're in a breakpoint(use 0x02 return command) } // Clear A and B condition matches BRCR = BRCR & 0x3F3F; } */ ////////////////////////////////////////////////////////////////////////////// int RemoteDebuggerStart(void *addr) { u32 *outbuf=(u32 *)addr; u32 *buf=(u32 *)RemoteDebugStart; u32 i; // Copy over code for (i = 0; i < RemoteDebugSize; i++) outbuf[i] = buf[i]; // Setup exception functions BIOS_SetSH2Interrupt(0x4, addr+RemoteExGeneralIllegalInstruction); BIOS_SetSH2Interrupt(0x6, addr+RemoteExSlotIllegalInstruction); BIOS_SetSH2Interrupt(0x9, addr+RemoteExCPUAddressError); BIOS_SetSH2Interrupt(0xA, addr+RemoteExDMAAddressError); BIOS_SetSH2Interrupt(0xC, addr+RemoteUBCHandler); // Hijack interrupt handling function here // if (so and so word == ?) // replace word with bra instruction return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// int RemoteDebuggerStop(void) { BIOS_SetSH2Interrupt(0x4, 0); BIOS_SetSH2Interrupt(0x6, 0); BIOS_SetSH2Interrupt(0x9, 0); BIOS_SetSH2Interrupt(0xA, 0); BIOS_SetSH2Interrupt(0xC, 0); // Give interrupt handling function control back here return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// #endif void UBCHandler(void) { // if (BRCR & ?) } ////////////////////////////////////////////////////////////////////////////// int DebuggerStart(void) { // This function basically sets up exception handlers, disables remote // debugging, and sets things up to allows for breakpoints int ret; if ((ret = DebuggerStop()) != LAPETUS_ERR_OK) return ret; BIOS_SetSH2Interrupt(0x4, ExGeneralIllegalInstruction); BIOS_SetSH2Interrupt(0x6, ExSlotIllegalInstruction); BIOS_SetSH2Interrupt(0x9, ExCPUAddressError); BIOS_SetSH2Interrupt(0xA, ExDMAAddressError); // Clear the UBC registers BBRA = 0; BBRB = 0; BDRB = 0; BRCR = 0; BIOS_SetSH2Interrupt(0xC, UBCHandler); // Adjust level mask if (InterruptGetLevelMask() > 0xE) InterruptSetLevelMask(0xE); return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// void DebuggerSetCodeBreakpoint(u32 addr) { BARA = addr; BAMRA = 0; // break on cpu cycles, instruction fetch cycles, read/write cycles BBRA = (0x1 << 6) | (0x1 << 4) | (0x3 << 2) | 0; // Clear the condition match flags, break before instruction execution BRCR = (BRCR & 0x3BFF); } ////////////////////////////////////////////////////////////////////////////// void DebuggerClearCodeBreakpoint() { BBRA = 0; } ////////////////////////////////////////////////////////////////////////////// void DebuggerSetMemoryBreakpoint(u32 addr, u32 val, u32 valmask, int rw, int size) { BARB = addr; BAMRB = 0; BDRB = val; BDMRB = valmask; // break on cpu cycles, data access cycles, etc. BBRB = (0x1 << 6) | (0x2 << 4) | ((rw & 0x3) << 2) | (size & 0x3); // Clear the condition match flags, break before instruction execution BRCR = (BRCR & 0xFF33); } ////////////////////////////////////////////////////////////////////////////// void DebuggerClearMemoryBreakpoint(u32 addr) { BBRB = 0; } ////////////////////////////////////////////////////////////////////////////// int DebuggerStop(void) { BIOS_SetSH2Interrupt(0x4, 0); BIOS_SetSH2Interrupt(0x6, 0); BIOS_SetSH2Interrupt(0x9, 0); BIOS_SetSH2Interrupt(0xA, 0); BIOS_SetSH2Interrupt(0xC, 0); return LAPETUS_ERR_OK; } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: localex.s --- .section .text ! Things to finish: ! -Replace remaining old code to new .macro SaveRegisters sts.l PR, @-r15 stc.l GBR, @-r15 stc.l VBR, @-r15 sts.l MACH, @-r15 sts.l MACL, @-r15 mov.l r0, @-r15 mov.l r1, @-r15 mov.l r2, @-r15 mov.l r3, @-r15 mov.l r4, @-r15 mov.l r5, @-r15 mov.l r6, @-r15 mov.l r7, @-r15 mov.l r8, @-r15 mov.l r9, @-r15 mov.l r10, @-r15 mov.l r11, @-r15 mov.l r12, @-r15 mov.l r13, @-r15 mov.l r14, @-r15 mov r15, r0 add #0x58, r0 mov.l r0, @-r15 .endm ! Global Data !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .align 4 debugdispsettings: ! bitmap specific disp_bitmapsize: .byte 0 ! BG_BITMAP512x256 ! tile specific disp_charsize: .byte 0 disp_patternnamesize: .byte 0 disp_planesize: .byte 0 disp_map: .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 disp_flipfunction: .byte 0 disp_extracharnum: .byte 0 ! used by both bitmap and tile disp_transparentbit: .byte 0 disp_color: .byte 1 ! BG_256COLOR disp_isbitmap: .byte 1 disp_specialpriority: .byte 0 disp_specialcolorcalc: .byte 0 disp_extrapalettenum: .byte 0 disp_mapoffset: .byte 0 ! rotation specific disp_rotationmode: .byte 0 disp_padding: .byte 0, 0 disp_parameteraddr: .long 0x25E60000 .align 4 debugfont: font_width: .byte 8 font_height: .byte 8 font_bpp: .byte 1 font_padding: .byte 1 font_data: .long _font8x8 font_charsize: .long 0 font_lineinc: .long 0 out: .long 0x25E00000 font_drawchar: .long 0 font_screen: .long 0 font_transparent: .long 0 ! ExGeneralIllegalInstruction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .global _ExGeneralIllegalInstruction _ExGeneralIllegalInstruction: ! Save all registers to stack SaveRegisters mov.l aGeneralInst_ptr, r10 ! message ! Let's display everything mov.l dispstuff_ptr,r1 jmp @r1 nop .align 4 dispstuff_ptr: .long dispstuff aGeneralInst_ptr: .long aGeneralInst aGeneralInst: .ascii "General Illegal Instruction" ! ExSlotIllegalInstruction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .align 4 .global _ExSlotIllegalInstruction _ExSlotIllegalInstruction: ! Save all registers to stack SaveRegisters mov.l aSlotInst_ptr, r10 ! message ! Let's display everything mov.l dispstuff_ptr_2,r1 jmp @r1 nop .align 4 dispstuff_ptr_2: .long dispstuff aSlotInst_ptr: .long aSlotInst aSlotInst: .ascii "Slot Illegal Instruction" ! ExCPUAddressError !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .align 4 .global _ExCPUAddressError _ExCPUAddressError: ! Save all registers to stack SaveRegisters mov.l aCPUAddr_ptr, r10 ! message ! Let's display everything mov.l dispstuff_ptr_3,r1 jmp @r1 nop .align 4 dispstuff_ptr_3: .long dispstuff aCPUAddr_ptr: .long aCPUAddr aCPUAddr: .ascii "CPU Address Error" ! ExDMAAddressError !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .align 4 .global _ExDMAAddressError _ExDMAAddressError: ! Save all registers to stack SaveRegisters mov.l aDMAAddr_ptr, r10 ! message mov.l dispstuff_ptr_4,r1 jmp @r1 nop .align 4 dispstuff_ptr_4: .long dispstuff aDMAAddr_ptr: .long aDMAAddr aDMAAddr: .ascii "DMA Address Error" ! dispstuff !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .align 4 dispstuff: ! Init Lapetus mov.l InitLapetus_ptr, r1 jsr @r1 mov #0, r4 ! RES_320x224 ! Setup RBG0 Screen mov.l debugdispsettings_ptr, r4 mov.l VdpRBG0Init_ptr, r1 jsr @r1 nop ! Use the default palette mov.l VdpSetDefaultPalette_ptr, r1 jsr @r1 nop ! Setup an 8x8 1BPP font mov #0, r6 ! Non-transparent text mov.l debugfont_ptr, r5 mov.l VdpSetFont_ptr, r1 jsr @r1 mov #4, r4 ! SCREEN_RBG0 ! Render Error Text ! void VdpPrintText(font_struct *font, int x, int y, int color, const char *text) add #-4, r15 mov.l r10, @r15 ! text mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0x8, r6 ! y mov.l VdpPrintText_ptr,r1 jsr @r1 mov #0x10, r5 ! x add #4, r15 ! Render Registers R0-R15 mov #0x10 r8 mov #0x90, r9 extu.b r9, r9 mov r15, r11 regdisploop1: add #-0x1, r8 ! Display Register Name and Value add #-0xC, r15 ! For Reg 0-9 we want an extra space mov #0xA, r0 cmp/ge r0, r8 bf useregname2 mov.l aRegName1_ptr, r0 bra regname1_done nop useregname2: mov.l aRegName2_ptr, r0 regname1_done: mov.l r0, @r15 !aRegName1_ptr/aRegName2_ptr mov.l r8, @(4, r15) ! Register Number mov.l @r11+, r0 mov.l r0, @(8, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov r9, r6 ! y mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0xC, r15 add #-0x8, r9 cmp/pl r8 bt regdisploop1 ! Render MACL Register add #-0x8, r15 mov.l aMACLName_ptr, r0 mov.l r0, @r15 ! aMACLName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xB8, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render MACH Register add #-0x8, r15 mov.l aMACHName_ptr, r0 mov.l r0, @r15 ! aMACHName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xB0, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render VBR Register add #-0x8, r15 mov.l aVBRName_ptr, r0 mov.l r0, @r15 ! aVBRName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xA8, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render GBR Register add #-0x8, r15 mov.l aGBRName_ptr, r0 mov.l r0, @r15 ! aGBRName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xA0, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render PR Register add #-0x8, r15 mov.l aPRName_ptr, r0 mov.l r0, @r15 ! aPRName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xC0, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render PC Register add #-0x8, r15 mov.l aPCName_ptr, r0 mov.l r0, @r15 ! aPCName_ptr mov.l @r11+, r0 add #-2, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0xC8, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Render SR Register add #-0x8, r15 mov.l aSRName_ptr, r0 mov.l r0, @r15 ! aSRName_ptr mov.l @r11+, r0 mov.l r0, @(4, r15) ! Register Value mov.l debugfont_ptr, r4 mov #0xF, r7 ! color mov #0x98, r6 ! y extu.b r6,r6 mov.l VdpPrintf_ptr,r1 jsr @r1 mov #0, r5 ! x add #0x8, r15 ! Display On mov.l VdpDispOn_ptr,r1 jsr @r1 nop mov.l CommlinkStartService_ptr, r1 jsr @r1 nop endlessloop: mov.l VdpVsync_ptr, r1 jsr @r1 nop mov.l per_ptr, r1 add #2, r1 mov.w @r1, r1 extu.w r1, r1 shlr8 r1 shlr2 r1 mov r1, r0 and #1, r0 extu.b r0, r1 tst r1, r1 bf reset bra endlessloop nop reset: mov.l SmpcCommand_ptr, r1 jsr @r1 mov #0xD, r4 ! SMPC_CMD_SYSRES colorf0_5: .word 0x00F0 .align 4 InitLapetus_ptr: .long _InitLapetus debugdispsettings_ptr: .long debugdispsettings VdpRBG0Init_ptr: .long _VdpRBG0Init VdpSetDefaultPalette_ptr: .long _VdpSetDefaultPalette debugfont_ptr: .long debugfont VdpSetFont_ptr: .long _VdpSetFont VdpPrintf_ptr: .long _VdpPrintf VdpPrintText_ptr: .long _VdpPrintText VdpVsync_ptr: .long _VdpVsync per_ptr: .long _per SmpcCommand_ptr: .long _SmpcCommand aRegName1_ptr: .long aRegName1 aRegName2_ptr: .long aRegName2 aMACLName_ptr: .long aMACLName aMACHName_ptr: .long aMACHName aVBRName_ptr: .long aVBRName aGBRName_ptr: .long aGBRName aPRName_ptr: .long aPRName aPCName_ptr: .long aPCName aSRName_ptr: .long aSRName aRegName1: .ascii "R%d: %08X" .align 4 aRegName2: .ascii "R%d: %08X" .align 4 aMACLName: .ascii "MACL: %08X" .align 4 aMACHName: .ascii "MACH: %08X" .align 4 aVBRName: .ascii "VBR: %08X" .align 4 aGBRName: .ascii "GBR: %08X" .align 4 aPRName: .ascii "PR: %08X" .align 4 aPCName: .ascii "PC: %08X" .align 4 aSRName: .ascii "SR: %08X" .align 4 VdpDispOn_ptr: .long _VdpDispOn CommlinkStartService_ptr: .long _CommlinkStartService |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:47
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31303 Modified Files: lapetus.h Log Message: -Added a couple of header files Index: lapetus.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/lapetus.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- lapetus.h 9 Jan 2008 05:03:44 -0000 1.9 +++ lapetus.h 3 Jun 2009 01:34:43 -0000 1.10 @@ -22,10 +22,12 @@ #include "types.h" #include "font.h" +#include "arcomm.h" #include "bios.h" #include "cd.h" #include "cdfs.h" #include "commlink.h" +#include "debug.h" #include "dma.h" #include "dsp.h" #include "int.h" |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:46
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31091 Modified Files: makefile Log Message: -Updated Index: makefile =================================================================== RCS file: /cvsroot/lapetus/lapetus/makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- makefile 3 Mar 2007 05:22:31 -0000 1.7 +++ makefile 3 Jun 2009 01:33:04 -0000 1.8 @@ -7,13 +7,16 @@ LIBDIR = . #INCDIR = $(GCC)\include INCDIR = . -CFLAGS = -O2 -Wall -m2 -I$(INCDIR) +CFLAGS = -O2 -Wall -m2 -I$(INCDIR) -DREENTRANT_SYSCALLS_PROVIDED ASFLAGS = ARFLAGS = rv -OBJS = cd.o cdfs.o \ - commlink.o dsp.o int.o lapetus.o smpc.o timer.o \ - vdpinit.o scrscr.o rotscr.o text.o pal.o font.o +OBJS = cd.o cdfs.o mpeg.o \ + debug.o remoteex.o localex.o \ + arcomm.o commlink.o dsp.o int.o lapetus.o smpc.o sound.o timer.o \ + vdpinit.o scrscr.o rotscr.o vdp1.o text.o pal.o font.o font8x8.o font8x16.o \ + sys/stdin.o sys/stdout.o sys/stderr.o sys/cd.o sys/bup.o sys/open.o \ + sys/close.o sys/write.o sys/read.o sys/fstat.o sys/lseek.o sys/sys.o TARGET = $(LIBDIR)/liblapetus.a |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:45
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31141 Modified Files: cdfs.c Log Message: -Fixed a bug with fetching file's lba Index: cdfs.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/cdfs.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cdfs.c 9 Jan 2008 22:09:55 -0000 1.3 +++ cdfs.c 3 Jun 2009 01:33:30 -0000 1.4 @@ -207,7 +207,7 @@ } // We're done. - file->lba = lba; + file->lba = dirrec.lba; file->size = dirrec.size; file->sectpos = 0; file->pos = 0; |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:45
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv668 Modified Files: scrscr.c Log Message: -Added DeInit functions Index: scrscr.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/scrscr.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- scrscr.c 27 Feb 2007 23:30:32 -0000 1.1 +++ scrscr.c 3 Jun 2009 01:46:24 -0000 1.2 @@ -61,22 +61,30 @@ int SetupRamCycles() { - int cycles=0; + int cycles[4]= { 0, 0, 0, 0 }; int availcycles; + char zmtbl[4] = { 1, 2, 4, 4}; // 1, 1/2, 1/4, 1/4 + char coltbl[8] = { 1, 2, 4, 4, 8, 0, 0, 0 }; // 16 color, 256 color, 2048 color, 32768 color, 16.7M color // Figure out how many available cycles we have availcycles = 16; - if (VDP2_REG_RAMCTL & 0x100) - availcycles += 8; - if (VDP2_REG_RAMCTL & 0x200) - availcycles += 8; + +// if (VDP2_REG_RAMCTL & 0x100) +// availcycles += 8; +// if (VDP2_REG_RAMCTL & 0x200) +// availcycles += 8; // Let's first make sure we have enough cycles for everything if (vdp2settings.BGON.part.nbg0enab) { -// CalcColorCycles(vdp2settings.CHCTLA.part.n0chcn); + // color settings +// cycles += coltbl[(vdp2settings.CHCTLA.part.n0chcn >> 4) & 0x7]; + + // Is zoom being used? +// cycles = cycles * zmtbl[vdp2settings.ZMCTL.part.n0zm]; // Is it tiled or bitmap? + // which bank is being used? // (for tile) @@ -201,6 +209,16 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpNBG0DeInit(void) +{ + vdp2settings.BGON.part.nbg0enab = 0; + + // Disable Screen + VDP2_REG_BGON = vdp2settings.BGON.all; +} + +////////////////////////////////////////////////////////////////////////////// + int VdpNBG1Init(screensettings_struct *settings) { // First make sure we're not not going to run into any @@ -295,6 +313,16 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpNBG1DeInit(void) +{ + vdp2settings.BGON.part.nbg1enab = 0; + + // Disable Screen + VDP2_REG_BGON = vdp2settings.BGON.all; +} + +////////////////////////////////////////////////////////////////////////////// + int VdpNBG2Init(screensettings_struct *settings) { vdp2settings.BGON.part.nbg2enab = 1; @@ -361,6 +389,16 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpNBG2DeInit(void) +{ + vdp2settings.BGON.part.nbg2enab = 0; + + // Disable Screen + VDP2_REG_BGON = vdp2settings.BGON.all; +} + +////////////////////////////////////////////////////////////////////////////// + int VdpNBG3Init(screensettings_struct *settings) { vdp2settings.BGON.part.nbg3enab = 1; @@ -427,6 +465,16 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpNBG3DeInit(void) +{ + vdp2settings.BGON.part.nbg3enab = 0; + + // Disable Screen + VDP2_REG_BGON = vdp2settings.BGON.all; +} + +////////////////////////////////////////////////////////////////////////////// + int VdpEXBGInit(screensettings_struct *settings) { return VDP_ERR_OK; @@ -434,3 +482,8 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpEXBGDeInit(void) +{ +} + +////////////////////////////////////////////////////////////////////////////// |
From: Theo B. <cyb...@us...> - 2009-06-03 02:16:43
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31204 Added Files: .cvsignore Log Message: -Initial add --- NEW FILE: .cvsignore --- *.o *.exe *.a |
From: Theo B. <cyb...@us...> - 2009-06-03 01:21:42
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29943 Added Files: arcomm.c arcomm.h Log Message: -Added early code for using a real AR's handler --- NEW FILE: arcomm.c --- /* Copyright 2009 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lapetus.h" void ARCLInitHandler(int vector, u32 patchaddr, u16 patchinst, u32 codeaddr) { int i; // Copy over AR handler from 0x02003024-0x02003147 to codeaddr+8 for (i = 0; i < 292; i+=4) *((u32 *)(codeaddr+8+i)) = *((u32 *)(0x02003024+i)); // Patch code address+8 so the bra call is correct(fix me) *((u16 *)(codeaddr+0x8)) = *((u16 *)(codeaddr+0xA)); *((u16 *)(codeaddr+0xA)) = 0x0009; // Patch interrupt with AR handler *((u32 *)(0x06000000 + (vector << 2))) = codeaddr + 0x8; // Read patch address, write it to code address+0xC *((u16 *)(codeaddr+0xC)) = *((u16 *)patchaddr); // Write patch instruction to patch address *((u16 *)patchaddr) = patchinst; // Write a dummy code(not sure if this is needed) *((u32 *)(codeaddr)) = 0x06000000; *((u32 *)(codeaddr+4)) = 0x00000000; // flag to keep handler from running multiple times at the same time *((u32 *)(codeaddr+0x11C)) = codeaddr; } --- NEW FILE: arcomm.h --- /* Copyright 2009 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ARCOMM_H #define ARCOMM_H void ARCLInitHandler(int vector, u32 patchaddr, u16 patchinst, u32 codeaddr); #endif |
From: Theo B. <cyb...@us...> - 2009-06-03 01:19:39
|
Update of /cvsroot/lapetus/lapetus/sys In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29693 Added Files: .cvsignore Log Message: -Initial add --- NEW FILE: .cvsignore --- *.o |
From: Theo B. <cyb...@us...> - 2009-06-03 01:17:57
|
Update of /cvsroot/lapetus/lapetus/sys In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29538 Added Files: bup.c cd.c close.c file.h fstat.c lseek.c open.c read.c stderr.c stdin.c stdout.c sys.c write.c Log Message: -Added some earlier stdio stuff --- NEW FILE: lseek.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> ////////////////////////////////////////////////////////////////////////////// /* _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int)) { } */ ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: sys.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> #include <reent.h> #include "lapetus.h" #include "file.h" const devoptab_t *devoptab_list[] = { &dotab_stdin, &dotab_stdout, &dotab_stderr, &dotab_cd, &dotab_bup, NULL }; ////////////////////////////////////////////////////////////////////////////// /* void *_sbrk_r _PARAMS ((struct _reent *, ptrdiff_t)) { } */ ////////////////////////////////////////////////////////////////////////////// /* int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *)) { } */ ////////////////////////////////////////////////////////////////////////////// /* _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *)) { } */ ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: file.h --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef FILE_H #define FILE_H typedef struct { const char *name; int (*open) (struct _reent *r, const char *path, int flags, int mode ); int (*close) (struct _reent *r, int fd ); _ssize_t (*write) (struct _reent *r, int fd, const char *ptr, int len); _ssize_t (*read) (struct _reent *r, int fd, char *ptr, int len); } devoptab_t; extern const devoptab_t dotab_stdin; extern const devoptab_t dotab_stdout; extern const devoptab_t dotab_stderr; extern const devoptab_t dotab_cd; extern const devoptab_t dotab_bup; extern const devoptab_t *devoptab_list[]; #endif --- NEW FILE: stdin.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "../lapetus.h" #include "file.h" ////////////////////////////////////////////////////////////////////////////// int stdin_open(struct _reent *r, const char *path, int flags, int mode) { return 0; } ////////////////////////////////////////////////////////////////////////////// int stdin_close(struct _reent *r, int fd) { return 0; } ////////////////////////////////////////////////////////////////////////////// _ssize_t stdin_write(struct _reent *r, int fd, const char *ptr, int len) { return -1; // Doesn't support writing } ////////////////////////////////////////////////////////////////////////////// _ssize_t stdin_read(struct _reent *r, int fd, char *ptr, int len) { if (per[0].id == PER_KEYBOARD) { return len; // fix me } return -1; } ////////////////////////////////////////////////////////////////////////////// const devoptab_t dotab_stdin = { "stdin", stdin_open, stdin_close, stdin_write, stdin_read }; ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: close.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// int _close_r _PARAMS ((struct _reent *r, int fd)) { int device = fd >> 16; return devoptab_list[device]->close(r, fd & 0xFFFF); } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: open.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include <stdio.h> #include <string.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// int _open_r _PARAMS ((struct _reent *r, const char *file, int flags, int mode)) { int i; int device=-1; int fd; for (i = 0; devoptab_list[i] != NULL; i++) { if (strncmp(devoptab_list[i]->name, file, strlen(devoptab_list[i]->name)) == 0) device = i; } if (device < 0 || (fd = devoptab_list[device]->open(r, file, flags, mode)) == -1) return -1; return ((device << 16) | (fd & 0xFFFF)); } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: stdout.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// int stdout_open(struct _reent *r, const char *path, int flags, int mode) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// int stdout_close(struct _reent *r, int fd) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t stdout_write(struct _reent *r, int fd, const char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t stdout_read(struct _reent *r, int fd, char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// const devoptab_t dotab_stdout = { "stdout", stdout_open, stdout_close, stdout_write, stdout_read }; --- NEW FILE: stderr.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// int stderr_open(struct _reent *r, const char *path, int flags, int mode) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// int stderr_close(struct _reent *r, int fd) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t stderr_write(struct _reent *r, int fd, const char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t stderr_read(struct _reent *r, int fd, char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// const devoptab_t dotab_stderr = { "stderr", stderr_open, stderr_close, stderr_write, stderr_read }; --- NEW FILE: fstat.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> ////////////////////////////////////////////////////////////////////////////// /* int _fstat_r _PARAMS ((struct _reent *, int, struct stat *)) { } */ ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: write.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// _ssize_t _write_r _PARAMS ((struct _reent *r, int fd, const void *ptr, size_t len)) { int device = fd >> 16; return devoptab_list[device]->write(r, fd & 0xFFFF, ptr, len); } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: bup.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// int bup_open(struct _reent *r, const char *path, int flags, int mode) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// int bup_close(struct _reent *r, int fd) { return 0; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t bup_write(struct _reent *r, int fd, const char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t bup_read(struct _reent *r, int fd, char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// const devoptab_t dotab_bup = { "bup", bup_open, bup_close, bup_write, bup_read }; --- NEW FILE: read.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "file.h" ////////////////////////////////////////////////////////////////////////////// _ssize_t _read_r _PARAMS ((struct _reent *r, int fd, void *ptr, size_t len)) { int device = fd >> 16; return devoptab_list[device]->read(r, fd & 0xFFFF, ptr, len); } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: cd.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <reent.h> #include "../lapetus.h" #include "file.h" ////////////////////////////////////////////////////////////////////////////// int cdfs_open(struct _reent *r, const char *path, int flags, int mode) { // Make sure CDFS has been initialized // Anyways, file has finally been found, return the fid return 0; } ////////////////////////////////////////////////////////////////////////////// int cdfs_close(struct _reent *r, int fd) { return 0; } ////////////////////////////////////////////////////////////////////////////// _ssize_t cdfs_write(struct _reent *r, int fd, const char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// _ssize_t cdfs_read(struct _reent *r, int fd, char *ptr, int len) { return len; // fix me } ////////////////////////////////////////////////////////////////////////////// const devoptab_t dotab_cd = { "cd", cdfs_open, cdfs_close, cdfs_write, cdfs_read }; ////////////////////////////////////////////////////////////////////////////// |
From: Theo B. <cyb...@us...> - 2009-05-29 04:15:51
|
Update of /cvsroot/lapetus/lapetus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16128 Modified Files: cd.c cd.h Log Message: -Added function for getting the number of sessions on a disc Index: cd.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/cd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cd.c 9 Jan 2008 05:04:21 -0000 1.3 +++ cd.c 29 May 2009 04:15:42 -0000 1.4 @@ -803,3 +803,27 @@ } ////////////////////////////////////////////////////////////////////////////// + +int CDGetSessionNum(u8 *num) +{ + int ret; + cdcmd_struct cdcmd; + cdcmd_struct cdcmdrs; + u16 auth; + cdstat_struct cdstatus; + int i; + + // Get Session Info + cdcmd.CR1 = 0x0300; + cdcmd.CR2 = 0x0000; + cdcmd.CR3 = 0x0000; + cdcmd.CR4 = 0x0000; + + if ((ret = CDExecCommand(0, &cdcmd, &cdcmdrs)) != 0) + return ret; + + num[0] = cdcmdrs.CR3 >> 8; + return LAPETUS_ERR_OK; +} + +////////////////////////////////////////////////////////////////////////////// Index: cd.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/cd.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cd.h 9 Jan 2008 05:04:21 -0000 1.3 +++ cd.h 29 May 2009 04:15:42 -0000 1.4 @@ -97,4 +97,5 @@ int CDReadSector(void *buffer, u32 FAD, int sectorsize, u32 numbytes); int PlayCDAudio(u8 audiotrack, u8 repeat, u8 vol_l, u8 vol_r); int StopCDAudio(void); +int CDGetSessionNum(u8 *num); #endif |
From: Theo B. <cyb...@us...> - 2008-02-18 23:20:05
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29339 Modified Files: scu.c scu.h Log Message: -Added Indirect DMA test -Changed a couple of values to use defines. Makes things look more cleaner Index: scu.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- scu.h 12 Jan 2008 18:17:51 -0000 1.3 +++ scu.h 18 Feb 2008 23:19:55 -0000 1.4 @@ -44,6 +44,7 @@ void TestDMA1(); void TestDMA2(); void TestDMAMisalignment(); +void TestIndirectDMA(); void TestISTandIMS(); void TestDSP(); void TestMVI_Imm_d(); Index: scu.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- scu.c 12 Jan 2008 23:11:17 -0000 1.4 +++ scu.c 18 Feb 2008 23:19:55 -0000 1.5 @@ -156,7 +156,7 @@ RegisterTest(&TestDMA1, "DMA 1 transfer"); RegisterTest(&TestDMA2, "DMA 2 transfer"); RegisterTest(&TestDMAMisalignment, "Misaligned DMA transfer"); -// RegisterTest(&TestIndirectDMA, "Indirect DMA transfer"); + RegisterTest(&TestIndirectDMA, "Indirect DMA transfer"); // RegisterTest(&TestTransNum0, "0 Transfer Number transfer"); // RegisterTest(&TestDMAStatus, "DMA Status Register"); // Test out DMA start factors here @@ -470,7 +470,7 @@ *((volatile u32 *)0x260F0000) = dmavaltest; BIOS_SetSCUInterrupt(0x4B, dmaint); - BIOS_ChangeSCUInterruptMask(~0x800, 0); + BIOS_ChangeSCUInterruptMask(~MASK_DMA0, 0); stagestatus = STAGESTAT_WAITINGFORINT; // Do a quick DMA @@ -493,7 +493,7 @@ *((volatile u32 *)0x260F0000) = dmavaltest; BIOS_SetSCUInterrupt(0x4A, dmaint); - BIOS_ChangeSCUInterruptMask(~0x400, 0); + BIOS_ChangeSCUInterruptMask(~MASK_DMA1, 0); stagestatus = STAGESTAT_WAITINGFORINT; // Do a quick DMA @@ -516,7 +516,7 @@ *((volatile u32 *)0x260F0000) = dmavaltest; BIOS_SetSCUInterrupt(0x49, dmaint); - BIOS_ChangeSCUInterruptMask(~0x200, 0); + BIOS_ChangeSCUInterruptMask(~MASK_DMA2, 0); stagestatus = STAGESTAT_WAITINGFORINT; // Do a quick DMA @@ -540,7 +540,7 @@ dmavaltest = 0x02030405; BIOS_SetSCUInterrupt(0x4B, dmaint); - BIOS_ChangeSCUInterruptMask(~0x800, 0); + BIOS_ChangeSCUInterruptMask(~MASK_DMA0, 0); stagestatus = STAGESTAT_WAITINGFORINT; // Do a quick DMA @@ -557,6 +557,46 @@ ////////////////////////////////////////////////////////////////////////////// +void TestIndirectDMA() +{ + static u32 dmaarray[3 * 3]; + static u32 dmadataarray[] = { + 0x02030405, + 0x0708090A, + 0x0C0D0E0F, + }; + int i; + + InterruptSetLevelMask(0xF); + + BIOS_SetSCUInterrupt(0x4B, dmaint); + BIOS_ChangeSCUInterruptMask(~MASK_DMA0, 0); + stagestatus = STAGESTAT_WAITINGFORINT; + + dmaarray[0] = 1; + dmaarray[1] = 0x25C40000; + dmaarray[2] = (u32)dmadataarray; + + dmaarray[3] = 2; + dmaarray[4] = 0x25C40001; + dmaarray[5] = (u32)dmadataarray+1; + + dmaarray[6] = 1; + dmaarray[7] = 0x05C40003; + dmaarray[8] = 0x80000000 | ((u32)dmadataarray+3); + + // Do an Indirect DMA + SCUREG_D0EN = 0; + SCUREG_D0W = ((u32)dmaarray); + SCUREG_D0AD = 0x101; + SCUREG_D0MD = 0x01000007; + SCUREG_D0EN = 0x101; + + InterruptSetLevelMask(0x4); +} + +////////////////////////////////////////////////////////////////////////////// + void TestISTandIMS() { // Mask All interrupts |
From: Theo B. <cyb...@us...> - 2008-02-17 15:59:21
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv635 Modified Files: main.c Log Message: -Added some code so you can run one single test if you want Index: main.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- main.c 8 Jan 2008 09:28:40 -0000 1.3 +++ main.c 17 Feb 2008 15:59:17 -0000 1.4 @@ -113,12 +113,20 @@ // Print messages and cursor VdpDispOn(); + +#ifdef RUNONETEST + for(;;) + { + pertest(); + } +#else // Display Main Menu for(;;) { choice = DoMenu(mainmenu, 4, 14, "Saturn Regression Test v0.3"); ClearScr(); } +#endif } ////////////////////////////////////////////////////////////////////////////// |
From: Theo B. <cyb...@us...> - 2008-02-17 15:57:28
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32224 Modified Files: smpc.c Log Message: -Added peripheral tester. Mostly complete except for oreg overflow handling isn't completely tested. Also only standard pad's buttons are handled. Index: smpc.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/smpc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- smpc.c 17 Feb 2008 00:36:28 -0000 1.1 +++ smpc.c 17 Feb 2008 15:57:23 -0000 1.2 @@ -19,6 +19,7 @@ #include <lapetus.h> #include <stdio.h> +#include <string.h> #include "intfac.h" #include "tests.h" #include "smpc.h" @@ -94,47 +95,141 @@ ////////////////////////////////////////////////////////////////////////////// +char *padstring[16] = { +"", +"", +"", +"L", +"Z", +"Y", +"X", +"R", +"B", +"C", +"A", +"START", +"UP", +"DOWN", +"LEFT", +"RIGHT" +}; + +////////////////////////////////////////////////////////////////////////////// + +u8 PerFetchContinue() +{ + // Issue a continue + SMPC_REG_IREG(0) = 0x80; + + // Wait till command is finished + while(SMPC_REG_SF & 0x1) {} + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +u8 GetOREG(u8 *oregcounter) +{ + u8 ret; + + if (oregcounter[0] >= 32) + oregcounter[0] = PerFetchContinue(); + + ret = SMPC_REG_OREG(oregcounter[0]); + oregcounter[0]++; + return ret; +} + +////////////////////////////////////////////////////////////////////////////// + +int endtest; + +u8 disppaddata(u8 oregcounter, int x, int y, u8 id) +{ + int i; + u16 data; + + data = GetOREG(&oregcounter) << 8; + data |= GetOREG(&oregcounter); + + if (!(data & 0x0F00)) + endtest = 1; + + for (i = 0; i < 16; i++) + { + if (!(data & (1 << i))) + { + VdpPrintf(&testdispfont, x, y, 0xF, "%s ", padstring[i]); + x += (strlen(padstring[i])+1) * 8; + } + } + + for (i = 0; i < ((352 - x) >> 3); i++) + VdpPrintf(&testdispfont, x+(i << 3), y, 0xF, " "); + + return oregcounter; +} + +////////////////////////////////////////////////////////////////////////////// + +u8 dispnothing(u8 oregcounter, int x, int y, u8 id) +{ + int i; + for (i = 0; i < ((352 - x) >> 3); i++) + VdpPrintf(&testdispfont, x+(i << 3), y, 0xF, " "); + + if (id == 0xFF) + return oregcounter; + else + return (oregcounter+(id & 0xF)); +} + +////////////////////////////////////////////////////////////////////////////// + typedef struct { u8 id; char *name; -// u8 (*func)(int xoffset, int yoffset); + u8 (*dispdata)(u8 oregcounter, int xoffset, int yoffset, u8 id); } perinfo_struct; perinfo_struct perinfo[] = { - { 0x02, "Standard Pad", }, - { 0x13, "Racing Wheel", }, - { 0x15, "Analog Pad", }, - { 0x23, "Saturn Mouse", }, - { 0x25, "Gun", }, - { 0x34, "Keyboard", }, - { 0xE1, "Megadrive 3 button", }, - { 0xE2, "Megadrive 6 button", }, - { 0xE3, "Shuttle Mouse", }, - { 0xFF, "Nothing", } + { 0x02, "Standard Pad", disppaddata }, + { 0x13, "Racing Wheel", dispnothing }, + { 0x15, "Analog Pad", dispnothing }, + { 0x23, "Saturn Mouse", dispnothing }, + { 0x25, "Gun", dispnothing }, + { 0x34, "Keyboard", dispnothing }, + { 0xE1, "Megadrive 3 button", dispnothing }, + { 0xE2, "Megadrive 6 button", dispnothing }, + { 0xE3, "Shuttle Mouse", dispnothing }, + { 0xFF, "Nothing", dispnothing } }; +////////////////////////////////////////////////////////////////////////////// + u8 perparse(char *portname, int yoffset, u8 oregcounter) { int i; - u8 perid = SMPC_REG_OREG(oregcounter); - oregcounter++; + u8 perid = GetOREG(&oregcounter); for (i = 0; i < (sizeof(perinfo) / sizeof(perinfo_struct)); i++) { if (perid == perinfo[i].id) { - VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "Port %s: %s ", portname, perinfo[i].name); - // parse button presses here + char text[50]; - if (perid == 0xFF) - return oregcounter; - return (oregcounter+(perid & 0xF)); + sprintf(text, "Port %s: %s", portname, perinfo[i].name); + VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "%s ", text); + + // Display peripheral data + oregcounter = perinfo[i].dispdata(oregcounter, (strlen(text)+1) * 8, yoffset, perid); + return oregcounter; } } - VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "Port %s: Unknown", portname); + VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "Port %s: Unknown(%02X)", portname, perid); return oregcounter; } @@ -144,7 +239,7 @@ { InterruptSetLevelMask(0xF); - InitLapetus(RES_320x224); + InitLapetus(RES_352x240); VdpRBG0Init(&testdispsettings); VdpSetDefaultPalette(); @@ -156,8 +251,10 @@ testdispfont.transparent = 0; - VdpPrintf(&testdispfont, 0 * 8, 1 * 8, 0xF, "Multitap test"); - VdpPrintf(&testdispfont, 0 * 8, 2 * 8, 0xF, "(to exit, press A+B+C on first pad)"); + VdpPrintf(&testdispfont, 0 * 8, 1 * 8, 0xF, "Peripheral test"); + VdpPrintf(&testdispfont, 0 * 8, 2 * 8, 0xF, "(to exit, press A+B+C+START on any pad)"); + + endtest = 0; for (;;) { @@ -177,22 +274,36 @@ // Wait till command is finished while(SMPC_REG_SF & 0x1) {} +#if 0 + for (i = 0; i < 16; i++) + VdpPrintf(&testdispfont, 0 * 8, (4+i) * 8, 0xF, "OREG %02d: %02X", i, SMPC_REG_OREG(i)); + + for (i = 0; i < 16; i++) + VdpPrintf(&testdispfont, 16 * 8, (4+i) * 8, 0xF, "OREG %02d: %02X", i+16, SMPC_REG_OREG(i+16)); +#endif + // Grab oreg's for (i = 0; i < 2; i++) { - portcon = SMPC_REG_OREG(oregcounter); - oregcounter++; + portcon = GetOREG(&oregcounter); if (portcon != 0x16) { - VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Multi-tap not connected", i+1); + if (portcon == 0xF1) + { + char text[3]; + sprintf(text, "%d", i+1); + oregcounter = perparse(text, (4+(8*i)) * 8, oregcounter); + } + else if (portcon == 0xF0) + VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Nothing ", i+1); for (i2 = 0; i2 < 6; i2++) VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)+1+i2) * 8, 0xF, " "); } else { - VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Multi-tap connected ", i+1); + VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Multi-tap ", i+1); for (i2 = 0; i2 < (portcon & 0x0F); i2++) { @@ -202,9 +313,16 @@ } } } + + if (endtest) + break; } + testdispfont.transparent = 1; + + // Re-enable Lapetus's peripheral handler + BIOS_ChangeSCUInterruptMask(~(MASK_VBLANKOUT | MASK_SYSTEMMANAGER), 0); } ////////////////////////////////////////////////////////////////////////////// |
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 |
From: Theo B. <cyb...@us...> - 2008-02-17 15:54:56
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31032 Modified Files: tests.h Log Message: -Added macro for test waiting Index: tests.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/tests.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tests.h 8 Jan 2008 09:28:40 -0000 1.2 +++ tests.h 17 Feb 2008 15:54:51 -0000 1.3 @@ -43,4 +43,21 @@ extern screensettings_struct testdispsettings; extern font_struct testdispfont; +#define WaitTest(testarg, maxtime, failstatus) \ + { \ + int time; \ + \ + for (time = 0; time < (maxtime); time++) \ + { \ + if (testarg) \ + { \ + stagestatus = STAGESTAT_DONE; \ + break; \ + } \ + if (time == ((maxtime) - 1)) \ + stagestatus = (failstatus); \ + } \ + } + + #endif |
From: Theo B. <cyb...@us...> - 2008-02-17 00:37:37
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27096 Added Files: m68k.c m68k.h Log Message: -Initial add --- NEW FILE: m68k.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <lapetus.h> #include "intfac.h" #include "tests.h" #include "m68k.h" ////////////////////////////////////////////////////////////////////////////// void m68ktest() { int choice; MENUITEMSTRUCT m68kmenu[] = { { "68k instructions", &m68kinsttest, }, { "Misc" , &miscm68ktest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; for (;;) { choice = DoMenu(m68kmenu, 8, 14, "68k Tests"); ClearScr(); if (choice == ((sizeof(m68kmenu) / sizeof(MENUITEMSTRUCT)) - 2)) break; } } ////////////////////////////////////////////////////////////////////////////// void m68kinsttest() { } ////////////////////////////////////////////////////////////////////////////// void miscm68ktest() { } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: m68k.h --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef M68KH #define M68KH void m68ktest(); void m68kinsttest(); void miscm68ktest(); #endif |
From: Theo B. <cyb...@us...> - 2008-02-17 00:37:20
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27077 Added Files: cart.c cart.h Log Message: -Initial add --- NEW FILE: cart.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <lapetus.h> #include "intfac.h" #include "tests.h" #include "cart.h" ////////////////////////////////////////////////////////////////////////////// void carttest() { int choice; MENUITEMSTRUCT cartmenu[] = { { "Action Replay" , &artest, }, { "1 Mbit DRAM Cart", &dram1mbittest, }, { "4 Mbit DRAM Cart", &dram4mbittest, }, { "Backup RAM Cart" , &buptest, }, { "Netlink Cart" , &netlinktest, }, { "ROM Cart" , &romtest, }, { "Misc" , &misccarttest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; for (;;) { choice = DoMenu(cartmenu, 8, 14, "Cart Tests"); ClearScr(); if (choice == ((sizeof(cartmenu) / sizeof(MENUITEMSTRUCT)) - 2)) break; } } ////////////////////////////////////////////////////////////////////////////// void artest () { } ////////////////////////////////////////////////////////////////////////////// void dram1mbittest () { } ////////////////////////////////////////////////////////////////////////////// void dram4mbittest () { } ////////////////////////////////////////////////////////////////////////////// void buptest () { } ////////////////////////////////////////////////////////////////////////////// void netlinktest () { } ////////////////////////////////////////////////////////////////////////////// void romtest () { } ////////////////////////////////////////////////////////////////////////////// void misccarttest () { } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: cart.h --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef CARTH #define CARTH void carttest(); void artest (); void dram1mbittest (); void dram4mbittest (); void buptest (); void netlinktest (); void romtest (); void misccarttest (); #endif |
From: Theo B. <cyb...@us...> - 2008-02-17 00:36:58
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26695 Added Files: vdp1.c vdp1.h Log Message: -Initial add --- NEW FILE: vdp1.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <lapetus.h> #include "intfac.h" #include "tests.h" #include "vdp1.h" ////////////////////////////////////////////////////////////////////////////// void vdp1test() { int choice; MENUITEMSTRUCT vdp1menu[] = { { "Draw commands" , &vdp1drawtest, }, { "Clip commands" , &vdp1cliptest, }, { "Misc" , &vdp1misctest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; for (;;) { choice = DoMenu(vdp1menu, 8, 14, "VDP1 Tests"); ClearScr(); if (choice == ((sizeof(vdp1menu) / sizeof(MENUITEMSTRUCT)) - 2)) break; } } ////////////////////////////////////////////////////////////////////////////// void vdp1drawtest() { } ////////////////////////////////////////////////////////////////////////////// void vdp1cliptest() { } ////////////////////////////////////////////////////////////////////////////// void vdp1misctest() { } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: vdp1.h --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef VDP1H #define VDP1H void vdp1test(); void vdp1drawtest(); void vdp1cliptest(); void vdp1misctest(); #endif |
From: Theo B. <cyb...@us...> - 2008-02-17 00:36:31
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26667 Added Files: smpc.c smpc.h Log Message: -Initial add --- NEW FILE: smpc.c --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <lapetus.h> #include <stdio.h> #include "intfac.h" #include "tests.h" #include "smpc.h" ////////////////////////////////////////////////////////////////////////////// void smpctest() { int choice; MENUITEMSTRUCT smpcmenu[] = { { "SMPC commands" , &smpcmdtest, }, { "SMPC command timing", &smpccmdtimingtest, }, // { "Keyboard test" , &kbdtest, }, // { "Mouse target test" , &mousetest, }, // { "Stunner target test" , &stunnertest, }, { "Peripheral test" , &pertest, }, // { "Misc" , &miscsmpctest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; for (;;) { choice = DoMenu(smpcmenu, 8, 14, "SMPC Tests"); ClearScr(); if (choice == ((sizeof(smpcmenu) / sizeof(MENUITEMSTRUCT)) - 2)) break; } } ////////////////////////////////////////////////////////////////////////////// void smpcmdtest() { } ////////////////////////////////////////////////////////////////////////////// void smpccmdtimingtest() { } ////////////////////////////////////////////////////////////////////////////// void padtest() { } ////////////////////////////////////////////////////////////////////////////// void kbdtest() { } ////////////////////////////////////////////////////////////////////////////// void mousetest() { } ////////////////////////////////////////////////////////////////////////////// void analogtest() { } ////////////////////////////////////////////////////////////////////////////// void stunnertest() { } ////////////////////////////////////////////////////////////////////////////// typedef struct { u8 id; char *name; // u8 (*func)(int xoffset, int yoffset); } perinfo_struct; perinfo_struct perinfo[] = { { 0x02, "Standard Pad", }, { 0x13, "Racing Wheel", }, { 0x15, "Analog Pad", }, { 0x23, "Saturn Mouse", }, { 0x25, "Gun", }, { 0x34, "Keyboard", }, { 0xE1, "Megadrive 3 button", }, { 0xE2, "Megadrive 6 button", }, { 0xE3, "Shuttle Mouse", }, { 0xFF, "Nothing", } }; u8 perparse(char *portname, int yoffset, u8 oregcounter) { int i; u8 perid = SMPC_REG_OREG(oregcounter); oregcounter++; for (i = 0; i < (sizeof(perinfo) / sizeof(perinfo_struct)); i++) { if (perid == perinfo[i].id) { VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "Port %s: %s ", portname, perinfo[i].name); // parse button presses here if (perid == 0xFF) return oregcounter; return (oregcounter+(perid & 0xF)); } } VdpPrintf(&testdispfont, 0 * 8, yoffset, 0xF, "Port %s: Unknown", portname); return oregcounter; } ////////////////////////////////////////////////////////////////////////////// void pertest() { InterruptSetLevelMask(0xF); InitLapetus(RES_320x224); VdpRBG0Init(&testdispsettings); VdpSetDefaultPalette(); // Display On VdpDispOn(); // Disable Lapetus's peripheral handler BIOS_ChangeSCUInterruptMask(0xFFFFFFF, MASK_VBLANKOUT | MASK_SYSTEMMANAGER); testdispfont.transparent = 0; VdpPrintf(&testdispfont, 0 * 8, 1 * 8, 0xF, "Multitap test"); VdpPrintf(&testdispfont, 0 * 8, 2 * 8, 0xF, "(to exit, press A+B+C on first pad)"); for (;;) { unsigned char oregcounter=0; unsigned char portcon; int i, i2; VdpVsync(); // Issue intback command SmpcWaitTillReady(); SMPC_REG_IREG(0) = 0x00; // no intback status SMPC_REG_IREG(1) = 0x0A; // 15-byte mode, peripheral data returned, time optimized SMPC_REG_IREG(2) = 0xF0; // ??? SmpcIssueCommand(SMPC_CMD_INTBACK); // Wait till command is finished while(SMPC_REG_SF & 0x1) {} // Grab oreg's for (i = 0; i < 2; i++) { portcon = SMPC_REG_OREG(oregcounter); oregcounter++; if (portcon != 0x16) { VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Multi-tap not connected", i+1); for (i2 = 0; i2 < 6; i2++) VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)+1+i2) * 8, 0xF, " "); } else { VdpPrintf(&testdispfont, 0 * 8, (4+(8*i)) * 8, 0xF, "Port %d: Multi-tap connected ", i+1); for (i2 = 0; i2 < (portcon & 0x0F); i2++) { char text[3]; sprintf(text, "%d%c", i+1, 'A' + (char)i2); oregcounter = perparse(text, (4+(8*i)+1+i2) * 8, oregcounter); } } } } testdispfont.transparent = 1; } ////////////////////////////////////////////////////////////////////////////// void miscsmpctest() { } ////////////////////////////////////////////////////////////////////////////// --- NEW FILE: smpc.h --- /* Copyright 2008 Theo Berkau This file is part of Lapetus. Lapetus is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Lapetus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lapetus; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SMPCH #define SMPCH void smpctest(); void smpcmdtest(); void smpccmdtimingtest(); void padtest(); void kbdtest(); void mousetest(); void analogtest(); void stunnertest(); void pertest(); void miscsmpctest(); #endif |
From: Theo B. <cyb...@us...> - 2008-01-13 01:42:03
|
Update of /cvsroot/lapetus/lapetus In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25233 Modified Files: vdpinit.c Log Message: -Can now change to resolutions other than 320x224. High resolutions still don't work correctly Index: vdpinit.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/vdpinit.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vdpinit.c 9 Jan 2008 05:55:59 -0000 1.6 +++ vdpinit.c 13 Jan 2008 01:42:00 -0000 1.7 @@ -44,9 +44,6 @@ int i; u16 EWRR; - // Make sure VDP2 is in a sane state - VDP2_REG_TVMD = res; - if (res & 0x1) BIOS_SetClockSpeed(1); // 352 else @@ -86,13 +83,16 @@ default: break; } - if (res & 0xC) + if (res & 0xC0) vdp2settings.screenheight <<= 1; // Clear registers for (i = 0; i < 0x200; i+=2) *((volatile u16 *)(0x25F80000+i)) = 0x0000; + // Make sure VDP2 is in a sane state + VDP2_REG_TVMD = (u16)res; + // Make sure VDP1 is in a sane state VDP1_REG_PTMR = 0; |
From: Theo B. <cyb...@us...> - 2008-01-12 23:11:20
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3181 Modified Files: scu.c Log Message: -Added pad interrupt support Index: scu.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- scu.c 12 Jan 2008 18:17:51 -0000 1.3 +++ scu.c 12 Jan 2008 23:11:17 -0000 1.4 @@ -330,6 +330,9 @@ { SetupInterrupt(0x48, MASK_PAD); // Insert triggering mechanism here(fix me) - How does this one even work? + SMPC_REG_DDR1 = 0x60; + SMPC_REG_IOSEL = 0x1; + SMPC_REG_EXLE = 1; InterruptSetLevelMask(0x7); } |
From: Theo B. <cyb...@us...> - 2008-01-12 21:43:43
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv654 Modified Files: dsp.c Log Message: -Fixed the DSP tests Index: dsp.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/dsp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dsp.c 7 Jan 2008 03:10:46 -0000 1.1 +++ dsp.c 12 Jan 2008 21:43:37 -0000 1.2 @@ -60,10 +60,11 @@ // Clear out program control port u32 testval = SCUREG_PPAF; // Make sure program is stopped, etc. - SCUREG_PPAF = 0; + DSPStop(); - if (SCUREG_PPAF != 0) + if (DSPIsExec()) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPIsExec() == 1"); stagestatus = STAGESTAT_BADDATA; return; } @@ -72,23 +73,30 @@ SCUREG_PPAF = 0x8000; // Upload our program(END instruction) - SCUREG_PPD = 0xF0000000; + SCUREG_PPD = END(); SCUREG_PPD = 0x00000000; + SCUREG_PPD = END(); + SCUREG_PPD = END(); + SCUREG_PPD = END(); + SCUREG_PPD = END(); - if ((SCUREG_PPAF & 0xFF) != 0x02) + if ((SCUREG_PPAF & 0xFF) != 0x06) { stagestatus = STAGESTAT_BADDATA; return; } // Start executing program - SCUREG_PPAF = 0x10000; + DSPExec(0); // Check the flags - while ((testval = SCUREG_PPAF) & 0x10000) {} + while (DSPIsExec()) {} - if (testval != 0x01) + testval = SCUREG_PPAF; + + if (testval != 0x02) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "testval != 0x02(%08X)", testval); stagestatus = STAGESTAT_BADDATA; return; } @@ -132,7 +140,7 @@ void TestMVI_Imm_d() { - FillDSPProg(0xF0000000); + FillDSPProg(END()); dspprog[0] = MOV_Imm_d(0, MOVDEST_CT0); dspprog[1] = MOV_Imm_d(0, MOVDEST_CT1); @@ -155,14 +163,16 @@ dspprog[8] = 0xB1FEEDED; // NOP dspprog[9] = NOP(); + dspprog[0xEE] = NOP(); if (DSPLoad(dspprog, 0, 255) != LAPETUS_ERR_OK) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPLoad error"); stagestatus = STAGESTAT_BADDATA; return; } - DSPExec(); + DSPExec(0); // Wait until we're done while (SCUREG_PPAF & 0x10000) {} @@ -171,6 +181,7 @@ SCUREG_PDA = (0 << 6) | 0; if (SCUREG_PDD != 0xFF0DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 21 * 8, 0xF, "SCUREG_PDD != 0xFF0DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -178,6 +189,7 @@ SCUREG_PDA = (1 << 6) | 0; if (SCUREG_PDD != 0xFF1DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF1DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -185,6 +197,7 @@ SCUREG_PDA = (2 << 6) | 0; if (SCUREG_PDD != 0xFF2DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF2DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -192,13 +205,15 @@ SCUREG_PDA = (3 << 6) | 0; if (SCUREG_PDD != 0xFF3DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF3DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } // Ok, that looks good. Now check the PC, and we're done! - if ((SCUREG_PPAF & 0xFF) != 0xEE) + if ((SCUREG_PPAF & 0xFF) != 0xEF) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "(SCUREG_PPAF & 0xFF) != 0xEF(%08X)", SCUREG_PPAF); stagestatus = STAGESTAT_BADDATA; return; } @@ -214,13 +229,13 @@ u32 freq; u32 starttime; u32 endtime; + u32 testval; FillDSPProg(NOP()); dspprog[0] = CLR_A(); dspprog[1] = MOV_Imm_d(1, MOVDEST_PL); - dspprog[2] = ADD(); - dspprog[3] = MOV_ALU_A(); + dspprog[2] = ADD() | MOV_ALU_A(); dspprog[4] = MOV_Imm_d(0, MOVDEST_CT0); dspprog[5] = MOV_s_d(MOVSRC_ALUL, MOVDEST_MC0); dspprog[249] = JMP_Imm(2); @@ -229,30 +244,34 @@ if (DSPLoad(dspprog, 0, 255) != LAPETUS_ERR_OK) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPLoad error"); stagestatus = STAGESTAT_BADDATA; return; } starttime = TimerCounter(); - DSPExec(); + DSPExec(0); // Wait about X number of seconds, etc. - while (((endtime = TimerCounter()) - starttime) < (224 * 60)) {} + while (((endtime = TimerCounter()) - starttime) < (224 * 60)) { + if (!DSPIsExec()) + VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, "DSP stopped prematurely"); + } // Stop DSP, check counter in data ram to see how much got executed DSPStop(); // Now we can figure out how much time it took SCUREG_PDA = (0 << 6) | 0; - VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "%08X", SCUREG_PDD); + testval = SCUREG_PDD; -/* - if (SCUREG_PDD != ??) + if (testval != 0xB40F) { + VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "SCUREG_PDD != 0xB40F(%08X)", testval); stagestatus = STAGESTAT_BADTIMING; return; } -*/ + stagestatus = STAGESTAT_DONE; } |
From: Theo B. <cyb...@us...> - 2008-01-12 18:17:55
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16517 Modified Files: scu.c scu.h Log Message: -Fixed interrupt tests -Added SCU VER register and Interrupt tests to menu. Index: scu.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- scu.h 8 Jan 2008 09:28:40 -0000 1.2 +++ scu.h 12 Jan 2008 18:17:51 -0000 1.3 @@ -48,6 +48,7 @@ void TestDSP(); void TestMVI_Imm_d(); +void scuregistertest(void); void scuinttest(void); void scudmatest(); void scudsptest(); Index: scu.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- scu.c 8 Jan 2008 09:28:40 -0000 1.2 +++ scu.c 12 Jan 2008 18:17:51 -0000 1.3 @@ -65,11 +65,11 @@ int choice; MENUITEMSTRUCT scumenu[] = { -// { "SCU Register Test", &scuregistertest, }, - -// { "SCU Interrupt Test", &scuinttest, }, - { "SCU DMA Test" , &scudmatest, }, - { "SCU DSP Test" , &scudsptest, }, + { "Register Test", &scuregistertest, }, + { "Interrupt Test", &scuinttest, }, + { "DMA Test" , &scudmatest, }, + { "DSP Test" , &scudsptest, }, +// { "Misc" , &scumisctest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; @@ -84,8 +84,8 @@ } ////////////////////////////////////////////////////////////////////////////// -/* -void scuinttest(void) + +void scuregistertest(void) { InterruptSetLevelMask(0xF); @@ -101,7 +101,7 @@ DoTests("SCU Register tests", 0, 0); } -*/ + ////////////////////////////////////////////////////////////////////////////// void scuinttest() @@ -116,16 +116,16 @@ VdpDispOn(); UnregisterAllTests(); - RegisterTest(&TestISTandIMS, "Interrupt status and mask"); +// RegisterTest(&TestISTandIMS, "Interrupt status and mask"); RegisterTest(&TestVBlankInInterrupt, "Vblank-out Interrupt"); RegisterTest(&TestVBlankOutInterrupt, "Vblank-in Interrupt"); RegisterTest(&TestHBlankInInterrupt, "HBlank-in Interrupt"); RegisterTest(&TestTimer0Interrupt, "Timer 0 Interrupt"); RegisterTest(&TestTimer1Interrupt, "Timer 1 Interrupt"); -// RegisterTest(&TestDSPEndInterrupt, "DSP End Interrupt"); + RegisterTest(&TestDSPEndInterrupt, "DSP End Interrupt"); RegisterTest(&TestSoundRequestInterrupt, "Sound Request Interrupt"); -// RegisterTest(&TestSMPCInterrupt, "SMPC Interrupt"); -// RegisterTest(&TestPadInterrupt, "Pad Interrupt"); + RegisterTest(&TestSMPCInterrupt, "SMPC Interrupt"); + RegisterTest(&TestPadInterrupt, "Pad Interrupt"); RegisterTest(&TestDMA0Interrupt, "DMA0 Interrupt"); RegisterTest(&TestDMA1Interrupt, "DMA1 Interrupt"); RegisterTest(&TestDMA2Interrupt, "DMA2 Interrupt"); @@ -135,7 +135,6 @@ // If Netlink is connected, do a test on it too // if (NetlinkInit() == LAPETUS_ERR_OK) // RegisterTest(&TestNetlinkInterrupt, "Netlink Interrupt"); - DoTests("SCU Interrupt tests", 0, 0); } @@ -171,10 +170,6 @@ void TestSCUVERRegister() { // Make sure it's at least version 4 - VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "%08X", SCUREG_PPAF); - SCUREG_PPAF = 0; - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "%08X", SCUREG_PPAF); - if (SCUREG_VER < 4) stagestatus = STAGESTAT_BADDATA; else @@ -207,8 +202,6 @@ { // Need to do an A-bus interrupt acknowledge } - - VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, "int"); } ////////////////////////////////////////////////////////////////////////////// @@ -216,23 +209,21 @@ void SetupInterrupt(u8 vector, u32 mask) { InterruptSetLevelMask(0xF); - VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, " "); - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "setup start"); intvector = vector; stagestatus = STAGESTAT_WAITINGFORINT; oldfunc = BIOS_GetSCUInterrupt(intvector); oldmask = BIOS_GetSCUInterruptMask(); + BIOS_SetSCUInterruptMask(0xFFFFFFFF); BIOS_SetSCUInterrupt(intvector, testintfunc); isinttime = 1; BIOS_ChangeSCUInterruptMask(~mask, 0); - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "setup done "); } ////////////////////////////////////////////////////////////////////////////// void TestVBlankInInterrupt() { - SetupInterrupt(0x40, 0x0001); + SetupInterrupt(0x40, MASK_VBLANKIN); InterruptSetLevelMask(0xE); } @@ -241,7 +232,7 @@ void TestVBlankOutInterrupt() { - SetupInterrupt(0x41, 0x0002); + SetupInterrupt(0x41, MASK_VBLANKOUT); InterruptSetLevelMask(0xD); } @@ -250,7 +241,7 @@ void TestHBlankInInterrupt() { - SetupInterrupt(0x42, 0x0004); + SetupInterrupt(0x42, MASK_HBLANKIN); InterruptSetLevelMask(0xC); } @@ -259,9 +250,10 @@ void TestTimer0Interrupt() { - SetupInterrupt(0x43, 0x0008); + SetupInterrupt(0x43, MASK_TIMER0); - // Enable Timer 0 + // Enable Timer 0 compare + SCUREG_T1MD = 0x001; SCUREG_T0C = 19; InterruptSetLevelMask(0xB); @@ -274,7 +266,7 @@ SCUREG_T1MD = 0; SCUREG_T1S = 100; - SetupInterrupt(0x44, 0x0010); + SetupInterrupt(0x44, MASK_TIMER1); SCUREG_T1MD = 1; InterruptSetLevelMask(0xA); @@ -284,22 +276,19 @@ void TestDSPEndInterrupt() { - SetupInterrupt(0x45, 0x0020); - - // Clear out program control port - u32 testval = SCUREG_PPAF; + u32 dspprog[1]; - // Make sure program is stopped, etc. - SCUREG_PPAF = 0; + SetupInterrupt(0x45, MASK_DSPEND); - // Setup DSP so we can send a program to it - SCUREG_PPAF = 0x8000; + dspprog[0] = ENDI(); - // Upload our program(ENDI instruction) - SCUREG_PPD = 0xF8000000; + if (DSPLoad(dspprog, 0, 1) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } - // Start executing program - SCUREG_PPAF = 0x10000; + DSPExec(0); InterruptSetLevelMask(0x9); } @@ -308,7 +297,7 @@ void TestSoundRequestInterrupt() { - SetupInterrupt(0x46, 0x0040); + SetupInterrupt(0x46, MASK_SNDREQUEST); // Reset all Sound interrupts *((volatile u16*)0x25B0042E) = 0x7FF; @@ -326,8 +315,7 @@ void TestSMPCInterrupt() { - SetupInterrupt(0x47, 0x0080); - // Insert triggering mechanism here(fix me) + SetupInterrupt(0x47, MASK_SYSTEMMANAGER); SmpcWaitTillReady(); SMPC_REG_IREG(0) = 0x00; // no intback status SMPC_REG_IREG(1) = 0x0A; // 15-byte mode, peripheral data returned, time optimized @@ -340,8 +328,8 @@ void TestPadInterrupt() { - SetupInterrupt(0x48, 0x0100); - // Insert triggering mechanism here(fix me) + SetupInterrupt(0x48, MASK_PAD); + // Insert triggering mechanism here(fix me) - How does this one even work? InterruptSetLevelMask(0x7); } @@ -349,7 +337,7 @@ void TestDMA0Interrupt() { - SetupInterrupt(0x4B, 0x0800); + SetupInterrupt(0x4B, MASK_DMA0); // Do a quick DMA SCUREG_D0EN = 0; @@ -367,7 +355,7 @@ void TestDMA1Interrupt() { - SetupInterrupt(0x4A, 0x0400); + SetupInterrupt(0x4A, MASK_DMA1); // Do a quick DMA SCUREG_D1EN = 0; @@ -385,7 +373,7 @@ void TestDMA2Interrupt() { - SetupInterrupt(0x49, 0x0200); + SetupInterrupt(0x49, MASK_DMA2); // Do a quick DMA SCUREG_D2EN = 0; @@ -403,7 +391,8 @@ void TestDMAIllegalInterrupt() { - SetupInterrupt(0x4C, 0x1000); + SetupInterrupt(0x4C, MASK_DMAILLEGAL); + // Insert triggering mechanism here(fix me) // Do a quick DMA SCUREG_D0EN = 0; @@ -422,7 +411,7 @@ { sprite_struct localcoord; - SetupInterrupt(0x4D, 0x2000); + SetupInterrupt(0x4D, MASK_DRAWEND); localcoord.attr = 0; localcoord.x = 0; @@ -576,9 +565,9 @@ SCUREG_IST = 0; // Set DMA 0 interrupt function - BIOS_SetSCUInterrupt(0x4B, testintfunc); - - stagestatus = STAGESTAT_WAITINGFORINT; +// BIOS_SetSCUInterrupt(0x4B, testintfunc); +// stagestatus = STAGESTAT_WAITINGFORINT; + SetupInterrupt(0x4B, MASK_DMA0); // Do a quick DMA SCUREG_D0R = 0x06000C00; |