Microchip® Advanced Software Framework

tc_interrupt.h File Reference

SAM TC - Timer Counter Callback Driver.

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

#include "tc.h"
#include <system_interrupt.h>

Functions

Callback Management

{@

enum status_code tc_register_callback (struct tc_module *const module, tc_callback_t callback_func, const enum tc_callback callback_type)
 Registers a callback. More...
 
enum status_code tc_unregister_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Unregisters a callback. More...
 
static void tc_enable_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Enables callback. More...
 
static void tc_disable_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Disables callback. More...
 

static void tc_disable_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)
inlinestatic

Disables callback.

Disables the callback function registered by the tc_register_callback, and the callback will not be called from the interrupt routine. The function will also disable the appropriate interrupts.

Parameters
[in]modulePointer to TC software instance struct
[in]callback_typeCallback type given by an enum

References Assert, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

Referenced by hw_timer_stop(), HwTimerStopCompare(), run_callback_test(), vPortSuppressTicksAndSleep(), xosc32k_fail_callback(), and xosc32k_ok_callback().

static void tc_enable_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)
inlinestatic

Enables callback.

Enables the callback function registered by the tc_register_callback. The callback function will be called from the interrupt handler when the conditions for the callback type are met. This function will also enable the appropriate interrupts.

Parameters
[in]modulePointer to TC software instance struct
[in]callback_typeCallback type given by an enum

References _tc_get_inst_index(), Assert, system_interrupt_enable(), TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

Referenced by adp_example_tc_configure_callback(), configure_tc_callbacks(), hw_timer_start_ms(), HwTimerSetCompare(), HwTimerSetOverflowCallback(), init_xosc32k_fail_detector(), platform_create_hw_timer(), run_16bit_capture_and_compare_test(), run_callback_test(), vPortSetupTimerInterrupt(), vPortSuppressTicksAndSleep(), xosc32k_fail_callback(), and xosc32k_ok_callback().

enum status_code tc_register_callback ( struct tc_module *const  module,
tc_callback_t  callback_func,
const enum tc_callback  callback_type 
)

Registers a callback.

Registers a callback function which is implemented by the user.

Note
The callback must be enabled by tc_enable_callback, in order for the interrupt handler to call it when the conditions for the callback type is met.
Parameters
[in]modulePointer to TC software instance struct
[in]callback_funcPointer to callback function
[in]callback_typeCallback type given by an enum

References Assert, STATUS_OK, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

Referenced by adp_example_tc_configure_callback(), configure_tc_callbacks(), hw_timer_init(), HwTimerSetCompareCallback(), HwTimerSetOverflowCallback(), init_xosc32k_fail_detector(), platform_create_hw_timer(), run_16bit_capture_and_compare_test(), run_callback_test(), vPortSetupTimerInterrupt(), and vPortSuppressTicksAndSleep().

enum status_code tc_unregister_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)

Unregisters a callback.

Unregisters a callback function implemented by the user. The callback should be disabled before it is unregistered.

Parameters
[in]modulePointer to TC software instance struct
[in]callback_typeCallback type given by an enum

References Assert, NULL, STATUS_OK, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

Referenced by vPortSuppressTicksAndSleep().