no-OS
Loading...
Searching...
No Matches
aducm3029_irq.c File Reference

Implementation of External IRQ driver for ADuCM302x. More...

#include "no_os_irq.h"
#include "aducm3029_irq.h"
#include "no_os_error.h"
#include <stdlib.h>
#include "no_os_uart.h"
#include "aducm3029_uart.h"
#include "no_os_rtc.h"
#include "aducm3029_rtc.h"
#include "no_os_gpio.h"
#include <drivers/gpio/adi_gpio.h>
#include <drivers/tmr/adi_tmr.h>
#include "no_os_timer.h"
#include "aducm3029_timer.h"
#include "no_os_util.h"
#include "no_os_list.h"
#include "no_os_alloc.h"
Include dependency graph for aducm3029_irq.c:

Classes

struct  event_list
 Struct that stores all the actions for a specific event. More...
 

Macros

#define BASE_XINT_NB   (XINT_EVT0_IRQn)
 
#define NB_EXT_INTERRUPTS   4u
 
#define NB_INTERRUPT_CONTROLLERS   1u
 

Functions

int32_t irq_action_cmp (void *data1, void *data2)
 Action comparator function.
 
int aducm3029_irq_ctrl_init (struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
 Initialized the controller for the ADuCM3029 external interrupts.
 
int aducm3029_irq_ctrl_remove (struct no_os_irq_ctrl_desc *desc)
 Free the resources allocated by no_os_irq_ctrl_init()
 
int aducm3029_irq_register_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
 Registers a IRQ callback function to irq controller.
 
int aducm3029_irq_unregister_callback (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
 Unregister IRQ handling function for the specified irq_id.
 
int aducm3029_irq_global_enable (struct no_os_irq_ctrl_desc *desc)
 Enable all previously enabled interrupts by no_os_irq_enable().
 
int aducm3029_irq_global_disable (struct no_os_irq_ctrl_desc *desc)
 Disable all external interrupts.
 
int aducm3029_irq_enable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Enable the interrupt.
 
int aducm3029_irq_disable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Disable the interrupt.
 

Variables

const struct no_os_irq_platform_ops aducm_irq_ops
 Aducm3029 platform specific IRQ platform ops structure.
 

Detailed Description

Implementation of External IRQ driver for ADuCM302x.

Author
Mihail Chindris (mihai.nosp@m.l.ch.nosp@m.indri.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2019(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ BASE_XINT_NB

#define BASE_XINT_NB   (XINT_EVT0_IRQn)

The number of the first external interrupt, used by NVIC

◆ NB_EXT_INTERRUPTS

#define NB_EXT_INTERRUPTS   4u

Number of available external interrupts

◆ NB_INTERRUPT_CONTROLLERS

#define NB_INTERRUPT_CONTROLLERS   1u

Number of interrupts controllers available

Function Documentation

◆ aducm3029_irq_ctrl_init()

int aducm3029_irq_ctrl_init ( struct no_os_irq_ctrl_desc ** desc,
const struct no_os_irq_init_param * param )

Initialized the controller for the ADuCM3029 external interrupts.

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

◆ aducm3029_irq_ctrl_remove()

int aducm3029_irq_ctrl_remove ( struct no_os_irq_ctrl_desc * desc)

Free the resources allocated by no_os_irq_ctrl_init()

Parameters
desc- Interrupt controller descriptor.
Returns
0 in case of success, -1 otherwise.

◆ aducm3029_irq_disable()

int aducm3029_irq_disable ( struct no_os_irq_ctrl_desc * desc,
uint32_t irq_id )

Disable the interrupt.

Parameters
desc- Interrupt controller descriptor.
irq_id- Id of the interrupt
Returns
0 in case of success, -1 otherwise.

◆ aducm3029_irq_enable()

int aducm3029_irq_enable ( struct no_os_irq_ctrl_desc * desc,
uint32_t irq_id )

Enable the interrupt.

In order for the irq_id interrupt to be triggered the GPIO associated pin must be set as input.
The associated values are:

  • ID 0 -> GPIO15
  • ID 1 -> GPIO16
  • ID 2 -> GPIO13
  • ID 3 -> GPIO33
Parameters
desc- Interrupt controller descriptor.
irq_id- Id of the interrupt
Returns
0 in case of success, -1 otherwise.

◆ aducm3029_irq_global_disable()

int aducm3029_irq_global_disable ( struct no_os_irq_ctrl_desc * desc)

Disable all external interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ aducm3029_irq_global_enable()

int aducm3029_irq_global_enable ( struct no_os_irq_ctrl_desc * desc)

Enable all previously enabled interrupts by no_os_irq_enable().

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ aducm3029_irq_register_callback()

int aducm3029_irq_register_callback ( struct no_os_irq_ctrl_desc * desc,
uint32_t irq_id,
struct no_os_callback_desc * callback_desc )

Registers a IRQ callback function to irq controller.

Parameters
desc- The IRQ controller descriptor.
irq_id- Interrupt identifier.
callback_desc- Descriptor of the callback. If it is NULL, the callback will be unregistered
Returns
0 in case of success, -1 otherwise.

◆ aducm3029_irq_unregister_callback()

int aducm3029_irq_unregister_callback ( struct no_os_irq_ctrl_desc * desc,
uint32_t irq_id,
struct no_os_callback_desc * cb )

Unregister IRQ handling function for the specified irq_id.

Parameters
desc- Interrupt controller descriptor.
irq_id- Id of the interrupt
cb- Callback descriptor.
Returns
0 in case of success, -1 otherwise.

◆ irq_action_cmp()

int32_t irq_action_cmp ( void * data1,
void * data2 )

Action comparator function.

irq_action compare function

Parameters
data1- List element
data2- Key
Returns
0 if the two are equal, any other integer otherwise

Variable Documentation

◆ aducm_irq_ops

const struct no_os_irq_platform_ops aducm_irq_ops
Initial value:
= {
.register_callback = &aducm3029_irq_register_callback,
.unregister_callback = &aducm3029_irq_unregister_callback,
.global_enable = &aducm3029_irq_global_enable,
.global_disable = &aducm3029_irq_global_disable,
.disable = &aducm3029_irq_disable,
.set_priority = &aducm3029_irq_set_priority,
}
int aducm3029_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Registers a IRQ callback function to irq controller.
Definition aducm3029_irq.c:222
int aducm3029_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialized the controller for the ADuCM3029 external interrupts.
Definition aducm3029_irq.c:170
int aducm3029_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by no_os_irq_ctrl_init()
Definition aducm3029_irq.c:200
int aducm3029_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable the interrupt.
Definition aducm3029_irq.c:459
int aducm3029_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable all previously enabled interrupts by no_os_irq_enable().
Definition aducm3029_irq.c:373
int aducm3029_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable the interrupt.
Definition aducm3029_irq.c:417
int aducm3029_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
Unregister IRQ handling function for the specified irq_id.
Definition aducm3029_irq.c:336
int aducm3029_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable all external interrupts.
Definition aducm3029_irq.c:390

Aducm3029 platform specific IRQ platform ops structure.

ADuCM3029 specific IRQ platform ops structure.