[English Learning] Examples of understanding: crystal oscillator; clock

clock

https://ariya.io/2012/08/real-time-clock
这个链接有一句话:
A crystal with a frequency of 32.768 KHz is particularly useful since it can be combined with a 15-bit prescaler to give a good 1 Hz signal for the clock.

It is said here that the frequency of this crystal is 32.768KHz (you need to be careful not to mix it up with the K in the memory, which is kb, kb). Then it is said that crystals of this frequency are particularly useful because they can be combined with a 15-bit prescaler (prescaler, a preset scalar device that can tolerate 32768 signals before stimulating a signal). This 15-bit scalar The maximum value of the device is also 32768. Therefore, the effect of one signal per second can be given: 1Hz signal.

Therefore, it is very important to create this kind of crystal with stuck frequency. You can adjust the value of the prescaler to realize the function of the timer. Trigger interrupts regularly.
Note that the prescaler can be programmed as well, specially to trigger IRQ (interrupt request) at a predefined frequency.

chatGPT: The process of making crystals

Manufacturing crystals of specific frequencies requires highly sophisticated processes and techniques, often requiring specialized equipment and laboratory conditions. The frequency of a crystal depends on its crystal structure and chemical composition, and different types of crystals will have different frequencies. Here are some general steps, but please note that the specific manufacturing process may vary depending on the crystal type:
Choose a crystal material: First, you need to choose a crystal material that is suitable for the frequency you require. Common crystal materials include quartz, silicon, germanium, etc. Each material has its own specific frequency characteristics.
Crystal Growth: A common crystal manufacturing method is to prepare crystals through a crystal growth process. This usually involves dissolving the appropriate raw materials in an environment of high temperature and pressure, then allowing the crystal to grow on a crystal seed. This process requires very tight temperature, pressure and chemical controls to ensure the final crystal has the desired frequency.
Crystal Shaping and Cutting: The manufactured crystal may require further shaping and cutting to ensure that its frequency meets requirements. This is usually performed by precision machinery to precisely control the shape and size of the crystal.
Polarization: Some applications require the crystal to be polarized, which means the crystal's molecular structure is aligned in a specific direction. This can be achieved by treating the crystal under specific temperature and electric field conditions.
Testing and Calibration: Manufactured crystals require frequency testing and calibration to ensure that they perform as required. This often requires the use of specialized testing equipment and laboratories.

It is important to emphasize that making crystal is a highly specialized process that often requires specialized knowledge and equipment. If you need a crystal of a specific frequency, it is recommended to work with a professional crystal manufacturing company or laboratory, who can customize the crystal to your requirements. At the same time, any relevant regulations and safety guidelines need to be followed, especially when working with high temperatures, pressures, or hazardous materials.

This clock alone involves a lot of knowledge.

kernel

4.99 KVM_REINJECT_CONTROL

:Capability: KVM_CAP_REINJECT_CONTROL
:Architectures: x86
:Type: vm ioctl
:Parameters: struct kvm_reinject_control (in)
:Returns: 0 on success,
-EFAULT if struct kvm_reinject_control cannot be read,
-ENXIO if KVM_CREATE_PIT or KVM_CREATE_PIT2 didn’t succeed earlier.

i8254 (PIT) has two modes, reinject and !reinject. The default is reinject, where KVM queues elapsed i8254 ticks and monitors completion of interrupt from vector(s) that i8254 injects. Reinject mode dequeues a tick and injects its interrupt whenever there isn’t a pending interrupt from i8254. !reinject mode injects an interrupt as soon as a tick arrives.

struct kvm_reinject_control {
__u8 pit_reinject;
__u8 reserved[31];
};

pit_reinject = 0 (!reinject mode) is recommended, unless running an old operating system that uses the PIT for timing (e.g. Linux 2.4.x).

i8254

This passage mentions i8254, which is the abbreviation of Intel 8254 Programmable Interval Timer (programmable interval timer), often called PIT. PIT is a hardware timer in a computer system that is used to generate pulse signals at fixed time intervals, usually running at a specific frequency. In computer architecture, PIT has two modes, namely "reinject" (reinjection) and "!reinject" (no reinjection).
Reinject mode: In reinject mode, PIT can generate pulse signals periodically, and after each pulse signal is issued, the timer will automatically reload (reinject) the count value to start the countdown again. This mode is usually used to generate periodic interrupts, such as operating system clock interrupts or other tasks that need to be performed at fixed intervals. The timer automatically retriggers without external intervention.
!reinject (no reinjection) mode: In !reinject mode, the PIT only generates a pulse signal once and then stops counting. The count value is not automatically reloaded, so external intervention is required to restart the timer and retrigger the generation of the pulse signal. This mode is usually used for one-time scheduled tasks, or when manual control of the timer is required.

These two modes allow the computer system to use PIT to perform different types of timing operations as needed. Which mode to choose depends on the specific application requirements. "reinject" mode is generally better suited for periodic tasks, while "!reinject" mode is better suited for one-time or manually controlled tasks.

MC146818 VS i8254

The MC146818 is a real-time clock (RTC) chip, while the i8254 is a programmable interval timer (PIT) chip. Although they all belong to hardware devices in the field of timing and counting, they have obvious differences in functions and uses.
MC146818: The MC146818 is a real-time clock (RTC) chip commonly used in computer systems to track and maintain date and time information. It typically includes a real-time clock and a non-volatile RAM (NVRAM) memory that stores the system's time and date settings and other configuration information. The RTC chip is used to maintain the system's real-time clock to ensure that the computer can still accurately track time after a power outage or restart.
i8254 (PIT): The i8254, or Programmable Interval Timer, is a hardware timer chip used to generate periodic intervals or pulse signals. It is commonly used for time measurement and interrupt generation in computer systems, and other applications that require precise time control. The PIT chip can be configured in different working modes to meet different timing requirements, such as single trigger, periodic trigger, etc.

Although the MC146818 and i8254 both deal with time and timing, their functions and application areas are different. MC146818 is mainly used to maintain the system's date and time, while i8254 is mainly used to generate time intervals and timing. They often coexist in a computer system but serve different roles.

Guess you like

Origin blog.csdn.net/qq_36428903/article/details/133030591