2024-05-30 18:32:23 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023 - 2024 MINRES Technologies GmbH
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2024-06-10 10:13:07 +02:00
|
|
|
* Generated at 2024-06-08 13:20:02 UTC
|
2024-05-30 18:32:23 +02:00
|
|
|
* by peakrdl_mnrs version 1.2.5
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BSP_GPIO_H
|
|
|
|
#define _BSP_GPIO_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct __attribute((__packed__)) {
|
|
|
|
volatile uint32_t VALUE;
|
|
|
|
volatile uint32_t WRITE;
|
|
|
|
volatile uint32_t WRITEENABLE;
|
|
|
|
}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)
|
|
|
|
|
|
|
|
//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);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _BSP_GPIO_H */
|