SatCat5
satcat5::freertos::ControllerFreeRTOS Class Reference

Detailed Description

FreeRTOS implementation of the "InterruptController" class.

This implementation supports irq_pause and irq_resume via the FreeRTOS portable layer API. This interrupt controller does not override any vector tables, or provide any interrupt handlers for a given processor. It is the responsibility of the user to create the ISR for the processor and call irq_handler, passing the associated SatCat5 irq::Handler object to delegate interrupt processing to SatCat5 logic. It is important to note that you only NEED to do this if leveraging any SatCat HAL peripherals that have integrated ISRs (SAMV71, PFSoC, etc).

The below example demonstrates this using the UsartDmaSAMV71 class provided under "hal_samv71". Since this is targetting a SAM V71 microcontroller, we must define "XDMAC_Handler()" to catch the DMA interrupt. Since UsartDmaSAMV71 has an integrated ISR, we pass in the object to irq_handler to register the ISR callback.

extern satcat5::sam::UsartDmaSAMV71 satcat_uart;
void XDMAC_Handler()
{
irq_controller.irq_handler(&satcat_uart);
}
FreeRTOS implementation of the "InterruptController" class.
void irq_handler(satcat5::irq::Handler *obj)
IRQ Handler method calls Handler::interrupt_static.

The control object registers interrupt handlers and handles nested calls to atomic_start, atomic_end, etc. Children should implement the specified platform-specific methods.

Definition at line 49 of file hal_freertos/interrupts.h.

#include <interrupts.h>

Inheritance diagram for satcat5::freertos::ControllerFreeRTOS:
[legend]
Collaboration diagram for satcat5::freertos::ControllerFreeRTOS:
[legend]

Public Member Functions

 ControllerFreeRTOS ()
 Constructor.
 
void irq_start (satcat5::util::TimeRef *timer=0)
 Initialize FreeRTOS controller and start SatCat5 interrupts.
 
void irq_handler (satcat5::irq::Handler *obj)
 IRQ Handler method calls Handler::interrupt_static.
 
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 satcat5::freertos::ControllerFreeRTOS::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.

◆ irq_pause()

void satcat5::freertos::ControllerFreeRTOS::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.

◆ irq_register()

void satcat5::freertos::ControllerFreeRTOS::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.

◆ irq_unregister()

void satcat5::freertos::ControllerFreeRTOS::irq_unregister ( satcat5::irq::Handler obj)
overrideprotectedvirtual

Un-register the callback for an interrupt handler.

Child MUST override this method.

Implements satcat5::irq::Controller.

◆ 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: