![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
How to use External Interrupts. More...
Data Structures | |
| struct | stc_exint_config |
| EXINT configuration. More... | |
| struct | stc_exint_nmi_config |
| NMI configuration. More... | |
| struct | stc_exint_intern_data |
| Datatype for holding internal data needed for EXINT. More... | |
| struct | stc_exint_nmi_intern_data |
| Datatype for holding internal data needed for NMI. More... | |
Macros | |
| #define | PDL_EXINT_CHANNELS |
| #define | EXINT0_BITPOS 0x00000001u |
| #define | EXINT1_BITPOS 0x00000002u |
| #define | EXINT2_BITPOS 0x00000004u |
| #define | EXINT3_BITPOS 0x00000008u |
| #define | EXINT4_BITPOS 0x00000010u |
| #define | EXINT5_BITPOS 0x00000020u |
| #define | EXINT6_BITPOS 0x00000040u |
| #define | EXINT7_BITPOS 0x00000080u |
| #define | EXINT8_BITPOS 0x00000100u |
| #define | EXINT9_BITPOS 0x00000200u |
| #define | EXINT10_BITPOS 0x00000400u |
| #define | EXINT11_BITPOS 0x00000800u |
| #define | EXINT12_BITPOS 0x00001000u |
| #define | EXINT13_BITPOS 0x00002000u |
| #define | EXINT14_BITPOS 0x00004000u |
| #define | EXINT15_BITPOS 0x00008000u |
| #define | EXINT16_BITPOS 0x00010000u |
| #define | EXINT17_BITPOS 0x00020000u |
| #define | EXINT18_BITPOS 0x00040000u |
| #define | EXINT19_BITPOS 0x00080000u |
| #define | EXINT20_BITPOS 0x00100000u |
| #define | EXINT21_BITPOS 0x00200000u |
| #define | EXINT22_BITPOS 0x00400000u |
| #define | EXINT23_BITPOS 0x00800000u |
| #define | EXINT24_BITPOS 0x01000000u |
| #define | EXINT25_BITPOS 0x02000000u |
| #define | EXINT26_BITPOS 0x04000000u |
| #define | EXINT27_BITPOS 0x08000000u |
| #define | EXINT28_BITPOS 0x10000000u |
| #define | EXINT29_BITPOS 0x20000000u |
| #define | EXINT30_BITPOS 0x40000000u |
| #define | EXINT31_BITPOS 0x80000000u |
| #define | EXINT0_BITMASK 0xFFFFFFFEu |
| #define | EXINT1_BITMASK 0xFFFFFFFDu |
| #define | EXINT2_BITMASK 0xFFFFFFFBu |
| #define | EXINT3_BITMASK 0xFFFFFFF7u |
| #define | EXINT4_BITMASK 0xFFFFFFEFu |
| #define | EXINT5_BITMASK 0xFFFFFFDFu |
| #define | EXINT6_BITMASK 0xFFFFFFBFu |
| #define | EXINT7_BITMASK 0FFFFFFF7Fu |
| #define | EXINT8_BITMASK 0xFFFFFEFFu |
| #define | EXINT9_BITMASK 0xFFFFFDFFu |
| #define | EXINT10_BITMASK 0xFFFFFBFFu |
| #define | EXINT11_BITMASK 0xFFFFF7FFu |
| #define | EXINT12_BITMASK 0xFFFFEFFFu |
| #define | EXINT13_BITMASK 0xFFFFDFFFu |
| #define | EXINT14_BITMASK 0xFFFFBFFFu |
| #define | EXINT15_BITMASK 0xFFFF7FFFu |
| #define | EXINT16_BITMASK 0xFFFEFFFFu |
| #define | EXINT17_BITMASK 0xFFFDFFFFu |
| #define | EXINT18_BITMASK 0xFFFBFFFFu |
| #define | EXINT19_BITMASK 0xFFF7FFFFu |
| #define | EXINT20_BITMASK 0xFFEFFFFFu |
| #define | EXINT21_BITMASK 0xFFDFFFFFu |
| #define | EXINT22_BITMASK 0xFFBFFFFFu |
| #define | EXINT23_BITMASK 0xFF7FFFFFu |
| #define | EXINT24_BITMASK 0xFEFFFFFFu |
| #define | EXINT25_BITMASK 0xFDFFFFFFu |
| #define | EXINT26_BITMASK 0xFBFFFFFFu |
| #define | EXINT27_BITMASK 0xF7FFFFFFu |
| #define | EXINT28_BITMASK 0xEFFFFFFFu |
| #define | EXINT29_BITMASK 0xDFFFFFFFu |
| #define | EXINT30_BITMASK 0xBFFFFFFFu |
| #define | EXINT31_BITMASK 0x7FFFFFFFu |
Typedefs | |
| typedef enum en_exint_level | en_exint_level_t |
| typedef struct stc_exint_config | stc_exint_config_t |
| EXINT configuration. More... | |
| typedef struct stc_exint_nmi_config | stc_exint_nmi_config_t |
| NMI configuration. More... | |
| typedef struct stc_exint_intern_data | stc_exint_intern_data_t |
| Datatype for holding internal data needed for EXINT. More... | |
| typedef struct stc_exint_nmi_intern_data | stc_exint_nmi_intern_data_t |
| Datatype for holding internal data needed for NMI. More... | |
Enumerations | |
| enum | en_exint_level { ExIntLowLevel = 0, ExIntHighLevel = 1, ExIntRisingEdge = 2, ExIntFallingEdge = 3 } |
Functions | |
| static uint8_t | ExintGetInternDataIdx (uint8_t u8Channel) |
| Return the internal reference index of an Exint channel. More... | |
| void | Exint_IrqHandler (uint8_t u8Channel) |
| Interrupt handlers for External interrupts 0. More... | |
| void | ExintNMIrqHandler (void) |
| Interrupt handler for None-Maskable Interrupt (NMI) More... | |
| en_result_t | Exint_Init (stc_exint_config_t *pstcConfig) |
| Init External Interrupts. More... | |
| en_result_t | Exint_DeInit (void) |
| Init External Interrupts. More... | |
| en_result_t | Exint_EnableChannel (uint8_t u8Channel) |
| Enable a single External Interrupt. More... | |
| en_result_t | Exint_DisableChannel (uint8_t u8Channel) |
| Disable a single External Interrupt. More... | |
| en_result_t | Exint_Nmi_Init (stc_exint_nmi_config_t *pstcConfig) |
| Init Non-Maskable Interrupt (NMI) More... | |
| en_result_t | Exint_Nmi_DeInit (stc_exint_nmi_config_t *pstcConfig) |
| De-Init Non-Maskable Interrupt (NMI) More... | |
How to use External Interrupts.
Provided functions of EXINT module:
With Exint_Init() the external interrupts are enabled as given in the configuration. Note, that both external interrupt groups (0-7 and 8-15) can be enabled individually.
If a single channel may be disabled and reenabled during runtime the functions Exint_DisableChannel() and Exint_EnableChannel() can be used.
The external interrupts are disabled globally by Exint_DeInit().
Each channel provides an individually callback function which is handled in the interrupt service routine.
Exint_Nmi_Init() "initializes" the None-Maskable Interrupt, which means that the callback function is set to the dedicated internal data.
| #define PDL_EXINT_CHANNELS |
Definition at line 106 of file exint.h.
Referenced by Exint_Init(), and ExintGetInternDataIdx().
| typedef enum en_exint_level en_exint_level_t |
| typedef struct stc_exint_config stc_exint_config_t |
EXINT configuration.
External Interrupt configuration
The EXINT configuration
| typedef struct stc_exint_intern_data stc_exint_intern_data_t |
Datatype for holding internal data needed for EXINT.
| typedef struct stc_exint_nmi_config stc_exint_nmi_config_t |
NMI configuration.
The NMI configuration
| typedef struct stc_exint_nmi_intern_data stc_exint_nmi_intern_data_t |
Datatype for holding internal data needed for NMI.
| enum en_exint_level |
| en_result_t Exint_DeInit | ( | void | ) |
Init External Interrupts.
This function de-initializes all external interrupts.
| Ok | EXINT sucessful disabled |
Definition at line 436 of file exint.c.
References Ok, PDL_DEFAULT_INTERRUPT_LEVEL, PDL_IRQ_LEVEL_EXINT16_17_18_19, PDL_IRQ_LEVEL_EXINT20_21_22_23, PDL_IRQ_LEVEL_EXINT24_25_26_27, and PDL_IRQ_LEVEL_EXINT28_29_30_31.
| en_result_t Exint_DisableChannel | ( | uint8_t | u8Channel | ) |
Disable a single External Interrupt.
This function disables a single External Interrupt.
| [in] | u8Channel | External Interrupt channel number |
| Ok | Channel enabled |
| ErrorInvalidParameter | Invalid channel number or channel |
Definition at line 579 of file exint.c.
References ErrorInvalidParameter, and Ok.
| en_result_t Exint_EnableChannel | ( | uint8_t | u8Channel | ) |
Enable a single External Interrupt.
This function enables a single External Interrupt.
| [in] | u8Channel | External Interrupt channel number |
| Ok | Channel enabled |
| ErrorInvalidParameter | Invalid channel number |
Definition at line 551 of file exint.c.
References ErrorInvalidParameter, and Ok.
| en_result_t Exint_Init | ( | stc_exint_config_t * | pstcConfig | ) |
Init External Interrupts.
This function initializes the external interrupts according the given configuration.
| [in] | pstcConfig | EXINT configuration parameters |
| Ok | EXINT initialized |
| ErrorInvalidParameter | pstcConfig == NULL or Illegal mode |
Definition at line 239 of file exint.c.
References stc_exint_config::abEnable, stc_exint_config::aenLevel, stc_exint_config::apfnExintCallback, stc_exint_intern_data::apfnExintCallback, cau8ExintReferenceLut, ErrorInvalidParameter, ExIntFallingEdge, ExIntHighLevel, ExIntLowLevel, ExIntRisingEdge, Ok, PDL_EXINT_CHANNELS, PDL_IRQ_LEVEL_EXINT0, PDL_IRQ_LEVEL_EXINT1, PDL_IRQ_LEVEL_EXINT10, PDL_IRQ_LEVEL_EXINT11, PDL_IRQ_LEVEL_EXINT12, PDL_IRQ_LEVEL_EXINT13, PDL_IRQ_LEVEL_EXINT14, PDL_IRQ_LEVEL_EXINT15, PDL_IRQ_LEVEL_EXINT16_17_18_19, PDL_IRQ_LEVEL_EXINT2, PDL_IRQ_LEVEL_EXINT20_21_22_23, PDL_IRQ_LEVEL_EXINT24_25_26_27, PDL_IRQ_LEVEL_EXINT28_29_30_31, PDL_IRQ_LEVEL_EXINT3, PDL_IRQ_LEVEL_EXINT4, PDL_IRQ_LEVEL_EXINT5, PDL_IRQ_LEVEL_EXINT6, PDL_IRQ_LEVEL_EXINT7, PDL_IRQ_LEVEL_EXINT8, PDL_IRQ_LEVEL_EXINT9, and TRUE.
| void Exint_IrqHandler | ( | uint8_t | u8Channel | ) |
Interrupt handlers for External interrupts 0.
This function clears the cause bit and calls the callback function, if specified.
Definition at line 193 of file exint.c.
References stc_exint_intern_data::apfnExintCallback, and ExintGetInternDataIdx().

| en_result_t Exint_Nmi_DeInit | ( | stc_exint_nmi_config_t * | pstcConfig | ) |
De-Init Non-Maskable Interrupt (NMI)
This function de-initializes the NMI according to the given configuration.
| [in] | pstcConfig | NMI configuration parameters |
| Ok | NMI initialized |
| ErrorInvalidParameter | pstcConfig == NULL |
Definition at line 645 of file exint.c.
References stc_exint_nmi_config::bTouchNVIC, ErrorInvalidParameter, Ok, PDL_DEFAULT_INTERRUPT_LEVEL, stc_exint_nmi_config::pfnNMICallback, stc_exint_nmi_intern_data::pfnNMICallback, and TRUE.
| en_result_t Exint_Nmi_Init | ( | stc_exint_nmi_config_t * | pstcConfig | ) |
Init Non-Maskable Interrupt (NMI)
This function initializes the NMI according to the given configuration.
| [in] | pstcConfig | NMI configuration parameters |
| Ok | NMI initialized |
| ErrorInvalidParameter | pstcConfig == NULL |
Definition at line 608 of file exint.c.
References stc_exint_nmi_config::bTouchNVIC, ErrorInvalidParameter, Ok, PDL_IRQ_LEVEL_NMI, stc_exint_nmi_config::pfnNMICallback, stc_exint_nmi_intern_data::pfnNMICallback, and TRUE.
|
static |
Return the internal reference index of an Exint channel.
| u8Channel | Exint channel number |
Definition at line 158 of file exint.c.
References cau8ExintReferenceLut, and PDL_EXINT_CHANNELS.
Referenced by Exint_IrqHandler().

| void ExintNMIrqHandler | ( | void | ) |
Interrupt handler for None-Maskable Interrupt (NMI)
This function clears the cause bit and calls the NMI callback function, if specified.
Definition at line 214 of file exint.c.
References stc_exint_nmi_intern_data::pfnNMICallback.
Definition at line 76 of file exint.c.
Referenced by Exint_Init(), and ExintGetInternDataIdx().
| stc_exint_intern_data_t stcExintInternData |
| stc_exint_intern_data_t stcExintInternData |
| stc_exint_nmi_intern_data_t stcExintNMIInternData |
| stc_exint_nmi_intern_data_t stcExintNMIInternData |