Re: RTC stuff in 2.1.x

ralf@uni-koblenz.de
Mon, 19 Oct 1998 13:05:20 +0200


On Sat, Oct 17, 1998 at 02:30:02PM -0400, Alex Buell wrote:

> Now that I've got some time, I've been looking into the rtc stuff. The
> current status in 2.1.x is that the i386 implementation of the rtc
> mechanism requires one to include sys/ioctl.h and linux/mc146818rtc.h,
> whilst the Sparc implementation has just asm-sparc[64]/rtc.h, the Alpha
> implementation has asm-alpha/io.h.
>
> I believe this is confusing, as there is no high level interface to the
> rtc component of the system, instead each architecture has its own low
> level implementation.
>
> In the interest for portability of programs that utilises the rtc, it's
> clearly necessary that there be an high level ioctl() interface to the
> native implementation of the rtc stuff.
>
> Proposal:
>
> Create an architecture independent rtc.h file to go into linux which can
> be used by all architectures that can use the rtc device in their system
> to provide a high level ioctl() interface using the RTC_SET_TIME /
> RTC_GET_TIME macros. (I appreciate that some architectures may not have a
> rtc, in these cases it could just return something like -ENOTUSED?)
>
> For i386 implementations, move the mc146818rtc.h to asm-i386 as it's
> obviously in the wrong place (someone correct me if this is not true and
> that different architectures actually uses this), and create a new rtc.h
> to live in asm-i386.
>
> For Alpha, create a rtc.h, and use RTC_SET_TIME/RTC_GET_TIME macros
> etcetera.
>
> For Sparc, modify the definitions in rtc.h to comply with the i386
> conventions (RTC_xxx etc) - it still uses the old 2.0.x RTCSET/RTCGET
> ioctl macros.
>
> Thus, we get an universal rtc ioctl() interface that will enable a rtc
> using program to be portable across these platforms, and then for each new
> platform that Linux is ported to, it is a simple matter to implement the
> ioctl() interface.
>
> Comments, anyone?

The current code has the problem that it assumes all the RTC on this world
are register compatible. Well, they're not. The Indy for example uses
a Dallas 1386 which is not register compatible. And the Amiga has yet
another RTC chip. This also impacts the programming interface as only a
couple of fundamental ioctls is available in both drivers.

Ralf

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/