gpl: added a license file for GPLv3

The COPYING file contains the full GPLv3 license, the license this
project is licensed under.

ETA/OS  Copyright (C) 2014  Michel Megens <dev@michelmegens.net>
    This program comes with ABSOLUTELY NO WARRANTY; for details type
    `show w'. This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: cleaned up some of the IRQ core code.

The IRQ core had some bad functions which would easily lead to errors.
Removed those functions and made the work for users easier by requiring
only a call to irq_request to install a new hardware interrupt handler.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: handle: added an implementation to irq_handle

irq_handle is the base of the portable IRQ subsystem. This function gets
called by the IRQ chip and is responsible for calling the correct
handler, hidden somewhere else in the system.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: handle: implemented hardware irq handles.

Added an implementation for hardware IRQ's. When a hardware IRQ is
triggered, the chip handler is called first. This handler is usually
irq_handle from kernel/irq/handle.c. This handle will then check if the
IRQ is enabled and valid. If all is good it will determine if its a SOFT
IRQ or HARD IRQ. Hard IRQs are handled instantly, in IRQ context, while
soft IRQs are handled at the next schedule call right before a context
switch in process context.

An IRQ can also have a thread associated with it, which can be woken up
when the IRQ has been handled by the driver. The driver should return
IRQ_WAKE_OWNER to do so.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: handle: removed a handle for slow soft IRQs.

The software (threaded) IRQs are handled (read: requested to be handled)
in the hard IRQ handle. In otherwords, there is no need for this
function to exist, therefore I cut it out and removed it.

Signed-off-by: Michel Megens <dev@michelmegens.net>
atomic: added atomic types and API funcs.

Added the types:

	* atomic_t;
	* atomic64_t;

The atomic_t type is an integer type with the length `signed int'. The
atomic64_t type is defined as an `int64_t' type and is for that reason
ALWAYS 64 bits long. Usage of the latter should be reduced for data
space reasons only.

The currently implemented atomic API functions:

	* atomic_inc & atomic64_inc
	* atomic_get & atomic64_get

The get functions return their respective types mentioned above.

Signed-off-by: Michel Megens <dev@michelmegens.net>
avr: atomic: reimplemented the atomic operations

Reimplemented most atomic operations so they rely on the most basic
version of themselves. For example, atomic_inc is basically an
atomic_add with 1.

New functions implemented:

	* atomic_add
	* atomic_sub
	* atomic_dec

Functions which have been rewritten:

	* atomic_inc

Signed-off-by: Michel Megens <dev@michelmegens.net>
time: added timer and clocksource structures.

The timer structure is the frontend structure for a timer. It defines
how often it fires, and what to do when it fires. You can compare this
structure to the pointers on the clock. Behind the clock there's an
engine which defines how fast these pointers are being moved. It is
basically the driver of the clock. In ETA/OS there is a specific
structure to define this mechanism: the clocksource.

Signed-off-by: Michel Megens <dev@michelmegens.net>
timer: source: added a basic clock source.

Implmented the basics of the clock source data structure. The clock
source data structure has:

	* a name
	* a way to turn it on
	* a way to turn it off
	* a list of all timers registered for that specific source.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: threaded: added an init for threaded IRQs

Threaded IRQs can now also be initialized by irq_request (after the
scheduler has seen birth, ofcourse) by passing the flag
IRQ_THREADED_MASK to the flags argument (together with other flags,
ofcourse).

Signed-off-by: Michel Megens <dev@michelmegens.net>
dev: core: added a name parameter to device create

The name is a major field of the device structure, since its a unique
identifier where other applications or drivers can search for to obtain
a pointer to the device for operation.

Signed-off-by: Michel Megens <dev@michelmegens.net>
list: added list_add_tail

Added a list API function to add a list item to the tail of the given
head.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: chip: fixed a list_add bug.

The parameter order of list_add is to first pass the new object you want
to add to the list and secondly the list head. The list head is the
object the where the first object will be added after. Consider the
following list:

X - Y - Z

If you now call list_add as follows:
	* list_add(&A, &Y)

The list will look like:

X - Y - A - Z

The list_add in irq_chip_add_irq called list_add in the wrong way (i.e.
the head first and the new object as second parameter). Flipped them to
fix.

Signed-off-by: Michel Megens <dev@michelmegens.net>
dev: core: rewritten device create

device_create has been rewritten to a new template. Device create will,
from now on take a name, a private data pointer and a pointer to the
appropriate file operations.

device_initialize is the cousin of device create, but it doesn't
allocate a new device. It takes one which is already allocated in its
parameters and initializes it.

Signed-off-by: Michel Megens <dev@michelmegens.net>
simulavr: added exit register

Added an exit register definition for simul avr (SIME (SImulator Exit)).
Writing a value to this register exits the simulator and displays the
value written to the register as error code on the console. Can be used
in tests to exit with error codes.

Signed-off-by: Michel Megens <dev@michelmegens.net>
git: ignore: added an entry for vim swp files.

Vims .swp files can no longer accidently end up in the repository as
there is an entry for them in the .gitignore file now.

Signed-off-by: Michel Megens <dev@michelmegens.net>
usr: tests: added automated tests to usr/

Automated tests can be added to usr/ from now on. These tests can be
designed to run on real hardware or on simulators of real hardware. To
run all tests issue the following command in usr/

`make tests'

To run a specific test, cd into the usr/tests directory and run:

`make <testname>'

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'master' into dev-core

* Lib fixes
* Testing environment
dev: core: fixed some listing bugs

Fixed some bugs in the dev-core related to the linking into the dev_root
list head. This list head was not being initialized, resulting in errors
while inserting new nodes in it. Therefore a static initializer has been
added to <etaos/list.h> to initialize global list_head structures.

Further:
	* Added an error code parameter to simul_avr_exit
	* Added flag checking in the memory allocator. Nodes which are
	  not flagged as allocated cannot be free'd.
	* Devtest: added a test for the device core.

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'master' into time

Signed-off-by: Michel Megens <dev@michelmegens.net>