241 lines
8.1 KiB
C
241 lines
8.1 KiB
C
|
/*
|
||
|
* 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_APB3SPIMODULE_H
|
||
|
#define _BSP_APB3SPIMODULE_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
typedef struct __attribute((__packed__)) {
|
||
|
volatile uint32_t DATA;
|
||
|
volatile uint32_t STATUS;
|
||
|
volatile uint32_t CONFIG;
|
||
|
volatile uint32_t INTR;
|
||
|
volatile uint32_t SCLK_CONFIG;
|
||
|
volatile uint32_t SSGEN_SETUP;
|
||
|
volatile uint32_t SSGEN_HOLD;
|
||
|
volatile uint32_t SSGEN_DISABLE;
|
||
|
volatile uint32_t SSGEN_ACTIVE_HIGH;
|
||
|
volatile uint32_t XIP_ENABLE;
|
||
|
volatile uint32_t XIP_CONFIG;
|
||
|
volatile uint32_t XIP_MODE;
|
||
|
volatile uint32_t XIP_WRITE;
|
||
|
volatile uint32_t XIP_READ_WRITE;
|
||
|
volatile uint32_t XIP_READ;
|
||
|
}apb3spimodule_t;
|
||
|
|
||
|
static inline void set_apb3spimodule_data(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->DATA = (reg->DATA & ~(0xffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_write(volatile apb3spimodule_t *reg){
|
||
|
return (reg->DATA >> 8) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_write(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->DATA = (reg->DATA & ~(0x1U << 8)) | (value << 8);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_read(volatile apb3spimodule_t *reg){
|
||
|
return (reg->DATA >> 9) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_read(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->DATA = (reg->DATA & ~(0x1U << 9)) | (value << 9);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_kind(volatile apb3spimodule_t *reg){
|
||
|
return (reg->DATA >> 11) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_kind(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->DATA = (reg->DATA & ~(0x1U << 11)) | (value << 11);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_rx_data_invalid(volatile apb3spimodule_t *reg){
|
||
|
return (reg->DATA >> 31) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_tx_free(volatile apb3spimodule_t *reg){
|
||
|
return (reg->STATUS >> 0) & 0x3f;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_rx_avail(volatile apb3spimodule_t *reg){
|
||
|
return (reg->STATUS >> 16) & 0x3f;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_kind(volatile apb3spimodule_t *reg){
|
||
|
return (reg->CONFIG >> 0) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_kind(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->CONFIG = (reg->CONFIG & ~(0x3U << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_mode(volatile apb3spimodule_t *reg){
|
||
|
return (reg->CONFIG >> 4) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_mode(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->CONFIG = (reg->CONFIG & ~(0x3U << 4)) | (value << 4);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_tx_ie(volatile apb3spimodule_t *reg){
|
||
|
return (reg->INTR >> 0) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_tx_ie(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->INTR = (reg->INTR & ~(0x1U << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_rx_ie(volatile apb3spimodule_t *reg){
|
||
|
return (reg->INTR >> 1) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_rx_ie(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->INTR = (reg->INTR & ~(0x1U << 1)) | (value << 1);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_tx_ip(volatile apb3spimodule_t *reg){
|
||
|
return (reg->INTR >> 8) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_rx_ip(volatile apb3spimodule_t *reg){
|
||
|
return (reg->INTR >> 9) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_tx_active(volatile apb3spimodule_t *reg){
|
||
|
return (reg->INTR >> 16) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_clk_divider(volatile apb3spimodule_t *reg){
|
||
|
return (reg->SCLK_CONFIG >> 0) & 0xfff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_clk_divider(volatile apb3spimodule_t *reg, uint16_t value){
|
||
|
reg->SCLK_CONFIG = (reg->SCLK_CONFIG & ~(0xfffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_setup_cycles(volatile apb3spimodule_t *reg){
|
||
|
return (reg->SSGEN_SETUP >> 0) & 0xfff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_setup_cycles(volatile apb3spimodule_t *reg, uint16_t value){
|
||
|
reg->SSGEN_SETUP = (reg->SSGEN_SETUP & ~(0xfffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_hold_cycles(volatile apb3spimodule_t *reg){
|
||
|
return (reg->SSGEN_HOLD >> 0) & 0xfff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_hold_cycles(volatile apb3spimodule_t *reg, uint16_t value){
|
||
|
reg->SSGEN_HOLD = (reg->SSGEN_HOLD & ~(0xfffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_disable_cycles(volatile apb3spimodule_t *reg){
|
||
|
return (reg->SSGEN_DISABLE >> 0) & 0xfff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_disable_cycles(volatile apb3spimodule_t *reg, uint16_t value){
|
||
|
reg->SSGEN_DISABLE = (reg->SSGEN_DISABLE & ~(0xfffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_high_cycles(volatile apb3spimodule_t *reg){
|
||
|
return (reg->SSGEN_ACTIVE_HIGH >> 0) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_high_cycles(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->SSGEN_ACTIVE_HIGH = (reg->SSGEN_ACTIVE_HIGH & ~(0x1U << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_enable(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_ENABLE >> 0) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_enable(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_ENABLE = (reg->XIP_ENABLE & ~(0x1U << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_instruction(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_CONFIG >> 0) & 0xff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_instruction(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_CONFIG = (reg->XIP_CONFIG & ~(0xffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_enable(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_CONFIG >> 8) & 0x1;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_enable(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_CONFIG = (reg->XIP_CONFIG & ~(0x1U << 8)) | (value << 8);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_dummy_value(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_CONFIG >> 16) & 0xff;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_dummy_value(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_CONFIG = (reg->XIP_CONFIG & ~(0xffU << 16)) | (value << 16);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_dummy_count(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_CONFIG >> 24) & 0xf;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_dummy_count(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_CONFIG = (reg->XIP_CONFIG & ~(0xfU << 24)) | (value << 24);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_instruction(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_MODE >> 0) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_instruction(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_MODE = (reg->XIP_MODE & ~(0x3U << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_address(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_MODE >> 8) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_address(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_MODE = (reg->XIP_MODE & ~(0x3U << 8)) | (value << 8);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_dummy(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_MODE >> 16) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_dummy(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_MODE = (reg->XIP_MODE & ~(0x3U << 16)) | (value << 16);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_payload(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_MODE >> 24) & 0x3;
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_payload(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_MODE = (reg->XIP_MODE & ~(0x3U << 24)) | (value << 24);
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_data(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_WRITE = (reg->XIP_WRITE & ~(0xffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline void set_apb3spimodule_data(volatile apb3spimodule_t *reg, uint8_t value){
|
||
|
reg->XIP_READ_WRITE = (reg->XIP_READ_WRITE & ~(0xffU << 0)) | (value << 0);
|
||
|
}
|
||
|
|
||
|
static inline uint32_t get_apb3spimodule_data(volatile apb3spimodule_t *reg){
|
||
|
return (reg->XIP_READ >> 0) & 0xff;
|
||
|
}
|
||
|
|
||
|
#endif /* _BSP_APB3SPIMODULE_H */
|