From a54ad9edce697133a024aff096e50f7e4f389d5b Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Sun, 18 Mar 2012 12:22:02 +0100 Subject: digital/beacon: import Zigbit stack (bitcloud) & avr sources --- .../avr/atmega1281/common/include/halDiagnostic.h | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h (limited to 'digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h') diff --git a/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h b/digital/beacon/src/Bitcloud_stack/Components/HAL/avr/atmega1281/common/include/halDiagnostic.h new file mode 100644 index 00000000..53fb0302 --- /dev/null +++ b/digital/beacon/src/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