Blame view

RIOT/core/include/arch/irq_arch.h 1.89 KB
fb11e647   vrobic   reseau statique a...
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
  /*
   * Copyright (C) 2014 Freie Universitรคt Berlin
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   */
  
  /**
   * @ingroup     core_arch
   * @{
   *
   * @file
   * @brief       Interrupt handling interface for globally en- and disabling interrupts
   *
   * This file acts as a wrapper between the kernels interrupt interface and the architecture
   * dependent implementation of the interfaces.
   *
   * @note All functions in this module have to be implemented in a way that it
   *       is safe to call them from within the context of an ISR.
   *
   * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
   */
  
  #ifndef IRQ_ARCH_H
  #define IRQ_ARCH_H
  
  #ifdef __cplusplus
   extern "C" {
  #endif
  
  /**
   * @name Define mapping between kernel internal and arch interfaces
   *
   * This mapping is done for compatibility of existing platforms,
   * new platforms should always use the *_arch_* interfaces.
   * @{
   */
  #ifdef COREIF_NG
  #define irq_enable      irq_arch_enable
  #define irq_disable     irq_arch_disable
  #define irq_restore     irq_arch_restore
  #define irq_is_in       irq_arch_in
  #endif
  /** @} */
  
  /**
   * @brief Globally enable maskable interrupt sources
   *
   * @return              the IRQ state after enabling interrupts
   */
  unsigned int irq_arch_enable(void);
  
  /**
   * @brief Globally disable all maskable interrupt sources
   *
   * @return              the IRQ state before disabling interrupts
   */
  unsigned int irq_arch_disable(void);
  
  
  /**
   * @brief Restore a previously recorded IRQ state
   *
   * @param[in] state     the state to set the IRQ flags to
   */
  void irq_arch_restore(unsigned int state);
  
  /**
   * @brief See if the current context is inside an ISR
   *
   * @return              1 if currently in interrupt context, 0 otherwise
   */
  int irq_arch_in(void);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* IRQ_ARCH_H */
  /** @} */