Add missing kernel.h includes (hopefully all of them).

Change-Id: I9c1825296a788587b8d494d8514b3314847b0ff0
diff --git a/bootloader/rk27xx.c b/bootloader/rk27xx.c
index c786271..c623a97 100644
--- a/bootloader/rk27xx.c
+++ b/bootloader/rk27xx.c
@@ -1,7 +1,8 @@
 #include <stdio.h>
-#include <system.h>
 #include <inttypes.h>
 #include "config.h"
+#include "system.h"
+#include "kernel.h"
 #include "gcc_extensions.h"
 #include "lcd.h"
 #include "font.h"
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index 9fa676f..c4c748d 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -18,9 +18,11 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "config.h"
-#include "logf.h"
 #include "system.h"
+#include "kernel.h"
+#include "logf.h"
 #include "string.h"
 #include "audio.h"
 
@@ -313,4 +315,3 @@
     tlv320_write_reg(REG_PC,  value_pc);
 }
 #endif /* HAVE_RECORDING */
-
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index 9d6ece1..debe299 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "logf.h"
 #include "system.h"
+#include "kernel.h"
 #include "audio.h"
 #include "debug.h"
 #include "udacodec.h"
diff --git a/firmware/drivers/audio/wm8978.c b/firmware/drivers/audio/wm8978.c
index 69ae608..0730ff5 100644
--- a/firmware/drivers/audio/wm8978.c
+++ b/firmware/drivers/audio/wm8978.c
@@ -20,8 +20,10 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "audiohw.h"
 #include "wmcodec.h"
 #include "audio.h"
diff --git a/firmware/target/arm/as3525/button-clip.c b/firmware/target/arm/as3525/button-clip.c
index 2bd472c..35b5e8a 100644
--- a/firmware/target/arm/as3525/button-clip.c
+++ b/firmware/target/arm/as3525/button-clip.c
@@ -20,7 +20,10 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
+#include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "button.h"
 #include "as3525v2.h"
 #ifndef BOOTLOADER
diff --git a/firmware/target/arm/as3525/button-e200v2-fuze.c b/firmware/target/arm/as3525/button-e200v2-fuze.c
index d8bb90e..7c29c74 100644
--- a/firmware/target/arm/as3525/button-e200v2-fuze.c
+++ b/firmware/target/arm/as3525/button-e200v2-fuze.c
@@ -22,6 +22,7 @@
 
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "button.h"
 #include "backlight.h"
 #include "dbop-as3525.h"
@@ -122,4 +123,3 @@
 
     return btn;
 }
-
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c
index fe1314d..b8e5720 100644
--- a/firmware/target/arm/ata-nand-telechips.c
+++ b/firmware/target/arm/ata-nand-telechips.c
@@ -18,10 +18,12 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
+#include <string.h>
+#include "system.h"
+#include "kernel.h"
 #include "nand.h"
 #include "ata-nand-target.h"
-#include "system.h"
-#include <string.h>
 #include "led.h"
 #include "panic.h"
 #include "nand_id.h"
diff --git a/firmware/target/arm/imx233/adc-imx233.c b/firmware/target/arm/imx233/adc-imx233.c
index 36ac0f4..f3b7869 100644
--- a/firmware/target/arm/imx233/adc-imx233.c
+++ b/firmware/target/arm/imx233/adc-imx233.c
@@ -19,8 +19,10 @@
  *
  ****************************************************************************/
 
+#include "config.h"
 #include "adc-target.h"
 #include "system.h"
+#include "kernel.h"
 #include "powermgmt-target.h"
 #include "lradc-imx233.h"
 #include "power-imx233.h"
diff --git a/firmware/target/arm/imx233/audioout-imx233.c b/firmware/target/arm/imx233/audioout-imx233.c
index 26a480d..c92804c 100644
--- a/firmware/target/arm/imx233/audioout-imx233.c
+++ b/firmware/target/arm/imx233/audioout-imx233.c
@@ -18,11 +18,15 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
+#include <string.h>
+
+#include "config.h"
+#include "kernel.h"
 #include "audioout-imx233.h"
 #include "clkctrl-imx233.h"
 #include "rtc-imx233.h"
 #include "pcm_sampr.h"
