summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-12-19 13:36:18 -0800
committerRandall Spangler <rspangler@chromium.org>2011-12-19 13:48:05 -0800
commit84a286b1f49c25df1d44bbf87d748b20421f5521 (patch)
treecdfb346f7d5690921d96dc657bca4a07723321ff
parent117021278ca6a3069c7bb8c55868a2f40530ae1a (diff)
downloadchrome-ec-84a286b1f49c25df1d44bbf87d748b20421f5521.tar.gz
Use #defined constants for IRQ names
Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=none Change-Id: If07ac671cef6b9d0e9fe0a96bf04455a3d2626ff
-rw-r--r--chip/lm4/i2c.c12
-rw-r--r--chip/lm4/init.S276
-rw-r--r--chip/lm4/lpc.c2
-rw-r--r--chip/lm4/registers.h89
-rw-r--r--chip/lm4/timer.c2
-rw-r--r--chip/lm4/uart.c6
-rw-r--r--chip/lm4/watchdog.c7
-rw-r--r--include/task.h7
-rw-r--r--test/powerdemo.c4
9 files changed, 236 insertions, 169 deletions
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index cc9c0e9658..340ece84dc 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -151,12 +151,12 @@ static void i2c3_interrupt(void) { handle_interrupt(3); }
static void i2c4_interrupt(void) { handle_interrupt(4); }
static void i2c5_interrupt(void) { handle_interrupt(5); }
-DECLARE_IRQ(8, i2c0_interrupt, 2);
-DECLARE_IRQ(37, i2c1_interrupt, 2);
-DECLARE_IRQ(68, i2c2_interrupt, 2);
-DECLARE_IRQ(69, i2c3_interrupt, 2);
-DECLARE_IRQ(109, i2c4_interrupt, 2);
-DECLARE_IRQ(110, i2c5_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C0, i2c0_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C1, i2c1_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C2, i2c2_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C3, i2c3_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C4, i2c4_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_I2C5, i2c5_interrupt, 2);
/*****************************************************************************/
/* Console commands */
diff --git a/chip/lm4/init.S b/chip/lm4/init.S
index df55b13226..7e0424e8e0 100644
--- a/chip/lm4/init.S
+++ b/chip/lm4/init.S
@@ -20,156 +20,134 @@
/* Exceptions vector */
vectors:
-.long stack_end @ initial stack pointer
-.long reset @ reset handler
-vector nmi @ NMI handler
-vector hard_fault @ HardFault handler
-vector mpu_fault @ MPU fault handler
-vector bus_fault @ Bus fault handler
-vector usage_fault @ Usage fault handler
-.long 0 @ reserved
-.long 0 @ reserved
-.long 0 @ reserved
-.long 0 @ reserved
-vector svc @ SWI
-vector debug @ Debug handler
-.long 0 @ reserved
-vector pendsv @ PendSV handler
-vector sys_tick @ SysTick handler
-vector irq_0 @ IRQ 0 handler
-vector irq_1 @ IRQ 1 handler
-vector irq_2 @ IRQ 2 handler
-vector irq_3 @ IRQ 3 handler
-vector irq_4 @ IRQ 4 handler
-vector irq_5 @ IRQ 5 handler
-vector irq_6 @ IRQ 6 handler
-vector irq_7 @ IRQ 7 handler
-vector irq_8 @ IRQ 8 handler
-vector irq_9 @ IRQ 9 handler
-vector irq_10 @ IRQ 10 handler
-vector irq_11 @ IRQ 11 handler
-vector irq_12 @ IRQ 12 handler
-vector irq_13 @ IRQ 13 handler
-vector irq_14 @ IRQ 14 handler
-vector irq_15 @ IRQ 15 handler
-vector irq_16 @ IRQ 16 handler
-vector irq_17 @ IRQ 17 handler
-vector irq_18 @ IRQ 18 handler
-vector irq_19 @ IRQ 19 handler
-vector irq_20 @ IRQ 20 handler
-vector irq_21 @ IRQ 21 handler
-vector irq_22 @ IRQ 22 handler
-vector irq_23 @ IRQ 23 handler
-vector irq_24 @ IRQ 24 handler
-vector irq_25 @ IRQ 25 handler
-vector irq_26 @ IRQ 26 handler
-vector irq_27 @ IRQ 27 handler
-vector irq_28 @ IRQ 28 handler
-vector irq_29 @ IRQ 29 handler
-vector irq_30 @ IRQ 30 handler
-vector irq_31 @ IRQ 31 handler
-vector irq_32 @ IRQ 32 handler
-vector irq_33 @ IRQ 33 handler
-vector irq_34 @ IRQ 34 handler
-vector irq_35 @ IRQ 35 handler
-vector irq_36 @ IRQ 36 handler
-vector irq_37 @ IRQ 37 handler
-vector irq_38 @ IRQ 38 handler
-vector irq_39 @ IRQ 39 handler
-vector irq_40 @ IRQ 40 handler
-vector irq_41 @ IRQ 41 handler
-vector irq_42 @ IRQ 42 handler
-vector irq_43 @ IRQ 43 handler
-vector irq_44 @ IRQ 44 handler
-vector irq_45 @ IRQ 45 handler
-vector irq_46 @ IRQ 46 handler
-vector irq_47 @ IRQ 47 handler
-vector irq_48 @ IRQ 48 handler
-vector irq_49 @ IRQ 49 handler
-vector irq_50 @ IRQ 50 handler
-vector irq_51 @ IRQ 51 handler
-vector irq_52 @ IRQ 52 handler
-vector irq_53 @ IRQ 53 handler
-vector irq_54 @ IRQ 54 handler
-vector irq_55 @ IRQ 55 handler
-vector irq_56 @ IRQ 56 handler
-vector irq_57 @ IRQ 57 handler
-vector irq_58 @ IRQ 58 handler
-vector irq_59 @ IRQ 59 handler
-vector irq_60 @ IRQ 60 handler
-vector irq_61 @ IRQ 61 handler
-vector irq_62 @ IRQ 62 handler
-vector irq_63 @ IRQ 63 handler
-vector irq_64 @ IRQ 64 handler
-vector irq_65 @ IRQ 65 handler
-vector irq_66 @ IRQ 66 handler
-vector irq_67 @ IRQ 67 handler
-vector irq_68 @ IRQ 68 handler
-vector irq_69 @ IRQ 69 handler
-vector irq_70 @ IRQ 70 handler
-vector irq_71 @ IRQ 71 handler
-vector irq_72 @ IRQ 72 handler
-vector irq_73 @ IRQ 73 handler
-vector irq_74 @ IRQ 74 handler
-vector irq_75 @ IRQ 75 handler
-vector irq_76 @ IRQ 76 handler
-vector irq_77 @ IRQ 77 handler
-vector irq_78 @ IRQ 78 handler
-vector irq_79 @ IRQ 79 handler
-vector irq_80 @ IRQ 80 handler
-vector irq_81 @ IRQ 81 handler
-vector irq_82 @ IRQ 82 handler
-vector irq_83 @ IRQ 83 handler
-vector irq_84 @ IRQ 84 handler
-vector irq_85 @ IRQ 85 handler
-vector irq_86 @ IRQ 86 handler
-vector irq_87 @ IRQ 87 handler
-vector irq_88 @ IRQ 88 handler
-vector irq_89 @ IRQ 89 handler
-vector irq_90 @ IRQ 90 handler
-vector irq_91 @ IRQ 91 handler
-vector irq_92 @ IRQ 92 handler
-vector irq_93 @ IRQ 93 handler
-vector irq_94 @ IRQ 94 handler
-vector irq_95 @ IRQ 95 handler
-vector irq_96 @ IRQ 96 handler
-vector irq_97 @ IRQ 97 handler
-vector irq_98 @ IRQ 98 handler
-vector irq_99 @ IRQ 99 handler
-vector irq_100 @ IRQ 100 handler
-vector irq_101 @ IRQ 101 handler
-vector irq_102 @ IRQ 102 handler
-vector irq_103 @ IRQ 103 handler
-vector irq_104 @ IRQ 104 handler
-vector irq_105 @ IRQ 105 handler
-vector irq_106 @ IRQ 106 handler
-vector irq_107 @ IRQ 107 handler
-vector irq_108 @ IRQ 108 handler
-vector irq_109 @ IRQ 109 handler
-vector irq_110 @ IRQ 110 handler
-vector irq_111 @ IRQ 111 handler
-vector irq_112 @ IRQ 112 handler
-vector irq_113 @ IRQ 113 handler
-vector irq_114 @ IRQ 114 handler
-vector irq_115 @ IRQ 115 handler
-vector irq_116 @ IRQ 116 handler
-vector irq_117 @ IRQ 117 handler
-vector irq_118 @ IRQ 118 handler
-vector irq_119 @ IRQ 119 handler
-vector irq_120 @ IRQ 120 handler
-vector irq_121 @ IRQ 121 handler
-vector irq_122 @ IRQ 122 handler
-vector irq_123 @ IRQ 123 handler
-vector irq_124 @ IRQ 124 handler
-vector irq_125 @ IRQ 125 handler
-vector irq_126 @ IRQ 126 handler
-vector irq_127 @ IRQ 127 handler
-vector irq_128 @ IRQ 128 handler
-vector irq_129 @ IRQ 129 handler
-vector irq_130 @ IRQ 130 handler
-vector irq_131 @ IRQ 131 handler
+.long stack_end @ initial stack pointer
+.long reset @ reset handler
+vector nmi @ NMI handler
+vector hard_fault @ HardFault handler
+vector mpu_fault @ MPU fault handler
+vector bus_fault @ Bus fault handler
+vector usage_fault @ Usage fault handler
+.long 0 @ reserved
+.long 0 @ reserved
+.long 0 @ reserved
+.long 0 @ reserved
+vector svc @ SWI
+vector debug @ Debug handler
+.long 0 @ reserved
+vector pendsv @ PendSV handler
+vector sys_tick @ SysTick handler
+vector irq_LM4_IRQ_GPIOA @ IRQ 0 handler
+vector irq_LM4_IRQ_GPIOB @ IRQ 1 handler
+vector irq_LM4_IRQ_GPIOC @ IRQ 2 handler
+vector irq_LM4_IRQ_GPIOD @ IRQ 3 handler
+vector irq_LM4_IRQ_GPIOE @ IRQ 4 handler
+vector irq_LM4_IRQ_UART0 @ IRQ 5 handler
+vector irq_LM4_IRQ_UART1 @ IRQ 6 handler
+vector irq_LM4_IRQ_SSI0 @ IRQ 7 handler
+vector irq_LM4_IRQ_I2C0 @ IRQ 8 handler
+.rept 5
+.long 0 @ IRQ 9-13: reserved
+.endr
+vector irq_LM4_IRQ_ADC0_SS0 @ IRQ 14 handler
+vector irq_LM4_IRQ_ADC0_SS1 @ IRQ 15 handler
+vector irq_LM4_IRQ_ADC0_SS2 @ IRQ 16 handler
+vector irq_LM4_IRQ_ADC0_SS3 @ IRQ 17 handler
+vector irq_LM4_IRQ_WATCHDOG @ IRQ 18 handler
+vector irq_LM4_IRQ_TIMER0A @ IRQ 19 handler
+vector irq_LM4_IRQ_TIMER0B @ IRQ 20 handler
+vector irq_LM4_IRQ_TIMER1A @ IRQ 21 handler
+vector irq_LM4_IRQ_TIMER1B @ IRQ 22 handler
+vector irq_LM4_IRQ_TIMER2A @ IRQ 23 handler
+vector irq_LM4_IRQ_TIMER2B @ IRQ 24 handler
+vector irq_LM4_IRQ_ACMP0 @ IRQ 25 handler
+vector irq_LM4_IRQ_ACMP1 @ IRQ 26 handler
+vector irq_LM4_IRQ_ACMP2 @ IRQ 27 handler
+vector irq_LM4_IRQ_SYSCTRL @ IRQ 28 handler
+vector irq_LM4_IRQ_EEPROM @ IRQ 29 handler
+vector irq_LM4_IRQ_GPIOF @ IRQ 30 handler
+vector irq_LM4_IRQ_GPIOG @ IRQ 31 handler
+vector irq_LM4_IRQ_GPIOH @ IRQ 32 handler
+vector irq_LM4_IRQ_UART2 @ IRQ 33 handler
+vector irq_LM4_IRQ_SSI1 @ IRQ 34 handler
+vector irq_LM4_IRQ_TIMER3A @ IRQ 35 handler
+vector irq_LM4_IRQ_TIMER3B @ IRQ 36 handler
+vector irq_LM4_IRQ_I2C1 @ IRQ 37 handler
+.rept 5
+.long 0 @ IRQ 38-42: reserved
+.endr
+vector irq_LM4_IRQ_HIBERNATE @ IRQ 43 handler
+.long 0 @ IRQ 44: reserved
+.long 0 @ IRQ 45: reserved
+vector irq_LM4_IRQ_UDMA_SOFTWARE @ IRQ 46 handler
+vector irq_LM4_IRQ_UDMA_ERROR @ IRQ 47 handler
+vector irq_LM4_IRQ_ADC1_SS0 @ IRQ 48 handler
+vector irq_LM4_IRQ_ADC1_SS1 @ IRQ 49 handler
+vector irq_LM4_IRQ_ADC1_SS2 @ IRQ 50 handler
+vector irq_LM4_IRQ_ADC1_SS3 @ IRQ 51 handler
+.long 0 @ IRQ 52: reserved
+.long 0 @ IRQ 53: reserved
+vector irq_LM4_IRQ_GPIOJ @ IRQ 54 handler
+vector irq_LM4_IRQ_GPIOK @ IRQ 55 handler
+vector irq_LM4_IRQ_GPIOL @ IRQ 56 handler
+vector irq_LM4_IRQ_SSI2 @ IRQ 57 handler
+vector irq_LM4_IRQ_SSI3 @ IRQ 58 handler
+vector irq_LM4_IRQ_UART3 @ IRQ 59 handler
+vector irq_LM4_IRQ_UART4 @ IRQ 60 handler
+vector irq_LM4_IRQ_UART5 @ IRQ 61 handler
+vector irq_LM4_IRQ_UART6 @ IRQ 62 handler
+vector irq_LM4_IRQ_UART7 @ IRQ 63 handler
+.rept 4
+.long 0 @ IRQ 64-67: reserved
+.endr
+vector irq_LM4_IRQ_I2C2 @ IRQ 68 handler
+vector irq_LM4_IRQ_I2C3 @ IRQ 69 handler
+vector irq_LM4_IRQ_TIMER4A @ IRQ 70 handler
+vector irq_LM4_IRQ_TIMER4B @ IRQ 71 handler
+.rept 20
+.long 0 @ IRQ 72-91: reserved
+.endr
+vector irq_LM4_IRQ_TIMER5A @ IRQ 92 handler
+vector irq_LM4_IRQ_TIMER5B @ IRQ 93 handler
+vector irq_LM4_IRQ_TIMERW0A @ IRQ 94 handler
+vector irq_LM4_IRQ_TIMERW0B @ IRQ 95 handler
+vector irq_LM4_IRQ_TIMERW1A @ IRQ 96 handler
+vector irq_LM4_IRQ_TIMERW1B @ IRQ 97 handler
+vector irq_LM4_IRQ_TIMERW2A @ IRQ 98 handler
+vector irq_LM4_IRQ_TIMERW2B @ IRQ 99 handler
+vector irq_LM4_IRQ_TIMERW3A @ IRQ 100 handler
+vector irq_LM4_IRQ_TIMERW3B @ IRQ 101 handler
+vector irq_LM4_IRQ_TIMERW4A @ IRQ 102 handler
+vector irq_LM4_IRQ_TIMERW4B @ IRQ 103 handler
+vector irq_LM4_IRQ_TIMERW5A @ IRQ 104 handler
+vector irq_LM4_IRQ_TIMERW5B @ IRQ 105 handler
+vector irq_LM4_IRQ_SYS_EXCEPTION @ IRQ 106 handler
+vector irq_LM4_IRQ_SYS_PECI @ IRQ 107 handler
+vector irq_LM4_IRQ_LPC @ IRQ 108 handler
+vector irq_LM4_IRQ_I2C4 @ IRQ 109 handler
+vector irq_LM4_IRQ_I2C5 @ IRQ 110 handler
+vector irq_LM4_IRQ_GPIOM @ IRQ 111 handler
+vector irq_LM4_IRQ_GPION @ IRQ 112 handler
+.long 0 @ IRQ 113: reserved
+vector irq_LM4_IRQ_FAN @ IRQ 114 handler
+.long 0 @ IRQ 115: reserved
+vector irq_LM4_IRQ_GPIOP @ IRQ 116 handler
+vector irq_LM4_IRQ_GPIOP1 @ IRQ 117 handler
+vector irq_LM4_IRQ_GPIOP2 @ IRQ 118 handler
+vector irq_LM4_IRQ_GPIOP3 @ IRQ 119 handler
+vector irq_LM4_IRQ_GPIOP4 @ IRQ 120 handler
+vector irq_LM4_IRQ_GPIOP5 @ IRQ 121 handler
+vector irq_LM4_IRQ_GPIOP6 @ IRQ 122 handler
+vector irq_LM4_IRQ_GPIOP7 @ IRQ 123 handler
+vector irq_LM4_IRQ_GPIOQ @ IRQ 124 handler
+vector irq_LM4_IRQ_GPIOQ1 @ IRQ 125 handler
+vector irq_LM4_IRQ_GPIOQ2 @ IRQ 126 handler
+vector irq_LM4_IRQ_GPIOQ3 @ IRQ 127 handler
+vector irq_LM4_IRQ_GPIOQ4 @ IRQ 128 handler
+vector irq_LM4_IRQ_GPIOQ5 @ IRQ 129 handler
+vector irq_LM4_IRQ_GPIOQ6 @ IRQ 130 handler
+vector irq_LM4_IRQ_GPIOQ7 @ IRQ 131 handler
.rept 108
-.long 0 @ IRQ 132-239: reserved
+.long 0 @ IRQ 132-239: reserved
.endr
.global reset
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 68f12c230d..9f14b8d4aa 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -235,4 +235,4 @@ static void lpc_interrupt(void)
}
}
-DECLARE_IRQ(108, lpc_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_LPC, lpc_interrupt, 2);
diff --git a/chip/lm4/registers.h b/chip/lm4/registers.h
index df701efd53..6762cb0410 100644
--- a/chip/lm4/registers.h
+++ b/chip/lm4/registers.h
@@ -186,20 +186,109 @@ static inline int lm4_fan_addr(int ch, int offset)
#define LM4_NVIC_PRI(x) LM4REG(0xe000e400 + 4 * (x))
#define LM4_NVIC_APINT LM4REG(0xe000ed0c)
#define LM4_NVIC_SWTRIG LM4REG(0xe000ef00)
+
/* IRQ numbers */
+#define LM4_IRQ_GPIOA 0
+#define LM4_IRQ_GPIOB 1
+#define LM4_IRQ_GPIOC 2
#define LM4_IRQ_GPIOD 3
+#define LM4_IRQ_GPIOE 4
#define LM4_IRQ_UART0 5
#define LM4_IRQ_UART1 6
+#define LM4_IRQ_SSI0 7
#define LM4_IRQ_I2C0 8
+/* 9 - 13 reserved */
+#define LM4_IRQ_ADC0_SS0 14
+#define LM4_IRQ_ADC0_SS1 15
+#define LM4_IRQ_ADC0_SS2 16
+#define LM4_IRQ_ADC0_SS3 17
#define LM4_IRQ_WATCHDOG 18
+#define LM4_IRQ_TIMER0A 19
+#define LM4_IRQ_TIMER0B 20
+#define LM4_IRQ_TIMER1A 21
+#define LM4_IRQ_TIMER1B 22
+#define LM4_IRQ_TIMER2A 23
+#define LM4_IRQ_TIMER2B 24
+#define LM4_IRQ_ACMP0 25
+#define LM4_IRQ_ACMP1 26
+#define LM4_IRQ_ACMP2 27
+#define LM4_IRQ_SYSCTRL 28
+#define LM4_IRQ_EEPROM 29
+#define LM4_IRQ_GPIOF 30
+#define LM4_IRQ_GPIOG 31
+#define LM4_IRQ_GPIOH 32
+#define LM4_IRQ_UART2 33
+#define LM4_IRQ_SSI1 34
+#define LM4_IRQ_TIMER3A 35
+#define LM4_IRQ_TIMER3B 36
#define LM4_IRQ_I2C1 37
+/* 38 - 42 reserved */
+#define LM4_IRQ_HIBERNATE 43
+/* 44 - 45 reserved */
+#define LM4_IRQ_UDMA_SOFTWARE 46
+#define LM4_IRQ_UDMA_ERROR 47
+#define LM4_IRQ_ADC1_SS0 48
+#define LM4_IRQ_ADC1_SS1 49
+#define LM4_IRQ_ADC1_SS2 50
+#define LM4_IRQ_ADC1_SS3 51
+/* 52 - 53 reserved */
+#define LM4_IRQ_GPIOJ 54
+#define LM4_IRQ_GPIOK 55
+#define LM4_IRQ_GPIOL 56
+#define LM4_IRQ_SSI2 57
+#define LM4_IRQ_SSI3 58
+#define LM4_IRQ_UART3 59
+#define LM4_IRQ_UART4 60
+#define LM4_IRQ_UART5 61
+#define LM4_IRQ_UART6 62
+#define LM4_IRQ_UART7 63
+/* 64 - 67 reserved */
#define LM4_IRQ_I2C2 68
#define LM4_IRQ_I2C3 69
+#define LM4_IRQ_TIMER4A 70
+#define LM4_IRQ_TIMER4B 71
+/* 72 - 91 reserved */
+#define LM4_IRQ_TIMER5A 92
+#define LM4_IRQ_TIMER5B 93
#define LM4_IRQ_TIMERW0A 94
+#define LM4_IRQ_TIMERW0B 95
#define LM4_IRQ_TIMERW1A 96
+#define LM4_IRQ_TIMERW1B 97
+#define LM4_IRQ_TIMERW2A 98
+#define LM4_IRQ_TIMERW2B 99
+#define LM4_IRQ_TIMERW3A 100
+#define LM4_IRQ_TIMERW3B 101
+#define LM4_IRQ_TIMERW4A 102
+#define LM4_IRQ_TIMERW4B 103
+#define LM4_IRQ_TIMERW5A 104
+#define LM4_IRQ_TIMERW5B 105
+#define LM4_IRQ_SYS_EXCEPTION 106
+#define LM4_IRQ_SYS_PECI 107
#define LM4_IRQ_LPC 108
#define LM4_IRQ_I2C4 109
#define LM4_IRQ_I2C5 110
+#define LM4_IRQ_GPIOM 111
+#define LM4_IRQ_GPION 112
+/* 113 reserved */
+#define LM4_IRQ_FAN 114
+/* 115 reserved */
+#define LM4_IRQ_GPIOP 116
+#define LM4_IRQ_GPIOP1 117
+#define LM4_IRQ_GPIOP2 118
+#define LM4_IRQ_GPIOP3 119
+#define LM4_IRQ_GPIOP4 120
+#define LM4_IRQ_GPIOP5 121
+#define LM4_IRQ_GPIOP6 122
+#define LM4_IRQ_GPIOP7 123
+#define LM4_IRQ_GPIOQ 124
+#define LM4_IRQ_GPIOQ1 125
+#define LM4_IRQ_GPIOQ2 126
+#define LM4_IRQ_GPIOQ3 127
+#define LM4_IRQ_GPIOQ4 128
+#define LM4_IRQ_GPIOQ5 129
+#define LM4_IRQ_GPIOQ6 130
+#define LM4_IRQ_GPIOQ7 131
+/* 132 - 138 reserved */
#define LM4_SCB_SYSCTRL LM4REG(0xe000ed10)
diff --git a/chip/lm4/timer.c b/chip/lm4/timer.c
index 9c273a0d9b..65f30b3fb7 100644
--- a/chip/lm4/timer.c
+++ b/chip/lm4/timer.c
@@ -118,7 +118,7 @@ static void __hw_clock_source_irq(void)
/* Find expired timers and set the new timer deadline */
process_timers();
}
-DECLARE_IRQ(94, __hw_clock_source_irq, 1);
+DECLARE_IRQ(LM4_IRQ_TIMERW0A, __hw_clock_source_irq, 1);
static void __hw_clock_source_init(void)
diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c
index 2ff4901d09..d9f86e9800 100644
--- a/chip/lm4/uart.c
+++ b/chip/lm4/uart.c
@@ -128,9 +128,7 @@ static void uart_0_interrupt(void)
if (tx_buf_tail == tx_buf_head)
LM4_UART_IM(0) &= ~0x20;
}
-/* TODO: can't use LM4_IRQ_UART0 constant because it messes with the
- * DECLARE_IRQ() macro. */
-DECLARE_IRQ(5, uart_0_interrupt, 1);
+DECLARE_IRQ(LM4_IRQ_UART0, uart_0_interrupt, 1);
/* Interrupt handler for UART1 */
@@ -150,7 +148,7 @@ static void uart_1_interrupt(void)
}
}
/* Must be same prio as LPC interrupt handler so they don't preempt */
-DECLARE_IRQ(6, uart_1_interrupt, 2);
+DECLARE_IRQ(LM4_IRQ_UART1, uart_1_interrupt, 2);
/* Configure GPIOs for the UART module. */
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c
index 42a8c8961d..86d9087a26 100644
--- a/chip/lm4/watchdog.c
+++ b/chip/lm4/watchdog.c
@@ -69,8 +69,8 @@ void watchdog_trace(uint32_t excep_lr, uint32_t excep_sp)
command_timer_info(0, NULL);
}
-void irq_18_handler(void) __attribute__((naked));
-void irq_18_handler(void)
+void irq_LM4_IRQ_WATCHDOG_handler(void) __attribute__((naked));
+void irq_LM4_IRQ_WATCHDOG_handler(void)
{
asm volatile("mov r0, lr\n"
"mov r1, sp\n"
@@ -80,7 +80,8 @@ void irq_18_handler(void)
"mov r0, lr\n"
"b task_resched_if_needed\n");
}
-const struct irq_priority prio_18 __attribute__((section(".rodata.irqprio")))
+const struct irq_priority prio_LM4_IRQ_WATCHDOG
+ __attribute__((section(".rodata.irqprio")))
= {LM4_IRQ_WATCHDOG, 0}; /* put the watchdog at the highest
priority */
diff --git a/include/task.h b/include/task.h
index 8db98c26f9..52e42d3740 100644
--- a/include/task.h
+++ b/include/task.h
@@ -91,9 +91,10 @@ struct irq_priority {
* Connects the interrupt handler "routine" to the irq number "irq" and
* ensures it is enabled in the interrupt controller with the right priority.
*
- * Note that you MUST pass irq as the number ("5") not as a #defined constant,
- * because it's stringized and matched up with a weak reference from init.S.
- * TODO: fix that; it's typo-prone.
+ * Note that you MUST pass irq using a LM4_IRQ_* constant from register.h, not
+ * as a number, because it's stringized and matched up with a weak reference
+ * from init.S. (This is still better than passing it as a raw number, because
+ * that's more typo-prone.)
*/
#define DECLARE_IRQ(irq, routine, priority) \
void irq_##irq##_handler(void) \
diff --git a/test/powerdemo.c b/test/powerdemo.c
index 1fe4e00ee8..c809c1eac5 100644
--- a/test/powerdemo.c
+++ b/test/powerdemo.c
@@ -128,7 +128,7 @@ static void __gpio_d_interrupt(void)
}
}
-DECLARE_IRQ(3, __gpio_d_interrupt, 1);
+DECLARE_IRQ(LM4_IRQ_GPIOD, __gpio_d_interrupt, 1);
/* Timer interrupt handler */
@@ -172,7 +172,7 @@ static void __timer_w1_interrupt(void)
}
}
-DECLARE_IRQ(96, __timer_w1_interrupt, 1);
+DECLARE_IRQ(LM4_IRQ_TIMERW1A, __timer_w1_interrupt, 1);
int power_demo_task(void)
{