Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
intc_mchp_eic_g1.h File Reference

EIC driver header file for Microchip eic g1 peripheral. More...

#include <soc.h>
#include <zephyr/types.h>
#include <zephyr/drivers/gpio.h>

Go to the source code of this file.

Data Structures

struct  eic_config_params
 Parameters used to configure a Microchip EIC line for a GPIO pin. More...

Typedefs

typedef void(* mchp_eic_callback_t) (uint32_t pins, void *data)
 EIC ISR callback used to notify the GPIO layer of an interrupt.

Enumerations

enum  mchp_eic_trigger {
  MCHP_EIC_RISING = 1 , MCHP_EIC_FALLING , MCHP_EIC_BOTH , MCHP_EIC_HIGH ,
  MCHP_EIC_LOW
}
 EIC interrupt trigger selection. More...
enum  mchp_gpio_port_id {
  MCHP_PORT_ID0 = 0 , MCHP_PORT_ID1 , MCHP_PORT_ID2 , MCHP_PORT_ID3 ,
  MCHP_PORT_ID_MAX
}
 Microchip GPIO port identifiers. More...
enum  mchp_eic_line {
  EIC_LINE_0 = 0 , EIC_LINE_1 , EIC_LINE_2 , EIC_LINE_3 ,
  EIC_LINE_4 , EIC_LINE_5 , EIC_LINE_6 , EIC_LINE_7 ,
  EIC_LINE_8 , EIC_LINE_9 , EIC_LINE_10 , EIC_LINE_11 ,
  EIC_LINE_12 , EIC_LINE_13 , EIC_LINE_14 , EIC_LINE_15 ,
  EIC_LINE_MAX
}
 Microchip EIC (External Interrupt Controller) line identifiers. More...

Functions

int eic_mchp_config_interrupt (struct eic_config_params *eic_pin_config)
 Configure and enable an EIC interrupt for a given pin.
uint32_t eic_mchp_interrupt_pending (uint8_t port_id)
 Get the pending EIC interrupts for a given port.
int eic_mchp_disable_interrupt (struct eic_config_params *eic_pin_config)
 Disables an EIC interrupt for a given pin configuration.

Detailed Description

EIC driver header file for Microchip eic g1 peripheral.

This can be used to access the APIs implemented for the eic driver.

Typedef Documentation

◆ mchp_eic_callback_t

typedef void(* mchp_eic_callback_t) (uint32_t pins, void *data)

EIC ISR callback used to notify the GPIO layer of an interrupt.

Parameters
[in]pinsBitmask of GPIO pins that triggered (bit n => pin n).
[in]dataUser/driver context pointer associated with the GPIO port.
Note
Called from interrupt context.

Enumeration Type Documentation

◆ mchp_eic_line

Microchip EIC (External Interrupt Controller) line identifiers.

Enumerator
EIC_LINE_0 

EIC line 0.

EIC_LINE_1 

EIC line 1.

EIC_LINE_2 

EIC line 2.

EIC_LINE_3 

EIC line 3.

EIC_LINE_4 

EIC line 4.

EIC_LINE_5 

EIC line 5.

EIC_LINE_6 

EIC line 6.

EIC_LINE_7 

EIC line 7.

EIC_LINE_8 

EIC line 8.

EIC_LINE_9 

EIC line 9.

EIC_LINE_10 

EIC line 10.

EIC_LINE_11 

EIC line 11.

EIC_LINE_12 

EIC line 12.

EIC_LINE_13 

EIC line 13.

EIC_LINE_14 

EIC line 14.

EIC_LINE_15 

EIC line 15.

EIC_LINE_MAX 

Number of EIC lines (sentinel).

◆ mchp_eic_trigger

EIC interrupt trigger selection.

Enumerator
MCHP_EIC_RISING 

Interrupt on rising edge.

MCHP_EIC_FALLING 

Interrupt on falling edge.

MCHP_EIC_BOTH 

Interrupt on both rising and falling edges.

MCHP_EIC_HIGH 

Interrupt when input is high (level).

MCHP_EIC_LOW 

Interrupt when input is low (level).

◆ mchp_gpio_port_id

Microchip GPIO port identifiers.

Enumerator
MCHP_PORT_ID0 

GPIO Port 0.

MCHP_PORT_ID1 

GPIO Port 1.

MCHP_PORT_ID2 

GPIO Port 2.

MCHP_PORT_ID3 

GPIO Port 3.

MCHP_PORT_ID_MAX 

Number of ports (sentinel).

Function Documentation

◆ eic_mchp_config_interrupt()

int eic_mchp_config_interrupt ( struct eic_config_params * eic_pin_config)

Configure and enable an EIC interrupt for a given pin.

This function configures the EIC interrupt for the specified pin, including setting up the trigger type, enabling input, configuring debounce if required, and updating the internal data structures to reflect the new assignment of pin to an eic line.

Parameters
eic_pin_configPointer to the EIC pin configuration structure.
Returns
0 on success, or a negative error code on failure:
  • -ENOTSUP if no EIC line is available for the pin.
  • -EBUSY if the EIC line is already in use.

◆ eic_mchp_disable_interrupt()

int eic_mchp_disable_interrupt ( struct eic_config_params * eic_pin_config)

Disables an EIC interrupt for a given pin configuration.

This function disables the EIC interrupt associated with the specified pin configuration. It checks if the pin is currently assigned to an EIC line, disables the interrupt line if so, and updates the internal data structures to mark the line as free.

Parameters
eic_pin_configPointer to the EIC pin configuration structure.
Returns
0 on success, or a negative error code on failure.

◆ eic_mchp_interrupt_pending()

uint32_t eic_mchp_interrupt_pending ( uint8_t port_id)

Get the pending EIC interrupts for a given port.

This function checks which pins in the specified port have pending EIC interrupts. It returns a bitmask where each set bit corresponds to a pin with a pending interrupt.

Parameters
port_idThe identifier of the port to check for pending interrupts.
Returns
A bitmask indicating which pins in the port have pending interrupts. Each bit set in the return value corresponds to a pin number with a pending interrupt.