text: /*!
   * @section LICENSE
   * (C) Copyright 2014 Bosch Sensortec GmbH All Rights Reserved
   *
   * This software program is licensed subject to the GNU General
   * Public License (GPL).Version 2,June 1991,
   * available at http://www.fsf.org/copyleft/gpl.html
   *
   * @brief
   * This file contains all function implementations for the BMA2X2 in linux
   */
  #ifndef _BMA2X2_REG_H_
  #define _BMA2X2_REG_H_
  
  
  #define SLOPE_THRESHOLD_VALUE		32
  #define SLOPE_DURATION_VALUE		1
  #define INTERRUPT_LATCH_MODE		13
  #define INTERRUPT_ENABLE		1
  #define INTERRUPT_DISABLE		0
  #define MAP_SLOPE_INTERRUPT		2
  #define SLOPE_X_INDEX			5
  #define SLOPE_Y_INDEX			6
  #define SLOPE_Z_INDEX			7
  #define BMA2X2_MAX_DELAY		200
  #define BMA2X2_MIN_DELAY		10
  
  #ifndef CONFIG_SENSORS_ACCELEROMETER_2G
  #define BMA2X2_RANGE_SET		5  /* +/- 4G */
  #else
  #define BMA2X2_RANGE_SET		3  /* +/- 2G */
  #endif
  
  #define BMA2X2_BW_SET			12 /* 125HZ  */
  
  #define LOW_G_INTERRUPT				REL_Z
  #define HIGH_G_INTERRUPT			REL_HWHEEL
  #define SLOP_INTERRUPT				REL_DIAL
  #define DOUBLE_TAP_INTERRUPT			REL_WHEEL
  #define SINGLE_TAP_INTERRUPT			REL_MISC
  #define ORIENT_INTERRUPT			ABS_PRESSURE
  #define FLAT_INTERRUPT				ABS_DISTANCE
  #define SLOW_NO_MOTION_INTERRUPT		REL_Y
  
  #define HIGH_G_INTERRUPT_X_HAPPENED			1
  #define HIGH_G_INTERRUPT_Y_HAPPENED			2
  #define HIGH_G_INTERRUPT_Z_HAPPENED			3
  #define HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED		4
  #define HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED		5
  #define HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED		6
  #define SLOPE_INTERRUPT_X_HAPPENED			7
  #define SLOPE_INTERRUPT_Y_HAPPENED			8
  #define SLOPE_INTERRUPT_Z_HAPPENED			9
  #define SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED		10
  #define SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED		11
  #define SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED		12
  #define DOUBLE_TAP_INTERRUPT_HAPPENED			13
  #define SINGLE_TAP_INTERRUPT_HAPPENED			14
  #define UPWARD_PORTRAIT_UP_INTERRUPT_HAPPENED		15
  #define UPWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED		16
  #define UPWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED	17
  #define UPWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED	18
  #define DOWNWARD_PORTRAIT_UP_INTERRUPT_HAPPENED		19
  #define DOWNWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED	20
  #define DOWNWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED	21
  #define DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED	22
  #define FLAT_INTERRUPT_TURE_HAPPENED			23
  #define FLAT_INTERRUPT_FALSE_HAPPENED			24
  #define LOW_G_INTERRUPT_HAPPENED			25
  #define SLOW_NO_MOTION_INTERRUPT_HAPPENED		26
  #define PAD_LOWG                    0
  #define PAD_HIGHG                   1
  #define PAD_SLOP                    2
  #define PAD_DOUBLE_TAP              3
  #define PAD_SINGLE_TAP              4
  #define PAD_ORIENT                  5
  #define PAD_FLAT                    6
  #define PAD_SLOW_NO_MOTION          7
  
  #define BMA2X2_EEP_OFFSET                       0x16
  #define BMA2X2_IMAGE_BASE                       0x38
  #define BMA2X2_IMAGE_LEN                        22
  
  #define BMA2X2_CHIP_ID_REG                      0x00
  #define BMA2X2_VERSION_REG                      0x01
  #define BMA2X2_X_AXIS_LSB_REG                   0x02
  #define BMA2X2_X_AXIS_MSB_REG                   0x03
  #define BMA2X2_Y_AXIS_LSB_REG                   0x04
  #define BMA2X2_Y_AXIS_MSB_REG                   0x05
  #define BMA2X2_Z_AXIS_LSB_REG                   0x06
  #define BMA2X2_Z_AXIS_MSB_REG                   0x07
  #define BMA2X2_TEMPERATURE_REG                  0x08
  #define BMA2X2_STATUS1_REG                      0x09
  #define BMA2X2_STATUS2_REG                      0x0A
  #define BMA2X2_STATUS_TAP_SLOPE_REG             0x0B
  #define BMA2X2_STATUS_ORIENT_HIGH_REG           0x0C
  #define BMA2X2_STATUS_FIFO_REG                  0x0E
  #define BMA2X2_RANGE_SEL_REG                    0x0F
  #define BMA2X2_BW_SEL_REG                       0x10
  #define BMA2X2_MODE_CTRL_REG                    0x11
  #define BMA2X2_LOW_NOISE_CTRL_REG               0x12
  #define BMA2X2_DATA_CTRL_REG                    0x13
  #define BMA2X2_RESET_REG                        0x14
  #define BMA2X2_INT_ENABLE1_REG                  0x16
  #define BMA2X2_INT_ENABLE2_REG                  0x17
  #define BMA2X2_INT_SLO_NO_MOT_REG               0x18
  #define BMA2X2_INT1_PAD_SEL_REG                 0x19
  #define BMA2X2_INT_DATA_SEL_REG                 0x1A
  #define BMA2X2_INT2_PAD_SEL_REG                 0x1B
  #define BMA2X2_INT_SRC_REG                      0x1E
  #define BMA2X2_INT_SET_REG                      0x20
  #define BMA2X2_INT_CTRL_REG                     0x21
  #define BMA2X2_LOW_DURN_REG                     0x22
  #define BMA2X2_LOW_THRES_REG                    0x23
  #define BMA2X2_LOW_HIGH_HYST_REG                0x24
  #define BMA2X2_HIGH_DURN_REG                    0x25
  #define BMA2X2_HIGH_THRES_REG                   0x26
  #define BMA2X2_SLOPE_DURN_REG                   0x27
  #define BMA2X2_SLOPE_THRES_REG                  0x28
  #define BMA2X2_SLO_NO_MOT_THRES_REG             0x29
  #define BMA2X2_TAP_PARAM_REG                    0x2A
  #define BMA2X2_TAP_THRES_REG                    0x2B
  #define BMA2X2_ORIENT_PARAM_REG                 0x2C
  #define BMA2X2_THETA_BLOCK_REG                  0x2D
  #define BMA2X2_THETA_FLAT_REG                   0x2E
  #define BMA2X2_FLAT_HOLD_TIME_REG               0x2F
  #define BMA2X2_FIFO_WML_TRIG                    0x30
  #define BMA2X2_SELF_TEST_REG                    0x32
  #define BMA2X2_EEPROM_CTRL_REG                  0x33
  #define BMA2X2_SERIAL_CTRL_REG                  0x34
  #define BMA2X2_EXTMODE_CTRL_REG                 0x35
  #define BMA2X2_OFFSET_CTRL_REG                  0x36
  #define BMA2X2_OFFSET_PARAMS_REG                0x37
  #define BMA2X2_OFFSET_X_AXIS_REG                0x38
  #define BMA2X2_OFFSET_Y_AXIS_REG                0x39
  #define BMA2X2_OFFSET_Z_AXIS_REG                0x3A
  #define BMA2X2_GP0_REG                          0x3B
  #define BMA2X2_GP1_REG                          0x3C
  #define BMA2X2_FIFO_MODE_REG                    0x3E
  #define BMA2X2_FIFO_DATA_OUTPUT_REG             0x3F
  
  #define BMA2X2_CHIP_ID__POS			0
  #define BMA2X2_CHIP_ID__MSK			0xFF
  #define BMA2X2_CHIP_ID__LEN			8
  #define BMA2X2_CHIP_ID__REG			BMA2X2_CHIP_ID_REG
  
  #define BMA2X2_VERSION__POS			0
  #define BMA2X2_VERSION__LEN			8
  #define BMA2X2_VERSION__MSK			0xFF
  #define BMA2X2_VERSION__REG			BMA2X2_VERSION_REG
  
  #define BMA2x2_SLO_NO_MOT_DUR__POS		2
  #define BMA2x2_SLO_NO_MOT_DUR__LEN		6
  #define BMA2x2_SLO_NO_MOT_DUR__MSK		0xFC
  #define BMA2x2_SLO_NO_MOT_DUR__REG		BMA2X2_SLOPE_DURN_REG
  
  #define BMA2X2_NEW_DATA_X__POS			0
  #define BMA2X2_NEW_DATA_X__LEN			1
  #define BMA2X2_NEW_DATA_X__MSK			0x01
  #define BMA2X2_NEW_DATA_X__REG			BMA2X2_X_AXIS_LSB_REG
  
  #define BMA2X2_ACC_X14_LSB__POS			2
  #define BMA2X2_ACC_X14_LSB__LEN			6
  #define BMA2X2_ACC_X14_LSB__MSK			0xFC
  #define BMA2X2_ACC_X14_LSB__REG			BMA2X2_X_AXIS_LSB_REG
  
  #define BMA2X2_ACC_X12_LSB__POS			4
  #define BMA2X2_ACC_X12_LSB__LEN			4
  #define BMA2X2_ACC_X12_LSB__MSK			0xF0
  #define BMA2X2_ACC_X12_LSB__REG			BMA2X2_X_AXIS_LSB_REG
  
  #define BMA2X2_ACC_X10_LSB__POS			6
  #define BMA2X2_ACC_X10_LSB__LEN			2
  #define BMA2X2_ACC_X10_LSB__MSK			0xC0
  #define BMA2X2_ACC_X10_LSB__REG			BMA2X2_X_AXIS_LSB_REG
  
  #define BMA2X2_ACC_X8_LSB__POS			0
  #define BMA2X2_ACC_X8_LSB__LEN			0
  #define BMA2X2_ACC_X8_LSB__MSK			0x00
  #define BMA2X2_ACC_X8_LSB__REG			BMA2X2_X_AXIS_LSB_REG
  
  #define BMA2X2_ACC_X_MSB__POS			0
  #define BMA2X2_ACC_X_MSB__LEN			8
  #define BMA2X2_ACC_X_MSB__MSK			0xFF
  #define BMA2X2_ACC_X_MSB__REG			BMA2X2_X_AXIS_MSB_REG
  
  #define BMA2X2_NEW_DATA_Y__POS			0
  #define BMA2X2_NEW_DATA_Y__LEN			1
  #define BMA2X2_NEW_DATA_Y__MSK			0x01
  #define BMA2X2_NEW_DATA_Y__REG			BMA2X2_Y_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Y14_LSB__POS			2
  #define BMA2X2_ACC_Y14_LSB__LEN			6
  #define BMA2X2_ACC_Y14_LSB__MSK			0xFC
  #define BMA2X2_ACC_Y14_LSB__REG			BMA2X2_Y_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Y12_LSB__POS			4
  #define BMA2X2_ACC_Y12_LSB__LEN			4
  #define BMA2X2_ACC_Y12_LSB__MSK			0xF0
  #define BMA2X2_ACC_Y12_LSB__REG			BMA2X2_Y_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Y10_LSB__POS			6
  #define BMA2X2_ACC_Y10_LSB__LEN			2
  #define BMA2X2_ACC_Y10_LSB__MSK			0xC0
  #define BMA2X2_ACC_Y10_LSB__REG			BMA2X2_Y_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Y8_LSB__POS			0
  #define BMA2X2_ACC_Y8_LSB__LEN			0
  #define BMA2X2_ACC_Y8_LSB__MSK			0x00
  #define BMA2X2_ACC_Y8_LSB__REG			BMA2X2_Y_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Y_MSB__POS			0
  #define BMA2X2_ACC_Y_MSB__LEN			8
  #define BMA2X2_ACC_Y_MSB__MSK			0xFF
  #define BMA2X2_ACC_Y_MSB__REG			BMA2X2_Y_AXIS_MSB_REG
  
  #define BMA2X2_NEW_DATA_Z__POS			0
  #define BMA2X2_NEW_DATA_Z__LEN			1
  #define BMA2X2_NEW_DATA_Z__MSK			0x01
  #define BMA2X2_NEW_DATA_Z__REG			BMA2X2_Z_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Z14_LSB__POS			2
  #define BMA2X2_ACC_Z14_LSB__LEN			6
  #define BMA2X2_ACC_Z14_LSB__MSK			0xFC
  #define BMA2X2_ACC_Z14_LSB__REG			BMA2X2_Z_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Z12_LSB__POS			4
  #define BMA2X2_ACC_Z12_LSB__LEN			4
  #define BMA2X2_ACC_Z12_LSB__MSK			0xF0
  #define BMA2X2_ACC_Z12_LSB__REG			BMA2X2_Z_AXIS_LSB_REG
  
  
  #define BMA2X2_ACC_Z10_LSB__POS			6
  #define BMA2X2_ACC_Z10_LSB__LEN			2
  #define BMA2X2_ACC_Z10_LSB__MSK			0xC0
  #define BMA2X2_ACC_Z10_LSB__REG			BMA2X2_Z_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Z8_LSB__POS			0
  #define BMA2X2_ACC_Z8_LSB__LEN			0
  #define BMA2X2_ACC_Z8_LSB__MSK			0x00
  #define BMA2X2_ACC_Z8_LSB__REG			BMA2X2_Z_AXIS_LSB_REG
  
  #define BMA2X2_ACC_Z_MSB__POS			0
  #define BMA2X2_ACC_Z_MSB__LEN			8
  #define BMA2X2_ACC_Z_MSB__MSK			0xFF
  #define BMA2X2_ACC_Z_MSB__REG			BMA2X2_Z_AXIS_MSB_REG
  
  #define BMA2X2_TEMPERATURE__POS			0
  #define BMA2X2_TEMPERATURE__LEN			8
  #define BMA2X2_TEMPERATURE__MSK			0xFF
  #define BMA2X2_TEMPERATURE__REG			BMA2X2_TEMP_RD_REG
  
  #define BMA2X2_LOWG_INT_S__POS			0
  #define BMA2X2_LOWG_INT_S__LEN			1
  #define BMA2X2_LOWG_INT_S__MSK			0x01
  #define BMA2X2_LOWG_INT_S__REG			BMA2X2_STATUS1_REG
  
  #define BMA2X2_HIGHG_INT_S__POS			1
  #define BMA2X2_HIGHG_INT_S__LEN			1
  #define BMA2X2_HIGHG_INT_S__MSK			0x02
  #define BMA2X2_HIGHG_INT_S__REG			BMA2X2_STATUS1_REG
  
  #define BMA2X2_SLOPE_INT_S__POS			2
  #define BMA2X2_SLOPE_INT_S__LEN			1
  #define BMA2X2_SLOPE_INT_S__MSK			0x04
  #define BMA2X2_SLOPE_INT_S__REG			BMA2X2_STATUS1_REG
  
  #define BMA2X2_SLO_NO_MOT_INT_S__POS		3
  #define BMA2X2_SLO_NO_MOT_INT_S__LEN		1
  #define BMA2X2_SLO_NO_MOT_INT_S__MSK		0x08
  #define BMA2X2_SLO_NO_MOT_INT_S__REG		BMA2X2_STATUS1_REG
  
  #define BMA2X2_DOUBLE_TAP_INT_S__POS		4
  #define BMA2X2_DOUBLE_TAP_INT_S__LEN		1
  #define BMA2X2_DOUBLE_TAP_INT_S__MSK		0x10
  #define BMA2X2_DOUBLE_TAP_INT_S__REG		BMA2X2_STATUS1_REG
  
  #define BMA2X2_SINGLE_TAP_INT_S__POS		5
  #define BMA2X2_SINGLE_TAP_INT_S__LEN		1
  #define BMA2X2_SINGLE_TAP_INT_S__MSK		0x20
  #define BMA2X2_SINGLE_TAP_INT_S__REG		BMA2X2_STATUS1_REG
  
  #define BMA2X2_ORIENT_INT_S__POS		6
  #define BMA2X2_ORIENT_INT_S__LEN		1
  #define BMA2X2_ORIENT_INT_S__MSK		0x40
  #define BMA2X2_ORIENT_INT_S__REG		BMA2X2_STATUS1_REG
  
  #define BMA2X2_FLAT_INT_S__POS			7
  #define BMA2X2_FLAT_INT_S__LEN			1
  #define BMA2X2_FLAT_INT_S__MSK			0x80
  #define BMA2X2_FLAT_INT_S__REG			BMA2X2_STATUS1_REG
  #define BMA2X2_FIFO_FULL_INT_S__POS		5
  #define BMA2X2_FIFO_FULL_INT_S__LEN		1
  #define BMA2X2_FIFO_FULL_INT_S__MSK		0x20
  #define BMA2X2_FIFO_FULL_INT_S__REG		BMA2X2_STATUS2_REG
  
  #define BMA2X2_FIFO_WM_INT_S__POS		6
  #define BMA2X2_FIFO_WM_INT_S__LEN		1
  #define BMA2X2_FIFO_WM_INT_S__MSK		0x40
  #define BMA2X2_FIFO_WM_INT_S__REG		BMA2X2_STATUS2_REG
  
  #define BMA2X2_DATA_INT_S__POS			7
  #define BMA2X2_DATA_INT_S__LEN			1
  #define BMA2X2_DATA_INT_S__MSK			0x80
  #define BMA2X2_DATA_INT_S__REG			BMA2X2_STATUS2_REG
  
  #define BMA2X2_SLOPE_FIRST_X__POS		0
  #define BMA2X2_SLOPE_FIRST_X__LEN		1
  #define BMA2X2_SLOPE_FIRST_X__MSK		0x01
  #define BMA2X2_SLOPE_FIRST_X__REG		BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_SLOPE_FIRST_Y__POS		1
  #define BMA2X2_SLOPE_FIRST_Y__LEN		1
  #define BMA2X2_SLOPE_FIRST_Y__MSK		0x02
  #define BMA2X2_SLOPE_FIRST_Y__REG		BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_SLOPE_FIRST_Z__POS		2
  #define BMA2X2_SLOPE_FIRST_Z__LEN		1
  #define BMA2X2_SLOPE_FIRST_Z__MSK		0x04
  #define BMA2X2_SLOPE_FIRST_Z__REG		BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_SLOPE_SIGN_S__POS		3
  #define BMA2X2_SLOPE_SIGN_S__LEN		1
  #define BMA2X2_SLOPE_SIGN_S__MSK		0x08
  #define BMA2X2_SLOPE_SIGN_S__REG		BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_TAP_FIRST_X__POS			4
  #define BMA2X2_TAP_FIRST_X__LEN			1
  #define BMA2X2_TAP_FIRST_X__MSK			0x10
  #define BMA2X2_TAP_FIRST_X__REG			BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_TAP_FIRST_Y__POS			5
  #define BMA2X2_TAP_FIRST_Y__LEN			1
  #define BMA2X2_TAP_FIRST_Y__MSK			0x20
  #define BMA2X2_TAP_FIRST_Y__REG			BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_TAP_FIRST_Z__POS			6
  #define BMA2X2_TAP_FIRST_Z__LEN			1
  #define BMA2X2_TAP_FIRST_Z__MSK			0x40
  #define BMA2X2_TAP_FIRST_Z__REG			BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_TAP_SIGN_S__POS			7
  #define BMA2X2_TAP_SIGN_S__LEN			1
  #define BMA2X2_TAP_SIGN_S__MSK			0x80
  #define BMA2X2_TAP_SIGN_S__REG			BMA2X2_STATUS_TAP_SLOPE_REG
  
  #define BMA2X2_HIGHG_FIRST_X__POS		0
  #define BMA2X2_HIGHG_FIRST_X__LEN		1
  #define BMA2X2_HIGHG_FIRST_X__MSK		0x01
  #define BMA2X2_HIGHG_FIRST_X__REG		BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_HIGHG_FIRST_Y__POS		1
  #define BMA2X2_HIGHG_FIRST_Y__LEN		1
  #define BMA2X2_HIGHG_FIRST_Y__MSK		0x02
  #define BMA2X2_HIGHG_FIRST_Y__REG		BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_HIGHG_FIRST_Z__POS		2
  #define BMA2X2_HIGHG_FIRST_Z__LEN		1
  #define BMA2X2_HIGHG_FIRST_Z__MSK		0x04
  #define BMA2X2_HIGHG_FIRST_Z__REG		BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_HIGHG_SIGN_S__POS		3
  #define BMA2X2_HIGHG_SIGN_S__LEN		1
  #define BMA2X2_HIGHG_SIGN_S__MSK		0x08
  #define BMA2X2_HIGHG_SIGN_S__REG		BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_ORIENT_S__POS			4
  #define BMA2X2_ORIENT_S__LEN			3
  #define BMA2X2_ORIENT_S__MSK			0x70
  #define BMA2X2_ORIENT_S__REG			BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_FLAT_S__POS			7
  #define BMA2X2_FLAT_S__LEN			1
  #define BMA2X2_FLAT_S__MSK			0x80
  #define BMA2X2_FLAT_S__REG			BMA2X2_STATUS_ORIENT_HIGH_REG
  
  #define BMA2X2_FIFO_FRAME_COUNTER_S__POS	0
  #define BMA2X2_FIFO_FRAME_COUNTER_S__LEN	7
  #define BMA2X2_FIFO_FRAME_COUNTER_S__MSK	0x7F
  #define BMA2X2_FIFO_FRAME_COUNTER_S__REG	BMA2X2_STATUS_FIFO_REG
  
  #define BMA2X2_FIFO_OVERRUN_S__POS		7
  #define BMA2X2_FIFO_OVERRUN_S__LEN		1
  #define BMA2X2_FIFO_OVERRUN_S__MSK		0x80
  #define BMA2X2_FIFO_OVERRUN_S__REG		BMA2X2_STATUS_FIFO_REG
  
  #define BMA2X2_RANGE_SEL__POS			0
  #define BMA2X2_RANGE_SEL__LEN			4
  #define BMA2X2_RANGE_SEL__MSK			0x0F
  #define BMA2X2_RANGE_SEL__REG			BMA2X2_RANGE_SEL_REG
  
  #define BMA2X2_BANDWIDTH__POS			0
  #define BMA2X2_BANDWIDTH__LEN			5
  #define BMA2X2_BANDWIDTH__MSK			0x1F
  #define BMA2X2_BANDWIDTH__REG			BMA2X2_BW_SEL_REG
  
  #define BMA2X2_SLEEP_DUR__POS			1
  #define BMA2X2_SLEEP_DUR__LEN			4
  #define BMA2X2_SLEEP_DUR__MSK			0x1E
  #define BMA2X2_SLEEP_DUR__REG			BMA2X2_MODE_CTRL_REG
  
  #define BMA2X2_MODE_CTRL__POS			5
  #define BMA2X2_MODE_CTRL__LEN			3
  #define BMA2X2_MODE_CTRL__MSK			0xE0
  #define BMA2X2_MODE_CTRL__REG			BMA2X2_MODE_CTRL_REG
  
  #define BMA2X2_DEEP_SUSPEND__POS		5
  #define BMA2X2_DEEP_SUSPEND__LEN		1
  #define BMA2X2_DEEP_SUSPEND__MSK		0x20
  #define BMA2X2_DEEP_SUSPEND__REG		BMA2X2_MODE_CTRL_REG
  
  #define BMA2X2_EN_LOW_POWER__POS		6
  #define BMA2X2_EN_LOW_POWER__LEN		1
  #define BMA2X2_EN_LOW_POWER__MSK		0x40
  #define BMA2X2_EN_LOW_POWER__REG		BMA2X2_MODE_CTRL_REG
  
  #define BMA2X2_EN_SUSPEND__POS			7
  #define BMA2X2_EN_SUSPEND__LEN			1
  #define BMA2X2_EN_SUSPEND__MSK			0x80
  #define BMA2X2_EN_SUSPEND__REG			BMA2X2_MODE_CTRL_REG
  
  #define BMA2X2_SLEEP_TIMER__POS			5
  #define BMA2X2_SLEEP_TIMER__LEN			1
  #define BMA2X2_SLEEP_TIMER__MSK			0x20
  #define BMA2X2_SLEEP_TIMER__REG			BMA2X2_LOW_NOISE_CTRL_REG
  
  #define BMA2X2_LOW_POWER_MODE__POS		6
  #define BMA2X2_LOW_POWER_MODE__LEN		1
  #define BMA2X2_LOW_POWER_MODE__MSK		0x40
  #define BMA2X2_LOW_POWER_MODE__REG		BMA2X2_LOW_NOISE_CTRL_REG
  
  #define BMA2X2_EN_LOW_NOISE__POS		7
  #define BMA2X2_EN_LOW_NOISE__LEN		1
  #define BMA2X2_EN_LOW_NOISE__MSK		0x80
  #define BMA2X2_EN_LOW_NOISE__REG		BMA2X2_LOW_NOISE_CTRL_REG
  
  #define BMA2X2_DIS_SHADOW_PROC__POS		6
  #define BMA2X2_DIS_SHADOW_PROC__LEN		1
  #define BMA2X2_DIS_SHADOW_PROC__MSK		0x40
  #define BMA2X2_DIS_SHADOW_PROC__REG		BMA2X2_DATA_CTRL_REG
  
  #define BMA2X2_EN_DATA_HIGH_BW__POS		7
  #define BMA2X2_EN_DATA_HIGH_BW__LEN		1
  #define BMA2X2_EN_DATA_HIGH_BW__MSK		0x80
  #define BMA2X2_EN_DATA_HIGH_BW__REG		BMA2X2_DATA_CTRL_REG
  
  #define BMA2X2_EN_SOFT_RESET__POS		0
  #define BMA2X2_EN_SOFT_RESET__LEN		8
  #define BMA2X2_EN_SOFT_RESET__MSK		0xFF
  #define BMA2X2_EN_SOFT_RESET__REG		BMA2X2_RESET_REG
  
  #define BMA2X2_EN_SOFT_RESET_VALUE		0xB6
  
  #define BMA2X2_EN_SLOPE_X_INT__POS		0
  #define BMA2X2_EN_SLOPE_X_INT__LEN		1
  #define BMA2X2_EN_SLOPE_X_INT__MSK		0x01
  #define BMA2X2_EN_SLOPE_X_INT__REG		BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_SINGLE_TAP_INT__POS		5
  #define BMA2X2_EN_SINGLE_TAP_INT__LEN		1
  #define BMA2X2_EN_SINGLE_TAP_INT__MSK		0x20
  #define BMA2X2_EN_SINGLE_TAP_INT__REG		BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_ORIENT_INT__POS		6
  #define BMA2X2_EN_ORIENT_INT__LEN		1
  #define BMA2X2_EN_ORIENT_INT__MSK		0x40
  #define BMA2X2_EN_ORIENT_INT__REG		BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_FLAT_INT__POS			7
  #define BMA2X2_EN_FLAT_INT__LEN			1
  #define BMA2X2_EN_FLAT_INT__MSK			0x80
  #define BMA2X2_EN_FLAT_INT__REG			BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_HIGHG_X_INT__POS		0
  #define BMA2X2_EN_HIGHG_X_INT__LEN		1
  #define BMA2X2_EN_HIGHG_X_INT__MSK		0x01
  #define BMA2X2_EN_HIGHG_X_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_EN_HIGHG_Y_INT__POS		1
  #define BMA2X2_EN_HIGHG_Y_INT__LEN		1
  #define BMA2X2_EN_HIGHG_Y_INT__MSK		0x02
  #define BMA2X2_EN_HIGHG_Y_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_EN_HIGHG_Z_INT__POS		2
  #define BMA2X2_EN_HIGHG_Z_INT__LEN		1
  #define BMA2X2_EN_HIGHG_Z_INT__MSK		0x04
  #define BMA2X2_EN_HIGHG_Z_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_EN_LOWG_INT__POS			3
  #define BMA2X2_EN_LOWG_INT__LEN			1
  #define BMA2X2_EN_LOWG_INT__MSK			0x08
  #define BMA2X2_EN_LOWG_INT__REG			BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_EN_NEW_DATA_INT__POS		4
  #define BMA2X2_EN_NEW_DATA_INT__LEN		1
  #define BMA2X2_EN_NEW_DATA_INT__MSK		0x10
  #define BMA2X2_EN_NEW_DATA_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_INT_FFULL_EN_INT__POS		5
  #define BMA2X2_INT_FFULL_EN_INT__LEN		1
  #define BMA2X2_INT_FFULL_EN_INT__MSK		0x20
  #define BMA2X2_INT_FFULL_EN_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_INT_FWM_EN_INT__POS		6
  #define BMA2X2_INT_FWM_EN_INT__LEN		1
  #define BMA2X2_INT_FWM_EN_INT__MSK		0x40
  #define BMA2X2_INT_FWM_EN_INT__REG		BMA2X2_INT_ENABLE2_REG
  
  #define BMA2X2_INT_SLO_NO_MOT_EN_X_INT__POS	0
  #define BMA2X2_INT_SLO_NO_MOT_EN_X_INT__LEN	1
  #define BMA2X2_INT_SLO_NO_MOT_EN_X_INT__MSK	0x01
  #define BMA2X2_INT_SLO_NO_MOT_EN_X_INT__REG	BMA2X2_INT_SLO_NO_MOT_REG
  
  #define BMA2X2_INT_SLO_NO_MOT_EN_Y_INT__POS	1
  #define BMA2X2_INT_SLO_NO_MOT_EN_Y_INT__LEN	1
  #define BMA2X2_INT_SLO_NO_MOT_EN_Y_INT__MSK	0x02
  #define BMA2X2_INT_SLO_NO_MOT_EN_Y_INT__REG	BMA2X2_INT_SLO_NO_MOT_REG
  
  #define BMA2X2_INT_SLO_NO_MOT_EN_Z_INT__POS	2
  #define BMA2X2_INT_SLO_NO_MOT_EN_Z_INT__LEN	1
  #define BMA2X2_INT_SLO_NO_MOT_EN_Z_INT__MSK	0x04
  #define BMA2X2_INT_SLO_NO_MOT_EN_Z_INT__REG	BMA2X2_INT_SLO_NO_MOT_REG
  
  #define BMA2X2_INT_SLO_NO_MOT_EN_SEL_INT__POS	3
  #define BMA2X2_INT_SLO_NO_MOT_EN_SEL_INT__LEN	1
  #define BMA2X2_INT_SLO_NO_MOT_EN_SEL_INT__MSK	0x08
  #define BMA2X2_INT_SLO_NO_MOT_EN_SEL_INT__REG	BMA2X2_INT_SLO_NO_MOT_REG
  
  #define BMA2X2_EN_INT1_PAD_LOWG__POS		0
  #define BMA2X2_EN_INT1_PAD_LOWG__LEN		1
  #define BMA2X2_EN_INT1_PAD_LOWG__MSK		0x01
  #define BMA2X2_EN_INT1_PAD_LOWG__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_SLOPE_Y_INT__POS		1
  #define BMA2X2_EN_SLOPE_Y_INT__LEN		1
  #define BMA2X2_EN_SLOPE_Y_INT__MSK		0x02
  #define BMA2X2_EN_SLOPE_Y_INT__REG		BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_SLOPE_Z_INT__POS		2
  #define BMA2X2_EN_SLOPE_Z_INT__LEN		1
  #define BMA2X2_EN_SLOPE_Z_INT__MSK		0x04
  #define BMA2X2_EN_SLOPE_Z_INT__REG		BMA2X2_INT_ENABLE1_REG
  
  #define BMA2X2_EN_DOUBLE_TAP_INT__POS		4
  #define BMA2X2_EN_DOUBLE_TAP_INT__LEN		1
  #define BMA2X2_EN_DOUBLE_TAP_INT__MSK		0x10
  #define BMA2X2_EN_DOUBLE_TAP_INT__REG		BMA2X2_INT_ENABLE1_REG
  #define BMA2X2_EN_INT1_PAD_HIGHG__POS		1
  #define BMA2X2_EN_INT1_PAD_HIGHG__LEN		1
  #define BMA2X2_EN_INT1_PAD_HIGHG__MSK		0x02
  #define BMA2X2_EN_INT1_PAD_HIGHG__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_SLOPE__POS		2
  #define BMA2X2_EN_INT1_PAD_SLOPE__LEN		1
  #define BMA2X2_EN_INT1_PAD_SLOPE__MSK		0x04
  #define BMA2X2_EN_INT1_PAD_SLOPE__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_SLO_NO_MOT__POS	3
  #define BMA2X2_EN_INT1_PAD_SLO_NO_MOT__LEN	1
  #define BMA2X2_EN_INT1_PAD_SLO_NO_MOT__MSK	0x08
  #define BMA2X2_EN_INT1_PAD_SLO_NO_MOT__REG	BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_DB_TAP__POS		4
  #define BMA2X2_EN_INT1_PAD_DB_TAP__LEN		1
  #define BMA2X2_EN_INT1_PAD_DB_TAP__MSK		0x10
  #define BMA2X2_EN_INT1_PAD_DB_TAP__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_SNG_TAP__POS		5
  #define BMA2X2_EN_INT1_PAD_SNG_TAP__LEN		1
  #define BMA2X2_EN_INT1_PAD_SNG_TAP__MSK		0x20
  #define BMA2X2_EN_INT1_PAD_SNG_TAP__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_ORIENT__POS		6
  #define BMA2X2_EN_INT1_PAD_ORIENT__LEN		1
  #define BMA2X2_EN_INT1_PAD_ORIENT__MSK		0x40
  #define BMA2X2_EN_INT1_PAD_ORIENT__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_FLAT__POS		7
  #define BMA2X2_EN_INT1_PAD_FLAT__LEN		1
  #define BMA2X2_EN_INT1_PAD_FLAT__MSK		0x80
  #define BMA2X2_EN_INT1_PAD_FLAT__REG		BMA2X2_INT1_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_LOWG__POS		0
  #define BMA2X2_EN_INT2_PAD_LOWG__LEN		1
  #define BMA2X2_EN_INT2_PAD_LOWG__MSK		0x01
  #define BMA2X2_EN_INT2_PAD_LOWG__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_HIGHG__POS		1
  #define BMA2X2_EN_INT2_PAD_HIGHG__LEN		1
  #define BMA2X2_EN_INT2_PAD_HIGHG__MSK		0x02
  #define BMA2X2_EN_INT2_PAD_HIGHG__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_SLOPE__POS		2
  #define BMA2X2_EN_INT2_PAD_SLOPE__LEN		1
  #define BMA2X2_EN_INT2_PAD_SLOPE__MSK		0x04
  #define BMA2X2_EN_INT2_PAD_SLOPE__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_SLO_NO_MOT__POS	3
  #define BMA2X2_EN_INT2_PAD_SLO_NO_MOT__LEN	1
  #define BMA2X2_EN_INT2_PAD_SLO_NO_MOT__MSK	0x08
  #define BMA2X2_EN_INT2_PAD_SLO_NO_MOT__REG	BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_DB_TAP__POS		4
  #define BMA2X2_EN_INT2_PAD_DB_TAP__LEN		1
  #define BMA2X2_EN_INT2_PAD_DB_TAP__MSK		0x10
  #define BMA2X2_EN_INT2_PAD_DB_TAP__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_SNG_TAP__POS		5
  #define BMA2X2_EN_INT2_PAD_SNG_TAP__LEN		1
  #define BMA2X2_EN_INT2_PAD_SNG_TAP__MSK		0x20
  #define BMA2X2_EN_INT2_PAD_SNG_TAP__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_ORIENT__POS		6
  #define BMA2X2_EN_INT2_PAD_ORIENT__LEN		1
  #define BMA2X2_EN_INT2_PAD_ORIENT__MSK		0x40
  #define BMA2X2_EN_INT2_PAD_ORIENT__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_FLAT__POS		7
  #define BMA2X2_EN_INT2_PAD_FLAT__LEN		1
  #define BMA2X2_EN_INT2_PAD_FLAT__MSK		0x80
  #define BMA2X2_EN_INT2_PAD_FLAT__REG		BMA2X2_INT2_PAD_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_NEWDATA__POS		0
  #define BMA2X2_EN_INT1_PAD_NEWDATA__LEN		1
  #define BMA2X2_EN_INT1_PAD_NEWDATA__MSK		0x01
  #define BMA2X2_EN_INT1_PAD_NEWDATA__REG		BMA2X2_INT_DATA_SEL_REG
  #define BMA2X2_EN_INT1_PAD_FWM__POS		1
  #define BMA2X2_EN_INT1_PAD_FWM__LEN		1
  #define BMA2X2_EN_INT1_PAD_FWM__MSK		0x02
  #define BMA2X2_EN_INT1_PAD_FWM__REG		BMA2X2_INT_DATA_SEL_REG
  
  #define BMA2X2_EN_INT1_PAD_FFULL__POS		2
  #define BMA2X2_EN_INT1_PAD_FFULL__LEN		1
  #define BMA2X2_EN_INT1_PAD_FFULL__MSK		0x04
  #define BMA2X2_EN_INT1_PAD_FFULL__REG		BMA2X2_INT_DATA_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_FFULL__POS		5
  #define BMA2X2_EN_INT2_PAD_FFULL__LEN		1
  #define BMA2X2_EN_INT2_PAD_FFULL__MSK		0x20
  #define BMA2X2_EN_INT2_PAD_FFULL__REG		BMA2X2_INT_DATA_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_FWM__POS		6
  #define BMA2X2_EN_INT2_PAD_FWM__LEN		1
  #define BMA2X2_EN_INT2_PAD_FWM__MSK		0x40
  #define BMA2X2_EN_INT2_PAD_FWM__REG		BMA2X2_INT_DATA_SEL_REG
  
  #define BMA2X2_EN_INT2_PAD_NEWDATA__POS		7
  #define BMA2X2_EN_INT2_PAD_NEWDATA__LEN		1
  #define BMA2X2_EN_INT2_PAD_NEWDATA__MSK		0x80
  #define BMA2X2_EN_INT2_PAD_NEWDATA__REG		BMA2X2_INT_DATA_SEL_REG
  
  #define BMA2X2_UNFILT_INT_SRC_LOWG__POS		0
  #define BMA2X2_UNFILT_INT_SRC_LOWG__LEN		1
  #define BMA2X2_UNFILT_INT_SRC_LOWG__MSK		0x01
  #define BMA2X2_UNFILT_INT_SRC_LOWG__REG		BMA2X2_INT_SRC_REG
  
  #define BMA2X2_UNFILT_INT_SRC_HIGHG__POS	1
  #define BMA2X2_UNFILT_INT_SRC_HIGHG__LEN	1
  #define BMA2X2_UNFILT_INT_SRC_HIGHG__MSK	0x02
  #define BMA2X2_UNFILT_INT_SRC_HIGHG__REG	BMA2X2_INT_SRC_REG
  
  #define BMA2X2_UNFILT_INT_SRC_SLOPE__POS	2
  #define BMA2X2_UNFILT_INT_SRC_SLOPE__LEN	1
  #define BMA2X2_UNFILT_INT_SRC_SLOPE__MSK	0x04
  #define BMA2X2_UNFILT_INT_SRC_SLOPE__REG	BMA2X2_INT_SRC_REG
  
  #define BMA2X2_UNFILT_INT_SRC_SLO_NO_MOT__POS	3
  #define BMA2X2_UNFILT_INT_SRC_SLO_NO_MOT__LEN	1
  #define BMA2X2_UNFILT_INT_SRC_SLO_NO_MOT__MSK	0x08
  #define BMA2X2_UNFILT_INT_SRC_SLO_NO_MOT__REG	BMA2X2_INT_SRC_REG
  
  #define BMA2X2_UNFILT_INT_SRC_TAP__POS		4
  #define BMA2X2_UNFILT_INT_SRC_TAP__LEN		1
  #define BMA2X2_UNFILT_INT_SRC_TAP__MSK		0x10
  #define BMA2X2_UNFILT_INT_SRC_TAP__REG		BMA2X2_INT_SRC_REG
  
  #define BMA2X2_UNFILT_INT_SRC_DATA__POS		5
  #define BMA2X2_UNFILT_INT_SRC_DATA__LEN		1
  #define BMA2X2_UNFILT_INT_SRC_DATA__MSK		0x20
  #define BMA2X2_UNFILT_INT_SRC_DATA__REG		BMA2X2_INT_SRC_REG
  
  #define BMA2X2_INT1_PAD_ACTIVE_LEVEL__POS	0
  #define BMA2X2_INT1_PAD_ACTIVE_LEVEL__LEN	1
  #define BMA2X2_INT1_PAD_ACTIVE_LEVEL__MSK	0x01
  #define BMA2X2_INT1_PAD_ACTIVE_LEVEL__REG	BMA2X2_INT_SET_REG
  
  #define BMA2X2_INT2_PAD_ACTIVE_LEVEL__POS	2
  #define BMA2X2_INT2_PAD_ACTIVE_LEVEL__LEN	1
  #define BMA2X2_INT2_PAD_ACTIVE_LEVEL__MSK	0x04
  #define BMA2X2_INT2_PAD_ACTIVE_LEVEL__REG	BMA2X2_INT_SET_REG
  
  #define BMA2X2_INT1_PAD_OUTPUT_TYPE__POS	1
  #define BMA2X2_INT1_PAD_OUTPUT_TYPE__LEN	1
  #define BMA2X2_INT1_PAD_OUTPUT_TYPE__MSK	0x02
  #define BMA2X2_INT1_PAD_OUTPUT_TYPE__REG	BMA2X2_INT_SET_REG
  
  #define BMA2X2_INT2_PAD_OUTPUT_TYPE__POS	3
  #define BMA2X2_INT2_PAD_OUTPUT_TYPE__LEN	1
  #define BMA2X2_INT2_PAD_OUTPUT_TYPE__MSK	0x08
  #define BMA2X2_INT2_PAD_OUTPUT_TYPE__REG	BMA2X2_INT_SET_REG
  
  #define BMA2X2_INT_MODE_SEL__POS		0
  #define BMA2X2_INT_MODE_SEL__LEN		4
  #define BMA2X2_INT_MODE_SEL__MSK		0x0F
  #define BMA2X2_INT_MODE_SEL__REG		BMA2X2_INT_CTRL_REG
  
  #define BMA2X2_RESET_INT__POS			7
  #define BMA2X2_RESET_INT__LEN			1
  #define BMA2X2_RESET_INT__MSK			0x80
  #define BMA2X2_RESET_INT__REG			BMA2X2_INT_CTRL_REG
  
  #define BMA2X2_LOWG_DUR__POS			0
  #define BMA2X2_LOWG_DUR__LEN			8
  #define BMA2X2_LOWG_DUR__MSK			0xFF
  #define BMA2X2_LOWG_DUR__REG			BMA2X2_LOW_DURN_REG
  
  #define BMA2X2_LOWG_THRES__POS			0
  #define BMA2X2_LOWG_THRES__LEN			8
  #define BMA2X2_LOWG_THRES__MSK			0xFF
  #define BMA2X2_LOWG_THRES__REG			BMA2X2_LOW_THRES_REG
  
  #define BMA2X2_LOWG_HYST__POS			0
  #define BMA2X2_LOWG_HYST__LEN			2
  #define BMA2X2_LOWG_HYST__MSK			0x03
  #define BMA2X2_LOWG_HYST__REG			BMA2X2_LOW_HIGH_HYST_REG
  
  #define BMA2X2_LOWG_INT_MODE__POS		2
  #define BMA2X2_LOWG_INT_MODE__LEN		1
  #define BMA2X2_LOWG_INT_MODE__MSK		0x04
  #define BMA2X2_LOWG_INT_MODE__REG		BMA2X2_LOW_HIGH_HYST_REG
  
  #define BMA2X2_HIGHG_DUR__POS			0
  #define BMA2X2_HIGHG_DUR__LEN			8
  #define BMA2X2_HIGHG_DUR__MSK			0xFF
  #define BMA2X2_HIGHG_DUR__REG			BMA2X2_HIGH_DURN_REG
  
  #define BMA2X2_HIGHG_THRES__POS			0
  #define BMA2X2_HIGHG_THRES__LEN			8
  #define BMA2X2_HIGHG_THRES__MSK			0xFF
  #define BMA2X2_HIGHG_THRES__REG			BMA2X2_HIGH_THRES_REG
  
  #define BMA2X2_HIGHG_HYST__POS			6
  #define BMA2X2_HIGHG_HYST__LEN			2
  #define BMA2X2_HIGHG_HYST__MSK			0xC0
  #define BMA2X2_HIGHG_HYST__REG			BMA2X2_LOW_HIGH_HYST_REG
  #define BMA2X2_SLOPE_DUR__POS			0
  #define BMA2X2_SLOPE_DUR__LEN			2
  #define BMA2X2_SLOPE_DUR__MSK			0x03
  #define BMA2X2_SLOPE_DUR__REG			BMA2X2_SLOPE_DURN_REG
  
  #define BMA2X2_SLO_NO_MOT_DUR__POS		2
  #define BMA2X2_SLO_NO_MOT_DUR__LEN		6
  #define BMA2X2_SLO_NO_MOT_DUR__MSK		0xFC
  #define BMA2X2_SLO_NO_MOT_DUR__REG		BMA2X2_SLOPE_DURN_REG
  
  #define BMA2X2_SLOPE_THRES__POS			0
  #define BMA2X2_SLOPE_THRES__LEN			8
  #define BMA2X2_SLOPE_THRES__MSK			0xFF
  #define BMA2X2_SLOPE_THRES__REG			BMA2X2_SLOPE_THRES_REG
  
  #define BMA2X2_SLO_NO_MOT_THRES__POS		0
  #define BMA2X2_SLO_NO_MOT_THRES__LEN		8
  #define BMA2X2_SLO_NO_MOT_THRES__MSK		0xFF
  #define BMA2X2_SLO_NO_MOT_THRES__REG		BMA2X2_SLO_NO_MOT_THRES_REG
  
  #define BMA2X2_TAP_DUR__POS			0
  #define BMA2X2_TAP_DUR__LEN			3
  #define BMA2X2_TAP_DUR__MSK			0x07
  #define BMA2X2_TAP_DUR__REG			BMA2X2_TAP_PARAM_REG
  
  #define BMA2X2_TAP_SHOCK_DURN__POS		6
  #define BMA2X2_TAP_SHOCK_DURN__LEN		1
  #define BMA2X2_TAP_SHOCK_DURN__MSK		0x40
  #define BMA2X2_TAP_SHOCK_DURN__REG		BMA2X2_TAP_PARAM_REG
  
  #define BMA2X2_ADV_TAP_INT__POS			5
  #define BMA2X2_ADV_TAP_INT__LEN			1
  #define BMA2X2_ADV_TAP_INT__MSK			0x20
  #define BMA2X2_ADV_TAP_INT__REG			BMA2X2_TAP_PARAM_REG
  
  #define BMA2X2_TAP_QUIET_DURN__POS		7
  #define BMA2X2_TAP_QUIET_DURN__LEN		1
  #define BMA2X2_TAP_QUIET_DURN__MSK		0x80
  #define BMA2X2_TAP_QUIET_DURN__REG		BMA2X2_TAP_PARAM_REG
  
  #define BMA2X2_TAP_THRES__POS			0
  #define BMA2X2_TAP_THRES__LEN			5
  #define BMA2X2_TAP_THRES__MSK			0x1F
  #define BMA2X2_TAP_THRES__REG			BMA2X2_TAP_THRES_REG
  
  #define BMA2X2_TAP_SAMPLES__POS			6
  #define BMA2X2_TAP_SAMPLES__LEN			2
  #define BMA2X2_TAP_SAMPLES__MSK			0xC0
  #define BMA2X2_TAP_SAMPLES__REG			BMA2X2_TAP_THRES_REG
  
  #define BMA2X2_ORIENT_MODE__POS			0
  #define BMA2X2_ORIENT_MODE__LEN			2
  #define BMA2X2_ORIENT_MODE__MSK			0x03
  #define BMA2X2_ORIENT_MODE__REG			BMA2X2_ORIENT_PARAM_REG
  
  #define BMA2X2_ORIENT_BLOCK__POS		2
  #define BMA2X2_ORIENT_BLOCK__LEN		2
  #define BMA2X2_ORIENT_BLOCK__MSK		0x0C
  #define BMA2X2_ORIENT_BLOCK__REG		BMA2X2_ORIENT_PARAM_REG
  
  #define BMA2X2_ORIENT_HYST__POS			4
  #define BMA2X2_ORIENT_HYST__LEN			3
  #define BMA2X2_ORIENT_HYST__MSK			0x70
  #define BMA2X2_ORIENT_HYST__REG			BMA2X2_ORIENT_PARAM_REG
  
  #define BMA2X2_ORIENT_AXIS__POS			7
  #define BMA2X2_ORIENT_AXIS__LEN			1
  #define BMA2X2_ORIENT_AXIS__MSK			0x80
  #define BMA2X2_ORIENT_AXIS__REG			BMA2X2_THETA_BLOCK_REG
  
  #define BMA2X2_ORIENT_UD_EN__POS		6
  #define BMA2X2_ORIENT_UD_EN__LEN		1
  #define BMA2X2_ORIENT_UD_EN__MSK		0x40
  #define BMA2X2_ORIENT_UD_EN__REG		BMA2X2_THETA_BLOCK_REG
  
  #define BMA2X2_THETA_BLOCK__POS			0
  #define BMA2X2_THETA_BLOCK__LEN			6
  #define BMA2X2_THETA_BLOCK__MSK                 0x3F
  #define BMA2X2_THETA_BLOCK__REG                  BMA2X2_THETA_BLOCK_REG
  
  #define BMA2X2_THETA_FLAT__POS                  0
  #define BMA2X2_THETA_FLAT__LEN                  6
  #define BMA2X2_THETA_FLAT__MSK                  0x3F
  #define BMA2X2_THETA_FLAT__REG                  BMA2X2_THETA_FLAT_REG
  
  #define BMA2X2_FLAT_HOLD_TIME__POS              4
  #define BMA2X2_FLAT_HOLD_TIME__LEN              2
  #define BMA2X2_FLAT_HOLD_TIME__MSK              0x30
  #define BMA2X2_FLAT_HOLD_TIME__REG              BMA2X2_FLAT_HOLD_TIME_REG
  
  #define BMA2X2_FLAT_HYS__POS			0
  #define BMA2X2_FLAT_HYS__LEN			3
  #define BMA2X2_FLAT_HYS__MSK			0x07
  #define BMA2X2_FLAT_HYS__REG			BMA2X2_FLAT_HOLD_TIME_REG
  
  #define BMA2X2_FIFO_WML_TRIG_RETAIN__POS	0
  #define BMA2X2_FIFO_WML_TRIG_RETAIN__LEN	6
  #define BMA2X2_FIFO_WML_TRIG_RETAIN__MSK	0x3F
  #define BMA2X2_FIFO_WML_TRIG_RETAIN__REG	BMA2X2_FIFO_WML_TRIG
  
  #define BMA2X2_EN_SELF_TEST__POS		0
  #define BMA2X2_EN_SELF_TEST__LEN		2
  #define BMA2X2_EN_SELF_TEST__MSK		0x03
  #define BMA2X2_EN_SELF_TEST__REG		BMA2X2_SELF_TEST_REG
  
  #define BMA2X2_NEG_SELF_TEST__POS		2
  #define BMA2X2_NEG_SELF_TEST__LEN		1
  #define BMA2X2_NEG_SELF_TEST__MSK		0x04
  #define BMA2X2_NEG_SELF_TEST__REG		BMA2X2_SELF_TEST_REG
  
  #define BMA2X2_SELF_TEST_AMP__POS		4
  #define BMA2X2_SELF_TEST_AMP__LEN		1
  #define BMA2X2_SELF_TEST_AMP__MSK		0x10
  #define BMA2X2_SELF_TEST_AMP__REG		BMA2X2_SELF_TEST_REG
  
  
  #define BMA2X2_UNLOCK_EE_PROG_MODE__POS		0
  #define BMA2X2_UNLOCK_EE_PROG_MODE__LEN		1
  #define BMA2X2_UNLOCK_EE_PROG_MODE__MSK		0x01
  #define BMA2X2_UNLOCK_EE_PROG_MODE__REG		BMA2X2_EEPROM_CTRL_REG
  
  #define BMA2X2_START_EE_PROG_TRIG__POS		1
  #define BMA2X2_START_EE_PROG_TRIG__LEN		1
  #define BMA2X2_START_EE_PROG_TRIG__MSK		0x02
  #define BMA2X2_START_EE_PROG_TRIG__REG		BMA2X2_EEPROM_CTRL_REG
  
  #define BMA2X2_EE_PROG_READY__POS		2
  #define BMA2X2_EE_PROG_READY__LEN		1
  #define BMA2X2_EE_PROG_READY__MSK		0x04
  #define BMA2X2_EE_PROG_READY__REG		BMA2X2_EEPROM_CTRL_REG
  
  #define BMA2X2_UPDATE_IMAGE__POS		3
  #define BMA2X2_UPDATE_IMAGE__LEN		1
  #define BMA2X2_UPDATE_IMAGE__MSK		0x08
  #define BMA2X2_UPDATE_IMAGE__REG		BMA2X2_EEPROM_CTRL_REG
  
  #define BMA2X2_EE_REMAIN__POS			4
  #define BMA2X2_EE_REMAIN__LEN			4
  #define BMA2X2_EE_REMAIN__MSK			0xF0
  #define BMA2X2_EE_REMAIN__REG			BMA2X2_EEPROM_CTRL_REG
  
  #define BMA2X2_EN_SPI_MODE_3__POS		0
  #define BMA2X2_EN_SPI_MODE_3__LEN		1
  #define BMA2X2_EN_SPI_MODE_3__MSK		0x01
  #define BMA2X2_EN_SPI_MODE_3__REG		BMA2X2_SERIAL_CTRL_REG
  
  #define BMA2X2_I2C_WATCHDOG_PERIOD__POS		1
  #define BMA2X2_I2C_WATCHDOG_PERIOD__LEN		1
  #define BMA2X2_I2C_WATCHDOG_PERIOD__MSK		0x02
  #define BMA2X2_I2C_WATCHDOG_PERIOD__REG		BMA2X2_SERIAL_CTRL_REG
  
  #define BMA2X2_EN_I2C_WATCHDOG__POS		2
  #define BMA2X2_EN_I2C_WATCHDOG__LEN		1
  #define BMA2X2_EN_I2C_WATCHDOG__MSK		0x04
  #define BMA2X2_EN_I2C_WATCHDOG__REG		BMA2X2_SERIAL_CTRL_REG
  
  #define BMA2X2_EXT_MODE__POS			7
  #define BMA2X2_EXT_MODE__LEN			1
  #define BMA2X2_EXT_MODE__MSK			0x80
  #define BMA2X2_EXT_MODE__REG			BMA2X2_EXTMODE_CTRL_REG
  
  #define BMA2X2_ALLOW_UPPER__POS			6
  #define BMA2X2_ALLOW_UPPER__LEN			1
  #define BMA2X2_ALLOW_UPPER__MSK			0x40
  #define BMA2X2_ALLOW_UPPER__REG			BMA2X2_EXTMODE_CTRL_REG
  
  #define BMA2X2_MAP_2_LOWER__POS			5
  #define BMA2X2_MAP_2_LOWER__LEN			1
  #define BMA2X2_MAP_2_LOWER__MSK			0x20
  #define BMA2X2_MAP_2_LOWER__REG			BMA2X2_EXTMODE_CTRL_REG
  
  #define BMA2X2_MAGIC_NUMBER__POS		0
  #define BMA2X2_MAGIC_NUMBER__LEN		5
  #define BMA2X2_MAGIC_NUMBER__MSK		0x1F
  #define BMA2X2_MAGIC_NUMBER__REG		BMA2X2_EXTMODE_CTRL_REG
  
  #define BMA2X2_UNLOCK_EE_WRITE_TRIM__POS	4
  #define BMA2X2_UNLOCK_EE_WRITE_TRIM__LEN	4
  #define BMA2X2_UNLOCK_EE_WRITE_TRIM__MSK	0xF0
  #define BMA2X2_UNLOCK_EE_WRITE_TRIM__REG	BMA2X2_CTRL_UNLOCK_REG
  
  #define BMA2X2_EN_SLOW_COMP_X__POS		0
  #define BMA2X2_EN_SLOW_COMP_X__LEN		1
  #define BMA2X2_EN_SLOW_COMP_X__MSK		0x01
  #define BMA2X2_EN_SLOW_COMP_X__REG		BMA2X2_OFFSET_CTRL_REG
  
  #define BMA2X2_EN_SLOW_COMP_Y__POS		1
  #define BMA2X2_EN_SLOW_COMP_Y__LEN		1
  #define BMA2X2_EN_SLOW_COMP_Y__MSK		0x02
  #define BMA2X2_EN_SLOW_COMP_Y__REG		BMA2X2_OFFSET_CTRL_REG
  
  #define BMA2X2_EN_SLOW_COMP_Z__POS		2
  #define BMA2X2_EN_SLOW_COMP_Z__LEN		1
  #define BMA2X2_EN_SLOW_COMP_Z__MSK		0x04
  #define BMA2X2_EN_SLOW_COMP_Z__REG		BMA2X2_OFFSET_CTRL_REG
  
  #define BMA2X2_FAST_CAL_RDY_S__POS		4
  #define BMA2X2_FAST_CAL_RDY_S__LEN		1
  #define BMA2X2_FAST_CAL_RDY_S__MSK		0x10
  #define BMA2X2_FAST_CAL_RDY_S__REG		BMA2X2_OFFSET_CTRL_REG
  
  #define BMA2X2_CAL_TRIGGER__POS			5
  #define BMA2X2_CAL_TRIGGER__LEN			2
  #define BMA2X2_CAL_TRIGGER__MSK			0x60
  #define BMA2X2_CAL_TRIGGER__REG			BMA2X2_OFFSET_CTRL_REG
  
  #define BMA2X2_RESET_OFFSET_REGS__POS		7
  #define BMA2X2_RESET_OFFSET_REGS__LEN		1
  #define BMA2X2_RESET_OFFSET_REGS__MSK		0x80
  #define BMA2X2_RESET_OFFSET_REGS__REG		BMA2X2_OFFSET_CTRL_REG
  #define BMA2X2_COMP_CUTOFF__POS			0
  #define BMA2X2_COMP_CUTOFF__LEN			1
  #define BMA2X2_COMP_CUTOFF__MSK			0x01
  #define BMA2X2_COMP_CUTOFF__REG			BMA2X2_OFFSET_PARAMS_REG
  
  #define BMA2X2_COMP_TARGET_OFFSET_X__POS	1
  #define BMA2X2_COMP_TARGET_OFFSET_X__LEN	2
  #define BMA2X2_COMP_TARGET_OFFSET_X__MSK	0x06
  #define BMA2X2_COMP_TARGET_OFFSET_X__REG	BMA2X2_OFFSET_PARAMS_REG
  
  #define BMA2X2_COMP_TARGET_OFFSET_Y__POS	3
  #define BMA2X2_COMP_TARGET_OFFSET_Y__LEN	2
  #define BMA2X2_COMP_TARGET_OFFSET_Y__MSK        0x18
  #define BMA2X2_COMP_TARGET_OFFSET_Y__REG	BMA2X2_OFFSET_PARAMS_REG
  
  #define BMA2X2_COMP_TARGET_OFFSET_Z__POS	5
  #define BMA2X2_COMP_TARGET_OFFSET_Z__LEN	2
  #define BMA2X2_COMP_TARGET_OFFSET_Z__MSK	0x60
  #define BMA2X2_COMP_TARGET_OFFSET_Z__REG	BMA2X2_OFFSET_PARAMS_REG
  
  #define BMA2X2_FIFO_DATA_SELECT__POS		0
  #define BMA2X2_FIFO_DATA_SELECT__LEN		2
  #define BMA2X2_FIFO_DATA_SELECT__MSK		0x03
  #define BMA2X2_FIFO_DATA_SELECT__REG		BMA2X2_FIFO_MODE_REG
  
  #define BMA2X2_FIFO_TRIGGER_SOURCE__POS		2
  #define BMA2X2_FIFO_TRIGGER_SOURCE__LEN		2
  #define BMA2X2_FIFO_TRIGGER_SOURCE__MSK		0x0C
  #define BMA2X2_FIFO_TRIGGER_SOURCE__REG		BMA2X2_FIFO_MODE_REG
  
  #define BMA2X2_FIFO_TRIGGER_ACTION__POS		4
  #define BMA2X2_FIFO_TRIGGER_ACTION__LEN		2
  #define BMA2X2_FIFO_TRIGGER_ACTION__MSK		0x30
  #define BMA2X2_FIFO_TRIGGER_ACTION__REG		BMA2X2_FIFO_MODE_REG
  
  #define BMA2X2_FIFO_MODE__POS			6
  #define BMA2X2_FIFO_MODE__LEN			2
  #define BMA2X2_FIFO_MODE__MSK			0xC0
  #define BMA2X2_FIFO_MODE__REG			BMA2X2_FIFO_MODE_REG
  
  
  #define BMA2X2_STATUS1				0
  #define BMA2X2_STATUS2				1
  #define BMA2X2_STATUS3				2
  #define BMA2X2_STATUS4				3
  #define BMA2X2_STATUS5				4
  
  
  #define BMA2X2_RANGE_2G				3
  #define BMA2X2_RANGE_4G				5
  #define BMA2X2_RANGE_8G				8
  #define BMA2X2_RANGE_16G			12
  
  
  #define BMA2X2_BW_7_81HZ			0x08
  #define BMA2X2_BW_15_63HZ			0x09
  #define BMA2X2_BW_31_25HZ			0x0A
  #define BMA2X2_BW_62_50HZ			0x0B
  #define BMA2X2_BW_125HZ				0x0C
  #define BMA2X2_BW_250HZ				0x0D
  #define BMA2X2_BW_500HZ				0x0E
  #define BMA2X2_BW_1000HZ			0x0F
  #define BMA2X2_SLEEP_DUR_0_5MS			0x05
  #define BMA2X2_SLEEP_DUR_1MS			0x06
  #define BMA2X2_SLEEP_DUR_2MS			0x07
  #define BMA2X2_SLEEP_DUR_4MS			0x08
  #define BMA2X2_SLEEP_DUR_6MS			0x09
  #define BMA2X2_SLEEP_DUR_10MS			0x0A
  #define BMA2X2_SLEEP_DUR_25MS			0x0B
  #define BMA2X2_SLEEP_DUR_50MS			0x0C
  #define BMA2X2_SLEEP_DUR_100MS			0x0D
  #define BMA2X2_SLEEP_DUR_500MS			0x0E
  #define BMA2X2_SLEEP_DUR_1S			0x0F
  
  #define BMA2X2_LATCH_DUR_NON_LATCH		0x00
  #define BMA2X2_LATCH_DUR_250MS			0x01
  #define BMA2X2_LATCH_DUR_500MS			0x02
  #define BMA2X2_LATCH_DUR_1S			0x03
  #define BMA2X2_LATCH_DUR_2S			0x04
  #define BMA2X2_LATCH_DUR_4S			0x05
  #define BMA2X2_LATCH_DUR_8S			0x06
  #define BMA2X2_LATCH_DUR_LATCH			0x07
  #define BMA2X2_LATCH_DUR_NON_LATCH1		0x08
  #define BMA2X2_LATCH_DUR_250US			0x09
  #define BMA2X2_LATCH_DUR_500US			0x0A
  #define BMA2X2_LATCH_DUR_1MS			0x0B
  #define BMA2X2_LATCH_DUR_12_5MS			0x0C
  #define BMA2X2_LATCH_DUR_25MS			0x0D
  #define BMA2X2_LATCH_DUR_50MS			0x0E
  #define BMA2X2_LATCH_DUR_LATCH1			0x0F
  
  #define BMA2X2_MODE_NORMAL			0
  #define BMA2X2_MODE_LOWPOWER1			1
  #define BMA2X2_MODE_SUSPEND			2
  #define BMA2X2_MODE_DEEP_SUSPEND		3
  #define BMA2X2_MODE_LOWPOWER2			4
  #define BMA2X2_MODE_STANDBY			5
  
  #define BMA2X2_X_AXIS				0
  #define BMA2X2_Y_AXIS				1
  #define BMA2X2_Z_AXIS				2
  
  #define BMA2X2_Low_G_Interrupt			0
  #define BMA2X2_High_G_X_Interrupt		1
  #define BMA2X2_High_G_Y_Interrupt		2
  #define BMA2X2_High_G_Z_Interrupt		3
  #define BMA2X2_DATA_EN				4
  #define BMA2X2_Slope_X_Interrupt		5
  #define BMA2X2_Slope_Y_Interrupt		6
  #define BMA2X2_Slope_Z_Interrupt		7
  #define BMA2X2_Single_Tap_Interrupt		8
  #define BMA2X2_Double_Tap_Interrupt		9
  #define BMA2X2_Orient_Interrupt			10
  #define BMA2X2_Flat_Interrupt			11
  #define BMA2X2_FFULL_INTERRUPT			12
  #define BMA2X2_FWM_INTERRUPT			13
  
  #define BMA2X2_INT1_LOWG			0
  #define BMA2X2_INT2_LOWG			1
  #define BMA2X2_INT1_HIGHG			0
  #define BMA2X2_INT2_HIGHG			1
  #define BMA2X2_INT1_SLOPE			0
  #define BMA2X2_INT2_SLOPE			1
  #define BMA2X2_INT1_SLO_NO_MOT			0
  #define BMA2X2_INT2_SLO_NO_MOT			1
  #define BMA2X2_INT1_DTAP			0
  #define BMA2X2_INT2_DTAP			1
  #define BMA2X2_INT1_STAP			0
  #define BMA2X2_INT2_STAP			1
  #define BMA2X2_INT1_ORIENT			0
  #define BMA2X2_INT2_ORIENT			1
  #define BMA2X2_INT1_FLAT			0
  #define BMA2X2_INT2_FLAT			1
  #define BMA2X2_INT1_NDATA			0
  #define BMA2X2_INT2_NDATA			1
  #define BMA2X2_INT1_FWM				0
  #define BMA2X2_INT2_FWM				1
  #define BMA2X2_INT1_FFULL			0
  #define BMA2X2_INT2_FFULL			1
  
  #define BMA2X2_SRC_LOWG				0
  #define BMA2X2_SRC_HIGHG			1
  #define BMA2X2_SRC_SLOPE			2
  #define BMA2X2_SRC_SLO_NO_MOT			3
  #define BMA2X2_SRC_TAP				4
  #define BMA2X2_SRC_DATA				5
  
  #define BMA2X2_INT1_OUTPUT			0
  #define BMA2X2_INT2_OUTPUT			1
  #define BMA2X2_INT1_LEVEL			0
  #define BMA2X2_INT2_LEVEL			1
  
  #define BMA2X2_LOW_DURATION			0
  #define BMA2X2_HIGH_DURATION			1
  #define BMA2X2_SLOPE_DURATION			2
  #define BMA2X2_SLO_NO_MOT_DURATION		3
  
  #define BMA2X2_LOW_THRESHOLD			0
  #define BMA2X2_HIGH_THRESHOLD			1
  #define BMA2X2_SLOPE_THRESHOLD			2
  #define BMA2X2_SLO_NO_MOT_THRESHOLD		3
  
  #define BMA2X2_LOWG_HYST			0
  #define BMA2X2_HIGHG_HYST			1
  
  #define BMA2X2_ORIENT_THETA			0
  #define BMA2X2_FLAT_THETA			1
  
  #define BMA2X2_I2C_SELECT			0
  #define BMA2X2_I2C_EN				1
  
  #define BMA2X2_SLOW_COMP_X			0
  #define BMA2X2_SLOW_COMP_Y			1
  #define BMA2X2_SLOW_COMP_Z			2
  
  #define BMA2X2_CUT_OFF				0
  #define BMA2X2_OFFSET_TRIGGER_X			1
  #define BMA2X2_OFFSET_TRIGGER_Y			2
  #define BMA2X2_OFFSET_TRIGGER_Z			3
  
  #define BMA2X2_GP0				0
  #define BMA2X2_GP1				1
  
  #define BMA2X2_SLO_NO_MOT_EN_X			0
  #define BMA2X2_SLO_NO_MOT_EN_Y			1
  #define BMA2X2_SLO_NO_MOT_EN_Z			2
  #define BMA2X2_SLO_NO_MOT_EN_SEL		3
  
  #define BMA2X2_WAKE_UP_DUR_20MS			0
  #define BMA2X2_WAKE_UP_DUR_80MS			1
  #define BMA2X2_WAKE_UP_DUR_320MS		2
  #define BMA2X2_WAKE_UP_DUR_2560MS		3
  #define BMA2X2_SELF_TEST0_ON			1
  #define BMA2X2_SELF_TEST1_ON			2
  
  #define BMA2X2_EE_W_OFF				0
  #define BMA2X2_EE_W_ON				1
  
  #define BMA2X2_LOW_TH_IN_G(gthres, range)           ((256 * gthres) / range)
  
  
  #define BMA2X2_HIGH_TH_IN_G(gthres, range)          ((256 * gthres) / range)
  
  
  #define BMA2X2_LOW_HY_IN_G(ghyst, range)            ((32 * ghyst) / range)
  
  
  #define BMA2X2_HIGH_HY_IN_G(ghyst, range)           ((32 * ghyst) / range)
  
  
  #define BMA2X2_SLOPE_TH_IN_G(gthres, range)    ((128 * gthres) / range)
  
  
  #define BMA2X2_GET_BITSLICE(regvar, bitname)\
  	((regvar & bitname##__MSK) >> bitname##__POS)
  
  
  #define BMA2X2_SET_BITSLICE(regvar, bitname, val)\
  	((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
  
  #define CHECK_CHIP_ID_TIME_MAX 5
  #define BMA255_CHIP_ID 0XFA
  #define BMA250E_CHIP_ID 0XF9
  #define BMA222E_CHIP_ID 0XF8
  #define BMA280_CHIP_ID 0XFB
  #define BMA355_CHIP_ID 0XEA
  
  #define BMA255_TYPE 0
  #define BMA250E_TYPE 1
  #define BMA222E_TYPE 2
  #define BMA280_TYPE 3
  
  #define MAX_FIFO_F_LEVEL 32
  #define MAX_FIFO_F_BYTES 6
  #define BMA_MAX_RETRY_I2C_XFER (100)
  
  /*! Bosch sensor remapping table size P0~P7*/
  #define MAX_AXIS_REMAP_TAB_SZ 8
  
  
  /* How was BMA enabled(set to operation mode) */
  #define BMA_ENABLED_ALL 0
  #define BMA_ENABLED_SGM 1
  #define BMA_ENABLED_DTAP 2
  #define BMA_ENABLED_INPUT 3
  #define BMA_ENABLED_BSX 4
  
  
  /*!
   * @brief:BMI058 feature
   *  macro definition
  */
  
  #define BMA2X2_FIFO_DAT_SEL_X                     1
  #define BMA2X2_FIFO_DAT_SEL_Y                     2
  #define BMA2X2_FIFO_DAT_SEL_Z                     3
  
  /*! high g or slope interrupt type definition*/
  /*! High G interrupt of x, y, z axis happened */
  #define HIGH_G_INTERRUPT_X            HIGH_G_INTERRUPT_X_HAPPENED
  #define HIGH_G_INTERRUPT_Y            HIGH_G_INTERRUPT_Y_HAPPENED
  #define HIGH_G_INTERRUPT_Z            HIGH_G_INTERRUPT_Z_HAPPENED
  /*! High G interrupt of x, y, z negative axis happened */
  #define HIGH_G_INTERRUPT_X_N          HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED
  #define HIGH_G_INTERRUPT_Y_N          HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED
  #define HIGH_G_INTERRUPT_Z_N          HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED
  /*! Slope interrupt of x, y, z axis happened */
  #define SLOPE_INTERRUPT_X             SLOPE_INTERRUPT_X_HAPPENED
  #define SLOPE_INTERRUPT_Y             SLOPE_INTERRUPT_Y_HAPPENED
  #define SLOPE_INTERRUPT_Z             SLOPE_INTERRUPT_Z_HAPPENED
  /*! Slope interrupt of x, y, z negative axis happened */
  #define SLOPE_INTERRUPT_X_N           SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED
  #define SLOPE_INTERRUPT_Y_N           SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED
  #define SLOPE_INTERRUPT_Z_N           SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED
  
  struct bma2x2_type_map_t {
  
  	/*! bma2x2 sensor chip id */
  	uint16_t chip_id;
  
  	/*! bma2x2 sensor type */
  	uint16_t sensor_type;
  
  	/*! bma2x2 sensor name */
  	const char *sensor_name;
  };
  static struct device *bma2x2_device;
  
  static const struct bma2x2_type_map_t sensor_type_map[] = {
  
  	{BMA255_CHIP_ID, BMA255_TYPE, "BMA255/254"},
  	{BMA355_CHIP_ID, BMA255_TYPE, "BMA355"},
  	{BMA250E_CHIP_ID, BMA250E_TYPE, "BMA250E"},
  	{BMA222E_CHIP_ID, BMA222E_TYPE, "BMA222E"},
  	{BMA280_CHIP_ID, BMA280_TYPE, "BMA280"},
  
  };
  
  static int bma2x2_set_mode(struct i2c_client *client,
  			u8 mode, u8 enabled_mode);
  static int bma2x2_get_mode(struct i2c_client *client, u8 *mode);
  static int bma2x2_get_fifo_mode(struct i2c_client *client, u8 *fifo_mode);
  
  
  #endif
  
  