summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/HAL/avr/common/src/resetReason.c
blob: 0fecaa11fee4048615397e63880ff54fd27d4c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**************************************************************************//**
  \file  halWdtInit.c

  \brief Implementation of the reset reason interface.

  \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:
      5/12/07 A. Khromykh - Created
 ******************************************************************************/
/******************************************************************************
 *   WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK.  *
 *   EXPERT USERS SHOULD PROCEED WITH CAUTION.                                *
 ******************************************************************************/

/******************************************************************************
                   Includes section
******************************************************************************/
#include <resetReason.h>
#include <types.h>
#include <wdtCtrl.h>

/******************************************************************************
                   External variables section
******************************************************************************/
extern uint8_t halResetReason; // contains the reset reason

/******************************************************************************
                   Implementations section
******************************************************************************/
/******************************************************************************
Returns the reset reason.
Parameters:
  none.
Returns:
  The reason of reset.
******************************************************************************/
HAL_ResetReason_t HAL_ReadResetReason(void)
{
  return (HAL_ResetReason_t)halResetReason;
}

/******************************************************************************
Software reset.
******************************************************************************/
void HAL_WarmReset(void)
{

  halResetReason = TEMP_WARM_RESET;
  wdt_enable(0);
  while(1);
}
//eof resetReason.c