-#include "string.h"
 #include "audio-target.h"
 
 #ifndef IMX233_AUDIO_COUPLING_MODE
@@ -294,4 +298,4 @@
     info.dac = !BF_RD(AUDIOOUT_PWRDN, DAC);
     info.capless = BF_RD(AUDIOOUT_PWRDN, CAPLESS);
     return info;
-}
\ No newline at end of file
+}
diff --git a/firmware/target/arm/imx233/button-lradc-imx233.c b/firmware/target/arm/imx233/button-lradc-imx233.c
index 5e3b716..6bb7f9b 100644
--- a/firmware/target/arm/imx233/button-lradc-imx233.c
+++ b/firmware/target/arm/imx233/button-lradc-imx233.c
@@ -18,8 +18,12 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
+#include <stdlib.h>
+
+#include "cpu.h"
+#include "kernel.h"
 #include "button-lradc-imx233.h"
-#include "stdlib.h"
 #include "lradc-imx233.h"
 #include "pinctrl-imx233.h"
 
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zen.c b/firmware/target/arm/imx233/creative-zen/lcd-zen.c
index 7e9e982..c653b54 100644
--- a/firmware/target/arm/imx233/creative-zen/lcd-zen.c
+++ b/firmware/target/arm/imx233/creative-zen/lcd-zen.c
@@ -18,10 +18,12 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include <sys/types.h> /* off_t */
 #include <string.h>
 #include "cpu.h"
 #include "system.h"
+#include "kernel.h"
 #include "backlight-target.h"
 #include "lcd.h"
 #include "lcdif-imx233.h"
@@ -346,4 +348,3 @@
         }
     }
 }
-
diff --git a/firmware/target/arm/imx233/dcp-imx233.c b/firmware/target/arm/imx233/dcp-imx233.c
index 8c0c1c4..c800d89 100644
--- a/firmware/target/arm/imx233/dcp-imx233.c
+++ b/firmware/target/arm/imx233/dcp-imx233.c
@@ -18,8 +18,10 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "dcp-imx233.h"
 #include "string.h"
 #include "kernel-imx233.h"
@@ -247,4 +249,4 @@
         info.csc.enable = HW_DCP_CSCCTRL0 & HW_DCP_CSCCTRL0__ENABLE;
     }
     return info;
-}
\ No newline at end of file
+}
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 55dbe18..6fe59ca 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -19,7 +19,9 @@
  *
  ****************************************************************************/
 
+#include "cpu.h"
 #include "system.h"
+#include "kernel.h"
 #include "dma-imx233.h"
 #include "lcd.h"
 #include "font.h"
diff --git a/firmware/target/arm/imx233/dma-imx233.c b/firmware/target/arm/imx233/dma-imx233.c
index 81ae5ae..6727e9b 100644
--- a/firmware/target/arm/imx233/dma-imx233.c
+++ b/firmware/target/arm/imx233/dma-imx233.c
@@ -18,8 +18,10 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "dma-imx233.h"
 #include "lcd.h"
 #include "string.h"
@@ -287,4 +289,3 @@
     s.nr_unaligned = apb_nr_unaligned[chan];
     return s;
 }
-
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h
index b12ca13..c08b3ac 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-target.h
+++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h
@@ -23,6 +23,7 @@
 
 #include "system-arm.h"
 #include "mmu-arm.h"
+#include "kernel.h"
 
 /* High enough for most tasks but low enough for reduced voltage */
 #define CPUFREQ_DEFAULT     264000000
diff --git a/firmware/target/arm/rk27xx/ma/audio-ma.c b/firmware/target/arm/rk27xx/ma/audio-ma.c
index f842824..6a4da1a 100644
--- a/firmware/target/arm/rk27xx/ma/audio-ma.c
+++ b/firmware/target/arm/rk27xx/ma/audio-ma.c
@@ -19,11 +19,12 @@
  *
  ****************************************************************************/
 
