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

📄 tuner_reg.c

📁 模拟高频头的 驱动程序(搜台、换台等功能)
💻 C
字号:
/******************************************************************************/
/**
 * @file    tuner_reg.c
 *
 * @brief   This file contains the register transfer functions
 *          of the driver of module Tuner.
 *
 * @note    (c) 2005 - 2008 Micronas GmbH. All rights reserved.
 *          Any use of the Software is permitted only in accordance
 *          with the terms set forth in the disclaimer text file.
 *
 * @author  ACOM software team
 ******************************************************************************/

#define _SOURCE_TUNER_REG_


/******************************************************************************/
/**
 * INCLUDE FILES:
 ******************************************************************************/

#include <system.h>

#ifdef __PIP_PVP__
#include <pip_pvp_main.h>
#endif

#include <api_i2c.h>
#include <tuner_init.h>
#include "tuner_rh_reg.h"
#include "tuner_reg.h"



/******************************************************************************/
/**
 * GLOBAL FUNCTIONS:
 ******************************************************************************/

/******************************************************************************/
/**
 * @brief   Sets value to bitslice, calculate the corresponding hardware
 *          register and write it to device.
 *
 * @param   idBitslice - [in] ID number of specified bitslice
 * @param   uValue     - [in] value to set for bitslice
 *
 * return
 ******************************************************************************/

void TUNER_RegSet(TUNER_ID_t idBitslice, const uint8_t uValue)
{
   TUNER_t bs;
   uint8_t uData;

   bs = tuner[idBitslice];
   /* get data from mirror */
   uData = tunerVar[bs.uVar] ;

   uData &= ~bs.uMask;
   uData |= (uValue << (bs.uCtrl & TUNER_CTRL_SHIFT)) & bs.uMask;

   /* shadow variable ? */
   if (bs.uVar != 0)
   {  /* update shadow variable */
      tunerVar[bs.uVar] = uData;
   }

   /* there is no single write into single register only update shadow */
   /* shadow variables will be written all once                        */
}



/******************************************************************************/
/**
 * @brief   Executes all I2c registers.
 *
 * @param   --
 *
 * @return  --
 ******************************************************************************/

void Tuner_RegWriteAllRegisters(void)
{
   uint8_t dataBuf[4];

   dataBuf[0] = (uint8_t)tunerVar[1];
   dataBuf[1] = (uint8_t)tunerVar[2];
   dataBuf[2] = (uint8_t)tunerVar[3];
   dataBuf[3] = (uint8_t)tunerVar[4];
#ifdef __PIP_PVP__
   if (useTargetPvp_g == TRUE)
       API_I2c_Write(I2CDEV_PVP_TUNER, 0, 0, dataBuf, 4);
   else
#endif
       API_I2c_Write(I2CDEV_TUNER, 0, 0, dataBuf, 4);
}

⌨️ 快捷键说明

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