2024-05-30 18:32:23 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023 - 2024 MINRES Technologies GmbH
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2024-08-09 14:20:00 +02:00
|
|
|
* Generated at 2024-08-09 14:18:51 UTC
|
|
|
|
* by peakrdl_mnrs version 1.2.8
|
2024-05-30 18:32:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BSP_GPIO_H
|
|
|
|
#define _BSP_GPIO_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-08-11 17:29:43 +02:00
|
|
|
typedef struct {
|
2024-05-30 18:32:23 +02:00
|
|
|
volatile uint32_t VALUE;
|
|
|
|
volatile uint32_t WRITE;
|
|
|
|
volatile uint32_t WRITEENABLE;
|
2024-08-09 14:20:00 +02:00
|
|
|
volatile uint32_t IE;
|
|
|
|
volatile uint32_t IP;
|
|
|
|
volatile uint32_t IRQ_TRIGGER;
|
|
|
|
volatile uint32_t IRQ_TYPE;
|
|
|
|
volatile uint32_t BOOT_SEL;
|
2024-05-30 18:32:23 +02:00
|
|
|
}gpio_t;
|
|
|
|
|
|
|
|
#define GPIO_VALUE_OFFS 0
|
|
|
|
#define GPIO_VALUE_MASK 0xffffffff
|
|
|
|
#define GPIO_VALUE(V) ((V & GPIO_VALUE_MASK) << GPIO_VALUE_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_WRITE_OFFS 0
|
|
|
|
#define GPIO_WRITE_MASK 0xffffffff
|
|
|
|
#define GPIO_WRITE(V) ((V & GPIO_WRITE_MASK) << GPIO_WRITE_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_WRITEENABLE_OFFS 0
|
|
|
|
#define GPIO_WRITEENABLE_MASK 0xffffffff
|
|
|
|
#define GPIO_WRITEENABLE(V) ((V & GPIO_WRITEENABLE_MASK) << GPIO_WRITEENABLE_OFFS)
|
|
|
|
|
2024-08-09 14:20:00 +02:00
|
|
|
#define GPIO_IE_OFFS 0
|
|
|
|
#define GPIO_IE_MASK 0xffffffff
|
|
|
|
#define GPIO_IE(V) ((V & GPIO_IE_MASK) << GPIO_IE_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_IP_OFFS 0
|
|
|
|
#define GPIO_IP_MASK 0xffffffff
|
|
|
|
#define GPIO_IP(V) ((V & GPIO_IP_MASK) << GPIO_IP_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_IRQ_TRIGGER_OFFS 0
|
|
|
|
#define GPIO_IRQ_TRIGGER_MASK 0xffffffff
|
|
|
|
#define GPIO_IRQ_TRIGGER(V) ((V & GPIO_IRQ_TRIGGER_MASK) << GPIO_IRQ_TRIGGER_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_IRQ_TYPE_OFFS 0
|
|
|
|
#define GPIO_IRQ_TYPE_MASK 0xffffffff
|
|
|
|
#define GPIO_IRQ_TYPE(V) ((V & GPIO_IRQ_TYPE_MASK) << GPIO_IRQ_TYPE_OFFS)
|
|
|
|
|
|
|
|
#define GPIO_BOOT_SEL_OFFS 0
|
|
|
|
#define GPIO_BOOT_SEL_MASK 0x7
|
|
|
|
#define GPIO_BOOT_SEL(V) ((V & GPIO_BOOT_SEL_MASK) << GPIO_BOOT_SEL_OFFS)
|
|
|
|
|
2024-05-30 18:32:23 +02:00
|
|
|
//GPIO_VALUE
|
|
|
|
inline uint32_t get_gpio_value(volatile gpio_t* reg){
|
|
|
|
return (reg->VALUE >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_WRITE
|
|
|
|
inline uint32_t get_gpio_write(volatile gpio_t* reg){
|
|
|
|
return (reg->WRITE >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_write(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->WRITE = (reg->WRITE & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_WRITEENABLE
|
|
|
|
inline uint32_t get_gpio_writeEnable(volatile gpio_t* reg){
|
|
|
|
return (reg->WRITEENABLE >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_writeEnable(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->WRITEENABLE = (reg->WRITEENABLE & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
2024-08-09 14:20:00 +02:00
|
|
|
//GPIO_IE
|
|
|
|
inline uint32_t get_gpio_ie(volatile gpio_t* reg){
|
|
|
|
return (reg->IE >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_ie(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->IE = (reg->IE & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_IP
|
|
|
|
inline uint32_t get_gpio_ip(volatile gpio_t* reg){
|
|
|
|
return (reg->IP >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_ip(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->IP = (reg->IP & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_IRQ_TRIGGER
|
|
|
|
inline uint32_t get_gpio_irq_trigger(volatile gpio_t* reg){
|
|
|
|
return (reg->IRQ_TRIGGER >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_irq_trigger(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->IRQ_TRIGGER = (reg->IRQ_TRIGGER & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_IRQ_TYPE
|
|
|
|
inline uint32_t get_gpio_irq_type(volatile gpio_t* reg){
|
|
|
|
return (reg->IRQ_TYPE >> 0) & 0xffffffff;
|
|
|
|
}
|
|
|
|
inline void set_gpio_irq_type(volatile gpio_t* reg, uint32_t value){
|
|
|
|
reg->IRQ_TYPE = (reg->IRQ_TYPE & ~(0xffffffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//GPIO_BOOT_SEL
|
|
|
|
inline uint32_t get_gpio_boot_sel(volatile gpio_t* reg){
|
|
|
|
return reg->BOOT_SEL;
|
|
|
|
}
|
|
|
|
inline uint32_t get_gpio_boot_sel_bootSel(volatile gpio_t* reg){
|
|
|
|
return (reg->BOOT_SEL >> 0) & 0x7;
|
|
|
|
}
|
|
|
|
|
2024-08-11 17:29:43 +02:00
|
|
|
#endif /* _BSP_GPIO_H */
|