/* * 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_UARTMODULE_H #define _BSP_UARTMODULE_H #include typedef struct __attribute((__packed__)) { volatile uint32_t RX_TX_REG; volatile uint32_t INT_CTRL_REG; volatile uint32_t CLK_DIVIDER_REG; volatile uint32_t FRAME_CONFIG_REG; volatile uint32_t STATUS_REG; }uartmodule_t; static inline uint32_t get_uartmodule_data(volatile uartmodule_t *reg){ return (reg->RX_TX_REG >> 0) & 0xff; } static inline void set_uartmodule_data(volatile uartmodule_t *reg, uint8_t value){ reg->RX_TX_REG = (reg->RX_TX_REG & ~(0xffU << 0)) | (value << 0); } static inline uint32_t get_uartmodule_rx_avail(volatile uartmodule_t *reg){ return (reg->RX_TX_REG >> 14) & 0x1; } static inline uint32_t get_uartmodule_tx_free(volatile uartmodule_t *reg){ return (reg->RX_TX_REG >> 15) & 0x1; } static inline uint32_t get_uartmodule_write_intr_enable(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 0) & 0x1; } static inline void set_uartmodule_write_intr_enable(volatile uartmodule_t *reg, uint8_t value){ reg->INT_CTRL_REG = (reg->INT_CTRL_REG & ~(0x1U << 0)) | (value << 0); } static inline uint32_t get_uartmodule_read_intr_enable(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 1) & 0x1; } static inline void set_uartmodule_read_intr_enable(volatile uartmodule_t *reg, uint8_t value){ reg->INT_CTRL_REG = (reg->INT_CTRL_REG & ~(0x1U << 1)) | (value << 1); } static inline uint32_t get_uartmodule_break_intr_enable(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 2) & 0x1; } static inline void set_uartmodule_break_intr_enable(volatile uartmodule_t *reg, uint8_t value){ reg->INT_CTRL_REG = (reg->INT_CTRL_REG & ~(0x1U << 2)) | (value << 2); } static inline uint32_t get_uartmodule_write_intr_pend(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 8) & 0x1; } static inline uint32_t get_uartmodule_read_intr_pend(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 9) & 0x1; } static inline uint32_t get_uartmodule_break_intr_pend(volatile uartmodule_t *reg){ return (reg->INT_CTRL_REG >> 10) & 0x1; } static inline uint32_t get_uartmodule_clock_divider(volatile uartmodule_t *reg){ return (reg->CLK_DIVIDER_REG >> 0) & 0xfffff; } static inline void set_uartmodule_clock_divider(volatile uartmodule_t *reg, uint32_t value){ reg->CLK_DIVIDER_REG = (reg->CLK_DIVIDER_REG & ~(0xfffffU << 0)) | (value << 0); } static inline uint32_t get_uartmodule_data_lenght(volatile uartmodule_t *reg){ return (reg->FRAME_CONFIG_REG >> 0) & 0x7; } static inline void set_uartmodule_data_lenght(volatile uartmodule_t *reg, uint8_t value){ reg->FRAME_CONFIG_REG = (reg->FRAME_CONFIG_REG & ~(0x7U << 0)) | (value << 0); } static inline uint32_t get_uartmodule_parity(volatile uartmodule_t *reg){ return (reg->FRAME_CONFIG_REG >> 3) & 0x3; } static inline void set_uartmodule_parity(volatile uartmodule_t *reg, uint8_t value){ reg->FRAME_CONFIG_REG = (reg->FRAME_CONFIG_REG & ~(0x3U << 3)) | (value << 3); } static inline uint32_t get_uartmodule_stop_bit(volatile uartmodule_t *reg){ return (reg->FRAME_CONFIG_REG >> 5) & 0x1; } static inline void set_uartmodule_stop_bit(volatile uartmodule_t *reg, uint8_t value){ reg->FRAME_CONFIG_REG = (reg->FRAME_CONFIG_REG & ~(0x1U << 5)) | (value << 5); } static inline uint32_t get_uartmodule_read_error(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 0) & 0x1; } static inline uint32_t get_uartmodule_stall(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 1) & 0x1; } static inline uint32_t get_uartmodule_break_line(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 8) & 0x1; } static inline uint32_t get_uartmodule_break_detected(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 9) & 0x1; } static inline void set_uartmodule_break_detected(volatile uartmodule_t *reg, uint8_t value){ reg->STATUS_REG = (reg->STATUS_REG & ~(0x1U << 9)) | (value << 9); } static inline uint32_t get_uartmodule_set_break(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 10) & 0x1; } static inline void set_uartmodule_set_break(volatile uartmodule_t *reg, uint8_t value){ reg->STATUS_REG = (reg->STATUS_REG & ~(0x1U << 10)) | (value << 10); } static inline uint32_t get_uartmodule_clear_break(volatile uartmodule_t *reg){ return (reg->STATUS_REG >> 11) & 0x1; } static inline void set_uartmodule_clear_break(volatile uartmodule_t *reg, uint8_t value){ reg->STATUS_REG = (reg->STATUS_REG & ~(0x1U << 11)) | (value << 11); } #endif /* _BSP_UARTMODULE_H */