Re: [hatari-devel] Real time clock support

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 06/04/2016 18:20, Roger Burrows a écrit :
On 6 Apr 2016 at 10:28, Nicolas Pomarède wrote:

Le 06/04/2016 03:15, Roger Burrows a écrit :
I was doing some work on EmuTOS time and date handling, and noticed that
setting the time on the MegaST real time clock does nothing.  That's not a
very
good emulation ;-).  Looking at Hatari source, it seems to be deliberate.
Why?


Hi
stupid question, but did you enable real time clock into "system"
settings :) ?

Not a stupid question, since I'm not smart enough to know what it means ;-).
What do you mean by "system settings"?  If you mean the page that is displayed
by clicking on the "System" button, then yes, it's enabled there.  And FWIW,
EmuTOS detects the system as a Mega ST.

 From a user program perspective, if I do a Tsettime()/Tsetdate() and then read
the data back with Tgettime()/Tgetdate(), I expect it to be the same (well
perhaps differing by a couple of seconds).  But this doesn't work for me.  So I
looked at the EmuTOS code and see that Tsettime()/Tsetdate() writes the time to
the RTC, and Tgettime()/Tgetdate() reads it back.  The time/date read back is
unchanged from what it was before the write.

I'm also not very familiar with Hatari internals, so I may be misunderstanding
the code, but in rtc.c, all the time/date data appears to come directly from
the host clock (e.g. Rtc_SecondsUnits_ReadByte()), and apart from the a couple
of interceptions for compatibility reasons, all the writes go to
IoMem_WriteWithoutInterception() (see ioMemTabSTE.c) which does nothing.

OK, I see which part you mention.

Then yes, I think the RTC in Mega ST mode is really minimal and only reports current date/time.

On the other hand, the falcon emulation also has RTC and it handles read/write to it.

It uses the same chip as the mega st ; I don't remember if this was discussed on this ML some time ago, or if it was just an idea I had on my todo list, but both rtc code should be merged.

The mega st has several registers dedicated to each unit in the rtc (hor, minute, ...), while the falcon has a "select register" and a "data register", but they're functionaly the same.

Then not all the MC146818A datasheet is implemented, but as it's correctly documented it should not be too much a problem.

Nicolas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/