From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../avr/atmega1281/common/include/halDiagnostic.h | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h (limited to 'digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h') diff --git a/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h b/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h new file mode 100644 index 00000000..53fb0302 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h @@ -0,0 +1,51 @@ +/**************************************************************************//** + \file halDiagnostic.h + + \brief Implementation of diagnostics defines. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 20/05/09 D. Kasyanov - Created + ******************************************************************************/ + +#ifndef _HALDIAGNOSTIC_H +#define _HALDIAGNOSTIC_H + +#include +#include + +#if defined (MEASURE) + #define TCNT5_ACCESS_TIME 8 + #define DEFALUT_TIME_LIMIT 100 + #define TIMER3_COMPA_TIME_LIMIT 150 + #define PHYDISPATCH_RFINT_TIME_LIMIT 210 + + #define BEGIN_MEASURE { \ + uint16_t timeLimit = DEFALUT_TIME_LIMIT; \ + uint16_t start = TCNT5; uint16_t offset; + + #define END_MEASURE(code) offset = (TCNT5 - start - TCNT5_ACCESS_TIME) / (F_CPU/1000000ul); \ + if (HALISR_TIMER3_COMPA_TIME_LIMIT == code) timeLimit = TIMER3_COMPA_TIME_LIMIT; \ + if (HALISR_PHYDISPATCH_RFINT_TIME_LIMIT == code) timeLimit = PHYDISPATCH_RFINT_TIME_LIMIT; \ + if (timeLimit != 0) { \ + if (offset > timeLimit) { \ + TCCR5B = 0; TCNT5 = offset; assert(0,code); \ + } \ + } \ + } + +#else + #define BEGIN_MEASURE + #define END_MEASURE(code) +#endif + + +#endif /* _HALDIAGNOSTIC_H */ + -- cgit v1.2.3