2016-03-14 23:29:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Open-RnD Sp. z o.o.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-03-14 23:29:46 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Driver for External interrupt/event controller in STM32 MCUs
|
|
|
|
*
|
2016-10-28 18:27:22 +08:00
|
|
|
* Based on reference manuals:
|
|
|
|
* RM0008 Reference Manual: STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx
|
2017-10-02 01:00:48 +08:00
|
|
|
* and STM32F107xx advanced ARM(r)-based 32-bit MCUs
|
2016-10-28 18:27:22 +08:00
|
|
|
* and
|
|
|
|
* RM0368 Reference manual STM32F401xB/C and STM32F401xD/E
|
2017-10-02 01:00:48 +08:00
|
|
|
* advanced ARM(r)-based 32-bit MCUs
|
2016-03-14 23:29:46 +08:00
|
|
|
*
|
2016-10-28 18:27:22 +08:00
|
|
|
* Chapter 10.2: External interrupt/event controller (EXTI)
|
2016-03-14 23:29:46 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _STM32_EXTI_H_
|
|
|
|
#define _STM32_EXTI_H_
|
|
|
|
|
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 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2016-03-14 23:29:46 +08:00
|
|
|
|
|
|
|
/* device name */
|
|
|
|
#define STM32_EXTI_NAME "stm32-exti"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief enable EXTI interrupt for specific line
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
*/
|
2016-08-13 13:06:32 +08:00
|
|
|
void stm32_exti_enable(int line);
|
2016-03-14 23:29:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief disable EXTI interrupt for specific line
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
*/
|
2016-08-13 13:06:32 +08:00
|
|
|
void stm32_exti_disable(int line);
|
2016-03-14 23:29:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief EXTI trigger flags
|
|
|
|
*/
|
|
|
|
enum stm32_exti_trigger {
|
|
|
|
/* trigger on rising edge */
|
|
|
|
STM32_EXTI_TRIG_RISING = 0x1,
|
|
|
|
/* trigger on falling endge */
|
|
|
|
STM32_EXTI_TRIG_FALLING = 0x2,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief set EXTI interrupt line triggers
|
|
|
|
*
|
|
|
|
* @param line EXTI# line
|
|
|
|
* @param trg OR'ed stm32_exti_trigger flags
|
|
|
|
*/
|
2016-08-13 13:06:32 +08:00
|
|
|
void stm32_exti_trigger(int line, int trg);
|
2016-03-14 23:29:46 +08: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
|
|
|
|
* @param arg user arg
|
|
|
|
*/
|
2016-08-13 13:06:32 +08:00
|
|
|
void stm32_exti_set_callback(int line, stm32_exti_callback_t cb, void *data);
|
2016-03-14 23:29:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief unset EXTI interrupt callback
|
|
|
|
*
|
|
|
|
* @param line EXI# line
|
|
|
|
*/
|
2016-08-13 13:06:32 +08:00
|
|
|
void stm32_exti_unset_callback(int line);
|
2016-03-14 23:29:46 +08:00
|
|
|
|
|
|
|
#endif /* _STM32_EXTI_H_ */
|