|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
GPIO-to-line routing, edge triggers, interrupt mask and pending bits. More...
Macros | |
| #define | EXTI_LINE_MAX (22U) |
| Highest EXTI line on the F446. | |
| #define | EXTI_GPIO_LINE_MAX (15U) |
| Highest line fed by a GPIO pin. | |
| #define | EXTI_LINE_UNUSED (19U) |
| The line with no source on the F446 (RM0390 section 10.2.5). | |
Typedefs | |
| typedef enum ExtiEdge_e | ExtiEdge_e |
| Which edges of a line's input set its pending bit. | |
Enumerations | |
| enum | ExtiEdge_e { EXTI_EDGE_RISING = 1 , EXTI_EDGE_FALLING = 2 , EXTI_EDGE_BOTH = 3 } |
| Which edges of a line's input set its pending bit. More... | |
Functions | |
| DRIVER_MUST_CHECK DriverStatus_e | extiSelectPort (SyscfgRegisters_t *syscfg, uint32_t line, const GpioRegisters_t *port) |
Route GPIO pin line of port to EXTI line line. | |
| DRIVER_MUST_CHECK DriverStatus_e | extiConfigure (ExtiRegisters_t *exti, uint32_t line, ExtiEdge_e edge) |
Set which edges trigger line; the other edge is cleared. | |
| DRIVER_MUST_CHECK DriverStatus_e | extiEnableInterrupt (ExtiRegisters_t *exti, uint32_t line) |
Unmask line's interrupt (IMR). | |
| DRIVER_MUST_CHECK DriverStatus_e | extiDisableInterrupt (ExtiRegisters_t *exti, uint32_t line) |
Mask line's interrupt (IMR). | |
| DRIVER_MUST_CHECK DriverStatus_e | extiTriggerSoftware (ExtiRegisters_t *exti, uint32_t line) |
Raise line's interrupt from software (SWIER). | |
| DRIVER_MUST_CHECK DriverStatus_e | extiIsPending (const ExtiRegisters_t *exti, uint32_t line, bool *pending) |
Report whether line's pending bit (PR) is set. | |
| DRIVER_MUST_CHECK DriverStatus_e | extiClearPending (ExtiRegisters_t *exti, uint32_t line) |
Clear line's pending bit, and its SWIER bit with it. | |
| static DriverStatus_e | extiValidateLine (uint32_t line) |
| Accept a line that exists: 0 to EXTI_LINE_MAX, except 19. | |
| static DriverStatus_e | extiPortSelector (const GpioRegisters_t *port, uint32_t *selector) |
| Map a GPIO port to its EXTICR selector. | |
GPIO-to-line routing, edge triggers, interrupt mask and pending bits.
| #define EXTI_LINE_MAX (22U) |
Highest EXTI line on the F446.
Definition at line 38 of file exti.h.
Referenced by extiValidateLine().
| #define EXTI_GPIO_LINE_MAX (15U) |
Highest line fed by a GPIO pin.
Definition at line 39 of file exti.h.
Referenced by extiSelectPort().
| #define EXTI_LINE_UNUSED (19U) |
The line with no source on the F446 (RM0390 section 10.2.5).
Definition at line 15 of file exti.c.
Referenced by extiValidateLine().
| enum ExtiEdge_e |
| DriverStatus_e extiSelectPort | ( | SyscfgRegisters_t * | syscfg, |
| uint32_t | line, | ||
| const GpioRegisters_t * | port ) |
Route GPIO pin line of port to EXTI line line.
| syscfg | SYSCFG block (e.g. SYSCFG). |
| line | 0 to EXTI_GPIO_LINE_MAX. |
| port | GPIOA to GPIOH; compared by address, never dereferenced. GPIOH has only pins 0 and 1. |
| DRIVER_STATUS_OK | The line's EXTICR field selects port. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is above 15, port is not GPIOA to GPIOH, or it is GPIOH with line above 1. Nothing written. |
Definition at line 86 of file exti.c.
References DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, EXTI_GPIO_LINE_MAX, SyscfgRegisters_t::EXTICR, extiPortSelector(), extiSelectPort(), and SYSCFG_EXTICR_PH.
Referenced by extiSelectPort().
| DriverStatus_e extiConfigure | ( | ExtiRegisters_t * | exti, |
| uint32_t | line, | ||
| ExtiEdge_e | edge ) |
Set which edges trigger line; the other edge is cleared.
An edge that arrives while RTSR or FTSR is being written is not latched (RM0390 section 10.3). Configure a line while its interrupt is masked, and clear its pending bit before unmasking it.
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| edge | Edges to trigger on. |
| DRIVER_STATUS_OK | RTSR and FTSR set for line. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line or edge is invalid. Nothing written. |
Definition at line 118 of file exti.c.
References DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, EXTI_EDGE_BOTH, EXTI_EDGE_FALLING, EXTI_EDGE_RISING, extiConfigure(), extiValidateLine(), ExtiRegisters_t::FTSR, and ExtiRegisters_t::RTSR.
Referenced by extiConfigure().
| DriverStatus_e extiEnableInterrupt | ( | ExtiRegisters_t * | exti, |
| uint32_t | line ) |
Unmask line's interrupt (IMR).
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| DRIVER_STATUS_OK | Unmasked. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is invalid. Nothing written. |
Definition at line 154 of file exti.c.
References DRIVER_STATUS_OK, extiEnableInterrupt(), extiValidateLine(), and ExtiRegisters_t::IMR.
Referenced by extiEnableInterrupt().
| DriverStatus_e extiDisableInterrupt | ( | ExtiRegisters_t * | exti, |
| uint32_t | line ) |
Mask line's interrupt (IMR).
Its pending bit is left alone.
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| DRIVER_STATUS_OK | Masked. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is invalid. Nothing written. |
Definition at line 166 of file exti.c.
References DRIVER_STATUS_OK, extiDisableInterrupt(), extiValidateLine(), and ExtiRegisters_t::IMR.
Referenced by extiDisableInterrupt().
| DriverStatus_e extiTriggerSoftware | ( | ExtiRegisters_t * | exti, |
| uint32_t | line ) |
Raise line's interrupt from software (SWIER).
Sets the pending bit only if the line's interrupt is unmasked; the edge configuration does not matter. Hardware clears SWIER when the pending bit is cleared.
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| DRIVER_STATUS_OK | SWIER bit set. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is invalid. Nothing written. |
Definition at line 178 of file exti.c.
References DRIVER_STATUS_OK, extiTriggerSoftware(), extiValidateLine(), and ExtiRegisters_t::SWIER.
Referenced by extiTriggerSoftware().
| DriverStatus_e extiIsPending | ( | const ExtiRegisters_t * | exti, |
| uint32_t | line, | ||
| bool * | pending ) |
Report whether line's pending bit (PR) is set.
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| pending | Receives the bit; written only on success. |
| DRIVER_STATUS_OK | pending written. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is invalid or pending is NULL. |
Definition at line 191 of file exti.c.
References DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, extiIsPending(), extiValidateLine(), and ExtiRegisters_t::PR.
Referenced by extiIsPending().
| DriverStatus_e extiClearPending | ( | ExtiRegisters_t * | exti, |
| uint32_t | line ) |
Clear line's pending bit, and its SWIER bit with it.
PR is write-1-to-clear, so this is a single store of the line's bit: it cannot clear another line's pending bit and needs no serialising.
| exti | EXTI block (e.g. EXTI). |
| line | 0 to EXTI_LINE_MAX, except 19. |
| DRIVER_STATUS_OK | Cleared. |
| DRIVER_STATUS_ERR_INVALID_PARAM | line is invalid. Nothing written. |
Definition at line 208 of file exti.c.
References DRIVER_STATUS_OK, extiClearPending(), extiValidateLine(), and ExtiRegisters_t::PR.
Referenced by extiClearPending().
|
static |
Accept a line that exists: 0 to EXTI_LINE_MAX, except 19.
| line | Candidate line. |
| DRIVER_STATUS_OK | Valid. |
| DRIVER_STATUS_ERR_INVALID_PARAM | Otherwise. |
Definition at line 23 of file exti.c.
References DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, EXTI_LINE_MAX, EXTI_LINE_UNUSED, and extiValidateLine().
Referenced by extiClearPending(), extiConfigure(), extiDisableInterrupt(), extiEnableInterrupt(), extiIsPending(), extiTriggerSoftware(), and extiValidateLine().
|
static |
Map a GPIO port to its EXTICR selector.
| port | Port to identify, compared by address. |
| selector | Receives a SYSCFG_EXTICR_P* value; untouched on failure. |
| DRIVER_STATUS_OK | port is GPIOA to GPIOH. |
| DRIVER_STATUS_ERR_INVALID_PARAM | Otherwise. |
Definition at line 42 of file exti.c.
References DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, extiPortSelector(), GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, SYSCFG_EXTICR_PA, SYSCFG_EXTICR_PB, SYSCFG_EXTICR_PC, SYSCFG_EXTICR_PD, SYSCFG_EXTICR_PE, SYSCFG_EXTICR_PF, SYSCFG_EXTICR_PG, and SYSCFG_EXTICR_PH.
Referenced by extiPortSelector(), and extiSelectPort().