github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/interrupt/interrupt_sifive.go (about)

     1  //go:build sifive
     2  
     3  package interrupt
     4  
     5  import "device/sifive"
     6  
     7  // Enable enables this interrupt. Right after calling this function, the
     8  // interrupt may be invoked if it was already pending.
     9  func (irq Interrupt) Enable() {
    10  	sifive.PLIC.ENABLE[irq.num/32].SetBits(1 << (uint(irq.num) % 32))
    11  }
    12  
    13  // SetPriority sets the interrupt priority for this interrupt. A higher priority
    14  // number means a higher priority (unlike Cortex-M). Priority 0 effectively
    15  // disables the interrupt.
    16  func (irq Interrupt) SetPriority(priority uint8) {
    17  	sifive.PLIC.PRIORITY[irq.num].Set(uint32(priority))
    18  }