summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halIrq.h
blob: 687447a34b09ae2ac26e2e735592c454a73d9208 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************//**
  \file  halIrq.h

  \brief Declaration of HWD IRQ 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.                                *
 ******************************************************************************/

#ifndef _HALIRQ_H
#define _HALIRQ_H

/******************************************************************************
                   Includes section
******************************************************************************/
#include <types.h>
#include <halTaskManager.h>
#include <irq.h>

/******************************************************************************
                   Define(s) section
******************************************************************************/
#if defined(PLATFORM_ZIGBIT)
  #define MAX_NUM_LINES             2
  #define MIN_VALID_IRQ_NUMBER  IRQ_6
#else
  #define MAX_NUM_LINES             3
  #define MIN_VALID_IRQ_NUMBER  IRQ_5
#endif
/** \brief number valid interrupt. */
#define HAL_NUM_IRQ_LINES       MAX_NUM_LINES
/** \brief first valid interrupt. */
#define HAL_FIRST_VALID_IRQ     MIN_VALID_IRQ_NUMBER

/******************************************************************************
                   Types section
******************************************************************************/
/** \brief user's callback type. */
typedef void (* IrqCallback_t)(void);

/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief Sets configuration of pins and the registers.
\param[in]
  irqNumber - number of interrupt.
\param[in]
  irqMode - mode of interrupt.
******************************************************************************/
void halSetIrqConfig(uint8_t irqNumber, uint8_t irqMode);

/**************************************************************************//**
\brief Clears configuration of pins and the registers.
\param[in]
  irqNumber - number of interrupt.
******************************************************************************/
void halClrIrqConfig(uint8_t irqNumber);

/******************************************************************************
                   Inline static functions section
******************************************************************************/
/**************************************************************************//**
\brief Enables external interrupt
\param[in]
  irqNumber - number of external interrupt.
******************************************************************************/
INLINE void halEnableIrqInterrupt(uint8_t irqNumber)
{
  // Enable external interrupt request
  EIMSK |= (1 << irqNumber);
}

/**************************************************************************//**
\brief Disables external interrupt
\param[in]
  irqNumber - number of external interrupt.
******************************************************************************/
INLINE void halDisableIrqInterrupt(uint8_t irqNumber)
{
  // Disable external interrupt request
  EIMSK &= ~(1 << irqNumber);
}

#endif /* _HALIRQ_H */
//eof halirq.h