Microchip® Advanced Software Framework

sercom_interrupt.c File Reference

SAM Serial Peripheral Interface Driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include "sercom_interrupt.h"

Macros

#define _SERCOM_INTERRUPT_HANDLER(n, unused)
 
#define _SERCOM_INTERRUPT_VECT_NUM(n, unused)   SYSTEM_INTERRUPT_MODULE_SERCOM##n,
 

Functions

static void _sercom_default_handler (const uint8_t instance)
 
enum system_interrupt_vector _sercom_get_interrupt_vector (Sercom *const sercom_instance)
 
void _sercom_set_handler (const uint8_t instance, const sercom_handler_t interrupt_handler)
 

Variables

static bool _handler_table_initialized = false
 Save status of initialized handlers. More...
 
void * _sercom_instances [SERCOM_INST_NUM]
 
static void(* _sercom_interrupt_handlers [SERCOM_INST_NUM])(const uint8_t instance)
 Void pointers for saving device instance structures. More...
 

#define _SERCOM_INTERRUPT_HANDLER (   n,
  unused 
)
Value:
void SERCOM##n##_Handler(void) \
{ \
}
static void(* _sercom_interrupt_handlers[SERCOM_INST_NUM])(const uint8_t instance)
Void pointers for saving device instance structures.
Definition: sercom_interrupt.c:44
static struct uip_ds6_notification n
Definition: simple-rpl.c:48

Generates a SERCOM interrupt handler function for a given SERCOM index.

#define _SERCOM_INTERRUPT_VECT_NUM (   n,
  unused 
)    SYSTEM_INTERRUPT_MODULE_SERCOM##n,

Converts a given SERCOM index to its interrupt vector index.

Referenced by _sercom_get_interrupt_vector().

static void _sercom_default_handler ( const uint8_t  instance)
static

Default interrupt handler.

Parameters
[in]instanceSERCOM instance used.

References Assert.

Referenced by _sercom_set_handler().

enum system_interrupt_vector _sercom_get_interrupt_vector ( Sercom *const  sercom_instance)

Returns the system interrupt vector.

Parameters
[in]sercom_instanceInstance pointer
Returns
Enum of system interrupt vector
Return values
SYSTEM_INTERRUPT_MODULE_SERCOM0
SYSTEM_INTERRUPT_MODULE_SERCOM1
SYSTEM_INTERRUPT_MODULE_SERCOM2
SYSTEM_INTERRUPT_MODULE_SERCOM3
SYSTEM_INTERRUPT_MODULE_SERCOM4
SYSTEM_INTERRUPT_MODULE_SERCOM5
SYSTEM_INTERRUPT_MODULE_SERCOM6
SYSTEM_INTERRUPT_MODULE_SERCOM7

References _sercom_get_sercom_inst_index(), _SERCOM_INTERRUPT_VECT_NUM, and MREPEAT.

Referenced by dbg_init(), i2c_master_disable(), i2c_master_enable(), i2c_master_reset(), i2c_slave_disable(), i2c_slave_enable(), i2c_slave_reset(), spi_disable(), spi_enable(), spi_master_vec_disable(), spi_master_vec_enable(), usart_disable(), and usart_enable().

void _sercom_set_handler ( const uint8_t  instance,
const sercom_handler_t  interrupt_handler 
)

Saves the given callback handler.

Parameters
[in]instanceInstance index.
[in]interrupt_handlerPointer to instance callback handler.

References _handler_table_initialized, _sercom_default_handler(), _sercom_instances, _sercom_interrupt_handlers, i, and NULL.

Referenced by cdc_rx_init(), dbg_init(), i2c_master_init(), i2c_slave_init(), spi_init(), spi_master_vec_init(), and usart_init().

bool _handler_table_initialized = false
static

Save status of initialized handlers.

Referenced by _sercom_set_handler().

void(* _sercom_interrupt_handlers[SERCOM_INST_NUM])(const uint8_t instance)
static

Void pointers for saving device instance structures.

Referenced by _sercom_set_handler().