Mistake on this page?
Report an issue in GitHub or email us
gpio_irq_api.h
1 
2 /** \addtogroup hal */
3 /** @{*/
4 /* mbed Microcontroller Library
5  * Copyright (c) 2006-2013 ARM Limited
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef MBED_GPIO_IRQ_API_H
21 #define MBED_GPIO_IRQ_API_H
22 
23 #include "device.h"
24 #include "pinmap.h"
25 
26 #if DEVICE_INTERRUPTIN
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /** GPIO IRQ events
33  */
34 typedef enum {
35  IRQ_NONE,
36  IRQ_RISE,
37  IRQ_FALL
39 
40 /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL
41  */
42 typedef struct gpio_irq_s gpio_irq_t;
43 
44 typedef void (*gpio_irq_handler)(uintptr_t context, gpio_irq_event event);
45 
46 /**
47  * \defgroup hal_gpioirq GPIO IRQ HAL functions
48  *
49  * # Defined behavior
50  * * ::gpio_irq_init initializes the GPIO IRQ pin
51  * * ::gpio_irq_init attaches the interrupt handler
52  * * ::gpio_irq_free releases the GPIO IRQ pin
53  * * ::gpio_irq_set enables/disables pin IRQ event
54  * * ::gpio_irq_enable enables GPIO IRQ
55  * * ::gpio_irq_disable disables GPIO IRQ
56  *
57  * # Undefined behavior
58  * * Calling other function before ::gpio_irq_init
59  *
60  * @{
61  */
62 
63 /**
64  * \defgroup hal_gpioirq_tests GPIO IRQ HAL tests
65  * The GPIO IRQ HAL tests ensure driver conformance to defined behaviour.
66  *
67  * To run the GPIO IRQ hal tests use the command:
68  *
69  * mbed test -t <toolchain> -m <target> -n tests-mbed_hal_fpga_ci_test_shield-gpio_irq
70  *
71  */
72 
73 /** Initialize the GPIO IRQ pin
74  *
75  * @param obj The GPIO object to initialize
76  * @param pin The GPIO pin name
77  * @param handler The handler to be attached to GPIO IRQ
78  * @param context The context to be passed back to the handler (context != 0, 0 is reserved)
79  * @return -1 if pin is NC, 0 otherwise
80  */
81 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uintptr_t context);
82 
83 /** Release the GPIO IRQ PIN
84  *
85  * @param obj The gpio object
86  */
87 void gpio_irq_free(gpio_irq_t *obj);
88 
89 /** Enable/disable pin IRQ event
90  *
91  * @param obj The GPIO object
92  * @param event The GPIO IRQ event
93  * @param enable The enable flag
94  */
95 void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
96 
97 /** Enable GPIO IRQ
98  *
99  * This is target dependent, as it might enable the entire port or just a pin
100  * @param obj The GPIO object
101  */
102 void gpio_irq_enable(gpio_irq_t *obj);
103 
104 /** Disable GPIO IRQ
105  *
106  * This is target dependent, as it might disable the entire port or just a pin
107  * @param obj The GPIO object
108  */
109 void gpio_irq_disable(gpio_irq_t *obj);
110 
111 /** Get the pins that support all GPIO IRQ tests
112  *
113  * Return a PinMap array of pins that support GPIO IRQ.
114  * The array is terminated with {NC, NC, 0}.
115  *
116  * Targets should override the weak implementation of this
117  * function to provide the actual pinmap for GPIO IRQ testing.
118  *
119  * @return PinMap array
120  */
121 const PinMap *gpio_irq_pinmap(void);
122 
123 /**@}*/
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
130 
131 #endif
132 
133 /** @}*/
void gpio_irq_enable(gpio_irq_t *obj)
Enable GPIO IRQ.
gpio_irq_event
GPIO IRQ events.
Definition: gpio_irq_api.h:34
void gpio_irq_free(gpio_irq_t *obj)
Release the GPIO IRQ PIN.
struct gpio_irq_s gpio_irq_t
GPIO IRQ HAL structure.
Definition: gpio_irq_api.h:42
const PinMap * gpio_irq_pinmap(void)
Get the pins that support all GPIO IRQ tests.
void gpio_irq_disable(gpio_irq_t *obj)
Disable GPIO IRQ.
Definition: pinmap.h:31
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
Enable/disable pin IRQ event.
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uintptr_t context)
Initialize the GPIO IRQ pin.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.