mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
IRQ list support for enabling specific IRQs without common runtime
This adds back DECLARE_IRQ() support when building without common runtime. With this, we can enable only a subset of IRQs and avoid linking in other unused IRQ handlers. Note that after this change, all boards without common runtime need to have a ec.irqlist file. BUG=None TEST=Build Keyborg and check it still works. TEST=make buildall BRANCH=None Change-Id: If68062a803b9a78f383027a1625cf99eb3370d3f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203264 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
635a07ddad
commit
6c8e451ff0
8
Makefile
8
Makefile
@@ -53,6 +53,14 @@ _flag_cfg:=$(shell $(CPP) $(CPPFLAGS) -P -dM -Ichip/$(CHIP) -Iboard/$(BOARD) \
|
||||
|
||||
$(foreach c,$(_tsk_cfg) $(_flag_cfg),$(eval $(c)=y))
|
||||
|
||||
ifneq "$(CONFIG_COMMON_RUNTIME)" "y"
|
||||
_irq_list:=$(shell $(CPP) $(CPPFLAGS) -P -Ichip/$(CHIP) -Iboard/$(BOARD) \
|
||||
-D"ENABLE_IRQ(x)=EN_IRQ x" -imacros chip/$(CHIP)/registers.h \
|
||||
board/$(BOARD)/ec.irqlist | grep "EN_IRQ .*" | cut -c8-)
|
||||
CPPFLAGS+=$(foreach irq,$(_irq_list),\
|
||||
-D"irq_$(irq)_handler_optional=irq_$(irq)_handler")
|
||||
endif
|
||||
|
||||
# Get build configuration from sub-directories
|
||||
# Note that this re-includes the board and chip makefiles
|
||||
include board/$(BOARD)/build.mk
|
||||
|
||||
12
board/keyborg/ec.irqlist
Normal file
12
board/keyborg/ec.irqlist
Normal file
@@ -0,0 +1,12 @@
|
||||
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of enabled IRQ. To enable an IRQ, use ENABLE_IRQ(irq_num). Any
|
||||
* IRQ that is not listed here is disabled.
|
||||
*/
|
||||
|
||||
ENABLE_IRQ(STM32_IRQ_EXTI0)
|
||||
ENABLE_IRQ(STM32_IRQ_TIM2)
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
#include "irq_handler.h"
|
||||
#include "master_slave.h"
|
||||
#include "registers.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -63,7 +63,7 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IRQ_HANDLER(STM32_IRQ_TIM2)(void)
|
||||
void tim2_interrupt(void)
|
||||
{
|
||||
if (STM32_TIM_CNT(3) == last_deadline >> 16) {
|
||||
STM32_TIM_DIER(2) = 0;
|
||||
@@ -74,6 +74,7 @@ void IRQ_HANDLER(STM32_IRQ_TIM2)(void)
|
||||
need_wfi = 1;
|
||||
}
|
||||
}
|
||||
DECLARE_IRQ(STM32_IRQ_TIM2, tim2_interrupt, 1);
|
||||
|
||||
void __hw_clock_event_set(uint32_t deadline)
|
||||
{
|
||||
|
||||
@@ -480,7 +480,7 @@ static void spi_nss_interrupt(void)
|
||||
}
|
||||
|
||||
/* Interrupt handler for PA0 */
|
||||
void IRQ_HANDLER(STM32_IRQ_EXTI0)(void)
|
||||
void spi_nss_interrupt_handler(void)
|
||||
{
|
||||
/* Clear the interrupt */
|
||||
STM32_EXTI_PR = STM32_EXTI_PR;
|
||||
@@ -488,4 +488,4 @@ void IRQ_HANDLER(STM32_IRQ_EXTI0)(void)
|
||||
/* SPI slave interrupt */
|
||||
spi_nss_interrupt();
|
||||
}
|
||||
|
||||
DECLARE_IRQ(STM32_IRQ_EXTI0, spi_nss_interrupt_handler, 1);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "irq_handler.h"
|
||||
#include "registers.h"
|
||||
#include "sha1.h"
|
||||
#include "task.h"
|
||||
#include "usb_pd.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -19,13 +19,14 @@ static uint32_t * const rw_rst =
|
||||
(uint32_t *)(CONFIG_FLASH_BASE+CONFIG_FW_RW_OFF+4);
|
||||
|
||||
/* External interrupt EXTINT7 for external comparator on PA7 */
|
||||
void IRQ_HANDLER(STM32_IRQ_EXTI4_15)(void)
|
||||
void pd_rx_interrupt(void)
|
||||
{
|
||||
/* clear the interrupt */
|
||||
STM32_EXTI_PR = STM32_EXTI_PR;
|
||||
/* trigger reception handling */
|
||||
pd_rx_handler();
|
||||
}
|
||||
DECLARE_IRQ(STM32_IRQ_EXTI4_15, pd_rx_interrupt, 1);
|
||||
|
||||
static void jump_to_rw(void)
|
||||
{
|
||||
|
||||
13
board/zinger/ec.irqlist
Normal file
13
board/zinger/ec.irqlist
Normal file
@@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of enabled IRQ. To enable an IRQ, use ENABLE_IRQ(irq_num). Any
|
||||
* IRQ that is not listed here is disabled.
|
||||
*/
|
||||
|
||||
ENABLE_IRQ(STM32_IRQ_EXTI4_15)
|
||||
ENABLE_IRQ(STM32_IRQ_ADC_COMP)
|
||||
ENABLE_IRQ(STM32_IRQ_TIM2)
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "common.h"
|
||||
#include "cpu.h"
|
||||
#include "debug.h"
|
||||
#include "irq_handler.h"
|
||||
#include "registers.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -52,12 +52,13 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IRQ_HANDLER(STM32_IRQ_TIM2)(void)
|
||||
void tim2_interrupt(void)
|
||||
{
|
||||
STM32_TIM_DIER(2) = 0; /* disable match interrupt */
|
||||
task_clear_pending_irq(STM32_IRQ_TIM2);
|
||||
last_event = 1 << 29 /* task event wake */;
|
||||
}
|
||||
DECLARE_IRQ(STM32_IRQ_TIM2, tim2_interrupt, 1);
|
||||
|
||||
uint32_t task_wait_event(int timeout_us)
|
||||
{
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
*/
|
||||
|
||||
#include "adc.h"
|
||||
#include "board.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "debug.h"
|
||||
#include "hooks.h"
|
||||
#include "irq_handler.h"
|
||||
#include "registers.h"
|
||||
#include "sha1.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
#include "usb_pd.h"
|
||||
@@ -239,7 +238,7 @@ int pd_power_negotiation_allowed(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void IRQ_HANDLER(STM32_IRQ_ADC_COMP)(void)
|
||||
void pd_adc_interrupt(void)
|
||||
{
|
||||
/* cut the power output */
|
||||
pd_power_supply_reset();
|
||||
@@ -248,6 +247,7 @@ void IRQ_HANDLER(STM32_IRQ_ADC_COMP)(void)
|
||||
/* record a special fault, the normal check will record the timeout */
|
||||
fault = FAULT_FAST_OCP;
|
||||
}
|
||||
DECLARE_IRQ(STM32_IRQ_ADC_COMP, pd_adc_interrupt, 1);
|
||||
|
||||
/* ----------------- Vendor Defined Messages ------------------ */
|
||||
int pd_custom_vdm(void *ctxt, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
|
||||
@@ -139,6 +139,8 @@
|
||||
#define STM32_IRQ_DMA2_CHANNEL5 60 /* STM32F100 only */
|
||||
#endif /* CHIP_FAMILY_STM32F0 */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
/* --- USART --- */
|
||||
#define STM32_USART1_BASE 0x40013800
|
||||
#define STM32_USART2_BASE 0x40004400
|
||||
@@ -1261,4 +1263,6 @@ typedef volatile struct stm32_dma_regs stm32_dma_regs_t;
|
||||
#define STM32_BXCAN1_BASE 0x40006400 /* STM32F10x only */
|
||||
#define STM32_BXCAN2_BASE 0x40006800 /* STM32F10x only */
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __CROS_EC_REGISTERS_H */
|
||||
|
||||
@@ -390,7 +390,9 @@ void pd_rx_handler(void)
|
||||
/* trigger the analysis in the task */
|
||||
pd_rx_event();
|
||||
}
|
||||
#ifndef BOARD_ZINGER
|
||||
DECLARE_IRQ(STM32_IRQ_COMP, pd_rx_handler, 1);
|
||||
#endif
|
||||
|
||||
/* --- Startup initialization --- */
|
||||
void *pd_hw_init(void)
|
||||
|
||||
@@ -238,8 +238,14 @@ struct irq_priority {
|
||||
#ifdef CONFIG_COMMON_RUNTIME
|
||||
#include "irq_handler.h"
|
||||
#else
|
||||
#define DECLARE_IRQ(irq, routine, priority)
|
||||
#define IRQ_HANDLER(irqname) CONCAT3(irq_, irqname, _handler)
|
||||
#define IRQ_HANDLER_OPT(irqname) CONCAT3(irq_, irqname, _handler_optional)
|
||||
#define DECLARE_IRQ(irq, routine, priority) \
|
||||
void IRQ_HANDLER_OPT(irq)(void) __attribute__((alias(#routine)));
|
||||
|
||||
/* Include ec.irqlist here for compilation dependency */
|
||||
#define ENABLE_IRQ(x)
|
||||
#include "ec.irqlist"
|
||||
#endif
|
||||
|
||||
#endif /* __CROS_EC_TASK_H */
|
||||
|
||||
Reference in New Issue
Block a user