+#include "system.h"
+#include "kernel.h"
 #include "audiohw.h"
 #include "df1704.h"
 #include "pca9555.h"
 #include "i2c-rk27xx.h"
-#include "system.h"
 
 void df1704_set_ml_dir(const int dir)
 {
diff --git a/firmware/target/arm/rk27xx/ma/pca9555-ma.c b/firmware/target/arm/rk27xx/ma/pca9555-ma.c
index 328a87e..bec2fb1 100644
--- a/firmware/target/arm/rk27xx/ma/pca9555-ma.c
+++ b/firmware/target/arm/rk27xx/ma/pca9555-ma.c
@@ -20,6 +20,7 @@
  ****************************************************************************/
 
 #include "system.h"
+#include "kernel.h"
 #include "i2c-rk27xx.h"
 #include "pca9555.h"
 
diff --git a/firmware/target/arm/rk27xx/pcm-rk27xx.c b/firmware/target/arm/rk27xx/pcm-rk27xx.c
index 4e6b8fe..21feaf6 100644
--- a/firmware/target/arm/rk27xx/pcm-rk27xx.c
+++ b/firmware/target/arm/rk27xx/pcm-rk27xx.c
@@ -19,7 +19,9 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "system.h"
+#include "kernel.h"
 #include "audio.h"
 #include "string.h"
 #include "panic.h"
diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c
index dcdea65..de06a43 100644
--- a/firmware/target/arm/s3c2440/debug-s3c2440.c
+++ b/firmware/target/arm/s3c2440/debug-s3c2440.c
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "cpu.h"
 #include "system.h"
+#include "kernel.h"
 #include "string.h"
 #include <stdbool.h>
 #include "button.h"
diff --git a/firmware/target/arm/s3c2440/i2c-s3c2440.c b/firmware/target/arm/s3c2440/i2c-s3c2440.c
index 33c4e31..b8fbb19 100644
--- a/firmware/target/arm/s3c2440/i2c-s3c2440.c
+++ b/firmware/target/arm/s3c2440/i2c-s3c2440.c
@@ -18,7 +18,9 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "system.h"
+#include "kernel.h"
 #include "i2c-s3c2440.h"
 
 static struct semaphore i2c_complete; /* Transfer completion signal */
diff --git a/firmware/target/arm/s3c2440/lcd-s3c2440.c b/firmware/target/arm/s3c2440/lcd-s3c2440.c
index 1631e35..55e1513 100644
--- a/firmware/target/arm/s3c2440/lcd-s3c2440.c
+++ b/firmware/target/arm/s3c2440/lcd-s3c2440.c
@@ -19,8 +19,10 @@
 * KIND, either express or implied.
 *
 ****************************************************************************/ 
+
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "lcd.h"
 #include "lcd-target.h"
 
diff --git a/firmware/target/arm/s5l8700/system-target.h b/firmware/target/arm/s5l8700/system-target.h
index 170794a..efd66fe 100644
--- a/firmware/target/arm/s5l8700/system-target.h
+++ b/firmware/target/arm/s5l8700/system-target.h
@@ -23,6 +23,7 @@
 
 #include "system-arm.h"
 #include "mmu-arm.h"
+#include "kernel.h"
 
 #define CPUFREQ_SLEEP      32768
 #define CPUFREQ_MAX     (1843200 * 4 * 26 / 1) /* 191692800 Hz */
diff --git a/firmware/target/arm/s5l8702/system-target.h b/firmware/target/arm/s5l8702/system-target.h
index ba05c2f..202ac83 100644
--- a/firmware/target/arm/s5l8702/system-target.h
+++ b/firmware/target/arm/s5l8702/system-target.h
@@ -23,6 +23,7 @@
 
 #include "system-arm.h"
 #include "mmu-arm.h"
+#include "kernel.h"
 
 #define CPUFREQ_SLEEP      32768
 #define CPUFREQ_MAX     216000000
diff --git a/firmware/target/arm/tcc780x/system-target.h b/firmware/target/arm/tcc780x/system-target.h
index fe66a6e..a369c2f 100644
--- a/firmware/target/arm/tcc780x/system-target.h
+++ b/firmware/target/arm/tcc780x/system-target.h
@@ -23,6 +23,7 @@
 
 #include "system-arm.h"
 #include "mmu-arm.h"
+#include "kernel.h" /* TIME_BEFORE */
 
 #define CPUFREQ_DEFAULT 32000000
 #define CPUFREQ_NORMAL  48000000
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c
index 89d8d50..37e48d1 100644
--- a/firmware/target/arm/tms320dm320/debug-dm320.c
+++ b/firmware/target/arm/tms320dm320/debug-dm320.c
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "cpu.h"
 #include "system.h"
+#include "kernel.h"
 #include "string.h"
 #include <stdbool.h>
 #include "button.h"
diff --git a/firmware/target/arm/tms320dm320/i2c-dm320.c b/firmware/target/arm/tms320dm320/i2c-dm320.c
index c201019..629dae3 100644
--- a/firmware/target/arm/tms320dm320/i2c-dm320.c
+++ b/firmware/target/arm/tms320dm320/i2c-dm320.c
@@ -21,8 +21,9 @@
  * KIND, either express or implied.
  *
  ****************************************************************************/
+
 #include "system.h"
-#include "thread.h"
+#include "kernel.h"
 #include "i2c-dm320.h"
 
 #ifdef HAVE_SOFTWARE_I2C
diff --git a/firmware/target/coldfire/debug-coldfire.c b/firmware/target/coldfire/debug-coldfire.c
index acc2c41..249c0a7 100644
--- a/firmware/target/coldfire/debug-coldfire.c
+++ b/firmware/target/coldfire/debug-coldfire.c
@@ -19,9 +19,11 @@
  *
  ****************************************************************************/
 
+#include <stdbool.h>
+
 #include "config.h"
 #include "system.h"
-#include <stdbool.h>
+#include "kernel.h"
 #include "font.h"
 #include "lcd.h"
 #include "button.h"
diff --git a/firmware/target/coldfire/iriver/lcd-remote-iriver.c b/firmware/target/coldfire/iriver/lcd-remote-iriver.c
index 03c0e40..fcf741a 100644
--- a/firmware/target/coldfire/iriver/lcd-remote-iriver.c
+++ b/firmware/target/coldfire/iriver/lcd-remote-iriver.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "system.h"
+#include "kernel.h"
 #include "file.h"
 #include "lcd-remote.h"
 #include "adc.h"
diff --git a/firmware/target/sh/archos/player/lcd-player.c b/firmware/target/sh/archos/player/lcd-player.c
index 330cc26..95b0164 100644
--- a/firmware/target/sh/archos/player/lcd-player.c
+++ b/firmware/target/sh/archos/player/lcd-player.c
@@ -20,10 +20,11 @@
  *
  ****************************************************************************/
 
-#include "config.h"
 #include <string.h>
-#include "hwcompat.h"
+#include "config.h"
 #include "system.h"
+#include "kernel.h"
+#include "hwcompat.h"
 #include "lcd.h"
 #include "lcd-charcell.h"
 
diff --git a/firmware/target/sh/debug-sh.c b/firmware/target/sh/debug-sh.c
index 180c37f..bee4896 100644
--- a/firmware/target/sh/debug-sh.c
+++ b/firmware/target/sh/debug-sh.c
@@ -19,10 +19,12 @@
  *
  ****************************************************************************/
 
-#include "config.h"
-#include "system.h"
 #include <stdbool.h>
 #include <string.h>
+
+#include "config.h"
+#include "system.h"
+#include "kernel.h"
 #include "font.h"
 #include "lcd.h"
 #include "button.h"