diff --git a/gpioMap.txt b/gpioMap.txt index e13a304..39b2589 100644 --- a/gpioMap.txt +++ b/gpioMap.txt @@ -1,4 +1,5 @@ -Port A: Fixed 0x40, likely nothing attached, is used by the Dragonball VZ built in display controller on other models +General Layout: +Port A: Fixed 0x40, likely nothing attached, is used by the Dragonball VZ built in grayscale display controller on other models Port B: Fixed 0x3F, likely nothing attached, probably used for chip select Port C: Usually 0x7F or 0x3F(less common), needs to be investigated further Port D: Hardware buttons @@ -6,5 +7,83 @@ Port E: Always 0x5E or 0x5C, only bit 1 seems used, needs to be investigated fur Port F: Always 0x9D or 0x9C, only bit 0 seems used, needs to be investigated further Port G: 0x15 when backlight is off, 0x17 when its on, bit 1 is a read back of SED1376 GPIO 0 pin 4 Port J: Fixed 0xB0, needs to be investigated further -Port K: Fixed 0x04 in testing, used to select Port Ds active matrix line +Port K: Fixed 0x04 in testing, used to select Port Ds active matrix line, bit 4 enables the vibrator motor Port M: Fixed 0x23, needs to be investigated further + +Pin Mapping(all pins are accounted for, documented or not): +Port A Pin 0: Unknown +Port A Pin 1: Unknown +Port A Pin 2: Unknown +Port A Pin 3: Unknown +Port A Pin 4: Unknown +Port A Pin 5: Unknown +Port A Pin 6: Unknown +Port A Pin 7: Unknown +Port B Pin 0: Unknown +Port B Pin 1: Unknown +Port B Pin 2: Unknown +Port B Pin 3: Unknown +Port B Pin 4: Unknown +Port B Pin 5: Unknown +Port B Pin 6: Unknown +Port B Pin 7: Unknown +Port C Pin 0: Unknown +Port C Pin 1: Unknown +Port C Pin 2: Unknown +Port C Pin 3: Unknown +Port C Pin 4: Unknown +Port C Pin 5: Unknown +Port C Pin 6: Unknown +Port C Pin 7: Unknown +Port D Pin 0: Button Matrix Input Line 0(low when button pressed) +Port D Pin 1: Button Matrix Input Line 1(low when button pressed) +Port D Pin 2: Button Matrix Input Line 2(low when button pressed) +Port D Pin 3: Button Matrix Input Line 3(low when button pressed) +Port D Pin 4: Unknown +Port D Pin 5: SD Card Status(low when card is inserted) +Port D Pin 6: Unknown +Port D Pin 7: Battery Critical Interrupt(low when critical) +Port E Pin 0: Unknown +Port E Pin 1: Unknown +Port E Pin 2: Unknown +Port E Pin 3: Unknown +Port E Pin 4: Unknown +Port E Pin 5: Unknown +Port E Pin 6: Unknown +Port E Pin 7: Unknown +Port F Pin 0: Unknown +Port F Pin 1: ADS7846 PENIRQ(low when screen is touched) +Port F Pin 2: Clock Output(required for SED1376 operation, reads and writes do nothing) +Port F Pin 3: Unknown +Port F Pin 4: Unknown +Port F Pin 5: Unknown +Port F Pin 6: Unknown +Port F Pin 7: Unknown +Port G Pin 0: Unknown +Port G Pin 1: Backlight State Read Back(high when backlight on) +Port G Pin 2: Unknown +Port G Pin 3: Unknown +Port G Pin 4: Unknown +Port G Pin 5: Unknown +Port J Pin 0: Unknown +Port J Pin 1: Unknown +Port J Pin 2: Unknown +Port J Pin 3: Unknown +Port J Pin 4: Unknown +Port J Pin 5: Unknown +Port J Pin 6: Unknown +Port J Pin 7: Unknown +Port K Pin 0: Unknown +Port K Pin 1: Unknown +Port K Pin 2: Unknown +Port K Pin 3: Unknown +Port K Pin 4: Enable Vibrator Motor(set high to enable) +Port K Pin 5: Button Matrix Line Select 0(set low to enable line, multiple lines can be enabled at once) +Port K Pin 6: Button Matrix Line Select 1(set low to enable line, multiple lines can be enabled at once) +Port K Pin 7: Button Matrix Line Select 2(set low to enable line, multiple lines can be enabled at once) +Port M Pin 0: Unknown +Port M Pin 1: Unknown +Port M Pin 2: Unknown +Port M Pin 3: Unknown +Port M Pin 4: Unknown +Port M Pin 5: Unknown \ No newline at end of file diff --git a/qtBuildSystem/Mu/Mu.pro.user b/qtBuildSystem/Mu/Mu.pro.user index 0be71b5..61a2059 100644 --- a/qtBuildSystem/Mu/Mu.pro.user +++ b/qtBuildSystem/Mu/Mu.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/hardwareRegisters.c b/src/hardwareRegisters.c index 84924ac..7a8b1d1 100644 --- a/src/hardwareRegisters.c +++ b/src/hardwareRegisters.c @@ -267,7 +267,8 @@ static void checkInterrupts(){ //some interrupts should probably be auto cleared after being run once, RTI, RTC, WATCHDOG and SPI1/2 seem like they should be cleared this way - pllWakeCpuIfOff(); + if(intLevel > 0)//the interrupt might actually need to be greater than the interrupt mask in the status register + pllWakeCpuIfOff(); m68k_set_irq(intLevel);//should be called even if intLevel is 0, that is how the interrupt state gets cleared } @@ -705,8 +706,8 @@ void setHwRegister8(uint32_t address, uint8_t value){ case PFSEL: //this is the clock output pin for the SED1376, if its disabled so is the LCD controller - setSed1376Attached(!(value & 0x04)); registerArrayWrite8(PFSEL, value); + setSed1376Attached(sed1376ClockConnected()); break; case PGSEL: @@ -858,11 +859,9 @@ void setHwRegister16(uint32_t address, uint16_t value){ case PLLCR: //CLKEN is required for SED1376 operation - if((value & 0x0010) != (registerArrayRead16(PLLCR) & 0x0010)) - setSed1376Attached(!(value & 0x0010)); - registerArrayWrite16(PLLCR, value & 0x3FBB); recalculateCpuSpeed(); + setSed1376Attached(sed1376ClockConnected()); if(value & 0x0008){ //The PLL shuts down 30 clock cycles of SYSCLK after the DISPLL bit is set in the PLLCR diff --git a/src/memoryAccess.c b/src/memoryAccess.c index bcc871a..1524754 100644 --- a/src/memoryAccess.c +++ b/src/memoryAccess.c @@ -372,19 +372,8 @@ void setRegisterFFFFAccessMode(){ } void setSed1376Attached(bool attached){ - if(chips[CHIP_B_SED].enable){ + if(chips[CHIP_B_SED].enable && bankType[START_BANK(chips[CHIP_B_SED].start)] != (attached ? CHIP_B_SED : CHIP_NONE)) memset(&bankType[START_BANK(chips[CHIP_B_SED].start)], attached ? CHIP_B_SED : CHIP_NONE, END_BANK(chips[CHIP_B_SED].start, chips[CHIP_B_SED].size) - START_BANK(chips[CHIP_B_SED].start) + 1); - /* - if(attached){ - MULTITHREAD_LOOP for(uint16_t bank = START_BANK(chips[CHIP_B_SED].start); bank <= END_BANK(chips[CHIP_B_SED].start, chips[CHIP_B_SED].size); bank++) - bankType[bank] = CHIP_B_SED; - } - else{ - MULTITHREAD_LOOP for(uint16_t bank = START_BANK(chips[CHIP_B_SED].start); bank <= END_BANK(chips[CHIP_B_SED].start, chips[CHIP_B_SED].size); bank++) - bankType[bank] = CHIP_NONE; - } - */ - } } void resetAddressSpace(){ diff --git a/unimplementedFeatures.txt b/unimplementedFeatures.txt index 0b46fc9..b4f733b 100644 --- a/unimplementedFeatures.txt +++ b/unimplementedFeatures.txt @@ -27,12 +27,13 @@ SPI1, probably the sdcard since sdcards use SPI for data transfer SPITEST SSTATUS is undocumented and therefore unemulated may need to trigger an interrupt if a IMR masked interrupt becomes unmasked and its bit is still set in IPR touch interrupt seems to not use IRQ5 -When SPICLK2, SPITXD or SPIRXD on port e is disabled ADS7846 functions should respond approptatly(not transmitting or receiving or blocking both for the clock) +When SPICLK2, SPITXD or SPIRXD on port e is disabled ADS7846 functions should respond appropriately(not transmitting or receiving or blocking both for the clock) port g data bit 2 may need to be 0 to access ADS7846 REFREQ clock frequency in RTCCTL should slow down the RTC when enabled port d IRQ* bits edge triggered interrupt mode is not emulated port g backlight state readback port d seems to allow using special function pins as inputs while active unlike other ports, this needs to be verified +edgeTriggeredInterruptLastValue may need to be locked when PLL is off Debug tools: missing icons