Subject: Re: [linuxsh-dev] Dreamcast RTC
To: None <>
From: Marcus Comstedt <>
List: port-sh3
Date: 12/01/2000 16:17:14
>>>>> "Philipp" == Philipp Rumpf <> writes:

  Philipp> Are the counters latched when you read the first register ?  Otherwise you


  Philipp> might want to use the standard trick of doing

  Philipp> 	do {
  Philipp> 		val1 = (ctrl_inl(high word)<<16) + (ctrl_inl(low word)&0xffff);
  Philipp> 		val2 = (ctrl_inl(high word)<<16) + (ctrl_inl(low word)&0xffff);
  Philipp> 	} while(val1 != val2);

The code I use check that the value is the same four times in a row.
That is what the SEGA libraries do, so maybe it's necessary.

  Philipp> so arch/sh/kernel/time.c: get_rtc_time would look like this;

What is said here only concerns the Dreamcast.  It should not be
applied to other machines using the SH cpu.  The Dreamcast RTC is part
of the AICA chip, not of the cpu.

  Philipp> 	val1 -= 631152000;


  // Marcus