pub enum PicOperationMode {
FullyNested,
AutomaticRotation,
SpecialMask,
PolledMode,
}Expand description
Operation Mode for PIC Controller.
PIC supports several operation mode, most of which are most likely to be ignored on x86 architecture, however some of them can be used to obtain some interesting results. See more information for each of them below.
Variants§
FullyNested
Fully Nested Mode (Default Mode)
This mode is entered after initialization unless another mode is programmed. The interrupt requests are ordered in priority from 0 through 7, where 0 is the highest priority. When interrupt is acknowledged the highest priority interrupt will be issued before the rest.
On a regular x86 PC with two chained PICs, the IRQ0, which is an output of a PIT timer, will be handled before others IRQ lines. Slave PIC has even smaller priority than first 7 masters IRQ lines, because it is mapped after the master PIC.
§Use Case
Use when the default priority level suits your needs. For example, if a PS/2 keyboard interrupt (IRQ1) will be always services before the real time clock (IRQ8).
AutomaticRotation
Automatic Rotation Mode (Equal Priority Mode)
Rotates the priority by the value specified in the current highest priority interrupt within the ISR register. Basically each time the highest priority interrupt occur, it will then be defined as a lowest priority interrupt. This way giving all interrupt sources an equal service time from the CPU.
§Use Case
Use if you think that all interrupts deserve to be handled equally. This sometimes might cause troubles with timers, specifically the PIT and RTC.
SpecialMask
Special Mask Mode (Manual Priority Mode)
Some applications might want to have a different priority mapping for the full software control over the sequence of interrupts. During this mode the mask register is now used to temporary disable certain interrupt levels as well as manually changing the priority level.
§Use Case
Critical sections that wish to disable some interrupts from the PIC but not all of them, or some applications with specific timing requirements that require to temporary inhibit some of interrupt levels to make sure that lower priority interrupts will meet timings accordingly.
PolledMode
Polled Mode (No interrupts)
Do not use interrupts to obtain information from the peripherals but only listen for upcoming changes. After the polled mode is enabled, data bus will provide a binary value of a highest priority issued interrupt. Each read from the data port will be treated as an interrupt acknowledge.
§Use Case
Probably the most useless one. Since it is very quick to turn this mode on and off, it can be used to handle several interrupts in one handler by reading all values from the data port until it will be equal to zero.
Trait Implementations§
Source§impl Clone for PicOperationMode
impl Clone for PicOperationMode
Source§fn clone(&self) -> PicOperationMode
fn clone(&self) -> PicOperationMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more