📄 mt_userdef.h
字号:
/**
* \file $Id: mt_userdef.h,v 1.6 2005/10/05 21:54:00 dingtao Exp $
*
* \brief MicroTuner software interface for Micronas DRX driver
*
* \author Jasper Schrader
*
* This file is based on a template provided by Microtune and has been adapted to
* the requirements for the DRX driver. This file is distributed with approval of
* Microtune but further MicroTuner driver files must be obtained from Microtune.
*
* $(c) 2005 Micronas GmbH. All rights reserved.
*
* This software and related documentation (the 'Software') are intellectual
* property owned by Micronas and are copyright of Micronas, unless specifically
* noted otherwise.
*
* Any use of the Software is permitted only pursuant to the terms of the
* license agreement, if any, which accompanies, is included with or applicable
* to the Software ('License Agreement') or upon express written consent of
* Micronas. Any copying, reproduction or redistribution of the Software in
* whole or in part by any means not in accordance with the License Agreement
* or as agreed in writing by Micronas is expressly prohibited.
*
* THE SOFTWARE IS WARRANTED, IF AT ALL, ONLY ACCORDING TO THE TERMS OF THE
* LICENSE AGREEMENT. EXCEPT AS WARRANTED IN THE LICENSE AGREEMENT THE SOFTWARE
* IS DELIVERED 'AS IS' AND MICRONAS HEREBY DISCLAIMS ALL WARRANTIES AND
* CONDITIONS WITH REGARD TO THE SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIT
* ENJOYMENT, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL
* PROPERTY OR OTHER RIGHTS WHICH MAY RESULT FROM THE USE OR THE INABILITY
* TO USE THE SOFTWARE.
*
* IN NO EVENT SHALL MICRONAS BE LIABLE FOR INDIRECT, INCIDENTAL, CONSEQUENTIAL,
* PUNITIVE, SPECIAL OR OTHER DAMAGES WHATSOEVER INCLUDING WITHOUT LIMITATION,
* DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
* INFORMATION, AND THE LIKE, ARISING OUT OF OR RELATING TO THE USE OF OR THE
* INABILITY TO USE THE SOFTWARE, EVEN IF MICRONAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES, EXCEPT PERSONAL INJURY OR DEATH RESULTING FROM
* MICRONAS' NEGLIGENCE. $
*
*/
/*****************************************************************************
**
** Name: MT_UserDef.h
**
** Description: User-defined data types needed by MicroTuner source code.
**
** Customers must provide the code for these functions
** in the file "MT_UserDef.c".
**
** Customers must verify that the typedef's in the
** "Data Types" section are correct for their platform.
**
** Functions
** Requiring
** Implementation: MT_WriteSub
** MT_ReadSub
** MT_Sleep
**
** References: None
**
** Exports: None
**
**
** Revision History:
**
** SCR Date Author Description
** -------------------------------------------------------------------------
** N/A 03-25-2004 DAD Original
** 082 12-06-2004 JWS Multi-tuner support - requires MTxxxx_CNT
** declarations
**
*****************************************************************************/
#if !defined( __MT_USERDEF_H )
#define __MT_USERDEF_H
/*
** If USE_DUMMY_MT2060 is defined a dummy implementation of the Microtune
** sources will be used.
**/
#include "bsp_types.h"
#if defined( __cplusplus )
extern "C" /* Use "C" external linkage */
{
#endif
/*
** Data Types
*/
typedef u8_t U8Data; /* type corresponds to 8 bits */
typedef u32_t UData_t; /* type must be at least 32 bits */
typedef s32_t SData_t; /* type must be at least 32 bits */
/* No drxdriver counterparts for the following */
typedef void * Handle_t; /* memory pointer type */
typedef double FData_t; /* floating point data type */
/*
** Define an MTxxxx_CNT macro for each type of tuner that will be built
** into your application (e.g., MT2121, MT2060). MT_TUNER_CNT
** must be set to the SUM of all of the MTxxxx_CNT macros.
**
*/
#define MT2121_CNT (1)
#define MT2060_CNT (2)
#define MT_TUNER_CNT (MT2060_CNT + MT2121_CNT) /* total num of MicroTuner tuners */
#define MAX_UDATA (4294967295) /* max value storable in UData_t */
/*
** Optional user-defined Error/Info Codes (examples below)
**
** This is the area where you can define user-specific error/info return
** codes to be returned by any of the functions you are responsible for
** writing such as MT_WriteSub() and MT_ReadSub. There are four bits
** available in the status field for your use. When set, these
** bits will be returned in the status word returned by any tuner driver
** call. If you OR in the MT_ERROR bit as well, the tuner driver code
** will treat the code as an error.
**
** The following are a few examples of errors you can provide.
**
** Example 1:
** You might check to see the hUserData handle is correct and issue
** MY_USERDATA_INVALID which would be defined like this:
**
** #define MY_USERDATA_INVALID (MT_USER_ERROR | MT_USER_DEFINED1)
**
**
** Example 2:
** You might be able to provide more descriptive two-wire bus errors:
**
** #define NO_ACK (MT_USER_ERROR | MT_USER_DEFINED1)
** #define NO_NACK (MT_USER_ERROR | MT_USER_DEFINED2)
** #define BUS_BUSY (MT_USER_ERROR | MT_USER_DEFINED3)
**
**
** Example 3:
** You can also provide information (non-error) feedback:
**
** #define MY_INFO_1 (MT_USER_DEFINED1)
**
**
** Example 4:
** You can combine the fields together to make a multi-bit field.
** This one can provide the tuner number based off of the addr
** passed to MT_WriteSub or MT_ReadSub. It assumes that
** MT_USER_DEFINED4 through MT_USER_DEFINED1 are contiguously. If
** TUNER_NUM were OR'ed into the status word on an error, you could
** use this to identify which tuner had the problem (and whether it
** was during a read or write operation).
**
** #define TUNER_NUM ((addr & 0x07) >> 1) << MT_USER_SHIFT
**
*/
/*****************************************************************************
**
** Name: MT_WriteSub
**
** Description: Write values to device using a two-wire serial bus.
**
** Parameters: hUserData - User-specific I/O parameter that was
** passed to tuner's Open function.
** addr - device serial bus address (value passed
** as parameter to MTxxxx_Open)
** subAddress - serial bus sub-address (Register Address)
** pData - pointer to the Data to be written to the
** device
** cnt - number of bytes/registers to be written
**
** Returns: status:
** MT_OK - No errors
** MT_COMM_ERR - Serial bus communications error
** user-defined
**
** Notes: This is a callback function that is called from the
** the tuning algorithm. You MUST provide code for this
** function to write data using the tuner's 2-wire serial
** bus.
**
** The hUserData parameter is a user-specific argument.
** If additional arguments are needed for the user's
** serial bus read/write functions, this argument can be
** used to supply the necessary information.
** The hUserData parameter is initialized in the tuner's Open
** function.
**
** Revision History:
**
** SCR Date Author Description
** -------------------------------------------------------------------------
** N/A 03-25-2004 DAD Original
**
*****************************************************************************/
UData_t MT_WriteSub(Handle_t hUserData,
UData_t addr,
U8Data subAddress,
U8Data *pData,
UData_t cnt);
/*****************************************************************************
**
** Name: MT_ReadSub
**
** Description: Read values from device using a two-wire serial bus.
**
** Parameters: hUserData - User-specific I/O parameter that was
** passed to tuner's Open function.
** addr - device serial bus address (value passed
** as parameter to MTxxxx_Open)
** subAddress - serial bus sub-address (Register Address)
** pData - pointer to the Data to be written to the
** device
** cnt - number of bytes/registers to be written
**
** Returns: status:
** MT_OK - No errors
** MT_COMM_ERR - Serial bus communications error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -