Add more registers

This commit is contained in:
meepingsnesroms
2018-04-29 14:09:08 -07:00
parent af29f58714
commit 54ae724b5a
4 changed files with 31 additions and 5 deletions

View File

@@ -43,7 +43,8 @@ void ads7846SendBit(bool bit){
case 0x02:
//battery
value = palmMisc.batteryLevel;
//value = palmMisc.batteryLevel;
value = 100;
rangeMax = 100;
break;

View File

@@ -101,8 +101,13 @@ static void recalculateCpuSpeed(){
if(pctlr & 0x80)
newCpuSpeed *= (double)(pctlr & 0x1F) / 31.0;
debugLog("New CPU frequency of:%f cycles per second.\n", newCpuSpeed * CRYSTAL_FREQUENCY);
debugLog("New CLK32 cycle count of:%f.\n", newCpuSpeed);
if(newCpuSpeed != palmCrystalCycles){
debugLog("New CPU frequency of:%f cycles per second.\n", newCpuSpeed * CRYSTAL_FREQUENCY);
debugLog("New CLK32 cycle count of:%f.\n", newCpuSpeed);
if(newCpuSpeed == 0.0)
debugLog("CPU turned off with PCTLR.\n");
}
palmCrystalCycles = newCpuSpeed;
}
@@ -346,10 +351,22 @@ unsigned int getHwRegister8(unsigned int address){
case PDDATA:
return getPortDValue();
case PEDATA:
//read outputs as is and inputs as true, floating pins are high
return (registerArrayRead8(PEDATA) & registerArrayRead8(PEDIR)) | ~registerArrayRead8(PEDIR);
case PFDATA:
//read outputs as is and inputs as true, floating pins are high
return (registerArrayRead8(PFDATA) & registerArrayRead8(PFDIR)) | ~registerArrayRead8(PFDIR);
case PGDATA:
//read outputs as is and inputs as true, floating pins are high
return (registerArrayRead8(PGDATA) & registerArrayRead8(PGDIR)) | ~registerArrayRead8(PGDIR);
case PJDATA:
//read outputs as is and inputs as true, floating pins are high
return (registerArrayRead8(PJDATA) & registerArrayRead8(PJDIR)) | ~registerArrayRead8(PJDIR);
case PKDATA:
return getPortKValue();
@@ -365,7 +382,9 @@ unsigned int getHwRegister8(unsigned int address){
//I/O direction
case PBDIR:
case PDDIR:
case PEDIR:
case PFDIR:
case PJDIR:
case PKDIR:
//select between GPIO or special function
@@ -442,6 +461,7 @@ unsigned int getHwRegister16(unsigned int address){
case RTCCTL:
case RTCIENR:
case ILCR:
case ICR:
case SPICONT2:
case SPIDATA2:
//simple read, no actions needed
@@ -641,6 +661,10 @@ void setHwRegister16(unsigned int address, unsigned int value){
//missing bits 6 and 7
registerArrayWrite16(address, value & 0xFF3F);
break;
case RTCCTL:
registerArrayWrite16(address, value & 0x000A);
break;
case IMR:
//this is a 32 bit register but Palm OS writes it as 16 bit chunks

View File

@@ -198,9 +198,9 @@ static inline void timer12Clk32(){
static inline void rtcAddSecondClk32(){
//this function is part of clk32();
//rtc
//RTC
if(registerArrayRead16(RTCCTL) & 0x0080){
//rtc enable bit set
//RTC enable bit set
uint16_t rtcInterruptEvents;
uint32_t newRtcTime;
uint32_t oldRtcTime = registerArrayRead32(RTCTIME);

View File

@@ -20,6 +20,7 @@ Port M Infrared shutdown (PMDATA 0x20)
interrupt control register (ICR), POL5 and edge trigger selects
ADC7846 temperature sensors
ADC7846 dock sensor
some undocumented I/O might be on port e and port j
Debug tools:
missing icons