New test added

This commit is contained in:
meepingsnesroms
2018-09-08 16:34:46 -07:00
parent 1034ad8575
commit c07c100f3d
6 changed files with 81 additions and 8 deletions

View File

@@ -35,30 +35,40 @@ var testButtonInput(){
frameCount = 0;
}
if(getButton(buttonLeft) && getButton(buttonRight) && getButton(buttonUp) && getButton(buttonBack) && !getButton(buttonDown) && !getButton(buttonSelect)){
if(getButton(buttonUp) && !getButton(buttonDown)){
firstRun = true;
writeArbitraryMemory8(HW_REG_ADDR(PDPOL), portDOriginalPolarity);
exitSubprogram();
}
UG_PutString(0, y, "Press Left,Right,Up and Back to exit this test.");
UG_PutString(0, y, "Press Up but not Down to exit this test.");
y += (FONT_HEIGHT + 1) * 2;
UG_PutString(0, y, "This requirement is to allow button testing.");
y += (FONT_HEIGHT + 1) * 2;
StrPrintF(sharedDataBuffer, "PDDIR:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDDIR)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDSEL:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDSEL)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDPOL:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDPOL)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDDATA:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDDATA)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDIRQEN:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDIRQEN)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDIRQEG:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDIRQEG)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDKBEN:0x%02X", readArbitraryMemory8(HW_REG_ADDR(PDKBEN)));
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
return makeVar(LENGTH_0, TYPE_NULL, 0);
}
@@ -646,6 +656,47 @@ var getInterruptInfo(){
return makeVar(LENGTH_0, TYPE_NULL, 0);
}
var getIcrInversion(){
static Boolean firstRun = true;
uint16_t oldIcr;
uint8_t portDValues[2];
uint16_t y = 0;
if(firstRun){
debugSafeScreenClear(C_WHITE);
firstRun = false;
}
if(getButtonPressed(buttonBack)){
firstRun = true;
exitSubprogram();
}
turnInterruptsOff();
oldIcr = readArbitraryMemory16(HW_REG_ADDR(ICR));
//not inverted
portDValues[0] = readArbitraryMemory8(HW_REG_ADDR(PDDATA));
writeArbitraryMemory16(HW_REG_ADDR(ICR), oldIcr | 0xF000);
//inverted
portDValues[1] = readArbitraryMemory8(HW_REG_ADDR(PDDATA));
writeArbitraryMemory16(HW_REG_ADDR(ICR), oldIcr);
turnInterruptsOn();
StrPrintF(sharedDataBuffer, "PDDATA Normal:0x%02X", portDValues[0]);
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
StrPrintF(sharedDataBuffer, "PDDATA Inverted:0x%02X", portDValues[1]);
UG_PutString(0, y, sharedDataBuffer);
y += FONT_HEIGHT + 1;
return makeVar(LENGTH_0, TYPE_NULL, 0);
}
var toggleBacklight(){
static Boolean firstRun = true;
uint16_t y = 0;

View File

@@ -17,6 +17,7 @@ var getClk32Frequency();
var getDeviceInfo();
var getCpuInfo();
var getInterruptInfo();
var getIcrInversion();
var toggleBacklight();
var toggleMotor();
var toggleAlarmLed();

View File

@@ -328,6 +328,10 @@ void resetFunctionViewer(){
hwTests[totalHwTests].testFunction = getInterruptInfo;
totalHwTests++;
StrNCopy(hwTests[totalHwTests].name, "Get ICR Inversion", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = getIcrInversion;
totalHwTests++;
StrNCopy(hwTests[totalHwTests].name, "ADS7846 Read", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = ads7846Read;
totalHwTests++;

View File

@@ -2,6 +2,21 @@
#define PDIUSBD12_COMMANDS_HEADER
/*PDIUSBD12 Commands*/
#define READ_INTERRUPT_REGISTER 0xF4
#define SELECT_ENDPOINT_CTRL_OUT 0x00
#define SELECT_ENDPOINT_CTRL_IN 0x01
#define SELECT_ENDPOINT_EP1_OUT 0x02
#define SELECT_ENDPOINT_EP1_IN 0x03
#define SELECT_ENDPOINT_EP2_OUT 0x04
#define SELECT_ENDPOINT_EP2_IN 0x05
#define SET_ADDRESS_ENABLE 0xD0
#define SET_ENDPOINT_ENABLE 0xD8
#define CLEAR_BUFFER 0xF2
#define SET_MODE 0xF3
#define READ_INTERRUPT_REGISTER 0xF4
#define SET_DMA 0xFB
#endif

View File

@@ -74,7 +74,7 @@ void pdiUsbD12LoadState(uint8_t* data){
uint8_t pdiUsbD12GetRegister(bool address){
//just log all USB accesses for now
debugLog("USB read, address:0x%01X\n", address);
//debugLog("USB read, address:0x%01X\n", address);
if(!address){
//0x0 data
@@ -91,7 +91,7 @@ uint8_t pdiUsbD12GetRegister(bool address){
void pdiUsbD12SetRegister(bool address, uint8_t value){
//just log all USB accesses for now
debugLog("USB write, address:0x%01X, value:0x%02X\n", address, value);
//debugLog("USB write, address:0x%01X, value:0x%02X\n", address, value);
if(!address){
//0x0 data
@@ -109,6 +109,7 @@ void pdiUsbD12SetRegister(bool address, uint8_t value){
break;
default:
debugLog("USB unknown command, address:0x%01X, value:0x%02X\n", address, value);
break;
}
}

View File

@@ -22,10 +22,10 @@ REFREQ clock frequency in RTCCTL should slow down the RTC when enabled
Dont know if it possible to have the backlight on and the display off at the same time(theres no reason for it but it may be possible)
SPI1 slave mode, should never be used
Edge triggered IRQ* and INT* interrupt pins may actually read the value of the interrupt instead of the pin value
ICR POL(1,2,3,6) may flip the pin value as well as the interrupt, POL5 does not flip the INT5 pin though, this was confirmed with a hardware test
port d data register seems to have its data bits cleared when an edge triggered interrupt is cleared(according to MC68VZ328UM.pdf Page 10-15)
USB chip seems to share an interrupt with the SD card
RxOverflow on SPI1, don't know if back or front of FIFO is overwritten on overflow(currently losing oldest entry)
IRQ2 seems to not even be hooked up in IDA
Debug tools:
missing home screen icons
@@ -50,6 +50,7 @@ Channels 3 and 4(they need to be scaled differently)
Fixed:
ICR POL(1,2,3,6) may flip the pin value as well as the interrupt, POL5 does not flip the INT5 pin though, this was confirmed with a hardware test(it doesnt)
framebuffer accesses can cause a buffer overflow(this was always the case, its not a new bug)(just increased the buffer to an address line maskable size)
chipselect mirroring is wrong(CS*0 and CS*1 are considered continuous when mapped with more address space than memory, mirroring is currently [CS*0, CS*1, repeat alternating till the end of address space] it should be [CS*0, repeat CS*0 until half way through CS* address space, CS*1, repeat CS*1 until end of CS* address space])
the second line on all the chip selects is not properly emulated, they should be empty and trigger a bus error(except CSD1, it seems to follow different rules) but currently mirror the first half