no-OS
Macros | Functions | Variables
aducm3029_irq.c File Reference

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

#include "irq.h"
#include "irq_extra.h"
#include "error.h"
#include <stdlib.h>
#include "uart.h"
#include "uart_extra.h"
#include "rtc.h"
#include "rtc_extra.h"
#include "gpio.h"
#include <drivers/gpio/adi_gpio.h>
#include "util.h"
Include dependency graph for aducm3029_irq.c:

Macros

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

Functions

int32_t aducm3029_irq_ctrl_init (struct irq_ctrl_desc **desc, const struct irq_init_param *param)
 Initialized the controller for the ADuCM3029 external interrupts. More...
 
int32_t aducm3029_irq_ctrl_remove (struct irq_ctrl_desc *desc)
 Free the resources allocated by irq_ctrl_init() More...
 
int32_t aducm3029_irq_register_callback (struct irq_ctrl_desc *desc, uint32_t irq_id, struct callback_desc *callback_desc)
 Registers a IRQ callback function to irq controller. More...
 
int32_t aducm3029_irq_unregister (struct irq_ctrl_desc *desc, uint32_t irq_id)
 Unregister IRQ handling function for the specified irq_id. More...
 
int32_t aducm3029_irq_global_enable (struct irq_ctrl_desc *desc)
 Enable all previously enabled interrupts by irq_enable(). More...
 
int32_t aducm3029_irq_global_disable (struct irq_ctrl_desc *desc)
 Disable all external interrupts. More...
 
int32_t aducm3029_irq_enable (struct irq_ctrl_desc *desc, uint32_t irq_id)
 Enable the interrupt. More...
 
int32_t aducm3029_irq_disable (struct irq_ctrl_desc *desc, uint32_t irq_id)
 Disable the interrupt. More...
 

Variables

const struct irq_platform_ops aducm_irq_ops
 Aducm3029 platform specific IRQ platform ops structure. More...
 

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.

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.

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

int32_t aducm3029_irq_ctrl_init ( struct irq_ctrl_desc **  desc,
const struct 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
SUCCESS in case of success, FAILURE otherwise.

◆ aducm3029_irq_ctrl_remove()

int32_t aducm3029_irq_ctrl_remove ( struct irq_ctrl_desc desc)

Free the resources allocated by irq_ctrl_init()

Parameters
desc- Interrupt controller descriptor.
Returns
SUCCESS in case of success, FAILURE otherwise.

◆ aducm3029_irq_disable()

int32_t aducm3029_irq_disable ( struct irq_ctrl_desc desc,
uint32_t  irq_id 
)

Disable the interrupt.

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

◆ aducm3029_irq_enable()

int32_t aducm3029_irq_enable ( struct 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
SUCCESS in case of success, FAILURE otherwise.

◆ aducm3029_irq_global_disable()

int32_t aducm3029_irq_global_disable ( struct irq_ctrl_desc desc)

Disable all external interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
SUCCESS

◆ aducm3029_irq_global_enable()

int32_t aducm3029_irq_global_enable ( struct irq_ctrl_desc desc)

Enable all previously enabled interrupts by irq_enable().

Parameters
desc- Interrupt controller descriptor.
Returns
SUCCESS

◆ aducm3029_irq_register_callback()

int32_t aducm3029_irq_register_callback ( struct irq_ctrl_desc desc,
uint32_t  irq_id,
struct 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
SUCCESS in case of success, FAILURE otherwise.

Intentional fall-through

Either register a new callback and add the GPIO to the interrupt group, or just add the GPIO to the interrupt group if no new callback is mentioned.

◆ aducm3029_irq_unregister()

int32_t aducm3029_irq_unregister ( struct irq_ctrl_desc desc,
uint32_t  irq_id 
)

Unregister IRQ handling function for the specified irq_id.

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

Intentional fall-through

Variable Documentation

◆ aducm_irq_ops

const struct irq_platform_ops aducm_irq_ops
Initial value:
= {
.register_callback = &aducm3029_irq_register_callback,
.unregister = &aducm3029_irq_unregister,
.global_enable = &aducm3029_irq_global_enable,
.global_disable = &aducm3029_irq_global_disable,
.disable = &aducm3029_irq_disable,
}

Aducm3029 platform specific IRQ platform ops structure.

ADuCM3029 specific IRQ platform ops structure.

aducm3029_irq_enable
int32_t aducm3029_irq_enable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Enable the interrupt.
Definition: aducm3029_irq.c:391
aducm3029_irq_ctrl_init
int32_t aducm3029_irq_ctrl_init(struct irq_ctrl_desc **desc, const struct irq_init_param *param)
Initialized the controller for the ADuCM3029 external interrupts.
Definition: aducm3029_irq.c:101
aducm3029_irq_disable
int32_t aducm3029_irq_disable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Disable the interrupt.
Definition: aducm3029_irq.c:433
aducm3029_irq_global_enable
int32_t aducm3029_irq_global_enable(struct irq_ctrl_desc *desc)
Enable all previously enabled interrupts by irq_enable().
Definition: aducm3029_irq.c:327
aducm3029_irq_ctrl_remove
int32_t aducm3029_irq_ctrl_remove(struct irq_ctrl_desc *desc)
Free the resources allocated by irq_ctrl_init()
Definition: aducm3029_irq.c:134
aducm3029_irq_unregister
int32_t aducm3029_irq_unregister(struct irq_ctrl_desc *desc, uint32_t irq_id)
Unregister IRQ handling function for the specified irq_id.
Definition: aducm3029_irq.c:256
aducm3029_irq_global_disable
int32_t aducm3029_irq_global_disable(struct irq_ctrl_desc *desc)
Disable all external interrupts.
Definition: aducm3029_irq.c:354
aducm3029_irq_register_callback
int32_t aducm3029_irq_register_callback(struct irq_ctrl_desc *desc, uint32_t irq_id, struct callback_desc *callback_desc)
Registers a IRQ callback function to irq controller.
Definition: aducm3029_irq.c:164