mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-14 09:29:33 +00:00
athens: allow setting custom XTAL frequency.
This commit is contained in:
parent
ffa221192d
commit
781d9b46da
|
@ -54,7 +54,12 @@ AthensClocks::AthensClocks(uint8_t dev_addr)
|
|||
// - dot clock VCO is disabled
|
||||
// - dot clock = reference clock / 2
|
||||
this->regs[AthensRegs::P2_MUX2] = 0x62;
|
||||
}
|
||||
|
||||
AthensClocks::AthensClocks(uint8_t dev_addr, const float crystal_freq)
|
||||
: AthensClocks(dev_addr)
|
||||
{
|
||||
this->xtal_freq = crystal_freq;
|
||||
}
|
||||
|
||||
void AthensClocks::start_transaction()
|
||||
|
@ -132,13 +137,13 @@ int AthensClocks::get_dot_freq()
|
|||
|
||||
switch (mux) {
|
||||
case 0: // clock source -> dot cock VCO
|
||||
out_freq = ATHENS_XTAL * ((float)n2 / (float)(d2 * post_div));
|
||||
out_freq = this->xtal_freq * ((float)n2 / (float)(d2 * post_div));
|
||||
break;
|
||||
case 1: // clock source -> system clock VCO
|
||||
LOG_F(WARNING, "%s: system clock VCO not supported yet!", this->name.c_str());
|
||||
break;
|
||||
case 2: // clock source -> crystal frequency
|
||||
out_freq = ATHENS_XTAL / post_div;
|
||||
out_freq = this->xtal_freq / post_div;
|
||||
break;
|
||||
case 3:
|
||||
LOG_F(WARNING, "%s: attempt to use reserved Mux value!", this->name.c_str());
|
||||
|
|
|
@ -53,6 +53,7 @@ class AthensClocks : public I2CDevice, public HWComponent
|
|||
{
|
||||
public:
|
||||
AthensClocks(uint8_t dev_addr);
|
||||
AthensClocks(uint8_t dev_addr, const float crystal_freq);
|
||||
~AthensClocks() = default;
|
||||
|
||||
// I2CDevice methods
|
||||
|
@ -69,6 +70,7 @@ private:
|
|||
uint8_t my_addr = 0;
|
||||
uint8_t reg_num = 0;
|
||||
int pos = 0;
|
||||
float xtal_freq = ATHENS_XTAL;
|
||||
|
||||
uint8_t regs[ATHENS_NUM_REGS] = {};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user