Detailed description of RTC programming in Linux Kernel

Source: Internet
Author: User
For details about RTC programming in the Linux operating system kernel, refer to general Linux technology-Linux programming and kernel information. Programming RTC in Linux Kernel

The MC146818 RTC chip (or other compatible chip, such as DS12887) can generate periodic interruptions on IRQ8, with the Interruption Frequency ranging from 2Hz ~ Between 8192HZ. The device driver corresponding to MC146818 RTC is implemented in include/linux/rtc. h and drivers/char/rtc. in the c file, the corresponding device file is/dev/rtc (major = 10, minor = 135, read-only character device ). Therefore, the user process can program her to activate the IRQ8 line when RTC reaches a specific time value, so that RTC can be used as an alarm clock.

The only purpose of the Linux kernel for RTC is to use RTC as the "offline" or "background" time and date maintainer. When the Linux kernel is started, it reads the benchmark values of time and date from RTC. Then, during the running period, the kernel will completely discard RTC, so as to maintain the current time and date of the system in the form of software, and write the time back to the RTC chip as needed.

Linux in include/linux/mc146818rtc. h and include/asm-i386/mc146818rtc. the h header file defines the meaning of each register of the mc146818 RTC chip and the I/O port operations of the RTC chip on the i386 platform. The general RTC interface is declared in the include/linux/rtc. h header file.

7.2.1 I/O port operation of the RTC Chip

Linux defines the I/O port operation of the RTC chip in the include/asm-i386/mc146818rtc. h header file. Port 0x70 is called "RTC port 0" and port 0x71 is called "RTC Port 1", as shown below:
QUOTE:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.