Complete rework of timer and interrupt code
Detail: * Moved interrupt and timer code out of s.Stubs - they're not stubs any more. * Rewrote timer and counter code to use GPU system timer 1 for our Timer0 rather than the ARM timer. This is recommended in the Broadcom datasheet because it's driven from the APB clock and so its speed will vary in reduced or low power mode. * HAL_CounterDelay now, well, does a delay! * Added a Timer1, driven from GPU system timer 3 - common code with Timer0. * Reshuffled device numbers so the GPU interrupts are at the bottom. This works better for FIQs and makes Timer0 the lowest priority interrupt. * Higher device numbers are now consistently treated as higher priority. * Stopped using bits 8-31 of the basic interrupt registers. These can't be masked, so they cause the kernel to lock up if generated, which happens if the GPU interrupt which they alias is generated (which appears to include the timers even though this is not documented). * Added definitions for all the interrupts, including those redacted from the datasheet - we need them at least for timers, USB and SD. * Stopped HAL_IRQClear from doing anything - this interrupt controller doesn't do latching. To acknowledge timer interrupts, you should use HAL_TimerIRQClear (and HAL_IRQClear too for compatibility with other ports). * Implemented HAL_IRQStatus and all the FIQ control routines. * Offsets to interrupt controller registers now use symbolic names. * Replaced some hard spaces in sources with normal ones. Admin: Tested on a beta Raspberry Pi. Confirmed that interrupt handlers for both ARM and GPU sources can both be operational simultaneuosly. However, the FIQ code has not been tested. Timer0 is verified as running at the correct speed and reporting a count *down* in the correct range (not a count up as some previous versions did). HAL_CounterDelay appears correct also. Version 0.04. Tagged as 'BCM2835-0_04'
Showing with 640 additions and 297 deletions