no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 "no_os_alloc.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)
 
int 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.
 
int stm32_irq_ctrl_remove (struct no_os_irq_ctrl_desc *desc)
 Free the resources allocated by irq_ctrl_init()
 
int stm32_trigger_level_set (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level level)
 Unused.
 
int stm32_irq_register_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
 Register a callback.
 
int stm32_irq_unregister_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
 Unregister a callback.
 
int stm32_irq_global_enable (struct no_os_irq_ctrl_desc *desc)
 Enable all interrupts.
 
int stm32_irq_global_disable (struct no_os_irq_ctrl_desc *desc)
 Disable all interrupts.
 
int stm32_irq_enable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Enable a specific interrupt.
 
int stm32_irq_disable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Disable a specific interrupt.
 

Variables

const struct no_os_irq_platform_ops stm32_irq_ops
 stm32 specific IRQ platform ops structure
 

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.

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

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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)
Here is the caller graph for this function:

◆ _RxCpltCallback()

void _RxCpltCallback ( UART_HandleTypeDef * huart)
Here is the caller graph for this function:

◆ _TxCpltCallback()

void _TxCpltCallback ( UART_HandleTypeDef * huart)
Here is the caller graph for this function:

◆ stm32_irq_ctrl_init()

int 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()

int 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()

int 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()

int 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()

int 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()

int 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()

int 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()

int 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()

int 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,
.get_priority = &stm32_irq_get_priority,
}
int stm32_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable all interrupts.
Definition stm32_irq.c:561
int 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:236
int stm32_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by irq_ctrl_init()
Definition stm32_irq.c:263
int 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:481
int stm32_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable all interrupts.
Definition stm32_irq.c:549
int stm32_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable a specific interrupt.
Definition stm32_irq.c:574
int 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:280
int stm32_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable a specific interrupt.
Definition stm32_irq.c:587
int 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:294

stm32 specific IRQ platform ops structure

stm32 platform specific irq platform ops structure