diff --git a/hwTestSuite/debug.c b/hwTestSuite/debug.c index 586e4b6..13d91a1 100644 --- a/hwTestSuite/debug.c +++ b/hwTestSuite/debug.c @@ -5,7 +5,7 @@ #ifdef DEBUG -#define DEBUG_AREA_SIZE 10 +#define DEBUG_AREA_SIZE 30 #define DEBUG_STRING_SIZE 100 diff --git a/hwTestSuite/emuFunctions.c b/hwTestSuite/emuFunctions.c index 6bebd1b..485d4a6 100644 --- a/hwTestSuite/emuFunctions.c +++ b/hwTestSuite/emuFunctions.c @@ -3,7 +3,8 @@ #include "emuFeatureRegistersSpec.h" Boolean isEmulator(){ - return (readArbitraryMemory32(EMU_REGISTER_BASE | EMU_INFO) & FEATURE_EMU_HONEST) != 0; + /*return (readArbitraryMemory32(EMU_REGISTER_BASE | EMU_INFO) & FEATURE_EMU_HONEST) != 0;*/ + return false; } Boolean isEmulatorFeatureEnabled(uint32_t feature){ diff --git a/hwTestSuite/readme.md b/hwTestSuite/readme.md index 4981274..8b06f0d 100644 --- a/hwTestSuite/readme.md +++ b/hwTestSuite/readme.md @@ -16,4 +16,4 @@ If you enable unsafe mode you will have to reboot to exit, this is because it wi In the hex viewer registers that are not safe to read will say "UNSAFE" instead of a hex value, the main unsafe reads are the uart registers. There is almost no memory, 4KB stack on some devices. -For some reason the official FileClose(FileHandle) crashes with "Fatal Exeption" on Clie Peg-SL10 and "illegal instruction 19F0 at 00000002" on Tungsten E and black screen reboot on Palm T|X, I think that it corrupts the stack triggering a jump to 0x00000000. +(Resolved, writing off the end of the framebuffer caused this)For some reason the official FileClose(FileHandle) crashes with "Fatal Exeption" on Clie Peg-SL10 and "illegal instruction 19F0 at 00000002" on Tungsten E and black screen reboot on Palm T|X, I think that it corrupts the stack triggering a jump to 0x00000000. diff --git a/hwTestSuite/testSuite.c b/hwTestSuite/testSuite.c index 8a47aae..c43323f 100644 --- a/hwTestSuite/testSuite.c +++ b/hwTestSuite/testSuite.c @@ -92,6 +92,12 @@ var memoryAllocationError(){ static void uguiDrawPixel(UG_S16 x, UG_S16 y, UG_COLOR color){ + /*ugui will call this function even if its over the screen bounds, dont let those writes through*/ + /* + if(x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT){ + } + */ + /*using 1bit grayscale*/ int pixel = x + y * SCREEN_WIDTH; int byte = pixel / 8; @@ -196,7 +202,7 @@ static Boolean testerInit(){ WinSetActiveWindow(WinGetDisplayWindow()); UG_Init(&uguiStruct, uguiDrawPixel, SCREEN_WIDTH, SCREEN_HEIGHT); - UG_FontSelect(&FONT_8X8); + UG_FontSelect(&SELECTED_FONT); UG_SetBackcolor(C_WHITE); UG_SetForecolor(C_BLACK); UG_ConsoleSetBackcolor(C_WHITE); @@ -225,12 +231,17 @@ static void testerFrameLoop(){ palmButtons = KeyCurrentState(); if(!unsafeMode){ - /*allow exiting the app normally*/ + /*allow exiting the app normally and prevent filling up the event loop*/ EventType event; - EvtGetEvent(&event, 1); - SysHandleEvent(&event); - if(event.eType == appStopEvent) - applicationRunning = false; + do{ + EvtGetEvent(&event, 1); + SysHandleEvent(&event); + if(event.eType == appStopEvent){ + applicationRunning = false; + break; + } + } + while(event.eType != nilEvent); } lastSubprogramReturnValue = currentSubprogram(); @@ -257,6 +268,18 @@ DWord PilotMain(Word cmd, Ptr cmdBPB, Word launchFlags){ testerExit(); } + + else if(cmd == sysAppLaunchCmdSystemReset){ + #ifdef DEBUG + /*app crashed, to ease development just self delete from internal storage*/ + /* + LocalID whatToDelete; + whatToDelete = DmFindDatabase(0, "HWTests"); + DmDeleteDatabase(0, whatToDelete); + SysReset(); + */ + #endif + } return(0); } diff --git a/hwTestSuite/testSuiteConfig.h b/hwTestSuite/testSuiteConfig.h index 1d151a0..0c014b1 100644 --- a/hwTestSuite/testSuiteConfig.h +++ b/hwTestSuite/testSuiteConfig.h @@ -8,4 +8,8 @@ #define TESTS_AVAILABLE 20 #define TEST_NAME_LENGTH 32 +#define FONT_WIDTH 6 +#define FONT_HEIGHT 8 +#define SELECTED_FONT FONT_6X8 + #endif diff --git a/hwTestSuite/tools.c b/hwTestSuite/tools.c index 45c7f41..9db1ca7 100644 --- a/hwTestSuite/tools.c +++ b/hwTestSuite/tools.c @@ -29,9 +29,7 @@ Err makeFile(uint8_t* data, uint32_t size, char* fileName){ count -= chunkSize; } - UG_PutString(0, 0, "File close next"); - - error = FileClose(file);//I have no idea why, but this function causes a fatal execption but i still get valid data in the file after reboot + error = FileClose(file); return error; } @@ -63,7 +61,7 @@ var hexRamBrowser(){ nibble = UINT32_C(0x10000000); clearScreen = true; setSubprogramArgs(makeVar(LENGTH_ANY, TYPE_PTR, (uint64_t)pointerValue));/*length doesnt matter*/ - execSubprogram(hexViewer); + callSubprogram(hexViewer); } if(getButtonPressed(buttonBack)){ @@ -111,7 +109,7 @@ var getTrapAddress(){ nibble = 0x100; clearScreen = true; setSubprogramArgs(makeVar(LENGTH_ANY, TYPE_PTR, (uint64_t)(uint32_t)SysGetTrapAddress(trapNum))); - execSubprogram(valueViewer); + callSubprogram(valueViewer); } if(getButtonPressed(buttonBack)){ @@ -131,6 +129,61 @@ var getTrapAddress(){ return makeVar(LENGTH_0, TYPE_NULL, 0); } +var manualLssa(){ + static uint32_t nibble; + static uint32_t hexValue; + static uint32_t originalLssa; + static Boolean customEnabled; + static Boolean firstRun = true; + + if(firstRun == true){ + nibble = UINT32_C(0x10000000); + hexValue = UINT32_C(0x77777777); + originalLssa = readArbitraryMemory32(0xFFFFFA00); + customEnabled = false; + firstRun = false; + } + + if(getButtonPressed(buttonUp)){ + hexValue += nibble; + } + + if(getButtonPressed(buttonDown)){ + hexValue -= nibble; + } + + if(getButtonPressed(buttonRight)){ + if(nibble > UINT32_C(0x00000001)) + nibble >>= 4; + } + + if(getButtonPressed(buttonLeft)){ + if(nibble < UINT32_C(0x10000000)) + nibble <<= 4; + } + + if(getButtonPressed(buttonSelect)){ + if(customEnabled){ + writeArbitraryMemory32(0xFFFFFA00, originalLssa); + customEnabled = false; + } + else{ + writeArbitraryMemory32(0xFFFFFA00, hexValue); + customEnabled = true; + } + } + + if(getButtonPressed(buttonBack)){ + firstRun = true; + exitSubprogram(); + } + + StrPrintF(sharedDataBuffer, "Enter switchs between this address and the custom LSSA.\nNew LSSA:\n0x%08lX", hexValue); + UG_PutString(0, 0, sharedDataBuffer); + + return makeVar(LENGTH_0, TYPE_NULL, 0); +} + var dumpBootloaderToFile(){ makeFile((uint8_t*)UINT32_C(0xFFFFFE00), 0x200, "BOOTLOADER.BIN"); exitSubprogram(); diff --git a/hwTestSuite/tools.h b/hwTestSuite/tools.h index 04b3e18..fc3235a 100644 --- a/hwTestSuite/tools.h +++ b/hwTestSuite/tools.h @@ -5,7 +5,8 @@ #include "testSuite.h" Err makeFile(uint8_t* data, uint32_t size, char* fileName); -var getTrapAddress(); var hexRamBrowser(); +var getTrapAddress(); +var manualLssa(); var dumpBootloaderToFile(); #endif diff --git a/hwTestSuite/ugui_config.h b/hwTestSuite/ugui_config.h index 9159925..41ef7a6 100755 --- a/hwTestSuite/ugui_config.h +++ b/hwTestSuite/ugui_config.h @@ -1,7 +1,8 @@ #ifndef __UGUI_CONFIG_H #define __UGUI_CONFIG_H -#include +#include +#include "testSuiteConfig.h" /* -------------------------------------------------------------------------------- */ /* -- CONFIG SECTION -- */ @@ -13,14 +14,21 @@ //#define USE_COLOR_RGB888 // RGB = 0xFF,0xFF,0xFF #define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB -/* Enable needed fonts here */ -//#define USE_FONT_4X6 +/* Enable needed fonts here */ +#if FONT_WIDTH == 4 && FONT_HEIGHT == 6 +#define USE_FONT_4X6 +#elif FONT_WIDTH == 5 && FONT_HEIGHT == 8 +#define USE_FONT_5X8 +#elif FONT_WIDTH == 6 && FONT_HEIGHT == 8 +#define USE_FONT_6X8 +#endif +//#define USE_FONT_4X6 //#define USE_FONT_5X8 //#define USE_FONT_5X12 //#define USE_FONT_6X8 //#define USE_FONT_6X10 //#define USE_FONT_7X12 -#define USE_FONT_8X8 +//#define USE_FONT_8X8 //#define USE_FONT_8X12_CYRILLIC //#define USE_FONT_8X12 //#define USE_FONT_8X12 diff --git a/hwTestSuite/viewer.c b/hwTestSuite/viewer.c index 0f51d1b..3a8a326 100644 --- a/hwTestSuite/viewer.c +++ b/hwTestSuite/viewer.c @@ -3,11 +3,10 @@ #include "tools.h" #include "tests.h" #include "debug.h" +#include "cpu.h" #include "ugui.h" -#define FONT_WIDTH 8 -#define FONT_HEIGHT 8 #define FONT_SPACING 0 #define RESERVED_PIXELS_Y (SCREEN_HEIGHT / 4)/*save pixels at the bottom of the screen for other information on the current item*/ @@ -107,7 +106,7 @@ static void testPickerHandler(uint32_t command){ } else if(command == LIST_ITEM_SELECTED){ setDebugTag("Test Picker Test Selected"); - execSubprogram(hwTests[selectedEntry].testFunction); + callSubprogram(hwTests[selectedEntry].testFunction); } } @@ -287,11 +286,19 @@ void initViewer(){ hwTests[totalHwTests].testFunction = getTrapAddress; totalHwTests++; - StrNCopy(hwTests[totalHwTests].name, "Dump Bootloader", TEST_NAME_LENGTH); - hwTests[totalHwTests].testFunction = dumpBootloaderToFile; - totalHwTests++; + if(getPhysicalCpuType() & CPU_M68K){ + /*68k only functions*/ + StrNCopy(hwTests[totalHwTests].name, "Dump Bootloader", TEST_NAME_LENGTH); + hwTests[totalHwTests].testFunction = dumpBootloaderToFile; + totalHwTests++; + + StrNCopy(hwTests[totalHwTests].name, "Manual LSSA", TEST_NAME_LENGTH); + hwTests[totalHwTests].testFunction = manualLssa; + totalHwTests++; + } StrNCopy(hwTests[totalHwTests].name, "File Access Test", TEST_NAME_LENGTH); hwTests[totalHwTests].testFunction = testFileAccessWorks; totalHwTests++; + }