#ifndef __CHEBY__IPINFO__H__
#define __CHEBY__IPINFO__H__
#define IPINFO_SIZE 20 /* 0x14 */

/* None */
#define IPINFO_STDVERSION 0x0UL
#define IPINFO_STDVERSION_MAJOR_MASK 0xff0000UL
#define IPINFO_STDVERSION_MAJOR_SHIFT 16
#define IPINFO_STDVERSION_MINOR_MASK 0xff00UL
#define IPINFO_STDVERSION_MINOR_SHIFT 8
#define IPINFO_STDVERSION_PATCH_MASK 0xffUL
#define IPINFO_STDVERSION_PATCH_SHIFT 0

/* IP Ident code */
#define IPINFO_IDENT 0x4UL

/* Firmware Version */
#define IPINFO_FIRMWAREVERSION 0x8UL
#define IPINFO_FIRMWAREVERSION_MAJOR_MASK 0xff0000UL
#define IPINFO_FIRMWAREVERSION_MAJOR_SHIFT 16
#define IPINFO_FIRMWAREVERSION_MINOR_MASK 0xff00UL
#define IPINFO_FIRMWAREVERSION_MINOR_SHIFT 8
#define IPINFO_FIRMWAREVERSION_PATCH_MASK 0xffUL
#define IPINFO_FIRMWAREVERSION_PATCH_SHIFT 0

/* Memory Map Version */
#define IPINFO_MEMMAPVERSION 0xcUL
#define IPINFO_MEMMAPVERSION_MAJOR_MASK 0xff0000UL
#define IPINFO_MEMMAPVERSION_MAJOR_SHIFT 16
#define IPINFO_MEMMAPVERSION_MINOR_MASK 0xff00UL
#define IPINFO_MEMMAPVERSION_MINOR_SHIFT 8
#define IPINFO_MEMMAPVERSION_PATCH_MASK 0xffUL
#define IPINFO_MEMMAPVERSION_PATCH_SHIFT 0

/* Echo register. This version of the standard foresees only 8bits linked to real memory */
#define IPINFO_ECHO 0x10UL
#define IPINFO_ECHO_ECHO_MASK 0xffUL
#define IPINFO_ECHO_ECHO_SHIFT 0
#define C_echo_unreachable 0xffUL
#define C_echo_initialized 0x80UL
#define C_echo_initializing 0x40UL
#define C_echo_error 0xc0UL
#define C_echo_uninitialized 0x0UL

#ifndef __ASSEMBLER__
struct ipInfo {
  /* [0x0]: REG (ro) (no description) */
  uint32_t stdVersion;

  /* [0x4]: REG (ro) IP Ident code */
  uint32_t ident;

  /* [0x8]: REG (ro) Firmware Version */
  uint32_t firmwareVersion;

  /* [0xc]: REG (ro) Memory Map Version */
  uint32_t memMapVersion;

  /* [0x10]: REG (rw) Echo register. This version of the standard foresees only 8bits linked to real memory */
  uint32_t echo;
};
#endif /* !__ASSEMBLER__*/

#endif /* __CHEBY__IPINFO__H__ */
