Skip to content

Commit

Permalink
arch/arm/max326xx: add max32690 gpio driver
Browse files Browse the repository at this point in the history
definitions for the max32660 moved to max32660_gpio.h

the max32690 has much more options for the gpios
so this is a complete new driver
  • Loading branch information
lordrasmus committed Feb 13, 2025
1 parent 2e21426 commit 3d2ac2e
Show file tree
Hide file tree
Showing 6 changed files with 1,108 additions and 126 deletions.
2 changes: 2 additions & 0 deletions arch/arm/src/max326xx/hardware/max326_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
# include "hardware/max32620_30_gpio.h"
#elif defined(CONFIG_ARCH_FAMILY_MAX32660)
# include "hardware/max32660_gpio.h"
#elif defined(CONFIG_ARCH_FAMILY_MAX32690)
# include "hardware/max32690_gpio.h"
#else
# error "Unsupported MAX326XX family"
#endif
Expand Down
125 changes: 125 additions & 0 deletions arch/arm/src/max326xx/max32660/max32660_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,129 @@

typedef uint16_t max326_pinset_t;

#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif

/****************************************************************************
* Public Functions Prototypes
****************************************************************************/

/****************************************************************************
* Name: max326_gpio_irqinitialize
*
* Description:
* Initialize logic to support interrupting GPIO pins. This function is
* called by the OS initialization logic and is not a user interface.
*
* Assumptions:
* Called early in the boot-up sequence
*
****************************************************************************/

#ifdef CONFIG_MAX326XX_GPIOIRQ
void max326_gpio_irqinitialize(void);
#endif

/****************************************************************************
* Name: max326_gpio_config
*
* Description:
* Configure a GPIO pin based on bit-encoded description of the pin.
*
* Assumptions:
* - The pin interrupt has been disabled and all interrupt related bits
* have been set to zero by max436_gpio_config().
* - We are called in a critical section.
*
****************************************************************************/

int max326_gpio_config(max326_pinset_t pinset);

/****************************************************************************
* Name: max326_gpio_irqconfig
*
* Description:
* Configure a pin for interrupt operation. This function should not be
* called directory but, rather, indirectly through max326_gpio_config().
*
****************************************************************************/

#if defined( CONFIG_MAX326XX_GPIOIRQ )
void max326_gpio_irqconfig(max326_pinconfig_t pinset);
#endif

/****************************************************************************
* Name: max326_gpio_write
*
* Description:
* Write one or zero to the selected GPIO pin
*
****************************************************************************/

void max326_gpio_write(max326_pinconfig_t pinset, bool value);

/****************************************************************************
* Name: max326_gpio_read
*
* Description:
* Read one or zero from the selected GPIO pin
*
****************************************************************************/

bool max326_gpio_read(max326_pinset_t pinset);

/****************************************************************************
* Name: max326_gpio_irqdisable
*
* Description:
* Disable a GPIO pin interrupt. This function should not be called
* directly but, rather through up_disable_irq();
*
****************************************************************************/

#ifdef CONFIG_MAX326XX_GPIOIRQ
void max326_gpio_irqdisable(int irq);
#endif

/****************************************************************************
* Name: max326_gpio_irqenable
*
* Description:
* Enable a GPIO pin interrupt. This function should not be called
* directly but, rather through up_enable_irq();
*
****************************************************************************/

#ifdef CONFIG_MAX326XX_GPIOIRQ
void max326_gpio_irqenable(int irq);
#endif

/****************************************************************************
* Function: max326_gpio_dump
*
* Description:
* Decode and dump all GPIO registers associated with the port and pin
* numbers in the provided pinset.
*
****************************************************************************/

#ifdef CONFIG_DEBUG_GPIO_INFO
int max326_gpio_dump(max326_pinset_t pinset, const char *msg);
#else
# define max326_gpio_dump(p,m)
#endif

#ifdef __cplusplus
}

#endif
#endif /* __ASSEMBLY__ */

#endif /* __ARCH_ARM_SRC_MAX326XX_MAX32660_MAX32660_GPIO_H */
Loading

0 comments on commit 3d2ac2e

Please sign in to comment.