📄 drv2user.h
字号:
/**********************************************************************
* DRV2USER.H
* User-defined data types and functions for DRV2002
*
* Copyright (C) 2000 NxtWave Communications, Inc.
*
*
* Rev 1.10 May 30 2001 14:10:46
* Added extern agcData[].
*
* Rev 1.9 May 17 2001 16:43:46
* Modifications for flexible AGC and multiregister access fix.
*
* Rev 1.8 Apr 20 2001 18:19:30
* First Official Release Version
*
* Rev 1.0 Nov 29 2000 20:46:42
* Initial revision.
**********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#include <wdm.h>
#ifdef __cplusplus
}
#endif
/* Insert your headers here */
#include "tuner.h"
#include "debug.h"
#ifndef DRV2USER_H
#define DRV2USER_H
/*
******************************************************************************
Defines
******************************************************************************
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
typedef enum {
SUCCESS = 0,
FAILURE
} NXTAPI;
/* MACRO-based definitions for memory alloc/free */
#define NxtAllocateMem(byteCount) ExAllocatePoolWithTag(NonPagedPool, byteCount, 'txnC')
#define NxtFreeMem(pBuffer) ExFreePool(pBuffer)
/* Adjacent channel detection thresholds -- see API manual for description */
#define IF_INPUT_ADJACENT_ON 0x9500 /* 58% of full scale (0xFFFF) */
#define IF_INPUT_ADJACENT_OFF 0x7AE0 /* 48% of full scale */
#define NXTWAVE_I2C_ADDR 0x14
/*
******************************************************************************
Public Types
******************************************************************************
*/
typedef unsigned char Data8;
typedef int Data16;
typedef int Data32;
typedef long Data64;
typedef int Bool;
//typedef void* NxtCSHandle_t;
typedef PKMUTEX NxtCSHandle_t;
/*
******************************************************************************
Public Data
******************************************************************************
*/
extern Data8 agcData[];
/*
******************************************************************************
Public Functions
******************************************************************************
*/
/**********************************************************************
*
* NxtOnChannelLock
*
* Called by DRV2002 on detection of a Lock condition
*
* Inputs:
* void *pContext - identifies which NXT2002 instance called the function
*
* Notes:
* This is a callback function that is called from NxtStart(). The
* user may define any action that should take place when lock is
* detected.
*
**********************************************************************/
void NxtOnChannelLock( void *pContext );
/**********************************************************************
*
* NxtOnChannelLoss
*
* Called by DRV2002 on detection of a Loss-Of-Lock condition
*
* Inputs:
* void *pContext - identifies which NXT2002 instance called the function
*
* Notes:
* This is a callback function that is called from NxtStart(). The
* user may define any action that should take place when loss is
* detected.
*
**********************************************************************/
void NxtOnChannelLoss( void *pContext );
/**********************************************************************
*
* NxtSuspendThread
*
* Called by DRV2002 to insert a delay in the current thread
*
* Inputs:
* Data16 mSecTime - number of milliseconds to sleep
*
* Notes:
* This should be implemented as an operating system "sleep" with
* 1 mS resolution.
*
**********************************************************************/
void NxtSuspendThread( Data16 mSecTime );
/**********************************************************************
*
* NxtInitCriticalSection
*
* Called by DRV2002 to create a mutual exclusion object
*
* Outputs:
* NxtCSHandle_t *pCs - handle assigned to the new critical section object
*
* Returns:
* non-zero for failure
* 0 for success
*
**********************************************************************/
Data8 NxtInitCriticalSection( PFAST_MUTEX );
/**********************************************************************
*
* NxtDeleteCriticalSection
*
* Called by DRV2002 to delete a mutual exclusion object
*
* Inputs:
* NxtCSHandle_t cs - handle of the critical section object to be deleted
*
* Returns:
* non-zero for failure
* 0 for success
*
**********************************************************************/
Data8 NxtDeleteCriticalSection( PFAST_MUTEX );
/**********************************************************************
*
* NxtRequestCriticalSection
*
* Called by DRV2002 on entry to a critical section, when no blocking
* is allowed.
*
* Inputs:
* NxtCSHandle_t cs - handle of the critical section being requested
*
* Returns:
* non-zero for failure -- critical section is currently in use
* 0 for success -- critical section not held by another thread
*
* Notes:
* This function must return immediately, indicating whether or not
* the calling function has exclusive access to the critical section.
* Implement as a critical section entry with no wait.
*
**********************************************************************/
Data8 NxtRequestCriticalSection( PFAST_MUTEX );
/**********************************************************************
*
* NxtWaitForCriticalSection
*
* Called by DRV2002 on entry to a critical section, when blocking
* is required.
*
* Inputs:
* NxtCSHandle_t cs - handle of the critical section being requested
*
* Returns:
* non-zero for failure
* 0 for success
*
* Notes:
* This function must block indefinitely, until the requested critical
* section is available.
* Implement as a critical section entry with infinite wait.
*
**********************************************************************/
Data8 NxtWaitForCriticalSection( PFAST_MUTEX );
/**********************************************************************
*
* NxtLeaveCriticalSection
*
* Called by DRV2002 on exit from a critical section
*
* Inputs:
* NxtCSHandle_t cs - handle of the critical section being released
*
* Returns:
* non-zero for failure
* 0 for success
*
**********************************************************************/
Data8 NxtLeaveCriticalSection( PFAST_MUTEX );
/**********************************************************************
*
* NxtAllocateMem
*
* Called by DRV2002 to dynamically allocate memory.
*
* Inputs:
* Data16 byteCount - number of bytes of memory to allocate
*
* Returns:
* void* - pointer to allocated memory, NULL for failure
*
* Notes:
* This function is only used in DRV2CNTX.C to allocate device control
* blocks for multiple NXT2002 instances.
*
**********************************************************************/
/* NxtAllocateMem -- MACRO defined above
void *NxtAllocateMem(Data16 byteCount);
*/
/**********************************************************************
*
* NxtFreeMem
*
* Called by DRV2002 to release dynamically allocated memory.
*
* Inputs:
* void *pBuffer - pointer to allocated memory to be released
*
* Notes:
* This function is only used in DRV2CNTX.C to release device control
* blocks for multiple NXT2002 instances.
*
**********************************************************************/
/* NxtFreeMem -- MACRO defined above
void NxtFreeMem(void *pBuffer);
*/
/**********************************************************************
*
* NxtGetDevAddr
*
* Called by DRV2002 to learn the I2C address of the referenced ASIC
*
* Inputs:
* void *pContext - identifies which NXT2002 instance
*
* Returns:
* Data8 - the I2C device address of the referenced NXT2002 instance
*
**********************************************************************/
Data8 NxtGetDevAddr( void *pContext );
/**********************************************************************
*
* iicRead (optional)
*
* Called by tuner control software
*
* Inputs:
* Data8 iicAddr - device address
* Data8 byteCount - number of bytes to read
*
* Outputs:
* Data8 *pBuffer - read data bytes are copied to this buffer
*
* Returns:
* 0 for success
* non-zero for failure
*
**********************************************************************/
Data8 iicRead(Data8 iicAddr,
Data8 byteCount,
Data8 *pBuffer );
/**********************************************************************
*
* iicWrite (optional)
*
* Called by tuner control software
*
* Inputs:
* Data8 iicAddr - device address
* Data8 byteCount - number of bytes to write
* Data8 *pBuffer - write data bytes are copied from this buffer
*
* Returns:
* 0 for success
* non-zero for failure
*
**********************************************************************/
Data8 iicWrite(Data8 iicAddr,
Data8 byteCount,
Data8 *pBuffer);
/**********************************************************************
*
* iicRegRead
*
* Called by DRV2002 to read NXT2002 registers
*
* Inputs:
* Data8 iicAddr - device address
* Data8 regAddr - NXT2002 register to read
* Data8 byteCount - number of bytes to read
*
* Outputs:
* Data8 *pBuffer - read data bytes are copied to this buffer
*
* Returns:
* 0 for success
* non-zero for failure
*
**********************************************************************/
Data8 iicRegRead(void *pContext,
Data8 iicAddr,
Data8 regAddr,
Data8 byteCount,
Data8 *pBuffer );
/**********************************************************************
*
* iicRegWrite
*
* Called by DRV2002 to write to NXT2002 registers
*
* Inputs:
* Data8 iicAddr - device address
* Data8 regAddr - NXT2002 register to write
* Data8 byteCount - number of bytes to write
* Data8 *pBuffer - write data bytes are copied from this buffer
*
* Returns:
* 0 for success
* non-zero for failure
*
**********************************************************************/
Data8 iicRegWrite(void *pContext,
Data8 iicAddr,
Data8 regAddr,
Data8 byteCount,
Data8 *pBuffer);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -