irqhandler.cpp: mask/unmask added
This commit is contained in:
		
							parent
							
								
									9931591a1f
								
							
						
					
					
						commit
						c84063aa6d
					
				| @ -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" | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user