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

📄 snimdriv.h

📁 ST5100 driver files for ST chipset
💻 H
📖 第 1 页 / 共 2 页
字号:
/*******************Zarlink Semiconductor Swindon UK******************************\
*   $Workfile::   SnimDriv.h                       $                              *
*   $Revision::   1.0                              $                              *
*   Author:      Colin E Undery                                                   *
*   $Date::   10 Oct 2006 11:21:28                 $                              *
*   Description:                                                                  *
*               Driver for ZL10312/ZL10313 based DVB_S and DSS satellite          *
*               for Snim9 and snim15 designs                                      *
*   Revision History:                                                             *
*   Version    Reason                              Author          Date           *
*   4.0        Snim15 release                       Colin E Undery  131/07/2004   *
*                                                                                 * 
*********************************************************************************** 
*                                                                                 *
* Copyright ?Zarlink Semiconductor Ltd.,2000-2004. All rights reserved. This     *
* copyrighted work constitutes an unpublished work created in 2004. Use of the    *
* copyright notice is intended to provide notice that Zarlink Semiconductor Ltd   *
* owns a copyright in this unpublished work; the copyright notice is not an       *
* admission that publication has occurred. This work contains confidential,       *
* proprietary information and trade secrets of Zarlink Semiconductor Ltd; it may  *
* not be used,reproduced, transmitted,or modified, in whole or in part, in any    *
* form or by any means without the prior written permission of Zarlink            *
* Semiconductor Ltd. This work is provided on a right to use basis subject to     *
* additional restrictions set out in the applicable license or other agreement.   *
*                                                                                 *
\*******************Zarlink Semiconductor Swindon UK******************************/





#ifndef _1E83BEB055A54fe5A2D06BB4ED36148A
#define _1E83BEB055A54fe5A2D06BB4ED36148A


