Hi,
Mikae wrote:But how it is possible to determine which flag to use in ICW1?
Due to the way it was wired in original 80x86 motherboards, ICW1 must be set to 0x11. Possibly the easiest way to determine this for the first time is to look at the datasheets for a modern chipset. For example, the Intel 865 chipset datasheet has the following description of ICW1 bits:
- Bits 7:5, ICW/OCW Select - WO. These bits are MSC-80 specific, and not needed. Should be programmed to 000b.
Bit 4, ICW/OCW Select - WO. This bit must be set to 1 to select ICW1 and enable the ICW2, ICW3 and ICW4 sequence
Bit 3, Edge/Level Bank Select (LTIM) - WO. Disabled. Replaced by the edge/level triggered control registers (ELCR).
Bit 2, ADI - WO. Ignored for the Intel ICH5. Should be programmed to 0.
Bit 1, Single or Cascade (SNGL) - WO. Must be programmed to 0 to indicate two controllers operating in cascade mode.
Bit 0, ICW4 Write Required (IC4) - WO. This bit must be programmed to a 1 to indicate that ICW4 needs to be programmed.
Of course after looking at this you'd wonder why the 8259A bothered with ICW4 in the first place, as every single bit is pointless. The answer to this involves some history...
The 8259A chip is a general purpose chip that wasn't specifically designed for 80x86. Because of this it supports things that are entirely useless for 80x86 (but may have been desirable for other architectures that were around at the time).
The other thing most people have forgotten is that the original IBM computers (the things modern 80x86 evolved from, and are still mostly compatible with) were a box of crap. None of it was really designed to suit, there was no consideration for future versions, and all of the electronics were chosen with cost as a major factor.
For an example, the reason why the PIT timer uses 1.191 MHz can be traced back to the frequency of the oscillators used in NTSC televisions (which made the parts used in the oscillator cheaper due to mass production).
BTW, the MCS-80 and MCS-85 were IBM machines that used Intel 8080 and 8085 CPUs. These CPUs aren't compatible with the later 8086 - they used 16-bit physical address which limited them to 64 KB, an 8-bit data bus, had 7 general registers (A, B, C, D, E, H and L), plus the PC (program counter), SP (stack pointer) and an 8-bit flags register. The 8085 was made redundant by the Z80 (a compatible but much better CPU made by Zilog) while Intel moved on to the 8086.
Mikae wrote:And how PCI & ISA devices work together since they have different way to deliver their ints to 8259? I mean, that I have only one LTIM for both PCI and ISA devices. I guess that all ISA devices are connected to PCI bus via a bridge, but this is just an assumption...
Some IRQs are used for ISA and are programmed in the ELCR (I/O ports 0x4D0 and 0x4D1) as edge triggered, while some are used for PCI and programmed in the ELCR as level triggered. The LTIM in the PIC chip itself is either ignored completely (not implemented) or set to 0 for compatability.
Mikae wrote:And I have a question about buffered mode. Is this mode required by some external conditions? If yes, when I have to use it?
If you can still find an 8259A and decide to use it in some sort of embedded device, then it's possible that (depending on how you design the hardware) buffered mode might be useful. For real computers "buffered mode" doesn't exist anymore (for e.g. it's described as "not used, should always be programmed to 0" in the 865 chipset datasheets).
Mikae wrote:Also, it is interesting to me, was 'rotational' mode of 8259 ever used?
It should still be supported, but I can't think of a reason why anyone would use it for 80x86. It looks like it's intended for situations where all IRQs are treated equally and load balancing is desirable - for example, consider a PIC chip used with 8 serial ports connected to 8 dumb terminals.
Mikae wrote:I hope, you are not tired yet, because of my questions
.
Hehe - no. I woke up at 6:00 yesterday afternoon, spent most of this morning pulling a roof apart to install some air-conditioning cables and it's 3:00 in the afternoon now - I'm tired for other reasons (your question was a much needed break from the roof).
Cheers,
Brendan