diff --git a/bugs/unimplementedHardware.txt b/bugs/unimplementedHardware.txt index cb87ced..8419806 100644 --- a/bugs/unimplementedHardware.txt +++ b/bugs/unimplementedHardware.txt @@ -57,10 +57,13 @@ MakePalmBitmap: Other: Qt port dosent support Windows touchscreen input memory dumping dosent work for OS 5 yet -T3 I2C currently has no ACK bits(should work without them its just inaccurate) -make the headers belong to the main file of the target chip being emulated +T3 I2C currently has no ACK bits(should work without them its just inaccurate)(I2C works fine though) +T3 emulation attempts to set GPIO1(reset button) as an output +GPIO lines from misc chips to CPU are not implemented + Fixed: +make the headers belong to the main file of the target chip being emulated for specs remove specs folder UART1 USTCNT1 trying to beam anything will lock up the OS diff --git a/src/pxa260/pxa260.c b/src/pxa260/pxa260.c index ca2fb35..a807be2 100644 --- a/src/pxa260/pxa260.c +++ b/src/pxa260/pxa260.c @@ -221,6 +221,8 @@ void pxa260LoadState(uint8_t* data){ void pxa260Execute(bool wantVideo){ uint32_t index; + pxa260gpioUpdateKeyMatrix(&pxa260Gpio); + //pxa260TimingRun(TUNGSTEN_T3_CPU_PLL_FREQUENCY / EMU_FPS * palmClockMultiplier); pxa260TimingRun(20000); diff --git a/src/pxa260/pxa260_GPIO.c b/src/pxa260/pxa260_GPIO.c index 7e15883..7c6dae2 100644 --- a/src/pxa260/pxa260_GPIO.c +++ b/src/pxa260/pxa260_GPIO.c @@ -11,12 +11,13 @@ static void pxa260gpioOnOutputPinUpdated(Pxa260gpio* gpio, UInt8 gpioNum){ //debugLog("PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum)); switch(gpioNum){ - /* case 19: case 20: case 21: case 22: - */ + case 33: + pxa260gpioUpdateKeyMatrix(gpio); + break; case 24: //TSC2101 chip select @@ -30,13 +31,12 @@ static void pxa260gpioOnOutputPinUpdated(Pxa260gpio* gpio, UInt8 gpioNum){ break; default: - debugLog("Unimplimented PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum)); + debugLog("Unimplimented PXA260 GPIO %d set:%d, PC:0x%08X\n", gpioNum, pxa260gpioGetState(gpio, gpioNum), pxa260GetPc()); break; } } static void pxa260gpioPrvRecalcValues(Pxa260gpio* gpio, UInt32 which){ - UInt8 i; UInt32 val, bit, newVal, oldVal = gpio->levels[which]; @@ -242,15 +242,54 @@ void pxa260gpioSetState(Pxa260gpio* gpio, UInt8 gpioNum, Boolean on){ } UInt8 pxa260gpioGetState(Pxa260gpio* gpio, UInt8 gpioNum){ - UInt32 sSet = gpioNum >> 5; UInt32 bSet = gpioNum >> 4; UInt32 sV = 1UL << (gpioNum & 0x1F); UInt32 bV = 3UL << (gpioNum & 0x0F); - if(gpioNum >= 85) return PXA260_GPIO_NOT_PRESENT; if(gpio->AFRs[bSet] & bV) return ((gpio->AFRs[bSet] & bV) >> (gpioNum & 0x0F)) - 1 + PXA260_GPIO_AFR1; if(gpio->dirs[sSet] & sV) return (gpio->latches[sSet] & sV) ? PXA260_GPIO_HIGH : PXA260_GPIO_LOW; return PXA260_GPIO_HiZ; } + +void pxa260gpioUpdateKeyMatrix(Pxa260gpio* gpio){ + bool inRail0 = true; + bool inRail1 = true; + bool inRail2 = true; + + if(!!pxa260gpioGetState(gpio, 19)){ + //outRail0 + inRail0 &= !palmInput.buttonAddress; + inRail1 &= !palmInput.buttonDown; + } + if(!!pxa260gpioGetState(gpio, 20)){ + //outRail1 + inRail1 &= !palmInput.buttonLeft; + inRail2 &= !palmInput.buttonNotes; + } + if(!!pxa260gpioGetState(gpio, 21)){ + //outRail2 + inRail1 &= !palmInput.buttonRight; + inRail2 &= !palmInput.buttonTodo; + } + if(!!pxa260gpioGetState(gpio, 22)){ + //outRail3 + //TODO: implement this button + //inRail0 &= !palmInput.buttonVoice; + inRail2 &= !palmInput.buttonCenter; + } + if(!!pxa260gpioGetState(gpio, 33)){ + //outRail4 + inRail0 &= !palmInput.buttonCalendar; + inRail1 &= !palmInput.buttonUp; + } + + pxa260gpioSetState(gpio, 0, inRail0); + pxa260gpioSetState(gpio, 10, inRail1); + pxa260gpioSetState(gpio, 11, inRail2); + + //TODO: move these to the init routine + pxa260gpioSetState(gpio, 3, true);//set the slider postion + pxa260gpioSetState(gpio, 12, false);//prevent HotSync button from being pressed +} diff --git a/src/pxa260/pxa260_GPIO.h b/src/pxa260/pxa260_GPIO.h index 9fe8972..73f7c36 100644 --- a/src/pxa260/pxa260_GPIO.h +++ b/src/pxa260/pxa260_GPIO.h @@ -43,6 +43,7 @@ void pxa260gpioInit(Pxa260gpio* gpio, Pxa260ic* ic); //for external use :) UInt8 pxa260gpioGetState(Pxa260gpio* gpio, UInt8 gpioNum); void pxa260gpioSetState(Pxa260gpio* gpio, UInt8 gpioNum, Boolean on); //we can only set value (and only of input pins), not direction +void pxa260gpioUpdateKeyMatrix(Pxa260gpio* gpio); #endif diff --git a/src/tsc2101.c b/src/tsc2101.c index 83a9da9..0dfbec0 100644 --- a/src/tsc2101.c +++ b/src/tsc2101.c @@ -163,7 +163,8 @@ static uint16_t tsc2101GetAux1Value(void){ debugLog("TSC2101 AUX1 detect type:%s\n", (tsc2101Registers[TOUCH_CONTROL_MEASUREMENT_CONFIGURATION] & 0x4000) ? "resistance" : "voltage"); if(tsc2101Registers[TOUCH_CONTROL_MEASUREMENT_CONFIGURATION] & 0x4000) return 0xFFF & tsc2101GetAnalogMask();//resistance - return 0xFFF & tsc2101GetAnalogMask();//voltage + //return 0xFFF & tsc2101GetAnalogMask();//voltage + return 0xE50 & tsc2101GetAnalogMask();//voltage, TODO: this is a hack } static uint16_t tsc2101GetAux2Value(void){