diff --git a/firmware/baseband/event_m4.cpp b/firmware/application/event_m0.hpp similarity index 62% rename from firmware/baseband/event_m4.cpp rename to firmware/application/event_m0.hpp index 50b0c0b77..f2cb5e41d 100644 --- a/firmware/baseband/event_m4.cpp +++ b/firmware/application/event_m0.hpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. + * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * * This file is part of PortaPack. * @@ -19,12 +19,16 @@ * Boston, MA 02110-1301, USA. */ -#include "event_m4.hpp" +#ifndef __EVENT_M0_H__ +#define __EVENT_M0_H__ -#include "ch.h" +#include "event.hpp" -Thread* thread_event_loop = nullptr; +constexpr auto EVT_MASK_RTC_TICK = EVENT_MASK(0); +constexpr auto EVT_MASK_LCD_FRAME_SYNC = EVENT_MASK(1); +constexpr auto EVT_MASK_SWITCHES = EVENT_MASK(3); +constexpr auto EVT_MASK_ENCODER = EVENT_MASK(4); +constexpr auto EVT_MASK_TOUCH = EVENT_MASK(5); +constexpr auto EVT_MASK_APPLICATION = EVENT_MASK(6); -void events_initialize(Thread* const event_loop_thread) { - thread_event_loop = event_loop_thread; -} +#endif/*__EVENT_M0_H__*/ diff --git a/firmware/application/irq_controls.cpp b/firmware/application/irq_controls.cpp index ddf8f154d..bba6f54d2 100644 --- a/firmware/application/irq_controls.cpp +++ b/firmware/application/irq_controls.cpp @@ -24,7 +24,7 @@ #include "ch.h" #include "hal.h" -#include "event.hpp" +#include "event_m0.hpp" #include "touch.hpp" #include "touch_adc.hpp" diff --git a/firmware/application/irq_lcd_frame.cpp b/firmware/application/irq_lcd_frame.cpp index 65498ad45..6ea2ed2df 100644 --- a/firmware/application/irq_lcd_frame.cpp +++ b/firmware/application/irq_lcd_frame.cpp @@ -21,7 +21,7 @@ #include "irq_lcd_frame.hpp" -#include "event.hpp" +#include "event_m0.hpp" #include "ch.h" #include "hal.h" diff --git a/firmware/application/irq_rtc.cpp b/firmware/application/irq_rtc.cpp index f393d0f45..9a7243201 100644 --- a/firmware/application/irq_rtc.cpp +++ b/firmware/application/irq_rtc.cpp @@ -26,7 +26,7 @@ #include "lpc43xx_cpp.hpp" using namespace lpc43xx; -#include "event.hpp" +#include "event_m0.hpp" void rtc_interrupt_enable() { rtc::interrupt::enable_second_inc(); diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 752da0354..8d8453bd6 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -37,7 +37,7 @@ #include "irq_controls.hpp" #include "irq_rtc.hpp" -#include "event.hpp" +#include "event_m0.hpp" #include "m4_startup.hpp" #include "spi_image.hpp" diff --git a/firmware/baseband/Makefile b/firmware/baseband/Makefile index 1d9ccf516..27608c439 100755 --- a/firmware/baseband/Makefile +++ b/firmware/baseband/Makefile @@ -124,7 +124,7 @@ CSRC = $(PORTSRC) \ # setting. CPPSRC = main.cpp \ message_queue.cpp \ - event_m4.cpp \ + event.cpp \ gpdma.cpp \ baseband_dma.cpp \ portapack_shared_memory.cpp \ diff --git a/firmware/baseband/event_m4.hpp b/firmware/baseband/event_m4.hpp index be113ca89..03277443c 100644 --- a/firmware/baseband/event_m4.hpp +++ b/firmware/baseband/event_m4.hpp @@ -22,25 +22,9 @@ #ifndef __EVENT_M4_H__ #define __EVENT_M4_H__ -#include "ch.h" +#include "event.hpp" constexpr auto EVT_MASK_BASEBAND = EVENT_MASK(0); constexpr auto EVT_MASK_SPECTRUM = EVENT_MASK(1); -void events_initialize(Thread* const event_loop_thread); - -extern Thread* thread_event_loop; - -inline void events_flag(const eventmask_t events) { - if( thread_event_loop ) { - chEvtSignal(thread_event_loop, events); - } -} - -inline void events_flag_isr(const eventmask_t events) { - if( thread_event_loop ) { - chEvtSignalI(thread_event_loop, events); - } -} - #endif/*__EVENT_M4_H__*/ diff --git a/firmware/application/event.cpp b/firmware/common/event.cpp similarity index 93% rename from firmware/application/event.cpp rename to firmware/common/event.cpp index 5133c0c2c..28f1151d1 100644 --- a/firmware/application/event.cpp +++ b/firmware/common/event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. + * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. * * This file is part of PortaPack. * diff --git a/firmware/application/event.hpp b/firmware/common/event.hpp similarity index 76% rename from firmware/application/event.hpp rename to firmware/common/event.hpp index fbf40d0a4..d05a0a325 100644 --- a/firmware/application/event.hpp +++ b/firmware/common/event.hpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. + * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. * * This file is part of PortaPack. * @@ -24,13 +24,6 @@ #include "ch.h" -constexpr auto EVT_MASK_RTC_TICK = EVENT_MASK(0); -constexpr auto EVT_MASK_LCD_FRAME_SYNC = EVENT_MASK(1); -constexpr auto EVT_MASK_SWITCHES = EVENT_MASK(3); -constexpr auto EVT_MASK_ENCODER = EVENT_MASK(4); -constexpr auto EVT_MASK_TOUCH = EVENT_MASK(5); -constexpr auto EVT_MASK_APPLICATION = EVENT_MASK(6); - void events_initialize(Thread* const event_loop_thread); extern Thread* thread_event_loop;