/*
  Register definitions for slave core: Vectored Interrupt Controller (VIC)

  * File           : vic-regs.h
  * Author         : auto-generated by wbgen2 from vic-regs.wb
  * Standard       : ANSI C

    THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE vic-regs.wb
    DO NOT HAND-EDIT UNLESS IT'S ABSOLUTELY NECESSARY!

*/

#ifndef __WBGEN2_REGDEFS_VIC
#define __WBGEN2_REGDEFS_VIC

#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif


#if defined( __GNUC__)
#define PACKED __attribute__ ((packed))
#else
#error "Unsupported compiler?"
#endif

#ifndef __WBGEN2_MACROS_DEFINED__
#define __WBGEN2_MACROS_DEFINED__
#define WBGEN2_GEN_MASK(offset, size) (((1<<(size))-1) << (offset))
#define WBGEN2_GEN_WRITE(value, offset, size) (((value) & ((1<<(size))-1)) << (offset))
#define WBGEN2_GEN_READ(reg, offset, size) (((reg) >> (offset)) & ((1<<(size))-1))
#define WBGEN2_SIGN_EXTEND(value, bits) (((value) & (1<<bits) ? ~((1<<(bits))-1): 0 ) | (value))
#endif


/* definitions for register: VIC Control Register */

/* definitions for field: VIC Enable in reg: VIC Control Register */
#define VIC_CTL_ENABLE                        WBGEN2_GEN_MASK(0, 1)

/* definitions for field: VIC output polarity in reg: VIC Control Register */
#define VIC_CTL_POL                           WBGEN2_GEN_MASK(1, 1)

/* definitions for field: Emulate Edge sensitive output in reg: VIC Control Register */
#define VIC_CTL_EMU_EDGE                      WBGEN2_GEN_MASK(2, 1)

/* definitions for field: Emulated Edge pulse timer in reg: VIC Control Register */
#define VIC_CTL_EMU_LEN_MASK                  WBGEN2_GEN_MASK(3, 16)
#define VIC_CTL_EMU_LEN_SHIFT                 3
#define VIC_CTL_EMU_LEN_W(value)              WBGEN2_GEN_WRITE(value, 3, 16)
#define VIC_CTL_EMU_LEN_R(reg)                WBGEN2_GEN_READ(reg, 3, 16)

/* definitions for register: Raw Interrupt Status Register */

/* definitions for register: Interrupt Enable Register */

/* definitions for register: Interrupt Disable Register */

/* definitions for register: Interrupt Mask Register */

/* definitions for register: Vector Address Register */

/* definitions for register: Software Interrupt Register */

/* definitions for register: End Of Interrupt Acknowledge Register */
/* definitions for RAM: Interrupt Vector Table */
#define VIC_IVT_RAM_BYTES 0x00000080 /* size in bytes */                               
#define VIC_IVT_RAM_WORDS 0x00000020 /* size in 32-bit words, 32-bit aligned */        

PACKED struct VIC_WB {
  /* [0x0]: REG VIC Control Register */
  uint32_t CTL;
  /* [0x4]: REG Raw Interrupt Status Register */
  uint32_t RISR;
  /* [0x8]: REG Interrupt Enable Register */
  uint32_t IER;
  /* [0xc]: REG Interrupt Disable Register */
  uint32_t IDR;
  /* [0x10]: REG Interrupt Mask Register */
  uint32_t IMR;
  /* [0x14]: REG Vector Address Register */
  uint32_t VAR;
  /* [0x18]: REG Software Interrupt Register */
  uint32_t SWIR;
  /* [0x1c]: REG End Of Interrupt Acknowledge Register */
  uint32_t EOIR;
  /* padding to: 32 words */
  uint32_t __padding_0[24];
  /* [0x80 - 0xff]: RAM Interrupt Vector Table, 32 32-bit words, 32-bit aligned, word-addressable */
  uint32_t IVT_RAM [32];
};

#endif
