no-OS
Classes | Macros | Functions | Variables
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. More...
 
int32_t 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. More...
 
int32_t aducm3029_irq_ctrl_remove (struct no_os_irq_ctrl_desc *desc)
 Free the resources allocated by no_os_irq_ctrl_init() More...
 
int32_t 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. More...
 
int32_t 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. More...
 
int32_t aducm3029_irq_global_enable (struct no_os_irq_ctrl_desc *desc)
 Enable all previously enabled interrupts by no_os_irq_enable(). More...
 
int32_t aducm3029_irq_global_disable (struct no_os_irq_ctrl_desc *desc)
 Disable all external interrupts. More...
 
int32_t aducm3029_irq_enable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Enable the interrupt. More...
 
int32_t aducm3029_irq_disable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Disable the interrupt. More...
 

Variables

const struct no_os_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.

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.

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

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

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

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

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

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

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

int32_t 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,
}

Aducm3029 platform specific IRQ platform ops structure.

ADuCM3029 specific IRQ platform ops structure.

aducm3029_irq_ctrl_init
int32_t 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:205
aducm3029_irq_ctrl_remove
int32_t 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:235
aducm3029_irq_enable
int32_t aducm3029_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable the interrupt.
Definition: aducm3029_irq.c:452
aducm3029_irq_unregister_callback
int32_t 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:371
aducm3029_irq_global_disable
int32_t aducm3029_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable all external interrupts.
Definition: aducm3029_irq.c:425
aducm3029_irq_register_callback
int32_t 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:257
aducm3029_irq_disable
int32_t aducm3029_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable the interrupt.
Definition: aducm3029_irq.c:494
aducm3029_irq_global_enable
int32_t 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:408