/*******************************************************************************
 * (c) Copyright 2010 Actel Corporation.  All rights reserved.
 *
 *  SmartFusion MPM reference design driver API providing the firmware
 *  interface to the MPM engine. This file contains #defines describing
 *  the MPM configuration register map.
 *
 *  SVN $Revision: 13756 $
 *  SVN $Date: 2010-07-15 14:47:11 +0100 (Thu, 15 Jul 2010) $
 *
 */

#ifdef MPM_ENABLE_I2C

/* I2C slave register address details */
#define MPM_I2C_CONFIG_REG_MIN_ADDR		(0x0000)
#define MPM_I2C_CONFIG_REG_MAX_ADDR		(0x0C07)
#define MPM_I2C_CLEAR_LOG_REG_ADDR		(0x0C07)
#define MPM_I2C_MONITOR_REG_MIN_ADDR	(0x0D00)
#define MPM_I2C_MONITOR_REG_MAX_ADDR	(0x0D3F)
#define MPM_I2C_STATUS_REG_ADDR			(0x0D40)
#define MPM_I2C_LOG_STATUS_REG_ADDR		(0x0D41)
#define MPM_I2C_RTC_REG_MIN_ADDR		(0x0D42)
#define MPM_I2C_RTC_REG_MAX_ADDR		(0x0D46)
#define MPM_I2C_LOG_MIN_ADDR			(0x1000)
#define MPM_I2C_LOG_MAX_ADDR			(0x7FFF)
#define MPM_I2C_CMD_REG_ADDR			(0x8000)

/* MPM I2C command opcodes */
#define MPM_I2C_CMD_START		(1)
#define MPM_I2C_CMD_STOP		(2)
#define MPM_I2C_CMD_MARGIN_LOW	(3)
#define MPM_I2C_CMD_MARGIN_NOM	(4)
#define MPM_I2C_CMD_MARGIN_HIGH	(5)
#define MPM_I2C_CMD_INIT		(6)

#endif

/* All sizes and addresses are bit sizes and bit addresses */
#define ByteSizeInBits 8
#define ChannelPageBase 0x0000
#define OutputPageBase 0x4000
#define MiscPageBase 0x6000

#define ChannelPageSize 512
#define OutputPageSize 256
#define MiscPageSize 2048

#define Channel_ControlerIsDigital (0x0000 + 0)
#define Channel_iHysteresis (0x0000 + 16)
#define Channel_iOV2Limit (0x0000 + 32)
#define Channel_iOV1Limit (0x0000 + 48)
#define Channel_iUV1Limit (0x0000 + 64)
#define Channel_iUV2Limit (0x0000 + 80)
#define Channel_iOFFLimit (0x0000 + 96)
#define Channel_iSlot (0x0000 + 112)
#define Channel_iOnDelay (0x0000 + 128)
#define Channel_iOffDelay (0x0000 + 144)
#define Channel_iControllerType (0x0000 + 160)
#define Channel_iTrimType (0x0000 + 161)
#define Channel_iNominal (0x0000 + 176)
#define Channel_iTrimStartUpDelay (0x0000 + 192)
#define Channel_iTrimPinVoltage (0x0000 + 208)
#define Channel_iTrimHighTrim (0x0000 + 224)
#define Channel_iTrimLowTrim (0x0000 + 240)
#define Channel_iMarginHighTrim (0x0000 + 256)
#define Channel_iMarginLowTrim (0x0000 + 272)
#define Channel_iI2CBus (0x0000 + 288)
#define Channel_iI2CAddress (0x0000 + 304)
#define Output_iRailA1 (0x4000 + 0)
#define Output_iRailA2 (0x4000 + 4)
#define Output_iRailA3 (0x4000 + 8)
#define Output_iRailA4 (0x4000 + 12)
#define Output_iRailA5 (0x4000 + 16)
#define Output_iRailA6 (0x4000 + 20)
#define Output_iRailA7 (0x4000 + 24)
#define Output_iRailA8 (0x4000 + 28)
#define Output_iRailA9 (0x4000 + 32)
#define Output_iRailA10 (0x4000 + 36)
#define Output_iRailA11 (0x4000 + 40)
#define Output_iRailA12 (0x4000 + 44)
#define Output_iRailA13 (0x4000 + 48)
#define Output_iRailA14 (0x4000 + 52)
#define Output_iRailA15 (0x4000 + 56)
#define Output_iRailA16 (0x4000 + 60)
#define Output_iRailA17 (0x4000 + 64)
#define Output_iRailA18 (0x4000 + 68)
#define Output_iRailA19 (0x4000 + 72)
#define Output_iRailA20 (0x4000 + 76)
#define Output_iRailA21 (0x4000 + 80)
#define Output_iRailA22 (0x4000 + 84)
#define Output_iRailA23 (0x4000 + 88)
#define Output_iRailA24 (0x4000 + 92)
#define Output_iRailA25 (0x4000 + 96)
#define Output_iRailA26 (0x4000 + 100)
#define Output_iRailA27 (0x4000 + 104)
#define Output_iRailA28 (0x4000 + 108)
#define Output_iRailA29 (0x4000 + 112)
#define Output_iRailA30 (0x4000 + 116)
#define Output_iRailA31 (0x4000 + 120)
#define Output_iRailA32 (0x4000 + 124)
#define Output_iCombine (0x4000 + 128)
#define Output_PinsAssertedLo (0x4000 + 131)
#define Output_Combiner (0x4000 + 132)
#define Output_bUpdateOutput (0x4000 + 133)
#define Output_bLogDuringPowerOnSequence (0x4000 + 134)
#define Output_bLogDuringPowerOffSequence (0x4000 + 135)
#define Output_bLog01Transitions (0x4000 + 136)
#define Output_bLog10Transitions (0x4000 + 137)
#define Misc_iOnFail (0x6000 + 0)
#define Misc_iSlotTimeout (0x6000 + 16)
#define Misc_PowerOffSequence (0x6000 + 32)
#define Misc_AfterPowerOff (0x6000 + 34)
#define Misc_iI2CAddress (0x6000 + 40)
#define Misc_bMPMState (0x6000 + 48)
#define Misc_bPowerOnEvents (0x6000 + 49)
#define Misc_bPowerOffEvents (0x6000 + 50)
#define Misc_bClearLog (0x6000 + 56)

