improve regs test (and make it a fifo example)
This commit is contained in:
parent
c442ae295f
commit
78be544fc2
|
@ -1,6 +1,6 @@
|
|||
/*---------------------------------------------------------------------------------
|
||||
|
||||
default ARM7 core
|
||||
once upon a time, this was: default ARM7 core
|
||||
|
||||
Copyright (C) 2005
|
||||
Michael Noland (joat)
|
||||
|
@ -30,6 +30,8 @@ distribution.
|
|||
#include <maxmod7.h>
|
||||
#include "../../regstest.h"
|
||||
|
||||
arm7comm_t *arm7comm;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void VcountHandler() {
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -42,21 +44,22 @@ void VblankHandler(void) {
|
|||
Wifi_Update();
|
||||
}
|
||||
|
||||
void pokeMessage(char* msg)
|
||||
void pokeMessage(const char* msg)
|
||||
{
|
||||
char* cp = msg;
|
||||
const char* cp = msg;
|
||||
int i=0;
|
||||
while(*cp)
|
||||
arm7comm->message[i++] = *cp++;
|
||||
arm7comm->message[i] = 0;
|
||||
}
|
||||
|
||||
void fail(char* msg, u32 offender=0)
|
||||
void fail(const char* msg, u32 offender=0)
|
||||
{
|
||||
arm7comm->code = 1;
|
||||
arm7comm->offender = offender;
|
||||
pokeMessage(msg);
|
||||
|
||||
fifoSendValue32(FIFO_USER_01,0);
|
||||
while (1) swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
@ -86,10 +89,11 @@ int main() {
|
|||
|
||||
irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);
|
||||
|
||||
|
||||
while (arm7comm->code != 0xDEADBEEF)
|
||||
swiWaitForVBlank();
|
||||
//find out where the arm9 wants us to stash our info
|
||||
while(!fifoCheckAddress(FIFO_USER_01)) swiWaitForVBlank();
|
||||
arm7comm = (arm7comm_t*)fifoGetAddress(FIFO_USER_01);
|
||||
|
||||
|
||||
//spu source reg should only be 27bit
|
||||
//but it is not readable so what does it matter
|
||||
for(int i=0;i<16;i++)
|
||||
|
@ -111,6 +115,7 @@ int main() {
|
|||
|
||||
|
||||
arm7comm->code = 2;
|
||||
fifoSendValue32(FIFO_USER_01,0);
|
||||
while (1) swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,16 +30,22 @@ void _myassert(const char *fileName, int lineNumber, const char* conditionString
|
|||
for(;;) swiWaitForVBlank();
|
||||
}
|
||||
|
||||
arm7comm_t arm7comm;
|
||||
|
||||
int main(void) {
|
||||
consoleDemoInit();
|
||||
|
||||
arm7comm->code = 0xDEADBEEF;
|
||||
//tell the arm7 where to store its stuff
|
||||
//(the arm7 needs to know a location in main memory (shared) to store its results)
|
||||
//(it could store its results in shared arm7 memory but we chose to do it this way since)
|
||||
//(I couldn't figure out how to specify storage there for a global in arm7.cpp. any suggestions?)
|
||||
fifoSendAddress(FIFO_USER_01,&arm7comm);
|
||||
|
||||
//fog table entries should not be readable. they should return 0
|
||||
for(int i=0;i<32;i++)
|
||||
{
|
||||
GFX_FOG_TABLE[i] = 0xFF;
|
||||
iprintf("%02X\n",GFX_FOG_TABLE[i]);
|
||||
//iprintf("%02X\n",GFX_FOG_TABLE[i]);
|
||||
myassert(GFX_FOG_TABLE[i] == 0x00,"test whether fog table entries are non-readable");
|
||||
}
|
||||
|
||||
|
@ -77,19 +83,20 @@ int main(void) {
|
|||
//-------------------
|
||||
iprintf("waiting for arm7 test to finish!\n");
|
||||
|
||||
//wait for arm7 test to finish
|
||||
for(;;) {
|
||||
if(arm7comm->code != 0xDEADBEEF) break;
|
||||
for(;;)
|
||||
{
|
||||
if(fifoCheckValue32(FIFO_USER_01))
|
||||
break;
|
||||
swiWaitForVBlank();
|
||||
}
|
||||
|
||||
iprintf("arm7 finish code: %d\n",arm7comm->code);
|
||||
iprintf("arm7 finish code: %d\n",arm7comm.code);
|
||||
|
||||
if(arm7comm->code == 1)
|
||||
if(arm7comm.code == 1)
|
||||
{
|
||||
iprintf("arm7 test failed!\n");
|
||||
iprintf("%s\n",arm7comm->message);
|
||||
iprintf("offending val: 0x%08X\n",arm7comm->offender);
|
||||
iprintf("%s\n",arm7comm.message);
|
||||
iprintf("offending val: 0x%08X\n",arm7comm.offender);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -5,4 +5,4 @@ typedef struct _arm7comm_t
|
|||
char message[1024];
|
||||
} arm7comm_t;
|
||||
|
||||
#define arm7comm ( (arm7comm_t*)0x02200000 )
|
||||
//#define arm7comm ( (arm7comm_t*)0x02200000 )
|
Loading…
Reference in New Issue