blob: 2894944a0d01e818fb9e88264efdf56bf3b610bc [file] [log] [blame]
Kévin Redon69b92d92019-01-24 16:39:20 +01001/**
2 * \file
3 *
4 * \brief IRQ related functionality declaration.
5 *
6 * Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Subject to your compliance with these terms, you may use Microchip
13 * software and any derivatives exclusively with Microchip products.
14 * It is your responsibility to comply with third party license terms applicable
15 * to your use of third party software (including open source software) that
16 * may accompany Microchip software.
17 *
18 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 *
30 * \asf_license_stop
31 *
32 */
33
34#ifndef _HPL_IRQ_H_INCLUDED
35#define _HPL_IRQ_H_INCLUDED
36
37/**
38 * \addtogroup HPL IRQ
39 *
40 * \section hpl_irq_rev Revision History
41 * - v1.0.0 Initial Release
42 *
43 *@{
44 */
45
46#include <compiler.h>
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/**
53 * \brief IRQ descriptor
54 */
55struct _irq_descriptor {
56 void (*handler)(void *parameter);
57 void *parameter;
58};
59
60/**
61 * \name HPL functions
62 */
63//@{
64/**
65 * \brief Retrieve current IRQ number
66 *
67 * \return The current IRQ number
68 */
69uint8_t _irq_get_current(void);
70
71/**
72 * \brief Disable the given IRQ
73 *
74 * \param[in] n The number of IRQ to disable
75 */
76void _irq_disable(uint8_t n);
77
78/**
79 * \brief Set the given IRQ
80 *
81 * \param[in] n The number of IRQ to set
82 */
83void _irq_set(uint8_t n);
84
85/**
86 * \brief Clear the given IRQ
87 *
88 * \param[in] n The number of IRQ to clear
89 */
90void _irq_clear(uint8_t n);
91
92/**
93 * \brief Enable the given IRQ
94 *
95 * \param[in] n The number of IRQ to enable
96 */
97void _irq_enable(uint8_t n);
98
99/**
100 * \brief Register IRQ handler
101 *
102 * \param[in] number The number registered IRQ
103 * \param[in] irq The pointer to irq handler to register
104 *
105 * \return The status of IRQ handler registering
106 * \retval -1 Passed parameters were invalid
107 * \retval 0 The registering is completed successfully
108 */
109void _irq_register(const uint8_t number, struct _irq_descriptor *const irq);
110//@}
111
112#ifdef __cplusplus
113}
114#endif
115/**@}*/
116#endif /* _HPL_IRQ_H_INCLUDED */