mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-29 17:49:14 -04:00
Add Shutdown message, plumbing to send and handle.
This commit is contained in:
parent
15791e345d
commit
690c3c98db
7 changed files with 58 additions and 11 deletions
|
@ -776,6 +776,10 @@ static void m0apptxevent_interrupt_enable() {
|
|||
nvicEnableVector(M0CORE_IRQn, CORTEX_PRIORITY_MASK(LPC43XX_M0APPTXEVENT_IRQ_PRIORITY));
|
||||
}
|
||||
|
||||
static void m0apptxevent_interrupt_disable() {
|
||||
nvicDisableVector(M0CORE_IRQn);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
CH_IRQ_HANDLER(MAPP_IRQHandler) {
|
||||
|
@ -792,6 +796,18 @@ CH_IRQ_HANDLER(MAPP_IRQHandler) {
|
|||
|
||||
}
|
||||
|
||||
static void shutdown() {
|
||||
// TODO: Is this complete?
|
||||
|
||||
nvicDisableVector(DMA_IRQn);
|
||||
|
||||
m0apptxevent_interrupt_disable();
|
||||
|
||||
chSysDisable();
|
||||
|
||||
systick_stop();
|
||||
}
|
||||
|
||||
static constexpr auto direction = baseband::Direction::Receive;
|
||||
|
||||
int main(void) {
|
||||
|
@ -849,6 +865,12 @@ int main(void) {
|
|||
}
|
||||
);
|
||||
|
||||
message_handlers.register_handler(Message::ID::Shutdown,
|
||||
[&event_dispatcher](const Message* const) {
|
||||
event_dispatcher.request_stop();
|
||||
}
|
||||
);
|
||||
|
||||
/* TODO: Ensure DMAs are configured to point at first LLI in chain. */
|
||||
|
||||
if( direction == baseband::Direction::Receive ) {
|
||||
|
@ -868,5 +890,10 @@ int main(void) {
|
|||
|
||||
event_dispatcher.run();
|
||||
|
||||
shutdown();
|
||||
|
||||
ShutdownMessage shutdown_message;
|
||||
shared_memory.application_queue.push(shutdown_message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue