diff --git a/firmware/baseband/Makefile b/firmware/baseband/Makefile index ca7ecee3..5695723b 100755 --- a/firmware/baseband/Makefile +++ b/firmware/baseband/Makefile @@ -125,7 +125,6 @@ CSRC = $(PORTSRC) \ CPPSRC = main.cpp \ message_queue.cpp \ event_m4.cpp \ - irq_ipc_m4.cpp \ gpdma.cpp \ baseband_dma.cpp \ portapack_shared_memory.cpp \ diff --git a/firmware/baseband/event_m4.cpp b/firmware/baseband/event_m4.cpp index 50b0c0b7..ca0038e7 100644 --- a/firmware/baseband/event_m4.cpp +++ b/firmware/baseband/event_m4.cpp @@ -21,6 +21,9 @@ #include "event_m4.hpp" +#include "lpc43xx_cpp.hpp" +using namespace lpc43xx; + #include "ch.h" Thread* thread_event_loop = nullptr; @@ -28,3 +31,19 @@ Thread* thread_event_loop = nullptr; void events_initialize(Thread* const event_loop_thread) { thread_event_loop = event_loop_thread; } + +extern "C" { + +CH_IRQ_HANDLER(MAPP_IRQHandler) { + CH_IRQ_PROLOGUE(); + + chSysLockFromIsr(); + events_flag_isr(EVT_MASK_BASEBAND); + chSysUnlockFromIsr(); + + creg::m0apptxevent::clear(); + + CH_IRQ_EPILOGUE(); +} + +} diff --git a/firmware/baseband/irq_ipc_m4.cpp b/firmware/baseband/irq_ipc_m4.cpp deleted file mode 100644 index 07a75335..00000000 --- a/firmware/baseband/irq_ipc_m4.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. - * - * This file is part of PortaPack. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "irq_ipc_m4.hpp" - -#include "ch.h" -#include "hal.h" - -#include "event_m4.hpp" - -#include "lpc43xx_cpp.hpp" -using namespace lpc43xx; - -void m0apptxevent_interrupt_enable() { - nvicEnableVector(M0CORE_IRQn, CORTEX_PRIORITY_MASK(LPC43XX_M0APPTXEVENT_IRQ_PRIORITY)); -} - -void m0apptxevent_interrupt_disable() { - nvicDisableVector(M0CORE_IRQn); -} - -extern "C" { - -CH_IRQ_HANDLER(MAPP_IRQHandler) { - CH_IRQ_PROLOGUE(); - - chSysLockFromIsr(); - events_flag_isr(EVT_MASK_BASEBAND); - chSysUnlockFromIsr(); - - creg::m0apptxevent::clear(); - - CH_IRQ_EPILOGUE(); -} - -} diff --git a/firmware/baseband/irq_ipc_m4.hpp b/firmware/baseband/irq_ipc_m4.hpp deleted file mode 100644 index 61328685..00000000 --- a/firmware/baseband/irq_ipc_m4.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. - * - * This file is part of PortaPack. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __IRQ_IPC_M4_H__ -#define __IRQ_IPC_M4_H__ - -void m0apptxevent_interrupt_enable(); -void m0apptxevent_interrupt_disable(); - -#endif/*__IRQ_IPC_M4_H__*/ diff --git a/firmware/baseband/main.cpp b/firmware/baseband/main.cpp index 3814aa28..fcf9de57 100755 --- a/firmware/baseband/main.cpp +++ b/firmware/baseband/main.cpp @@ -30,8 +30,6 @@ #include "event_m4.hpp" -#include "irq_ipc_m4.hpp" - #include "touch_dma.hpp" #include "baseband_thread.hpp" @@ -123,7 +121,7 @@ class EventDispatcher { public: void run() { events_initialize(chThdSelf()); - m0apptxevent_interrupt_enable(); + lpc43xx::creg::m0apptxevent::enable(); baseband_thread.thread_main = chThdSelf(); baseband_thread.thread_rssi = rssi_thread.start(NORMALPRIO + 10); @@ -134,7 +132,7 @@ public: dispatch(events); } - m0apptxevent_interrupt_disable(); + lpc43xx::creg::m0apptxevent::disable(); } void request_stop() { diff --git a/firmware/common/lpc43xx_cpp.hpp b/firmware/common/lpc43xx_cpp.hpp index abdb0d62..f1578192 100644 --- a/firmware/common/lpc43xx_cpp.hpp +++ b/firmware/common/lpc43xx_cpp.hpp @@ -57,6 +57,16 @@ inline void clear() { namespace m0apptxevent { +#if defined(LPC43XX_M4) +inline void enable() { + nvicEnableVector(M0CORE_IRQn, CORTEX_PRIORITY_MASK(LPC43XX_M0APPTXEVENT_IRQ_PRIORITY)); +} + +inline void disable() { + nvicDisableVector(M0CORE_IRQn); +} +#endif + #if defined(LPC43XX_M0) inline void assert() { __SEV();