Microchip® Advanced Software Framework

hw_timer.c File Reference

Copyright (c) 2014-2018 Microchip Technology Inc.

and its subsidiaries.

#include <compiler.h>
#include <parts.h>
#include "tc.h"
#include "hw_timer.h"
#include "sysclk.h"
#include "common_hw_timer.h"
#include "conf_hw_timer.h"

Functions

static void configure_irq_handler (void)
 to register the timer callback with the corresponding handler ID More...
 
void restore_cpu_interrupt (uint8_t flags)
 to restore saved interrupt status More...
 
uint8_t save_cpu_interrupt (void)
 to save current interrupt status More...
 
static void tc0_callback (void)
 
static void tc1_callback (void)
 
void tmr_disable_cc_interrupt (void)
 to disable compare interrupt More...
 
void tmr_disable_ovf_interrupt (void)
 to disable overflow interrupt More...
 
void tmr_enable_cc_interrupt (void)
 to enable compare interrupt More...
 
void tmr_enable_ovf_interrupt (void)
 to enable overflow interrupt More...
 
uint8_t tmr_init (void)
 to initialiaze hw timer More...
 
uint16_t tmr_read_count (void)
 read the actual timer count from register More...
 
void tmr_stop (void)
 to stop the running timer More...
 
void tmr_write_cmpreg (uint16_t compare_value)
 to load compare value in channel compare register More...
 

Variables

static tc_interrupt_t tc_interrupt
 
uint8_t timer_multiplier
 
tmr_callback_t tmr_callback
 

static void configure_irq_handler ( void  )
static

to register the timer callback with the corresponding handler ID

References irq_register_handler, tc0_callback(), tc1_callback(), and TIMER.

Referenced by tmr_init().

void restore_cpu_interrupt ( uint8_t  flags)

to restore saved interrupt status

Parameters
savedinterrupt status

References cpu_irq_restore().

uint8_t save_cpu_interrupt ( void  )

to save current interrupt status

References cpu_irq_save().

static void tc0_callback ( void  )
static
static void tc1_callback ( void  )
static
void tmr_disable_cc_interrupt ( void  )

to disable compare interrupt

References tc_interrupt_t::cpcs, tc_configure_interrupts(), and TIMER.

Referenced by tmr_init().

void tmr_disable_ovf_interrupt ( void  )

to disable overflow interrupt

References tc_interrupt_t::covfs, tc_configure_interrupts(), and TIMER.

void tmr_enable_cc_interrupt ( void  )

to enable compare interrupt

References tc_interrupt_t::cpcs, tc_configure_interrupts(), tc_read_sr(), and TIMER.

void tmr_enable_ovf_interrupt ( void  )

to enable overflow interrupt

References tc_interrupt_t::covfs, tc_configure_interrupts(), tc_read_sr(), and TIMER.

Referenced by tmr_init().

uint16_t tmr_read_count ( void  )

read the actual timer count from register

References tc_read_tc(), and TIMER.

void tmr_stop ( void  )

to stop the running timer

References tc_stop(), and TIMER.

void tmr_write_cmpreg ( uint16_t  compare_value)

to load compare value in channel compare register

References tc_write_rc(), and TIMER.

tc_interrupt_t tc_interrupt
static
Initial value:
= {
.etrgs = 0,
.ldrbs = 0,
.ldras = 0,
.cpcs = 0,
.cpbs = 0,
.cpas = 0,
.lovrs = 0,
.covfs = 0
}

Referenced by init_timer(), and tc_init().

uint8_t timer_multiplier

Referenced by tmr_init().

tmr_callback_t tmr_callback