SatCat5
satcat5::sam::ControllerSAMV71 Class Reference

Detailed Description

Microchip SAM V71 implementation of the "InterruptController" API.

Control object for registering interrupt handlers and handling nested calls to atomic_start, atomic_end, etc. Children should implement the specified platform-specific methods.

User should instantiate and configure a global "satcat5::irq::Handler", then pass a pointer to this object. User is responsible for populating interrupt handlers and calling irq_handler with the handler object. In addition, because SatCat does not allow negative IRQ Nums and some IRQ Nums are negative the NVIC_USER_IRQ_OFFSET is applied when creating interrupt handlers. The ControllerSAMV71 will then revert this offset before calling NVIC API functions.

Example instantation:

#include <hal_sam/interrupts.h>
#include <hal_sam/systick_timer.h>
// IRQ Controller
extern satcat5::sam::ControllerSAMV71 irq_controller;
// SysTick Timer
extern satcat5::sam::SysTickTimer systick_timer;
void SysTick_Handler()
{
irq_controller.irq_handler(&systick_timer);
}
int main(...) {
while (1) {satcat5::poll::service();}
}
Microchip SAM V71 implementation of the "InterruptController" API.
void irq_handler(satcat5::irq::Handler *obj)
IRQ Handler.
Microchip SAM V71 implementation of the "TimeRef" API.
Definition: systick_timer.h:23
void service()
Single-pass service loop.
Definition: polling.cc:143

Definition at line 53 of file hal_samv71/interrupts.h.

#include <interrupts.h>

Inheritance diagram for satcat5::sam::ControllerSAMV71:
[legend]
Collaboration diagram for satcat5::sam::ControllerSAMV71:
[legend]

Public Member Functions

 ControllerSAMV71 ()
 Constructor.
 
void irq_start (satcat5::util::TimeRef *timer=0)
 Initialize SAMV71 controller and start SatCat5 interrupts.
 
void irq_handler (satcat5::irq::Handler *obj)
 IRQ Handler.
 
void init (satcat5::util::TimeRef *timer=0)
 Start the interrupt controller. More...
 
void stop ()
 Unregister ALL interrupt handlers. More...
 

Static Public Member Functions

static bool is_initialized ()
 Has init() been called?
 
static bool is_irq_context ()
 Are we currently servicing an interrupt?
 
static bool is_irq_or_locked ()
 Are we currently in a critical-section?
 

Protected Member Functions

void irq_pause () override
 Prevent preemption from "pause" until "resume". More...
 
void irq_resume () override
 Disable hardware interrupts.
 
void irq_register (satcat5::irq::Handler *obj) override
 Re-enable hardware interrupts. More...
 
void irq_unregister (satcat5::irq::Handler *obj) override
 Un-register the callback for an interrupt handler. More...
 
void irq_acknowledge (satcat5::irq::Handler *obj) override
 Post-handler acknowledgement, notification, and cleanup. More...
 

Static Protected Member Functions

static void interrupt_static (satcat5::irq::Handler *obj)
 Static interrupt service routine. More...
 

Member Function Documentation

◆ init()

void satcat5::irq::Controller::init ( satcat5::util::TimeRef timer = 0)
inherited

Start the interrupt controller.

Link all registered irq::Handler objects (see below). The timer argument is optional but allows collection of statistics about time spent in each interrupt handler. If none is provided, statistics use SATCAT5_CLOCK. The platform-specific implementation MUST call this function exactly once, when it is ready to begin servicing interrupts.

Definition at line 83 of file satcat5/interrupts.cc.

◆ interrupt_static()

void satcat5::irq::Controller::interrupt_static ( satcat5::irq::Handler obj)
staticprotectedinherited

Static interrupt service routine.

Child MUST call this method whenever an interrupt occurs.

Definition at line 125 of file satcat5/interrupts.cc.

◆ irq_acknowledge()

void ControllerSAMV71::irq_acknowledge ( satcat5::irq::Handler obj)
overrideprotectedvirtual

Post-handler acknowledgement, notification, and cleanup.

Child SHOULD override this method if such action is required.

Reimplemented from satcat5::irq::Controller.

Definition at line 68 of file hal_samv71/interrupts.cc.

◆ irq_pause()

void ControllerSAMV71::irq_pause ( )
overrideprotectedvirtual

Prevent preemption from "pause" until "resume".

May be implemented by mutex, disabling interrupts, etc. Child MUST override these two methods.

Implements satcat5::irq::Controller.

Definition at line 39 of file hal_samv71/interrupts.cc.

◆ irq_register()

void ControllerSAMV71::irq_register ( satcat5::irq::Handler obj)
overrideprotectedvirtual

Re-enable hardware interrupts.

Register the callback for an interrupt-handler. Child MUST override this method.

Implements satcat5::irq::Controller.

Definition at line 49 of file hal_samv71/interrupts.cc.

◆ irq_unregister()

void ControllerSAMV71::irq_unregister ( satcat5::irq::Handler obj)
overrideprotectedvirtual

Un-register the callback for an interrupt handler.

Child MUST override this method.

Implements satcat5::irq::Controller.

Definition at line 60 of file hal_samv71/interrupts.cc.

◆ stop()

void satcat5::irq::Controller::stop ( )
inherited

Unregister ALL interrupt handlers.

(For safety, this must be called before the destructor, since cleanup may require the use of various virtual methods.)

Definition at line 65 of file satcat5/interrupts.cc.


The documentation for this class was generated from the following files: