⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mxd_sdk_porting.c

📁 MXD_SDK_Ax.x.xxx :MXD1320 软件开发包源码
💻 C
字号:
/*!
 *
 * \file    mxd_sdk_porting.c
 *
 * \brief    Poring Section for SDK.
 *
 * Implementation of those APIS need porting.
 *
 * \par    Include files
 *    - mxd_sdk_api.h
 *    - mxd_sdk_data.h
 *    - mxd_sdk_porting.h
 *
 * \par    Sections
 * - OAL
 * - I2C
 * - Tuner
 * - Config
 *
 * \par    Copyright (c) 2007 Maxscend Technologies Inc. All rights reserved
 *
 * PROPRIETARY RIGHTS of Maxscend Technologies Inc. are involved in
 * the subject matter of this material.  All manufacturing, reproduction, 
 * use, and sales rights pertaining to this subject matter are governed 
 * by the license agreement.  The recipient of this software implicitly 
 * accepts the terms of the license.
 *
 * \version
 * Revision of last commit:  $Rev:: 37                           $
 * Author of last commit  :  $Author:: MAXSCEND\peng.chen        $
 * Date of last commit    :  $Date:: 2007-10-07 10:22:55 +0800 (#$
 *
 */

/* porting point - please add your code here for header file including */
#include "mxd_sdk_data.h"
#include "mxd_sdk_api.h"
#include "mxd_sdk_porting.h"

/***********************************************************************************************
 *
 * OAL Porting Section of SDK
 * - OAL_Sleep
 * - OAL_DebugPrint
 *
 ***********************************************************************************************
 */
/*!
 * Delay, unit: ms
 *
 * \param 
 *             milliSeconds:  [ in ] the milli seconds to be delayed.
 * \return 
 *             Return code by MXD_RTN_CODE_E enumeration
 */
MXD_RTN_CODE_E MXD_API OAL_Sleep( IN MXD_U32 milliSeconds )
{
    /* porting point - please add your code here for sleep */

    return MXD_RTN_OK;
} /* end of OAL_Sleep( ) */


/*!
 * Debug Print
 *
 * \param 
 *             traceLevel    [ in ] current trace level
 *             dbgOutput    [ in ] Output debug information 
 * \return 
 *             Return code by MXD_RTN_CODE_E enumeration
 */
VOID MXD_API OAL_DebugPrint( IN MXD_U8 trace, IN CONST MXD_CHAR* dbgOutput, ... )
{
    if(DEBUG_TRACE_LEVEL >= trace)       
    {
	    /* porting point - please add your code here for debug output */
    }
} /* end of OAL_DebugPrint( ) */

#ifdef __I2C_TS_USED__
/***********************************************************************************************
 *
 * I2C Porting Section of SDK
 *
 ***********************************************************************************************
 */
/*!
 * I2C read
 *
 * \param i2cHandle    		[ in ] Handle of the device driver
 * \param slaveAddr    		[ in ] Demodulator slave address.
 * \param byteLen			[ in ] the byte length to be read.
 * \param pValue			[ out ] pointer to the value returned
 * \param pRtnLen			[ out ] pointer to the length has been read
 *
 * \return Return code by MHL_DRV_RTN_CODE_E enumeration
 *
 */

MXD_RTN_CODE_E MXD_API MXD_Porting_I2cRead( 
    IN HMXDDEV i2cHandle,
    IN MXD_U16 slaveAddr, 
    IN MXD_U8 dataAddr,    
    IN MXD_U16 byteLen,
    OUT MXD_U8 *pValue,
    OUT MXD_U16 *pRtnLen )
{	
    /* porting point - please add your code here for i2c read if I2C is used */
    return MXD_RTN_OK;
}/* end of MXD_Porting_I2cRead( ) */

/*!
 * I2C write.
 *
 * \param i2cHandle    		[ in ] Handle of the device driver
 * \param slaveAddr    		[ in ] Demodulator slave address.
 * \param byteLen			[ in ] the byte length to be written.
 * \param pValue			[ in ] pointer to the value to be written
 * \param pRtnLen			[ out ] pointer to the length has been read
 *
 * \return Return code by MHL_DRV_RTN_CODE_E enumeration
 *
 */
MXD_RTN_CODE_E MXD_API MXD_Porting_I2cWrite( 
    IN HMXDDEV i2cHandle,
    IN MXD_U16 slaveAddr, 
    IN MXD_U8 dataAddr,      
    IN MXD_U16 byteLen,
    IN MXD_U8 *pValue,
    OUT MXD_U16 *pRtnLen )
{
	/* porting point - please add your code here for i2c write if I2C is used */
    return MXD_RTN_OK;
}/* end of MXD_Porting_I2cWrite( ) */
#endif /* end of #ifdef __I2C_TS_USED__ */

/***********************************************************************************************
 *
 * Tuner Porting Section of SDK
 *
 ***********************************************************************************************
 */
/*!
 * Init for tuner, including demod for tuner
 *
 * \param hDevice    [ in ] Device handle
 * \return Return code by MXD_RTN_CODE_E enumeration
 *
 */
MXD_RTN_CODE_E MXD_API MXD_Porting_InitTuner(IN HMXDDEV hDevice)
{
	/* porting point - please add your code here for tuner interface & AGC setup */
    /* please refer to the reference code in the tuner directory */
	return MXD_RTN_OK;
}/* enf of MXD_Porting_InitTuner( )*/

#ifndef __TUNER_EXT_CTRL__
/*!
 * Tune the tuner to the frequency
 *
 * \param hDevice    [ in ] Device handle
 * \param freqHz     [ in ] frequency to be tuned, unit: Hz
 *
 * \return Return code by MXD_RTN_CODE_E enumeration
 *
 */
MXD_RTN_CODE_E MXD_API MXD_Porting_TuneFreq(IN HMXDDEV hDevice, IN MXD_U32 freqHz )
{
    /* porting point - please add your code here for setting tuner frequency */

	return MXD_RTN_OK;
}/* end of MXD_Porting_TuneFreq( )*/

/*!
 * Get tuner status. If locked, then return ok, if un-locked, then return failed.
 *
 * \param hDevice    [ in ] Device handle
 *
 * \return Return code by MXD_RTN_CODE_E enumeration
 *
 */
MXD_RTN_CODE_E MXD_API MXD_Porting_GetTunerStatus(IN HMXDDEV hDevice)
{
    /* porting point - please add your code here for polling tuner status */
	
	return MXD_RTN_OK; 
}/* end of MXD_Porting_GetTunerStatus( )*/

#endif /* end of #ifndef __TUNER_EXT_CTRL__ */

/***********************************************************************************************
 *
 * Config Section of SDK
 *
 ***********************************************************************************************
 */
/*!
 * Device Config
 *
 * \param pDemodProperty    [ in ] demod property
 * \param pTunerProperty    [ in ] tuner property
 *
 * \return Return code by MXD_RTN_CODE_E enumeration
 *
 */
VOID MXD_API MXD_Porting_DeviceConfig( IN PDEMOD_PROPERTY_S psDemodProperty, IN PTUNER_PROPERTY_S psTunerProperty)
{
    /* 
	 * Demod Configuration 
	 */
#ifdef __I2C_TS_USED__
	psDemodProperty->m_sChannelProperty.m_eRegAccessType = MXD_I2C_IF;
    psDemodProperty->m_sChannelProperty.m_eTsStreamAccessType = MXD_MP2TS_IF;

    psDemodProperty->m_sI2cProperty.m_BitRateKHz = I2C_BIT_RATE_IN_KHZ;
    psDemodProperty->m_sI2cProperty.m_DemodSlaveAddr = MXD_I2C_SLAVE_ADDR;
    psDemodProperty->m_sI2cProperty.m_pPIL_I2cRead = MXD_Porting_I2cRead;
    psDemodProperty->m_sI2cProperty.m_pPIL_I2cWrite = MXD_Porting_I2cWrite;

    psDemodProperty->m_sMp2tsProperty.m_SpeedKHz = MP2TS_CLK_FREQ_IN_KHZ;
    psDemodProperty->m_sMp2tsProperty.m_ByteMode = MP2TS_BYTE_MODE;
    psDemodProperty->m_sMp2tsProperty.m_DataMode = MP2TS_DATA_TYPE;
    psDemodProperty->m_sMp2tsProperty.m_TriggerEdge = MP2TS_TRIGGER_EDGE;
#endif /* end of #ifdef __I2C_TS_USED__ */
    
#ifdef __EEPROM_USED__
    psDemodProperty->m_EepromAddr = E2PROM_SLAVE_ADDR;
#else
	psDemodProperty->m_MtxLoadLen = MAX_I2C_BURST_WRITE_LEN;
#endif
	
    psDemodProperty->m_sSdramProperty.m_BurstLength = SDRAM_BURST_LENGTH;
    psDemodProperty->m_sSdramProperty.m_BurstType = SDRAM_BURST_TYPE;
    psDemodProperty->m_sSdramProperty.m_Cas = SDRAM_CAS;
    psDemodProperty->m_sSdramProperty.m_Ras = SDRAM_RAS;
    psDemodProperty->m_sSdramProperty.m_Rc = SDRAM_RC;
    psDemodProperty->m_sSdramProperty.m_RefreshPeriod = SDRAM_REFRESH_PERIOD;
    psDemodProperty->m_sSdramProperty.m_Rfc = SDRAM_RFC;
    psDemodProperty->m_sSdramProperty.m_Rp = SDRAM_RP;
    psDemodProperty->m_sSdramProperty.m_Rrd = SDRAM_RRD;
    psDemodProperty->m_sSdramProperty.m_Mrd = SDRAM_MRD;
    psDemodProperty->m_sSdramProperty.m_Xp = SDRAM_XP;
    psDemodProperty->m_sSdramProperty.m_Twr = SDRAM_TWR;
	psDemodProperty->m_sSdramProperty.m_CalibVal = SDRAM_CALIBVAL;

    /* Tuner Configuration */
    psTunerProperty->m_LifFreqKhz = LIF_FREQ_IN_KHZ;
    psTunerProperty->m_LifOrNZif = TUNER_NZIF_LIF;
    psTunerProperty->m_pPIL_InitTuner = MXD_Porting_InitTuner;
#ifndef __TUNER_EXT_CTRL__
    psTunerProperty->m_SlaveAddr = TUNER_SALVE_ADDR_VAL;
    psTunerProperty->m_pPIL_SetFreq = MXD_Porting_TuneFreq;
    psTunerProperty->m_pPIL_GetTunerStatus = MXD_Porting_GetTunerStatus;
#else
    psTunerProperty->m_pPIL_SetFreq = NULL;
    psTunerProperty->m_pPIL_GetTunerStatus = NULL;
#endif /* end of #ifndef __TUNER_EXT_CTRL__ */

}/* end of MxdPorting_devConfig( ) */

/***********************************************************************************************
 *
 * Callback Section of SDK
 *
 ***********************************************************************************************
 */
CALLBACK_SETTING_S gsCallbackSetting ={0, 0, 0, NULL, NULL, NULL};;

/* end of mxd_sdk_porting.c */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -