#ifndef __CHEBY__HWINFO__H__
#define __CHEBY__HWINFO__H__
#define HWINFO_SIZE 256 /* 0x100 */

/* None */
#define HWINFO_STDVERSION 0x0UL
#define HWINFO_STDVERSION_PLATFORM_MASK 0xff000000UL
#define HWINFO_STDVERSION_PLATFORM_SHIFT 24
#define HWINFO_STDVERSION_MAJOR_MASK 0xff0000UL
#define HWINFO_STDVERSION_MAJOR_SHIFT 16
#define HWINFO_STDVERSION_MINOR_MASK 0xff00UL
#define HWINFO_STDVERSION_MINOR_SHIFT 8
#define HWINFO_STDVERSION_PATCH_MASK 0xffUL
#define HWINFO_STDVERSION_PATCH_SHIFT 0

/* HW serial number */
#define HWINFO_SERIALNUMBER 0x8UL

/* Module ID code */
#define HWINFO_IDENT 0x10UL
#define HWINFO_IDENT_JTAGREMOTEDISABLE 0x8000UL
#define HWINFO_IDENT_EXTENDEDID_MASK 0x7f00UL
#define HWINFO_IDENT_EXTENDEDID_SHIFT 8
#define HWINFO_IDENT_CARDID_MASK 0xffUL
#define HWINFO_IDENT_CARDID_SHIFT 0

/* Firmware Version */
#define HWINFO_FIRMWAREVERSION 0x14UL
#define HWINFO_FIRMWAREVERSION_MAJOR_MASK 0xff0000UL
#define HWINFO_FIRMWAREVERSION_MAJOR_SHIFT 16
#define HWINFO_FIRMWAREVERSION_MINOR_MASK 0xff00UL
#define HWINFO_FIRMWAREVERSION_MINOR_SHIFT 8
#define HWINFO_FIRMWAREVERSION_PATCH_MASK 0xffUL
#define HWINFO_FIRMWAREVERSION_PATCH_SHIFT 0

/* Memory Map Version */
#define HWINFO_MEMMAPVERSION 0x18UL
#define HWINFO_MEMMAPVERSION_MAJOR_MASK 0xff0000UL
#define HWINFO_MEMMAPVERSION_MAJOR_SHIFT 16
#define HWINFO_MEMMAPVERSION_MINOR_MASK 0xff00UL
#define HWINFO_MEMMAPVERSION_MINOR_SHIFT 8
#define HWINFO_MEMMAPVERSION_PATCH_MASK 0xffUL
#define HWINFO_MEMMAPVERSION_PATCH_SHIFT 0

/* Echo register */
#define HWINFO_ECHO 0x1cUL
#define HWINFO_ECHO_ECHO_MASK 0xffUL
#define HWINFO_ECHO_ECHO_SHIFT 0

/* In order to use the new standard concurrently with the old standard, the bits 31-30 of the old memmapVersion register are used (see comment) */
#define HWINFO_SETSTANDARD 0xfcUL
#define HWINFO_SETSTANDARD_VAL_MASK 0xc0000000UL
#define HWINFO_SETSTANDARD_VAL_SHIFT 30
#define C_standardType_datecode 0x0UL
#define C_standardType_semanticNumber 0x1UL
#define C_standardType_uTCA 0x2UL

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

  /* padding to: 2 words */
  uint32_t __padding_0[1];

  /* [0x8]: REG (ro) HW serial number */
  uint64_t serialNumber;

  /* [0x10]: REG (ro) Module ID code */
  uint16_t ident;

  /* padding to: 20 words */
  uint8_t __padding_1[2];

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

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

  /* [0x1c]: REG (rw) Echo register */
  uint32_t echo;

  /* padding to: 63 words */
  uint32_t __padding_2[55];

  /* [0xfc]: REG (ro) In order to use the new standard concurrently with the old standard, the bits 31-30 of the old memmapVersion register are used (see comment) */
  uint32_t setStandard;
};
#endif /* !__ASSEMBLER__*/

#endif /* __CHEBY__HWINFO__H__ */
