NetBurner 3.5.6
PDF Version
Interrupt Macro: MOD5441x,NANO54415, SB800EX

Topics

 ColdFire Exception and Interrupt Vectors
 Vector offset definitions for predefined ColdFire exception and interrupt vectors.
 

Functions

uint16_t GetSR_IntLevel ()
 Get the current interrupt mask level from the Status Register (SR).
 
void SetSR_IntLevel (uint16_t sv)
 Set the interrupt mask level in the Status Register (SR).
 

Detailed Description

Function Documentation

◆ GetSR_IntLevel()

uint16_t GetSR_IntLevel ( )

#include <cfinter.h>

Get the current interrupt mask level from the Status Register (SR).

Retrieves the interrupt priority mask from bits 8-10 of the ColdFire Status Register. The interrupt mask determines which interrupt priority levels are currently blocked. Only interrupts with priority higher than the current mask level can be serviced.

The returned value represents the interrupt mask level:

  • 0x0000 (0): All interrupts enabled (no masking)
  • 0x0100 (1): Block priority 1 and lower
  • 0x0200 (2): Block priority 2 and lower
  • 0x0300 (3): Block priority 3 and lower
  • 0x0400 (4): Block priority 4 and lower
  • 0x0500 (5): Block priority 5 and lower
  • 0x0600 (6): Block priority 6 and lower
  • 0x0700 (7): All interrupts masked (except level 7 NMI)
Returns
Current interrupt mask level from SR register (bits 8-10), formatted as 0x0X00 where X is the priority level (0-7).
See also
SetSR_IntLevel()

Expand for Example Usage

Examples

Example 1: Reading and displaying current interrupt mask level
void DisplayInterruptStatus() {
uint16_t currentLevel = GetSR_IntLevel();
printf("Current interrupt mask level: 0x%04X\r\n", currentLevel);
// Extract just the level bits
uint8_t level = (currentLevel >> 8) & 0x07;
printf("Masking interrupts at priority %u and below\r\n", level);
if (level == 0) {
printf("All interrupts enabled\r\n");
} else if (level == 7) {
printf("All maskable interrupts disabled\r\n");
} else {
printf("Interrupts %u and lower are masked\r\n", level);
}
}
uint16_t GetSR_IntLevel()
Get the current interrupt mask level from the Status Register (SR).

◆ SetSR_IntLevel()

void SetSR_IntLevel ( uint16_t sv)

#include <cfinter.h>

Set the interrupt mask level in the Status Register (SR).

Sets the interrupt priority mask in bits 8-10 of the ColdFire Status Register. The interrupt mask controls which interrupt priority levels are blocked. Only interrupts with priority strictly higher than the mask level can be serviced.

Valid interrupt mask values:

  • 0x0000 (0): Enable all interrupts (no masking)
  • 0x0100 (1): Block priority 1, allow 2-7
  • 0x0200 (2): Block priority 1-2, allow 3-7
  • 0x0300 (3): Block priority 1-3, allow 4-7
  • 0x0400 (4): Block priority 1-4, allow 5-7
  • 0x0500 (5): Block priority 1-5, allow 6-7
  • 0x0600 (6): Block priority 1-6, allow 7 only
  • 0x0700 (7): Block all maskable interrupts (only level 7 NMI allowed)
Parameters
svThe interrupt mask level to set, formatted as 0x0X00 where X is the priority level (0-7). Only bits 8-10 are used; other bits in the SR are preserved.
Note
Setting the mask to 0x0700 disables all maskable interrupts. Use with caution as this can affect RTOS operation and real-time responsiveness.
Level 7 interrupts (NMI) cannot be masked and will always be serviced.
Warning
Improper use of this function can cause:
  • Missed real-time deadlines
  • RTOS scheduler dysfunction
  • System deadlock if interrupts remain disabled
  • Communication timeouts
Always save the previous interrupt level with GetSR_IntLevel() before modifying it, and restore the saved level when done.
See also
GetSR_IntLevel()

Expand for Example Usage

Examples

Example 1: Selective interrupt masking for priority management
void MediumPriorityWork() {
uint16_t savedLevel = GetSR_IntLevel();
// Block interrupts priority 2 and lower, allow 3+
SetSR_IntLevel(0x0200);
// This work can be interrupted by priority 3+ interrupts
// but not by lower priority interrupts
ProcessMediumPriorityData();
SetSR_IntLevel(savedLevel);
}
void HighPriorityWork() {
uint16_t savedLevel = GetSR_IntLevel();
// Block interrupts priority 5 and lower, allow 6-7
SetSR_IntLevel(0x0500);
// Only highest priority interrupts can preempt this
ProcessHighPriorityData();
SetSR_IntLevel(savedLevel);
}
void SetSR_IntLevel(uint16_t sv)
Set the interrupt mask level in the Status Register (SR).