The official git repository for OSD-Contiki, the open source OS for the Internet of Things
Go to file
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
apps Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
core Merge pull request #1285 from simonduq/pr/tsch 2015-12-07 14:29:10 +01:00
cpu x86: Initialize the 8259 PIC 2015-12-21 08:06:14 -02:00
dev Merge pull request #1168 from bthebaudeau/enc28j60-fixes-and-improvements 2015-12-15 00:14:02 +01:00
doc Merge pull request #1133 from bkozak-scanimetrics/cc-gcc 2015-12-05 00:39:59 +01:00
examples Added support for the RE-Mote on-board Real Time Clock Calendar (RTCC) 2015-12-16 18:43:33 +01:00
lib/newlib Implement generic Newlib syscalls 2015-12-16 19:50:49 +01:00
platform x86: Initialize the 8259 PIC 2015-12-21 08:06:14 -02:00
regression-tests jn516x: remove temporary adjustements for compilation in a 802.15.4e-free Contiki 2015-12-07 11:51:50 +01:00
tools fixed make login for Zoul on MAC 2015-12-19 10:28:30 +01:00
.gitattributes Add binary files file extension 2015-10-22 16:19:39 +02:00
.gitignore gitignore: Add Vim swap files 2015-12-21 08:06:14 -02:00
.gitmodules Align to current master 2015-09-04 17:01:04 +02:00
.travis.yml Merge pull request #1219 from simonduq/jn516x-port 2015-09-25 12:09:52 +02:00
CONTRIBUTING.md Updated CONTRIBUTING.md to reflect Contiki's new merging policy 2015-08-18 22:06:56 +02:00
LICENSE Removed the explicit year 2012 to make it more generic 2012-10-25 23:08:54 +02:00
Makefile.include Makefile.include: Remove unused MODULESSUBST 2015-06-01 22:09:58 +02:00
README-BUILDING.md Rename to md 2013-03-26 23:15:37 +01:00
README-EXAMPLES.md Several minor consistency improvements. 2013-07-31 00:55:31 +02:00
README.md Travis icon in README.md: show build status of the current master rather than latest build status (can be any pull request) 2015-08-19 09:21:38 +02:00

The Contiki Operating System

Build Status

Contiki is an open source operating system that runs on tiny low-power microcontrollers and makes it possible to develop applications that make efficient use of the hardware while providing standardized low-power wireless communication for a range of hardware platforms.

Contiki is used in numerous commercial and non-commercial systems, such as city sound monitoring, street lights, networked electrical power meters, industrial monitoring, radiation monitoring, construction site monitoring, alarm systems, remote house monitoring, and so on.

For more information, see the Contiki website:

http://contiki-os.org