drivers: usart: added empty files for the usart.

Added various standard files for the usart driver core. The USART driver
core is going to be responsible for all generic USART operations and
calling the correct chip driver when needed or requested. In other
words, is a thin abstraction layer for USART drivers.

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>
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>
usart: core: implemented the core usart structure.

Implemented the core data structure for the USART device driver. The
USART device driver is located at drivers/usart/usart-core.c. A platform
specific driver is then using that driver to implement the hardware in
drivers/usart/usart-<platform-name>.c

The USART data structure contains:

	* a lock (mutex)
	* device structure (embedded, no pointer)
	* read fpointer
	* write fpointer
	* timeout for reads and writes

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>
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>
avr: timer: implemented the avr sys-clk init.

The AVR system clock is run of the AVR core timer 0, which is an 8 bit
HR timer. The timer is configured to interrupt on overflow, which occurs
at each time the timer hits 125 or 250 (depending on the CPU frequency). The
timer only works for CPU's running on either 8MHz or 16Mhz:

 8Mhz/64/125 = 1000Hz
16Mhz/64/250 = 1000Hz

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

* Unit tests in usr/tests
* Bunch of minor fixes

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

Conflicts:
	arch/avr/include/asm/iom328.h
	kernel/irq/irqchip.c
link: irq: fixed a linking error.

The interrupt vectors are defined from PROGMEM address 0x0 - 0xXXXX.
There was some linking error which placed garbage at the first ~30-ish
bytes of the program memory. Up until now, this wasn't a problem,
however as soon as interrupts come in play it caused a crash because the
right IRQ vector couldn't be found.

Signed-off-by: Michel Megens <dev@michelmegens.net>
test: clock: added a test for the IRQ based clock.

usr/tests/sysclk contains a test to test if the IRQ based clock source
is working.

Signed-off-by: Michel Megens <dev@michelmegens.net>
irq: dbg: added a debug counter to the AVR IRQ.

Added a debugging symbol (unsigned long) to the AVR interrupt sevice
routine for the system clock. This symbol is used by the sysclk unit
test.

Signed-off-by: Michel Megens <dev@michelmegens.net>
git: ignore: added *.hex and *.dmp files as ignore

Binary hex files and object dump (files from *-objdump) shouldn't end up
the source control.

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

* improved IRQ allocation (including threaded IRQs)
* removed soft IRQs
* sysclk initialisation (not the handling yet)
Merge branch 'time'

* Atomic operations
* Clock sources
* Timers with possiblity to run as virtual timer
* Timer test

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

Conflicts:
	kernel/Makefile
Merge branch 'dev-core'

Besides some small and minor bug fixes, most changes are related to the
creation of devices which had a minor overhaul. Mainly the
device_create() function. This function now includes a name and private
data parameter and returns the created (AKA allocated) device structure.

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

Conflicts:
	usr/tests/Makefile