mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-27 00:29:18 +00:00
athens: clean up initialization.
This commit is contained in:
parent
14f75d834a
commit
751f964139
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -44,8 +44,16 @@ AthensClocks::AthensClocks(uint8_t dev_addr)
|
||||
|
||||
this->my_addr = dev_addr;
|
||||
|
||||
// set up power on values
|
||||
// This initialization is not prescribed
|
||||
// but let's set them to acceptable values anyway
|
||||
this->regs[AthensRegs::D2] = 2;
|
||||
this->regs[AthensRegs::N2] = 2;
|
||||
|
||||
// set P2_MUX2 on power up as follows:
|
||||
// - dot clock VCO is disabled
|
||||
// - dot clock = reference clock / 2
|
||||
this->regs[AthensRegs::P2_MUX2] = 0x62;
|
||||
|
||||
}
|
||||
|
||||
void AthensClocks::start_transaction()
|
||||
@ -72,9 +80,6 @@ bool AthensClocks::send_byte(uint8_t data)
|
||||
return false; // return NACK
|
||||
}
|
||||
this->regs[this->reg_num] = data;
|
||||
if (reg_num == 3) {
|
||||
LOG_F(INFO, "Athens: dot clock frequency set to %d Hz", get_dot_freq());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG_F(WARNING, "Athens: too much data received!");
|
||||
@ -138,5 +143,7 @@ int AthensClocks::get_dot_freq()
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_F(INFO, "Athens: dot clock frequency set to %f Hz", out_freq);
|
||||
|
||||
return static_cast<int>(out_freq + 0.5f);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -31,7 +31,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#define ATHENS_NUM_REGS 8
|
||||
|
||||
constexpr auto ATHENS_XTAL = 31334400.0f; // external crystal oscillator frequency
|
||||
/** Default external crystal oscillator frequency. */
|
||||
constexpr auto ATHENS_XTAL = 31334400.0f;
|
||||
|
||||
namespace AthensRegs {
|
||||
|
||||
@ -69,7 +70,7 @@ private:
|
||||
uint8_t reg_num = 0;
|
||||
int pos = 0;
|
||||
|
||||
uint8_t regs[ATHENS_NUM_REGS];
|
||||
uint8_t regs[ATHENS_NUM_REGS] = {};
|
||||
};
|
||||
|
||||
#endif // ATHENS_H
|
||||
|
Loading…
Reference in New Issue
Block a user