no-OS
Classes | Functions | Variables
stm32_irq.c File Reference

Implementation of external irq driver. More...

#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include "no_os_list.h"
#include "no_os_irq.h"
#include "no_os_util.h"
#include "stm32_irq.h"
Include dependency graph for stm32_irq.c:

Classes

struct  irq_action
 Struct used to store a (peripheral, callback) pair. More...
 
struct  event_list
 Struct that stores all the actions for a specific event. More...
 

Functions

void _TxCpltCallback (UART_HandleTypeDef *huart)
 
void _RxCpltCallback (UART_HandleTypeDef *huart)
 
void _ErrorCallback (UART_HandleTypeDef *huart)
 
int32_t stm32_irq_ctrl_init (struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
 Initialized the controller for the STM32 external interrupts. More...
 
int32_t stm32_irq_ctrl_remove (struct no_os_irq_ctrl_desc *desc)
 Free the resources allocated by irq_ctrl_init() More...
 
int32_t stm32_trigger_level_set (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level level)
 Unused. More...
 
int32_t stm32_irq_register_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
 Register a callback. More...
 
int32_t stm32_irq_unregister_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
 Unregister a callback. More...
 
int32_t stm32_irq_global_enable (struct no_os_irq_ctrl_desc *desc)
 Enable all interrupts. More...
 
int32_t stm32_irq_global_disable (struct no_os_irq_ctrl_desc *desc)
 Disable all interrupts. More...
 
int32_t stm32_irq_enable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Enable a specific interrupt. More...
 
int32_t stm32_irq_disable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Disable a specific interrupt. More...
 

Variables

const struct no_os_irq_platform_ops stm32_irq_ops
 stm32 specific IRQ platform ops structure More...
 

Detailed Description

Implementation of external irq driver.

Author
Darius Berghe (dariu.nosp@m.s.be.nosp@m.rghe@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2022(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ _ErrorCallback()

void _ErrorCallback ( UART_HandleTypeDef *  huart)

◆ _RxCpltCallback()

void _RxCpltCallback ( UART_HandleTypeDef *  huart)

◆ _TxCpltCallback()

void _TxCpltCallback ( UART_HandleTypeDef *  huart)

◆ stm32_irq_ctrl_init()

int32_t stm32_irq_ctrl_init ( struct no_os_irq_ctrl_desc **  desc,
const struct no_os_irq_init_param param 
)

Initialized the controller for the STM32 external interrupts.

Parameters
desc- Pointer where the configured instance is stored
param- Configuration information for the instance
Returns
0 in case of success, errno error codes otherwise.

◆ stm32_irq_ctrl_remove()

int32_t stm32_irq_ctrl_remove ( struct no_os_irq_ctrl_desc desc)

Free the resources allocated by irq_ctrl_init()

Parameters
desc- Interrupt controller descriptor.
Returns
0 in case of success, errno error codes otherwise.

◆ stm32_irq_disable()

int32_t stm32_irq_disable ( struct no_os_irq_ctrl_desc desc,
uint32_t  irq_id 
)

Disable a specific interrupt.

Parameters
desc- Interrupt controller descriptor.
irq_id- Interrupt identifier
Returns
0 in case of success, -EINVAL otherwise.

◆ stm32_irq_enable()

int32_t stm32_irq_enable ( struct no_os_irq_ctrl_desc desc,
uint32_t  irq_id 
)

Enable a specific interrupt.

Parameters
desc- Interrupt controller descriptor.
irq_id- Interrupt identifier
Returns
0 in case of success, errno error codes otherwise.

◆ stm32_irq_global_disable()

int32_t stm32_irq_global_disable ( struct no_os_irq_ctrl_desc desc)

Disable all interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ stm32_irq_global_enable()

int32_t stm32_irq_global_enable ( struct no_os_irq_ctrl_desc desc)

Enable all interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ stm32_irq_register_callback()

int32_t stm32_irq_register_callback ( struct no_os_irq_ctrl_desc desc,
uint32_t  irq_id,
struct no_os_callback_desc cb 
)

Register a callback.

Parameters
desc- The IRQ controller descriptor.
irq_id- Interrupt identifier.
cb- Descriptor of the callback.
Returns
0 if successfull, negative error code otherwise.

◆ stm32_irq_unregister_callback()

int32_t stm32_irq_unregister_callback ( struct no_os_irq_ctrl_desc desc,
uint32_t  irq_id,
struct no_os_callback_desc cb 
)

Unregister a callback.

Parameters
desc- Interrupt controller descriptor.
irq_id- Id of the interrupt
cb- Descriptor of the callback.
Returns
0 if successfull, negative error code otherwise.

◆ stm32_trigger_level_set()

int32_t stm32_trigger_level_set ( struct no_os_irq_ctrl_desc desc,
uint32_t  irq_id,
enum no_os_irq_trig_level  level 
)

Unused.

Parameters
desc-irq descriptor.
irq_id- The interrupt vector entry id of the peripheral.
level- the trigger condition.
Returns
-ENOSYS

Variable Documentation

◆ stm32_irq_ops

const struct no_os_irq_platform_ops stm32_irq_ops
Initial value:
= {
.trigger_level_set = &stm32_trigger_level_set,
.register_callback = &stm32_irq_register_callback,
.unregister_callback = &stm32_irq_unregister_callback,
.global_enable = &stm32_irq_global_enable,
.global_disable = &stm32_irq_global_disable,
.enable = &stm32_irq_enable,
.disable = &stm32_irq_disable,
.set_priority = &stm32_irq_set_priority,
}

stm32 specific IRQ platform ops structure

stm32 platform specific irq platform ops structure

stm32_trigger_level_set
int32_t stm32_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level level)
Unused.
Definition: stm32_irq.c:188
stm32_irq_global_enable
int32_t stm32_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable all interrupts.
Definition: stm32_irq.c:365
stm32_irq_unregister_callback
int32_t stm32_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
Unregister a callback.
Definition: stm32_irq.c:321
stm32_irq_global_disable
int32_t stm32_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable all interrupts.
Definition: stm32_irq.c:377
stm32_irq_ctrl_init
int32_t stm32_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialized the controller for the STM32 external interrupts.
Definition: stm32_irq.c:143
stm32_irq_ctrl_remove
int32_t stm32_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by irq_ctrl_init()
Definition: stm32_irq.c:171
stm32_irq_disable
int32_t stm32_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable a specific interrupt.
Definition: stm32_irq.c:403
stm32_irq_register_callback
int32_t stm32_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
Register a callback.
Definition: stm32_irq.c:202
stm32_irq_enable
int32_t stm32_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable a specific interrupt.
Definition: stm32_irq.c:390