/* * Copyright (c) 2023 - 2024 MINRES Technologies GmbH * * SPDX-License-Identifier: Apache-2.0 * * Generated at 2024-04-22 11:11:53 UTC * by peakrdl_mnrs version 1.2.2 */ #ifndef _BSP_TIMERMODULE_H #define _BSP_TIMERMODULE_H #include typedef struct __attribute((__packed__)) { volatile uint32_t PRESCALER; volatile uint32_t T0_CTRL; volatile uint32_t T0_OVERFLOW; volatile uint32_t T0_VALUE; volatile uint32_t T1_CTRL; volatile uint32_t T1_OVERFLOW; volatile uint32_t T1_VALUE; }timermodule_t; static inline uint32_t get_timermodule_limit(volatile timermodule_t *reg){ return (reg->PRESCALER >> 0) & 0xffff; } static inline void set_timermodule_limit(volatile timermodule_t *reg, uint16_t value){ reg->PRESCALER = (reg->PRESCALER & ~(0xffffU << 0)) | (value << 0); } static inline uint32_t get_timermodule_enable(volatile timermodule_t *reg){ return (reg->T0_CTRL >> 0) & 0x7; } static inline void set_timermodule_enable(volatile timermodule_t *reg, uint8_t value){ reg->T0_CTRL = (reg->T0_CTRL & ~(0x7U << 0)) | (value << 0); } static inline uint32_t get_timermodule_clear(volatile timermodule_t *reg){ return (reg->T0_CTRL >> 3) & 0x3; } static inline void set_timermodule_clear(volatile timermodule_t *reg, uint8_t value){ reg->T0_CTRL = (reg->T0_CTRL & ~(0x3U << 3)) | (value << 3); } static inline uint32_t get_timermodule_limit(volatile timermodule_t *reg){ return (reg->T0_OVERFLOW >> 0) & 0xffffffff; } static inline void set_timermodule_limit(volatile timermodule_t *reg, uint32_t value){ reg->T0_OVERFLOW = (reg->T0_OVERFLOW & ~(0xffffffffU << 0)) | (value << 0); } static inline uint32_t get_timermodule_value(volatile timermodule_t *reg){ return (reg->T0_VALUE >> 0) & 0xffffffff; } static inline uint32_t get_timermodule_enable(volatile timermodule_t *reg){ return (reg->T1_CTRL >> 0) & 0x7; } static inline void set_timermodule_enable(volatile timermodule_t *reg, uint8_t value){ reg->T1_CTRL = (reg->T1_CTRL & ~(0x7U << 0)) | (value << 0); } static inline uint32_t get_timermodule_clear(volatile timermodule_t *reg){ return (reg->T1_CTRL >> 3) & 0x3; } static inline void set_timermodule_clear(volatile timermodule_t *reg, uint8_t value){ reg->T1_CTRL = (reg->T1_CTRL & ~(0x3U << 3)) | (value << 3); } static inline uint32_t get_timermodule_limit(volatile timermodule_t *reg){ return (reg->T1_OVERFLOW >> 0) & 0xffffffff; } static inline void set_timermodule_limit(volatile timermodule_t *reg, uint32_t value){ reg->T1_OVERFLOW = (reg->T1_OVERFLOW & ~(0xffffffffU << 0)) | (value << 0); } static inline uint32_t get_timermodule_value(volatile timermodule_t *reg){ return (reg->T1_VALUE >> 0) & 0xffffffff; } #endif /* _BSP_TIMERMODULE_H */