mirror of
https://github.com/libretro/Mu.git
synced 2026-09-24 07:35:55 +00:00
Add chip select and reset lines for TSC2101
This commit is contained in:
@@ -244,7 +244,7 @@ void emulatorSoftReset(void){
|
||||
palmClockMultiplier = 1.00;
|
||||
pxa260Reset();
|
||||
tps65010Reset();
|
||||
tsc2101Reset();
|
||||
tsc2101Reset(true);
|
||||
w86l488Reset();
|
||||
sandboxReset();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,32 @@
|
||||
#include "pxa260_GPIO.h"
|
||||
#include "pxa260_mem.h"
|
||||
#include "../tsc2101.h"
|
||||
#include "../emulator.h"
|
||||
|
||||
|
||||
static void pxa260gpioOnOutputPinUpdated(Pxa260gpio* gpio, UInt8 gpioNum){
|
||||
//the pin value is not sent to this function because it is usually not needed and can be fetched with pxa260gpioGetState
|
||||
|
||||
debugLog("PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum));
|
||||
|
||||
switch(gpioNum){
|
||||
case 24:
|
||||
//TSC2101 chip select
|
||||
tsc2101SetChipSelect(!!pxa260gpioGetState(gpio, gpioNum));
|
||||
break;
|
||||
|
||||
case 40:
|
||||
//TSC2101 reset
|
||||
if(pxa260gpioGetState(gpio, gpioNum) == PXA260_GPIO_LOW)
|
||||
tsc2101Reset(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
//debugLog("Unimplimented PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void pxa260gpioPrvRecalcValues(Pxa260gpio* gpio, UInt32 which){
|
||||
|
||||
UInt8 i;
|
||||
@@ -20,8 +45,17 @@ static void pxa260gpioPrvRecalcValues(Pxa260gpio* gpio, UInt32 which){
|
||||
if (newVal != oldVal) {
|
||||
UInt32 wentHi = newVal &~ oldVal;
|
||||
UInt32 wentLo = oldVal &~ newVal;
|
||||
UInt32 outputChanged = (wentHi | wentLo) & gpio->dirs[which];
|
||||
|
||||
gpio->detStatus[which] |= (wentHi & gpio->riseDet[which]) | (wentLo & gpio->fallDet[which]);
|
||||
|
||||
if(outputChanged){
|
||||
UInt8 index;
|
||||
|
||||
for(index = 0; index < 32; index++)
|
||||
if(outputChanged & 1UL << index)
|
||||
pxa260gpioOnOutputPinUpdated(gpio, which * 32 + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +140,7 @@ Boolean pxa260gpioPrvMemAccessF(void* userData, UInt32 pa, UInt8 size, Boolean w
|
||||
case 25:
|
||||
case 26:
|
||||
gpio->AFRs[pa - 21] = val;
|
||||
//pa = (pa - 21) / 2;
|
||||
pa = (pa - 21) / 2;
|
||||
goto recalc;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ static void tsc2101RegisterWrite(uint8_t page, uint8_t address, uint16_t value){
|
||||
}
|
||||
}
|
||||
|
||||
void tsc2101Reset(void){
|
||||
void tsc2101Reset(bool isBoot){
|
||||
memset(tsc2101Registers, 0x00, sizeof(tsc2101Registers));
|
||||
tsc2101CurrentWord = 0x0000;
|
||||
tsc2101CurrentWordBitsRemaining = 16;
|
||||
@@ -82,7 +82,9 @@ void tsc2101Reset(void){
|
||||
tsc2101CurrentRegister = 0;
|
||||
tsc2101CommandFinished = false;
|
||||
tsc2101Read = false;
|
||||
tsc2101ChipSelect = true;
|
||||
|
||||
if(isBoot)
|
||||
tsc2101ChipSelect = true;
|
||||
|
||||
//TODO: need to add all the registers here
|
||||
tsc2101Registers[TOUCH_CONTROL_STATUS] = 0x8000;
|
||||
@@ -111,6 +113,9 @@ void tsc2101SetChipSelect(bool value){
|
||||
bool tsc2101ExchangeBit(bool bit){
|
||||
bool output = true;//TODO: SPI return value is usualy true but this is unverified
|
||||
|
||||
if(tsc2101ChipSelect)
|
||||
return true;
|
||||
|
||||
if(!tsc2101Read){
|
||||
tsc2101CurrentWord <<= 1;
|
||||
tsc2101CurrentWord |= bit;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
void tsc2101Reset(void);
|
||||
void tsc2101Reset(bool isBoot);
|
||||
uint32_t tsc2101StateSize(void);
|
||||
void tsc2101SaveState(uint8_t* data);
|
||||
void tsc2101LoadState(uint8_t* data);
|
||||
|
||||
Reference in New Issue
Block a user