osd-contiki/platform
Jesus Sanchez-Palencia 11098501d8 x86: Initialize the 8259 PIC
The Programmable Interrupt Controller is a chip responsible for
translating hardware interrupts to system interrupts. When it
receives an Interrupt Request (IRQ), it triggers the appropriate
interrupt line reaching the appropriate IDT gate, following a
previously setup offset.

There are 2 daisy-chained PICs. PIC1 handles IRQs 0-7 and PIC2
handles IRQs 8-15. If no vector offset is set, an IRQ0, for instance,
would trigger the interrupt 0, clashing with the "Division by zero exception"
handler. Thus the IRQs must be remapped.

This patch implements the PICs initialization through their 4
Initialization Command Words (ICWs) in a very "canonical" way:
- ICW1: the initializing command;
- ICW2: the vector offset for the PIC1 and PIC2 (we add an offset of 32 positions);
- ICW3: the inter-PICs wiring setup (we connect PIC2 to PIC1's IRQ2);
- ICW4: extra systems information (we set PIC1 as Master and PIC2 as slave).

It then masks the Interrupt Mask Register, blocking all IRQs but #2 initially.
These must be unmasked on demand. The IMR is 8-bits long, so setting the n^th bit to 1
would DISABLE the IRQ n while setting it to 0 would ENABLE IRQ n.

As stated, this is an implementation of the legacy 8259 PIC. More
investigation is needed so we decide if it is enough or if we need
the (newer) APIC implementation instead.

This patch also adds the outb() helper function to helpers.h. The helpers
is a wrapper for assembly 'out' instruction.

Finally, since we now properly support hardware interrupts, this patch
also enables IRQs in platform main().

More information:
- Quark X1000 Datasheet, section 21.12, page 898.
- http://wiki.osdev.org/8259_PIC
- http://stanislavs.org/helppc/8259.html
2015-12-21 08:06:14 -02:00
..
apple2enh Made 80 column display a cc65 application attribute. 2015-10-30 12:42:58 +01:00
atarixl Made 80 column display a cc65 application attribute. 2015-10-30 12:42:58 +01:00
avr-atmega128rfa1 AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00
avr-raven AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00
avr-ravenlcd Merge pull request #756 from sieben/dos2unix 2015-10-18 20:26:07 +02:00
avr-ravenusb Merge pull request #1344 from tsparber/fix-doxygen 2015-11-30 22:07:15 +01:00
avr-rcb AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00
avr-zigbit AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00
c64 Added 80 column IRC client / web browser for the C64. 2015-10-30 16:48:00 +01:00
c128 Added 80 column IRC client / web browser for the C64. 2015-10-30 16:48:00 +01:00
cc2530dk Use ENERGEST_SWITCH to switch between different power modes to improve energest accuracy. 2015-09-04 11:46:00 +02:00
cc2538dk Added PWM driver for the Zolertia Zoul module and CC2538 platforms 2015-11-25 23:56:29 +01:00
cooja x86: Only add elfloader-x86.c to the platforms using it 2015-12-21 08:06:14 -02:00
cooja-ip64 Merge pull request #1344 from tsparber/fix-doxygen 2015-11-30 22:07:15 +01:00
econotag Added ECC functions on elliptic curve secp256r1 2015-09-24 14:11:20 +02:00
ev-aducrf101mkxz Remove unused UIP_CONF_ND6_ defines in platforms 2015-03-24 13:09:29 +01:00
eval-adf7xxxmb4z eval-adf7xxxmb4z: declare node_id only when needed 2015-10-20 10:11:13 +02:00
exp5438 exp5438: do not use char as array index 2015-10-20 10:11:04 +02:00
galileo x86: Initialize the 8259 PIC 2015-12-21 08:06:14 -02:00
jn516x jn516x: remove temporary adjustements for compilation in a 802.15.4e-free Contiki 2015-12-07 11:51:50 +01:00
mbxxx Merge pull request #1293 from simonduq/pr/fix-warnings 2015-11-10 08:49:11 +01:00
micaz AVR platforms: use 32 bit clock_time_t. 2015-11-28 10:18:22 +01:00
minimal-net Removed CC_FASTCALL. 2015-11-01 18:10:17 +01:00
native Merge pull request #1293 from simonduq/pr/fix-warnings 2015-11-10 08:49:11 +01:00
seedeye Use ENERGEST_SWITCH to switch between different power modes to improve energest accuracy. 2015-09-04 11:46:00 +02:00
sensinode Use ENERGEST_SWITCH to switch between different power modes to improve energest accuracy. 2015-09-04 11:46:00 +02:00
sky Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
srf06-cc26xx Merge pull request #1344 from tsparber/fix-doxygen 2015-11-30 22:07:15 +01:00
stm32nucleo-spirit1 Added contacts for stm32nucleo-spirit1 platform. 2015-11-25 12:56:42 +01:00
stm32test Network layer configuration: replace UIP_CONF_* with NETSTACK_CONF_WITH_* 2014-12-01 21:02:57 +01:00
win32 Removed CC_FASTCALL. 2015-11-01 18:10:17 +01:00
wismote Merge pull request #1344 from tsparber/fix-doxygen 2015-11-30 22:07:15 +01:00
z1 Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
zoul fixed make login for Zoul on MAC 2015-12-19 10:28:30 +01:00