// Generated by PeakRDL-cheader - A free and open-source header generator
//  https://github.com/SystemRDL/PeakRDL-cheader

#ifndef ATXMEGA_SPI_BF_H
#define ATXMEGA_SPI_BF_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <assert.h>

// Reg - atxmega_spi::CTRL
#define ATXMEGA_SPI__CTRL__PRESCALER_bm 0x3
#define ATXMEGA_SPI__CTRL__PRESCALER_bp 0
#define ATXMEGA_SPI__CTRL__PRESCALER_bw 2
#define ATXMEGA_SPI__CTRL__PRESCALER_reset 0x0
#define ATXMEGA_SPI__CTRL__MODE_bm 0xc
#define ATXMEGA_SPI__CTRL__MODE_bp 2
#define ATXMEGA_SPI__CTRL__MODE_bw 2
#define ATXMEGA_SPI__CTRL__MODE_reset 0x0
#define ATXMEGA_SPI__CTRL__MASTER_bm 0x10
#define ATXMEGA_SPI__CTRL__MASTER_bp 4
#define ATXMEGA_SPI__CTRL__MASTER_bw 1
#define ATXMEGA_SPI__CTRL__MASTER_reset 0x0
#define ATXMEGA_SPI__CTRL__DORD_bm 0x20
#define ATXMEGA_SPI__CTRL__DORD_bp 5
#define ATXMEGA_SPI__CTRL__DORD_bw 1
#define ATXMEGA_SPI__CTRL__DORD_reset 0x0
#define ATXMEGA_SPI__CTRL__ENABLE_bm 0x40
#define ATXMEGA_SPI__CTRL__ENABLE_bp 6
#define ATXMEGA_SPI__CTRL__ENABLE_bw 1
#define ATXMEGA_SPI__CTRL__ENABLE_reset 0x0
#define ATXMEGA_SPI__CTRL__CLK2X_bm 0x80
#define ATXMEGA_SPI__CTRL__CLK2X_bp 7
#define ATXMEGA_SPI__CTRL__CLK2X_bw 1
#define ATXMEGA_SPI__CTRL__CLK2X_reset 0x0
typedef union {
    struct __attribute__ ((__packed__)) {
        uint8_t PRESCALER :2;
        uint8_t MODE :2;
        uint8_t MASTER :1;
        uint8_t DORD :1;
        uint8_t ENABLE :1;
        uint8_t CLK2X :1;
    } f;
    uint8_t w;
} atxmega_spi__CTRL_t;

// Reg - atxmega_spi::INTCTRL
#define ATXMEGA_SPI__INTCTRL__INTLVL_bm 0x3
#define ATXMEGA_SPI__INTCTRL__INTLVL_bp 0
#define ATXMEGA_SPI__INTCTRL__INTLVL_bw 2
#define ATXMEGA_SPI__INTCTRL__INTLVL_reset 0x0
typedef union {
    struct __attribute__ ((__packed__)) {
        uint8_t INTLVL :2;
        uint8_t :6;
    } f;
    uint8_t w;
} atxmega_spi__INTCTRL_t;

// Reg - atxmega_spi::STATUS
#define ATXMEGA_SPI__STATUS__WRCOL_bm 0x40
#define ATXMEGA_SPI__STATUS__WRCOL_bp 6
#define ATXMEGA_SPI__STATUS__WRCOL_bw 1
#define ATXMEGA_SPI__STATUS__WRCOL_reset 0x0
#define ATXMEGA_SPI__STATUS__IF_bm 0x80
#define ATXMEGA_SPI__STATUS__IF_bp 7
#define ATXMEGA_SPI__STATUS__IF_bw 1
#define ATXMEGA_SPI__STATUS__IF_reset 0x0
typedef union {
    struct __attribute__ ((__packed__)) {
        uint8_t :6;
        uint8_t WRCOL :1;
        uint8_t IF :1;
    } f;
    uint8_t w;
} atxmega_spi__STATUS_t;

// Reg - atxmega_spi::DATA
#define ATXMEGA_SPI__DATA__WDATA_bm 0xff
#define ATXMEGA_SPI__DATA__WDATA_bp 0
#define ATXMEGA_SPI__DATA__WDATA_bw 8
#define ATXMEGA_SPI__DATA__RDATA_bm 0xff
#define ATXMEGA_SPI__DATA__RDATA_bp 0
#define ATXMEGA_SPI__DATA__RDATA_bw 8
typedef union {
    struct __attribute__ ((__packed__)) {
        uint8_t RDATA :8;
    } fr;
    struct __attribute__ ((__packed__)) {
        uint8_t WDATA :8;
    } fw;
    uint8_t w;
} atxmega_spi__DATA_t;

// Addrmap - atxmega_spi
typedef struct __attribute__ ((__packed__)) {
    atxmega_spi__CTRL_t CTRL;
    atxmega_spi__INTCTRL_t INTCTRL;
    atxmega_spi__STATUS_t STATUS;
    atxmega_spi__DATA_t DATA;
} atxmega_spi_t;


static_assert(sizeof(atxmega_spi_t) == 0x4, "Packing error");

#ifdef __cplusplus
}
#endif

#endif /* ATXMEGA_SPI_BF_H */
