no-OS
Classes | Macros | Functions | Variables
pico_irq.c File Reference

Implementation of external irq driver. More...

#include "no_os_irq.h"
#include "no_os_list.h"
#include "no_os_uart.h"
#include "no_os_util.h"
#include "no_os_error.h"
#include "no_os_timer.h"
#include "no_os_alloc.h"
#include "pico_irq.h"
#include "pico_uart.h"
#include "pico_timer.h"
#include "pico/stdlib.h"
#include "hardware/irq.h"
Include dependency graph for pico_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...
 

Macros

#define PICO_IRQ_NB   26u
 

Functions

void on_uart0_rx (void)
 UART0 RX interrupt handler. More...
 
void on_uart1_rx (void)
 UART1 RX interrupt handler. More...
 
int32_t irq_action_cmp (void *data1, void *data2)
 Action comparator function. More...
 
int32_t pico_irq_ctrl_init (struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
 Initialized the controller for pico external interrupts. More...
 
int32_t pico_irq_ctrl_remove (struct no_os_irq_ctrl_desc *desc)
 Free the resources allocated by irq_ctrl_init(). More...
 
int32_t pico_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 pico_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 pico_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 pico_irq_global_enable (struct no_os_irq_ctrl_desc *desc)
 Enable all interrupts. More...
 
int32_t pico_irq_global_disable (struct no_os_irq_ctrl_desc *desc)
 Disable all interrupts. More...
 
int32_t pico_irq_enable (struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
 Enable a specific interrupt. More...
 
int32_t pico_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 pico_irq_ops
 pico specific IRQ platform ops structure More...
 

Detailed Description

Implementation of external irq driver.

Author
RBolboac (ramon.nosp@m.a.bo.nosp@m.lboac.nosp@m.a@an.nosp@m.alog..nosp@m.com)

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.

Macro Definition Documentation

◆ PICO_IRQ_NB

#define PICO_IRQ_NB   26u

Function Documentation

◆ 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.

◆ on_uart0_rx()

void on_uart0_rx ( void  )

UART0 RX interrupt handler.

Here is the caller graph for this function:

◆ on_uart1_rx()

void on_uart1_rx ( void  )

UART1 RX interrupt handler.

Here is the caller graph for this function:

◆ pico_irq_ctrl_init()

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

Initialized the controller for pico external interrupts.

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

◆ pico_irq_ctrl_remove()

int32_t pico_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, error code otherwise.

◆ pico_irq_disable()

int32_t pico_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 if successful, error code otherwise.

◆ pico_irq_enable()

int32_t pico_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 if successful, error code otherwise.

◆ pico_irq_global_disable()

int32_t pico_irq_global_disable ( struct no_os_irq_ctrl_desc desc)

Disable all interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ pico_irq_global_enable()

int32_t pico_irq_global_enable ( struct no_os_irq_ctrl_desc desc)

Enable all interrupts.

Parameters
desc- Interrupt controller descriptor.
Returns
0

◆ pico_irq_register_callback()

int32_t pico_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 successful, error code otherwise.

◆ pico_irq_unregister_callback()

int32_t pico_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 successful, error code otherwise.

◆ pico_trigger_level_set()

int32_t pico_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

◆ pico_irq_ops

const struct no_os_irq_platform_ops pico_irq_ops
Initial value:
= {
.trigger_level_set = &pico_trigger_level_set,
.register_callback = &pico_irq_register_callback,
.unregister_callback = &pico_irq_unregister_callback,
.global_enable = &pico_irq_global_enable,
.global_disable = &pico_irq_global_disable,
.enable = &pico_irq_enable,
.disable = &pico_irq_disable,
.set_priority = &pico_irq_set_priority,
}

pico specific IRQ platform ops structure

pico platform specific irq platform ops structure

pico_irq_global_disable
int32_t pico_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable all interrupts.
Definition: pico_irq.c:349
pico_irq_unregister_callback
int32_t pico_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
Unregister a callback.
Definition: pico_irq.c:313
pico_irq_disable
int32_t pico_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable a specific interrupt.
Definition: pico_irq.c:383
pico_irq_enable
int32_t pico_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable a specific interrupt.
Definition: pico_irq.c:367
pico_irq_ctrl_init
int32_t pico_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialized the controller for pico external interrupts.
Definition: pico_irq.c:169
pico_irq_register_callback
int32_t pico_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *cb)
Register a callback.
Definition: pico_irq.c:228
pico_irq_global_enable
int32_t pico_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable all interrupts.
Definition: pico_irq.c:336
pico_trigger_level_set
int32_t pico_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level level)
Unused.
Definition: pico_irq.c:214
pico_irq_ctrl_remove
int32_t pico_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by irq_ctrl_init().
Definition: pico_irq.c:197