#ifdef __cplusplus
extern "C" {  /* define c style exports for c plus plus MS specific*/
#endif

/******************************************************************************\
*                          DiSEqC Messaging functions                         *
* To include the DiSEqC messaging engine in the build, globally define the    *
* macro _INCLUDE_DISEQC on the compiler's command line                        *
******************************************************************************/
#define _INCLUDE_DISEQC

/******************************************************************************\
*                              IMPORTS                                         *
\******************************************************************************/
#include "Htype.h"
#include "dtdattyp.h"      /* general data types */
#include "vkernel.h"


/***********************************************************************************************************\
*                                        RESOURCE CONTROL MACROS                                            *
* Required for multitasking operating systems to prevent contentions                                        *
* NB driver does not require nestable contention lock, Each routine calls ENTER_SNIM_CONTENTION_LOCK        *
* once on entry and EXIT_SNIM_CONTENTION_LOCK once on exit                                                  *
\***********************************************************************************************************/
unsigned long aaa;

#if !defined(ENTER_SNIM_CONTENTION_LOCK)
#define ENTER_SNIM_CONTENTION_LOCK VK_SEM_Get(aaa)
#endif

#if !defined(EXIT_SNIM_CONTENTION_LOCK)
#define EXIT_SNIM_CONTENTION_LOCK VK_SEM_Release(aaa)
#endif

#if !defined(SNIM_DLL_EXPORT)
#define SNIM_DLL_EXPORT
#endif


/***********************************************************************************************************\
*                                    EXTERNAL FUNCTIONS REQUIRED                                            *
* Function pointers to bus routines, see description at the end of this file.                               *
\***********************************************************************************************************/
typedef BOOL (*PFRegisterRead)(unsigned long unitId, Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount);
typedef BOOL (*PFRegisterWrite)(unsigned long unitId, Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount);
typedef BOOL (*PFSlaveAccess)(unsigned long unitId, Uint8T byID,Uint8T bySlaveID,Uint8T byReg,Uint8T byOpen,Uint8T byClose,Uint8T * pBuffer,Sint8T cCount);
typedef BOOL (*PFEnable)(BOOL bWantOn, Uint8T byEnableNo);
typedef BOOL (*PFDiSEqCCallback)(Uint32T ulCammand);



/***********************************************************************************************************\
*                              STRUCTURES, DEFINES, TYPEDEFS                                                *
\***********************************************************************************************************/
/*
Configuration Structure used by SnimCreate
*/
typedef struct SSnimConfig
{
    Uint8T ucAddress;               /* address of ZL10312 */
    Uint8T ucEnableNo;              /* enable number for ZL10312*/
    Uint16T wConfig;                 /* MPEG configuration*/
    PFRegisterRead pfRegRead;       /* address of ZL10312 register read routine*/
    PFRegisterWrite pfRegWrite;     /* address of ZL10312 register write routine*/
    PFSlaveAccess   pfSlaveAccess;  /* address of ZL10312 slave access routine*/
    PFEnable pfEnable;              /* address of ZL10312 enable routine (may be NULL if not implemented)*/
    PFDiSEqCCallback pfnDiSEqCCallBack; /* address of ZL10312 User Callback for External DiSEqC Settings */
}SSnimConfig, *PSSNIMCONFIG;

/*Settings in SSnimConfig.wSetup */
#define SNIM_CONFIG_MPEG_TRISTATE  0x0001 /* MPEG output is tristated at start up (ZL10312 only) */
#define SNIM_CONFIG_BKERR_NOSIG    0x0002 /* flag missing packets on BKERR line*/
#define SNIM_CONFIG_MPEG_SERIAL    0x0004 /* serial mode on MDO0 pin*/
#define SNIM_CONFIG_TEI_IN_MEG     0x0008 /* set (default) to enable SNIM_TPS error indicator in mpeg packet header*/
#define SNIM_CONFIG_MOCLK_INV      0x0010 /* set (default) to invert the MPEG output clock*/
#define SNIM_CONFIG_BKERR_INV      0x0020 /* invert the \BKERR output pin*/
#define SNIM_CONFIG_MPEGIRQCLK     0x0040 /* External MPEG clock is on IRQ, not DiSEqC2 pin (ZL10313 only)*/

#define SNIM_DEFAULT_ENABLENO  0
#define SNIM_DEFAULT_ADDRESS   28
#define SNIM_DEFAULT_WCONFIG   (SNIM_CONFIG_TEI_IN_MEG|SNIM_CONFIG_MOCLK_INV)



/* Channel data structure*/
typedef struct SSnimChannel
{
    Uint16T  MHz;                        /* 0-65535 Mhz  (values <2200 are direct tuner freqs)*/
    Uint16T  kRs;                       /* symbol rate kS/s*/
    Uint8T   ucExt;                     /* b2:b0 code rate 1 to 7. b3 0-vert 1-Hor. b7:b4 Frequency Trim +/-500kHz*/
    Uint8T   ucSat;                    /* 0 = sat 1(A), 1 = sat 2(B)*/

}SSnimChannel, *PSSNIMCHANNEL;
#define SCHANNELEXT_HORIZONTAL   0x08   /* horizontal poarisation flag */
#define SCHANNELEXT_CODERATE     0x07   /* mask for code rate bits*/
#define SCHANNELEXT_GETFTRIM(x)  Sint8T(((x)>>4) | (((x) & 0x80)?0xF0:0))   /* retrieve frequency trim value as signed byte */



/* LNB data structure */
typedef struct SSnimLnb
{
    Uint16T HiBandLO;       /* LO frequency MHz for High (or only) band of LNB*/
    Uint16T LoBandLO;       /* LO frequency MHz for Low band of LNB (0 for single band)*/
    Uint16T LoHiSwap;       /* Band changeover point in MHz (0 for single band)*/
    Uint16T Delay_ms;       /* time to allow H/V or Hi/Lo band to take effect*/
}SSnimLnb;




/* structure used to send and receive diSEqC messages */
typedef struct SSnimDiSEqCMessage
{
    Uint8T parity;      /*Rx parity.0 = no errors, b0 set = byte 0 parity error etc*/
    Uint8T count;       /*number of bytes to send or received*/
    Uint8T data[8];     /*the message data*/
}SSnimDiSEqCMessage,*PSSNIMDISEQC;



/*********************************************************************************************************************\
*                                                                                                                     *
*                                       Construction/destruction and main process                                     *
*                                                                                                                     *
\*********************************************************************************************************************/

/* Create, initialise and get handle to a SNIM structure on the heap (uses calloc()).*/
HANDLE SnimCreate(unsigned long unitId, PSSNIMCONFIG psConfig);

/* Remove Snim structure from heap (uses free()). */
void SnimDelete(HANDLE hSnim); 

/* Main Snim service routine - call regularly(10 - 20 msec) with current system time in milliseconds */
Uint32T SnimMain(HANDLE hSnim,Uint32T dwTimeNow);

/* SnimMain() may return one or more of the following flags:*/
/* Events: */

#define SNIM_EVENT_VITBER        0x00000001     /* a new Post-Viterbi BER is available*/
#define SNIM_EVENT_QPSKBER       0x00000002     /* a new pre-Viterbi (QPSK) ber is available*/
#define SNIM_EVENT_FOUND         0x00000004     /* channel found during scan process */
#define SNIM_EVENT_SCANCOMPLETE  0x00000008     /* scan has finished */
#define SNIM_EVENT_TRAINCOMPLETE 0x00000010     /* tuner training completed successfully*/
#define SNIM_EVENT_HORZ          0x00000020     /* require horizontal polarisation to be set */
#define SNIM_EVENT_VERT          0x00000040     /* require vertical polarisation to be set */
#define SNIM_EVENT_SATA          0x00000080     /* require satellite A  to be selected */
#define SNIM_EVENT_SATB          0x00000100     /* require satellite B to be selected */
#define SNIM_EVENT_HIBAND        0x00000200     /* require Hi band selection */
#define SNIM_EVENT_LOBAND        0x00000400     /* require Lo band selection */
#define SNIM_EVENT_LOCKED        0x00000800     /* FEC lock acheived (not during scanning)*/
#define SNIM_EVENT_TUNERWRITE    0x00001000     /* occurs when the Snim_WriteTuner()routine is called*/
#define SNIM_EVENT_SCANPROGRESS  0x00002000     /* occurs when scan moves on to next frequency */
#define SNIM_EVENT_RSUBCUPDATE   0x00004000     /* once per second to update RSUBC count */
#define SNIM_EVENT_STATECHANGE   0x00008000     /* occurs whenever a stae change occurs*/
#define SNIM_EVENT_DISEQCWAIT    0x00010000     /* transmit message sent OK, waiting for reply*/
#define SNIM_EVENT_DISEQCDONE    0x00020000     /* transmit message sent OK, not waiting for reply*/
#define SNIM_EVENT_DISEQCREPLY   0x00040000     /* a reply is ready */
#define SNIM_EVENT_DISEQCNOREPLY 0x00080000     /* a reply was not forthcoming */
#define SNIM_EVENT_TUNERTIMEOUT  0x00100000     /* tuner pll did not lock within timeout */
#define SNIM_EVENT_QPSKTIMEOUT   0x00200000     /* QPSK did not lock within timeout */
#define SNIM_EVENT_FECTIMEOUT    0x00400000     /* FEC did not lock within timeout*/

/* detected errors */
#define SNIM_ERROR_COMMS         0x01000000     /* unexpected communication error */
#define SNIM_ERROR_TRAININIT     0x02000000     /* error occured during training initialisation*/
#define SNIM_ERROR_TRAIN         0x04000000     /* error occured during tuner training*/
#define SNIM_ERROR_GENERAL       0x08000000     /* an error occured during operation */
#define SNIM_ERROR_SCAN          0x10000000     /* error during scan*/
#define SNIM_ERROR_TUNERCOMMS    0x20000000     /* tuner read/write failure*/
#define SNIM_ERROR_DISEQC        0x40000000     /* an error occurred in DiSEqC*/
#define SNIM_ERROR_DISEQCTXFAIL  0x80000000     /* the DiSEqC transmission did not complete in time*/

#define SNIM_ERROR_MASKALL       0x3F000000     /* the error flags, excluding DiSEqC*/


/*********************************************************************************************************************\
*                                                                                                                     *
*                                                   API                                                               *
*                                                                                                                     *
\*********************************************************************************************************************/


/*starts  acquisition of known channel/frequency. if psChannel == NULL, uses previous channel data*/
SNIM_DLL_EXPORT BOOL SnimAcquire(HANDLE hSnim,PSSNIMCHANNEL psChannel);


/* set the LNB parameters to use */
SNIM_DLL_EXPORT void SnimSetLnb(HANDLE hSnim, SSnimLnb *psLnb);     

/* Read current channel*/
SNIM_DLL_EXPORT BOOL SnimReadChannel(HANDLE hSnim, PSSNIMCHANNEL psChannel);

#if defined (_INCLUDE_DISEQC)
/* send a DiSEqCmessage */
SNIM_DLL_EXPORT BOOL  SnimSendDiSEqC(HANDLE hSnim, SSnimDiSEqCMessage * psMessage);

/* read a DiSEqC message */
SNIM_DLL_EXPORT BOOL  SnimReadDiSEqC(HANDLE hSnim, SSnimDiSEqCMessage * psMessage);

SNIM_DLL_EXPORT BOOL  SnimSetDiSEqCMode(HANDLE hSnim, Sint32T iMode);
SNIM_DLL_EXPORT Sint32T SnimGetDiSEqCMode(HANDLE hSnim);
SNIM_DLL_EXPORT BOOL  SnimSetDiSEqCPolarisation(HANDLE hSnim, Sint32T iVerHor);
#endif


/* main command interface */
SNIM_DLL_EXPORT BOOL SnimCommand(HANDLE hSnim,Uint8T nCommand);
#define SNIM_COMMAND_POWER_OFF      0         /* selects sleep mode, or standby if sleep not available*/
#define SNIM_COMMAND_POWER_ON       1         /* power up to full operational mode*/
#define SNIM_COMMAND_MPEG_DISABLE   2         /* disable the MPEG output */
#define SNIM_COMMAND_MPEG_ENABLE    3         /* enable the MPEG output */
#define SNIM_COMMAND_DISEQCDONE     4         /* continue operation, after stop for DiSEqC */


#define SNIM_COMMAND_SCAN_START     6         /* start the scan */

⌨️ 快捷键说明

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