mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
hal/gpio_irq_api.h@150:da61ba4e9755, 2016-11-25 (annotated)
- Committer:
- sivasuren
- Date:
- Fri Nov 25 07:57:40 2016 +0000
- Revision:
- 150:da61ba4e9755
- Parent:
- 149:156823d33999
surendar changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | |
<> | 149:156823d33999 | 2 | /** \addtogroup hal */ |
<> | 149:156823d33999 | 3 | /** @{*/ |
<> | 144:ef7eb2e8f9f7 | 4 | /* mbed Microcontroller Library |
<> | 144:ef7eb2e8f9f7 | 5 | * Copyright (c) 2006-2013 ARM Limited |
<> | 144:ef7eb2e8f9f7 | 6 | * |
<> | 144:ef7eb2e8f9f7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 144:ef7eb2e8f9f7 | 8 | * you may not use this file except in compliance with the License. |
<> | 144:ef7eb2e8f9f7 | 9 | * You may obtain a copy of the License at |
<> | 144:ef7eb2e8f9f7 | 10 | * |
<> | 144:ef7eb2e8f9f7 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 144:ef7eb2e8f9f7 | 12 | * |
<> | 144:ef7eb2e8f9f7 | 13 | * Unless required by applicable law or agreed to in writing, software |
<> | 144:ef7eb2e8f9f7 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 144:ef7eb2e8f9f7 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 144:ef7eb2e8f9f7 | 16 | * See the License for the specific language governing permissions and |
<> | 144:ef7eb2e8f9f7 | 17 | * limitations under the License. |
<> | 144:ef7eb2e8f9f7 | 18 | */ |
<> | 144:ef7eb2e8f9f7 | 19 | #ifndef MBED_GPIO_IRQ_API_H |
<> | 144:ef7eb2e8f9f7 | 20 | #define MBED_GPIO_IRQ_API_H |
<> | 144:ef7eb2e8f9f7 | 21 | |
<> | 144:ef7eb2e8f9f7 | 22 | #include "device.h" |
<> | 144:ef7eb2e8f9f7 | 23 | |
<> | 144:ef7eb2e8f9f7 | 24 | #if DEVICE_INTERRUPTIN |
<> | 144:ef7eb2e8f9f7 | 25 | |
<> | 144:ef7eb2e8f9f7 | 26 | #ifdef __cplusplus |
<> | 144:ef7eb2e8f9f7 | 27 | extern "C" { |
<> | 144:ef7eb2e8f9f7 | 28 | #endif |
<> | 144:ef7eb2e8f9f7 | 29 | |
<> | 144:ef7eb2e8f9f7 | 30 | /** GPIO IRQ events |
<> | 144:ef7eb2e8f9f7 | 31 | */ |
<> | 144:ef7eb2e8f9f7 | 32 | typedef enum { |
<> | 144:ef7eb2e8f9f7 | 33 | IRQ_NONE, |
<> | 144:ef7eb2e8f9f7 | 34 | IRQ_RISE, |
<> | 144:ef7eb2e8f9f7 | 35 | IRQ_FALL |
<> | 144:ef7eb2e8f9f7 | 36 | } gpio_irq_event; |
<> | 144:ef7eb2e8f9f7 | 37 | |
<> | 144:ef7eb2e8f9f7 | 38 | /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL |
<> | 144:ef7eb2e8f9f7 | 39 | */ |
<> | 144:ef7eb2e8f9f7 | 40 | typedef struct gpio_irq_s gpio_irq_t; |
<> | 144:ef7eb2e8f9f7 | 41 | |
<> | 144:ef7eb2e8f9f7 | 42 | typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event); |
<> | 144:ef7eb2e8f9f7 | 43 | |
<> | 144:ef7eb2e8f9f7 | 44 | /** |
<> | 144:ef7eb2e8f9f7 | 45 | * \defgroup hal_gpioirq GPIO IRQ HAL functions |
<> | 144:ef7eb2e8f9f7 | 46 | * @{ |
<> | 144:ef7eb2e8f9f7 | 47 | */ |
<> | 144:ef7eb2e8f9f7 | 48 | |
<> | 144:ef7eb2e8f9f7 | 49 | /** Initialize the GPIO IRQ pin |
<> | 144:ef7eb2e8f9f7 | 50 | * |
<> | 144:ef7eb2e8f9f7 | 51 | * @param obj The GPIO object to initialize |
<> | 144:ef7eb2e8f9f7 | 52 | * @param pin The GPIO pin name |
<> | 144:ef7eb2e8f9f7 | 53 | * @param handler The handler to be attached to GPIO IRQ |
<> | 144:ef7eb2e8f9f7 | 54 | * @param id The object ID (id != 0, 0 is reserved) |
<> | 144:ef7eb2e8f9f7 | 55 | * @return -1 if pin is NC, 0 otherwise |
<> | 144:ef7eb2e8f9f7 | 56 | */ |
<> | 144:ef7eb2e8f9f7 | 57 | int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id); |
<> | 144:ef7eb2e8f9f7 | 58 | |
<> | 144:ef7eb2e8f9f7 | 59 | /** Release the GPIO IRQ PIN |
<> | 144:ef7eb2e8f9f7 | 60 | * |
<> | 144:ef7eb2e8f9f7 | 61 | * @param obj The gpio object |
<> | 144:ef7eb2e8f9f7 | 62 | */ |
<> | 144:ef7eb2e8f9f7 | 63 | void gpio_irq_free(gpio_irq_t *obj); |
<> | 144:ef7eb2e8f9f7 | 64 | |
<> | 144:ef7eb2e8f9f7 | 65 | /** Enable/disable pin IRQ event |
<> | 144:ef7eb2e8f9f7 | 66 | * |
<> | 144:ef7eb2e8f9f7 | 67 | * @param obj The GPIO object |
<> | 144:ef7eb2e8f9f7 | 68 | * @param event The GPIO IRQ event |
<> | 144:ef7eb2e8f9f7 | 69 | * @param enable The enable flag |
<> | 144:ef7eb2e8f9f7 | 70 | */ |
<> | 144:ef7eb2e8f9f7 | 71 | void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable); |
<> | 144:ef7eb2e8f9f7 | 72 | |
<> | 144:ef7eb2e8f9f7 | 73 | /** Enable GPIO IRQ |
<> | 144:ef7eb2e8f9f7 | 74 | * |
<> | 144:ef7eb2e8f9f7 | 75 | * This is target dependent, as it might enable the entire port or just a pin |
<> | 144:ef7eb2e8f9f7 | 76 | * @param obj The GPIO object |
<> | 144:ef7eb2e8f9f7 | 77 | */ |
<> | 144:ef7eb2e8f9f7 | 78 | void gpio_irq_enable(gpio_irq_t *obj); |
<> | 144:ef7eb2e8f9f7 | 79 | |
<> | 144:ef7eb2e8f9f7 | 80 | /** Disable GPIO IRQ |
<> | 144:ef7eb2e8f9f7 | 81 | * |
<> | 144:ef7eb2e8f9f7 | 82 | * This is target dependent, as it might disable the entire port or just a pin |
<> | 144:ef7eb2e8f9f7 | 83 | * @param obj The GPIO object |
<> | 144:ef7eb2e8f9f7 | 84 | */ |
<> | 144:ef7eb2e8f9f7 | 85 | void gpio_irq_disable(gpio_irq_t *obj); |
<> | 144:ef7eb2e8f9f7 | 86 | |
<> | 144:ef7eb2e8f9f7 | 87 | /**@}*/ |
<> | 144:ef7eb2e8f9f7 | 88 | |
<> | 144:ef7eb2e8f9f7 | 89 | #ifdef __cplusplus |
<> | 144:ef7eb2e8f9f7 | 90 | } |
<> | 144:ef7eb2e8f9f7 | 91 | #endif |
<> | 144:ef7eb2e8f9f7 | 92 | |
<> | 144:ef7eb2e8f9f7 | 93 | #endif |
<> | 144:ef7eb2e8f9f7 | 94 | |
<> | 144:ef7eb2e8f9f7 | 95 | #endif |
<> | 149:156823d33999 | 96 | |
<> | 149:156823d33999 | 97 | /** @}*/ |