#define Channel_ControlerIsDigitalSize 1
#define Channel_iHysteresisSize 16
#define Channel_iOV2LimitSize 16
#define Channel_iOV1LimitSize 16
#define Channel_iUV1LimitSize 16
#define Channel_iUV2LimitSize 16
#define Channel_iOFFLimitSize 16
#define Channel_iSlotSize 6
#define Channel_iOnDelaySize 16
#define Channel_iOffDelaySize 16
#define Channel_iControllerTypeSize 1
#define Channel_iTrimTypeSize 2
#define Channel_iNominalSize 16
#define Channel_iTrimStartUpDelaySize 16
#define Channel_iTrimPinVoltageSize 16
#define Channel_iTrimHighTrimSize 16
#define Channel_iTrimLowTrimSize 16
#define Channel_iMarginHighTrimSize 16
#define Channel_iMarginLowTrimSize 16
#define Channel_iI2CBusSize 16
#define Channel_iI2CAddressSize 16
#define Output_iRailA1Size 4
#define Output_iRailA2Size 4
#define Output_iRailA3Size 4
#define Output_iRailA4Size 4
#define Output_iRailA5Size 4
#define Output_iRailA6Size 4
#define Output_iRailA7Size 4
#define Output_iRailA8Size 4
#define Output_iRailA9Size 4
#define Output_iRailA10Size 4
#define Output_iRailA11Size 4
#define Output_iRailA12Size 4
#define Output_iRailA13Size 4
#define Output_iRailA14Size 4
#define Output_iRailA15Size 4
#define Output_iRailA16Size 4
#define Output_iRailA17Size 4
#define Output_iRailA18Size 4
#define Output_iRailA19Size 4
#define Output_iRailA20Size 4
#define Output_iRailA21Size 4
#define Output_iRailA22Size 4
#define Output_iRailA23Size 4
#define Output_iRailA24Size 4
#define Output_iRailA25Size 4
#define Output_iRailA26Size 4
#define Output_iRailA27Size 4
#define Output_iRailA28Size 4
#define Output_iRailA29Size 4
#define Output_iRailA30Size 4
#define Output_iRailA31Size 4
#define Output_iRailA32Size 4
#define Output_iCombineSize 3
#define Output_PinsAssertedLoSize 1
#define Output_CombinerSize 1
#define Output_bUpdateOutputSize 1
#define Output_bLogDuringPowerOnSequenceSize 1
#define Output_bLogDuringPowerOffSequenceSize 1
#define Output_bLog01TransitionsSize 1
#define Output_bLog10TransitionsSize 1
#define Misc_iOnFailSize 3
#define Misc_iSlotTimeoutSize 16
#define Misc_PowerOffSequenceSize 2
#define Misc_AfterPowerOffSize 1
#define Misc_iI2CAddressSize 8
#define Misc_bMPMStateSize 1
#define Misc_bPowerOnEventsSize 1
#define Misc_bPowerOffEventsSize 1
#define Misc_bClearLogSize 1

