Fix another bug in TSC2101 making commands never again start after the first

This commit is contained in:
meepingsnesroms
2019-08-23 14:06:52 -07:00
parent 68c9e28c08
commit afa5b13d14
7 changed files with 33 additions and 8 deletions

View File

@@ -261,7 +261,7 @@ void *addr_cache_miss(uint32_t virt, bool writing, fault_proc *fault) {
return ptr;
}
void addr_cache_flush() {
void addr_cache_flush(void) {
#ifndef SUPPORT_LINUX
/* The OS does something incredibly stupid: For every access to the flash,
* it disables the MMU and flushes all buffers and caches. Argh.

View File

@@ -68,7 +68,7 @@ extern ac_entry *addr_cache __asm__("addr_cache");
bool addr_cache_pagefault(void *addr);
void *addr_cache_miss(uint32_t addr, bool writing, fault_proc *fault) __asm__("addr_cache_miss");
void addr_cache_flush();
void addr_cache_flush(void);
void mmu_dump_tables(void);
#ifdef __cplusplus

View File

@@ -22,7 +22,7 @@ uint8_t pxa260I2cBus;
uint8_t pxa260I2cBuffer;
uint16_t pxa260I2cIcr;
uint16_t pxa260I2cIsr;
uint16_t pxa260I2cIsar;
uint8_t pxa260I2cIsar;
bool pxa260I2cUnitBusy;
@@ -38,7 +38,7 @@ void pxa260I2cReset(void){
pxa260I2cBuffer = 0x00;
pxa260I2cIcr = 0x0000;
pxa260I2cIsr = 0x0000;
pxa260I2cIsar = 0x0000;
pxa260I2cIsar = 0x00;
pxa260I2cUnitBusy = false;
}

View File

@@ -26,7 +26,7 @@ extern uint8_t pxa260I2cBus;
extern uint8_t pxa260I2cBuffer;
extern uint16_t pxa260I2cIcr;
extern uint16_t pxa260I2cIsr;
extern uint16_t pxa260I2cIsar;
extern uint8_t pxa260I2cIsar;
extern bool pxa260I2cUnitBusy;
void pxa260I2cReset(void);

View File

@@ -1,16 +1,28 @@
#include <stdint.h>
#include "../emulator.h"
#include "pxa260.h"
#define UDCCR 0x0000
uint8_t pxa260UdcUdccr;
void pxa260UdcReset(void){
pxa260UdcUdccr = 0xA0;
}
uint32_t pxa260UdcReadWord(uint32_t address){
address &= 0xFFFF;
switch(address){
case UDCCR:
//TODO: is incomplete
//currently aborts here
debugLog("Snoot boop, PC:0x%08X\n", pxa260GetPc());
return pxa260UdcUdccr;
default:
debugLog("Unimplimented 32 bit PXA260 UDC register read:0x%04X\n", address);
@@ -22,6 +34,10 @@ void pxa260UdcWriteWord(uint32_t address, uint32_t value){
address &= 0xFFFF;
switch(address){
case UDCCR:
//TODO: is incomplete
pxa260UdcUdccr = value & 0xFF;
return;
default:
debugLog("Unimplimented 32 bit PXA260 UDC register write:0x%04X, value:0x%02X\n", address, value);

View File

@@ -6,6 +6,8 @@
#define PXA260_UDC_BASE 0x40600000
#define PXA260_UDC_SIZE 0x00010000
extern uint8_t pxa260UdcUdccr;
void pxa260UdcReset(void);
uint32_t pxa260UdcReadWord(uint32_t address);

View File

@@ -108,6 +108,8 @@ static void tsc2101ResetRegisters(void){
//TODO: need to add all the registers here
tsc2101Registers[TOUCH_CONTROL_STATUS] = 0x8000;
//tsc2101Registers[TOUCH_CONTROL_BUFFER_MODE] = 0x0200;//TODO: return buffer emupt flag based on real buffer size
tsc2101Registers[TOUCH_CONTROL_REFERENCE] = 0x0002;
tsc2101RefreshInterrupt();
}
@@ -127,7 +129,6 @@ static uint16_t tsc2101RegisterRead(uint8_t page, uint8_t address){
case TOUCH_CONTROL_RESET_CONTROL_REGISTER:
return 0xFFFF;
/*
case TOUCH_DATA_X:
case TOUCH_DATA_Y:
case TOUCH_DATA_Z1:
@@ -137,8 +138,8 @@ static uint16_t tsc2101RegisterRead(uint8_t page, uint8_t address){
case TOUCH_DATA_AUX2:
case TOUCH_DATA_TEMP1:
case TOUCH_DATA_TEMP2:
debugLog("Unimplemented TSC2101 analog port read:%d\n", combinedRegisterNumber);
return 0x0000;
*/
default:
debugLog("Unimplemented TSC2101 register read, page:0x%01X, address:0x%02X\n", page, address);
@@ -155,6 +156,11 @@ static void tsc2101RegisterWrite(uint8_t page, uint8_t address, uint16_t value){
tsc2101RefreshInterrupt();
return;
case TOUCH_CONTROL_REFERENCE:
//TODO: may need to divide the values by the referece voltage then multiply by 0xFFF
tsc2101Registers[TOUCH_CONTROL_REFERENCE] = value & 0x001F;
return;
case TOUCH_CONTROL_RESET_CONTROL_REGISTER:
if(value == 0xBB00)
tsc2101ResetRegisters();
@@ -235,6 +241,7 @@ void tsc2101SetChipSelect(bool value){
if(value && !tsc2101ChipSelect){
tsc2101CurrentWordBitsRemaining = 16;
tsc2101Read = false;
tsc2101CommandFinished = false;
}
tsc2101ChipSelect = value;
}