Microchip® Advanced Software Framework

classb_freq.h File Reference

Settings and definitions for the CPU frequency test.

Application note:
AVR1610: Guide to IEC60730 Class B compliance with XMEGA

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

#include <asf.h>
#include "classb_rtc_common.h"
#include "error_handler.h"

Macros

#define CLASSB_TC_COUNT_REF
 TC count reference. More...
 
#define CLASSB_TC_FREQ   (uint32_t)(F_CPU / CLASSB_TC_PRESCALER)
 TC frequency. More...
 
#define CLASSB_TC_MAX_DIFF
 Maximum absolute difference between reference and estimated frequency. More...
 
#define CLASSB_TC_MAX_OVF_COUNT
 TC maximum number of overflows. More...
 
#define CLASSB_TC_MOD   D1
 TC module selection. More...
 
#define CLASSB_TC_PER   0xFFFF
 TC period. More...
 
#define CLASSB_TC_PRESCALER   64
 TC prescaler. More...
 
#define CLASSB_TC_PRESCALER_gc   LABEL(TC_CLKSEL_DIV, CLASSB_TC_PRESCALER, _gc)
 Label for the TC prescaler group configuration. More...
 
#define CLASSB_TC_TOLERANCE   25UL
 Tolerance for the CPU frequency deviation. More...
 
#define CLASSB_TEST_TC   LABEL(TC, CLASSB_TC_MOD,)
 Label for the TC module. More...
 
#define CLASSB_TEST_TC_OVF_vect   LABEL(TC, CLASSB_TC_MOD, _OVF_vect)
 Label for the overflow interrupt vector for the chosen TC. More...
 
#define F_CPU   <value>
 The system frequency. More...
 
Internal string manipulation macros
#define STRINGIZE_AUX(X)   #X
 
#define STRINGIZE(X)   STRINGIZE_AUX(X)
 
#define CONCAT3(X, Y, Z)   X##Y##Z
 
#define LABEL(X, Y, Z)   CONCAT3(X,Y,Z)
 

Functions

void classb_freq_callback (void)
 Callback function for the RTC interrupt. More...
 
void classb_freq_setup_timer (void)
 Set up the TC for use in the frequency test. More...
 
void classb_freq_tc_callback (void)
 TC overflow interrupt. More...
 

#define CONCAT3 (   X,
  Y,
 
)    X##Y##Z
#define LABEL (   X,
  Y,
 
)    CONCAT3(X,Y,Z)
#define STRINGIZE (   X)    STRINGIZE_AUX(X)
#define STRINGIZE_AUX (   X)    #X