Run baseband image per application.

First step toward having separate baseband images per app or function.
This commit is contained in:
Jared Boone 2016-06-24 11:30:54 -07:00
parent ac0bdc35a6
commit 303bfeaafc
8 changed files with 31 additions and 9 deletions

View File

@ -286,6 +286,8 @@ void AISRecentEntryDetailView::set_entry(const AISRecentEntry& entry) {
} }
AISAppView::AISAppView(NavigationView&) { AISAppView::AISAppView(NavigationView&) {
baseband::run_image(portapack::spi_flash::baseband);
add_children({ { add_children({ {
&label_channel, &label_channel,
&options_channel, &options_channel,
@ -333,6 +335,8 @@ AISAppView::AISAppView(NavigationView&) {
AISAppView::~AISAppView() { AISAppView::~AISAppView() {
baseband::stop(); baseband::stop();
radio::disable(); radio::disable();
baseband::shutdown();
} }
void AISAppView::focus() { void AISAppView::focus() {

View File

@ -21,6 +21,8 @@
#include "analog_audio_app.hpp" #include "analog_audio_app.hpp"
#include "baseband_api.hpp"
#include "portapack.hpp" #include "portapack.hpp"
#include "portapack_persistent_memory.hpp" #include "portapack_persistent_memory.hpp"
using namespace portapack; using namespace portapack;
@ -77,6 +79,8 @@ NBFMOptionsView::NBFMOptionsView(
AnalogAudioView::AnalogAudioView( AnalogAudioView::AnalogAudioView(
NavigationView& nav NavigationView& nav
) { ) {
baseband::run_image(portapack::spi_flash::baseband);
add_children({ { add_children({ {
&rssi, &rssi,
&channel, &channel,
@ -145,6 +149,8 @@ AnalogAudioView::~AnalogAudioView() {
audio::output::stop(); audio::output::stop();
receiver_model.disable(); receiver_model.disable();
baseband::shutdown();
} }
void AnalogAudioView::on_hide() { void AnalogAudioView::on_hide() {

View File

@ -26,6 +26,8 @@
#include "portapack_shared_memory.hpp" #include "portapack_shared_memory.hpp"
#include "core_control.hpp"
namespace baseband { namespace baseband {
void AMConfig::apply() const { void AMConfig::apply() const {
@ -81,6 +83,10 @@ void stop() {
); );
} }
void run_image(const portapack::spi_flash::region_t image_region) {
m4_init(image_region, portapack::memory::map::m4_code);
}
void shutdown() { void shutdown() {
ShutdownMessage shutdown_message; ShutdownMessage shutdown_message;
shared_memory.baseband_queue.push(shutdown_message); shared_memory.baseband_queue.push(shutdown_message);

View File

@ -26,6 +26,8 @@
#include "dsp_fir_taps.hpp" #include "dsp_fir_taps.hpp"
#include "spi_image.hpp"
#include <cstddef> #include <cstddef>
namespace baseband { namespace baseband {
@ -53,6 +55,7 @@ struct WFMConfig {
void start(BasebandConfiguration configuration); void start(BasebandConfiguration configuration);
void stop(); void stop();
void run_image(const portapack::spi_flash::region_t image_region);
void shutdown(); void shutdown();
void spectrum_streaming_start(); void spectrum_streaming_start();

View File

@ -32,6 +32,8 @@ using namespace portapack;
namespace ui { namespace ui {
CaptureAppView::CaptureAppView(NavigationView& nav) { CaptureAppView::CaptureAppView(NavigationView& nav) {
baseband::run_image(portapack::spi_flash::baseband);
add_children({ { add_children({ {
&rssi, &rssi,
&channel, &channel,
@ -83,6 +85,8 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
CaptureAppView::~CaptureAppView() { CaptureAppView::~CaptureAppView() {
baseband::stop(); baseband::stop();
radio::disable(); radio::disable();
baseband::shutdown();
} }
void CaptureAppView::on_hide() { void CaptureAppView::on_hide() {

View File

@ -121,6 +121,8 @@ void RecentEntriesView<ERTRecentEntries>::draw(
} }
ERTAppView::ERTAppView(NavigationView&) { ERTAppView::ERTAppView(NavigationView&) {
baseband::run_image(portapack::spi_flash::baseband);
add_children({ { add_children({ {
&recent_entries_view, &recent_entries_view,
} }); } });
@ -149,6 +151,8 @@ ERTAppView::ERTAppView(NavigationView&) {
ERTAppView::~ERTAppView() { ERTAppView::~ERTAppView() {
baseband::stop(); baseband::stop();
radio::disable(); radio::disable();
baseband::shutdown();
} }
void ERTAppView::focus() { void ERTAppView::focus() {

View File

@ -59,13 +59,6 @@ static void event_loop() {
}; };
EventDispatcher event_dispatcher { &system_view, context }; EventDispatcher event_dispatcher { &system_view, context };
MessageHandlerRegistration message_handler_shutdown {
Message::ID::Shutdown,
[&event_dispatcher](const Message* const) {
event_dispatcher.request_stop();
}
};
MessageHandlerRegistration message_handler_display_sleep { MessageHandlerRegistration message_handler_display_sleep {
Message::ID::DisplaySleep, Message::ID::DisplaySleep,
[&event_dispatcher](const Message* const) { [&event_dispatcher](const Message* const) {
@ -88,8 +81,6 @@ int main(void) {
sdcStart(&SDCD1, nullptr); sdcStart(&SDCD1, nullptr);
m4_init(portapack::spi_flash::baseband, portapack::memory::map::m4_code);
controls_init(); controls_init();
lcd_frame_sync_configure(); lcd_frame_sync_configure();
rtc_interrupt_enable(); rtc_interrupt_enable();

View File

@ -164,6 +164,8 @@ void RecentEntriesView<TPMSRecentEntries>::draw(
} }
TPMSAppView::TPMSAppView(NavigationView&) { TPMSAppView::TPMSAppView(NavigationView&) {
baseband::run_image(portapack::spi_flash::baseband);
add_children({ { add_children({ {
&rssi, &rssi,
&channel, &channel,
@ -205,6 +207,8 @@ TPMSAppView::TPMSAppView(NavigationView&) {
TPMSAppView::~TPMSAppView() { TPMSAppView::~TPMSAppView() {
baseband::stop(); baseband::stop();
radio::disable(); radio::disable();
baseband::shutdown();
} }
void TPMSAppView::focus() { void TPMSAppView::focus() {