2016-03-14 16:29:46 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Open-RnD Sp. z o.o.
|
|
|
|
*
|
2017-01-18 17:01:01 -08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-03-14 16:29:46 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Driver for External interrupt/event controller in STM32 MCUs
|
|
|
|
*
|
2016-10-28 15:57:22 +05:30
|
|
|
* Based on reference manuals:
|
|
|
|
* RM0008 Reference Manual: STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx
|
2017-10-01 10:00:48 -07:00
|
|
|
* and STM32F107xx advanced ARM(r)-based 32-bit MCUs
|
2016-10-28 15:57:22 +05:30
|
|
|
* and
|
|
|
|
* RM0368 Reference manual STM32F401xB/C and STM32F401xD/E
|
2017-10-01 10:00:48 -07:00
|
|
|
* advanced ARM(r)-based 32-bit MCUs
|
2016-03-14 16:29:46 +01:00
|
|
|
*
|
2016-10-28 15:57:22 +05:30
|
|
|
* Chapter 10.2: External interrupt/event controller (EXTI)
|
2016-03-14 16:29:46 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-12-18 09:31:56 +01:00
|
|
|
#ifndef ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_
|
|
|
|
#define ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_
|
2016-03-14 16:29:46 +01:00
|
|
|
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 10:32:08 -05:00
|
|
|
#include <zephyr/types.h>
|
2016-03-14 16:29:46 +01:00
|
|
|
|
|
|
|
/* device name */
|
|
|
|
#define STM32_EXTI_NAME "stm32-exti"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief enable EXTI interrupt for specific line
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
*/
|
2019-01-24 15:11:23 +01:00
|
|
|
int stm32_exti_enable(int line);
|
2016-03-14 16:29:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief disable EXTI interrupt for specific line
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
*/
|
2016-08-13 02:06:32 -03:00
|
|
|
void stm32_exti_disable(int line);
|
2016-03-14 16:29:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief EXTI trigger flags
|
|
|
|
*/
|
|
|
|
enum stm32_exti_trigger {
|
2019-10-08 16:39:01 +02:00
|
|
|
/* clear trigger */
|
|
|
|
STM32_EXTI_TRIG_NONE = 0x0,
|
2016-03-14 16:29:46 +01:00
|
|
|
/* trigger on rising edge */
|
|
|
|
STM32_EXTI_TRIG_RISING = 0x1,
|
|
|
|
/* trigger on falling endge */
|
|
|
|
STM32_EXTI_TRIG_FALLING = 0x2,
|
2019-10-08 16:39:01 +02:00
|
|
|
/* trigger on falling endge */
|
|
|
|
STM32_EXTI_TRIG_BOTH = 0x3,
|
2016-03-14 16:29:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief set EXTI interrupt line triggers
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
* @param trg OR'ed stm32_exti_trigger flags
|
|
|
|
*/
|
2016-08-13 02:06:32 -03:00
|
|
|
void stm32_exti_trigger(int line, int trg);
|
2016-03-14 16:29:46 +01:00
|
|
|
|
|
|
|
/* callback for exti interrupt */
|
|
|
|
typedef void (*stm32_exti_callback_t) (int line, void *user);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief set EXTI interrupt callback
|
|
|
|
*
|
|
|
|
* @param line EXI# line
|
|
|
|
* @param cb user callback
|
2019-12-18 12:04:26 +01:00
|
|
|
* @param data user data
|
2016-03-14 16:29:46 +01:00
|
|
|
*/
|
2019-10-09 11:20:02 +02:00
|
|
|
int stm32_exti_set_callback(int line, stm32_exti_callback_t cb, void *data);
|
2016-03-14 16:29:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief unset EXTI interrupt callback
|
|
|
|
*
|
|
|
|
* @param line EXI# line
|
|
|
|
*/
|
2016-08-13 02:06:32 -03:00
|
|
|
void stm32_exti_unset_callback(int line);
|
2016-03-14 16:29:46 +01:00
|
|
|
|
2019-12-18 09:31:56 +01:00
|
|
|
#endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_ */
|