#===============================================================================
# HAL I2C Libs
#
# GENERAL DESCRIPTION
#    HAL I2C Libs build script
#
# Copyright (c) 2009-2010 by QUALCOMM, Incorporated.
# All Rights Reserved.
# QUALCOMM Proprietary/GTDR
#
#-------------------------------------------------------------------------------
#
#  $Header: //source/qcom/qct/core/buses/i2c/rel/1H11/hal/legacy/build/SConscript#1 $
#  $DateTime: 2011/06/07 08:56:37 $
#  $Author: lkodheli $
#  $Change: 1780292 $
#                      EDIT HISTORY FOR FILE
#                      
#  This section contains comments describing changes made to the module.
#  Notice that changes are listed in reverse chronological order.
#  
# when       who     what, where, why
# --------   ---     ---------------------------------------------------------
# 07/10/09   MJS     Merged to SCMM qcore tip.
#===============================================================================
Import('env')
env = env.Clone()

if env['MSM_ID'] in ['8650', '8650B']:
   env.Replace(MSM_ID = '8650B')
elif env['MSM_ID'] in ['7625', '7627']:
   env.Replace(MSM_ID = '76xx')
elif env['MSM_ID'] in ['7x30']:
   env.Replace(MSM_ID = '7x30')
elif env['MSM_ID'] in ['6695']:
   env.Replace(MSM_ID = '6695')
else:
   Return()
# Re-mapping of MSM_ID not required for 7x30, 7600, 6695
   
#-------------------------------------------------------------------------------
# Source PATH
#-------------------------------------------------------------------------------
SRCPATH = "../src"

env.VariantDir('${BUILDPATH}', SRCPATH, duplicate=0) 
   
#-------------------------------------------------------------------------------
# Publish Private APIs
#-------------------------------------------------------------------------------
env.PublishPrivateApi('BUSES_I2C_HAL', [
   '${INC_ROOT}/core/buses/i2c/hal/legacy/inc',
   '${INC_ROOT}/core/buses/i2c/hal/legacy/src/common',
   '${INC_ROOT}/core/buses/i2c/hal/legacy/src/${MSM_ID}',
])

#-------------------------------------------------------------------------------
# Internal depends within CoreBSP
#-------------------------------------------------------------------------------
CBSP_APIS = [
   'DEBUGTOOLS',
   'HAL',
   'MPROC',
   'SERVICES',
   'SYSTEMDRIVERS',
   'KERNEL',
]

env.RequirePublicApi(CBSP_APIS)
env.RequireRestrictedApi(CBSP_APIS)

#-------------------------------------------------------------------------------
# Sources, libraries
#-------------------------------------------------------------------------------

HAL_I2C_SOURCES = [
   '${BUILDPATH}/common/HALi2c.c',
   '${BUILDPATH}/${MSM_ID}/HALi2cTarget.c'
]   

hal_i2c_obj = env.Object(HAL_I2C_SOURCES)
hal_i2c_lib = env.Library('${BUILDPATH}/HALi2c', hal_i2c_obj)

#-------------------------------------------------------------------------------
# Add Libraries to image
#-------------------------------------------------------------------------------

env.AddLibsToImage(
   ['SINGLE_IMAGE', 'CBSP_SINGLE_IMAGE', 'MODEM_IMAGE', 'CBSP_MODEM_IMAGE', 
    'APPS_IMAGE', 'CBSP_APPS_IMAGE', 'OSBL_BOOT_IMAGE'], 
   hal_i2c_lib)
