irqhandler.cpp: mask/unmask added

This commit is contained in:
Verkehrsrot committed 2019-03-24 16:15:29 +01:00
1 parent 9931591a1f
commit c84063aa6d
2 files changed
+14 -2

No files matched your search

+3
View File
@@ -6,6 +6,9 @@
#define SENDCYCLE_IRQ 0x04
#define CYCLIC_IRQ 0x08
#define TIMESYNC_IRQ 0x10
#define MASK_IRQ 0x20
#define UNMASK_IRQ 0x40
#define RESERVED_IRQ 0x80
#include "globals.h"
#include "cyclic.h"
+11 -2
View File
@@ -3,14 +3,13 @@
// Local logging tag
static const char TAG[] = __FILE__;
static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
// irq handler task, handles all our application level interrupts
void irqHandler(void *pvParameters) {
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check
uint32_t InterruptStatus;
static bool mask_irq = false;
// task remains in blocked state until it is notified by an irq
for (;;) {
@@ -19,6 +18,16 @@ void irqHandler(void *pvParameters) {
&InterruptStatus, // Receives the notification value
portMAX_DELAY); // wait forever
// interrupt handler to be enabled?
if (InterruptStatus & UNMASK_IRQ)
mask_irq = false;
else if (mask_irq)
continue; // suppress processing if interrupt handler is disabled
// interrupt handler to be disabled?
if (InterruptStatus & MASK_IRQ)
mask_irq = true;
// button pressed?
#ifdef HAS_BUTTON
if (InterruptStatus & BUTTON_IRQ)