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

📄 snimdriv.h

📁 ST5100 driver files for ST chipset
💻 H
📖 第 1 页 / 共 2 页
字号:
#define SNIM_COMMAND_SCAN_CONTINUE  7         /* continue scan, after channel found has stopped it */
#define SNIM_COMMAND_SCAN_ABORT     8         /* cancel the scan in progress */
#define SNIM_COMMAND_TRAIN_TUNER    9         /* starts tuner training if supported by tuner*/
#define SNIM_COMMAND_BYPASS_ON     10         /* if supported by tuner, turns the RF bypass on*/
#define SNIM_COMMAND_BYPASS_OFF    11         /* if supported by tuner, turns the RF bypass off*/


/* write and read  various information */
SNIM_DLL_EXPORT BOOL    SnimWrite(HANDLE hSnim,Uint16T nSelect,Sint32T lData);
SNIM_DLL_EXPORT Sint32T SnimRead(HANDLE hSnim,Uint16T nSelect);

#define SNIM_DATA_FIRST             1000           /* Values lower than this are passed to the tuner driver via SnimRead() and SnimWrite()*/

#define SNIM_DATA_PROGRESS          SNIM_DATA_FIRST+1   /*R    read progress of scan or viterbi timer 0 to 100%*/
#define SNIM_DATA_FOFFKHZ           SNIM_DATA_FIRST+2   /*R    frequency offset in kHz*/
#define SNIM_DATA_DEMODSTATE        SNIM_DATA_FIRST+3   /*R    return value is  ESnimState value */
#define SNIM_DATA_PREVITBER         SNIM_DATA_FIRST+4   /*R    Pre-Viterbi (QPSK) BER * 10^6*/
#define SNIM_DATA_POSTVITBER        SNIM_DATA_FIRST+5   /*R    Post-Viterbi BER * 10^9 */
#define SNIM_DATA_POSTVITCOUNT      SNIM_DATA_FIRST+6   /*R    Post-Viterbi raw  error count  */
#define SNIM_DATA_POSTVITPERIOD     SNIM_DATA_FIRST+7   /*R/W  Post-Viterbi measurement  period  seconds*/
#define SNIM_DATA_RSUBCSEC          SNIM_DATA_FIRST+8   /*R    RSUBC total for 1 second period, updated once per sec */
#define SNIM_DATA_RSUBCRUN          SNIM_DATA_FIRST+9   /*R    RSUBC counts running total since last read */
#define SNIM_DATA_EBNOx10           SNIM_DATA_FIRST+10  /*R    EBNO (in 1/10 dB) */
#define SNIM_DATA_TUNERFREQ         SNIM_DATA_FIRST+11  /*R    Tuner input frequency in kHz */
#define SNIM_DATA_TRANSPONDERFREQ   SNIM_DATA_FIRST+12  /*R    Tuner input frequency + LNB frequency kHz*/
#define SNIM_DATA_MPEGCLOCK         SNIM_DATA_FIRST+13  /*R/W  MPEG clock setting (see below)*/
#define SNIM_DATA_SATDELAY          SNIM_DATA_FIRST+14  /*R/W  Satellite switch settling delay time Milliseconds*/
#define SNIM_DATA_SCAN_STARTFREQ    SNIM_DATA_FIRST+15  /*W    Start frequency for scan MHz*/
#define SNIM_DATA_SCAN_STOPFREQ     SNIM_DATA_FIRST+16  /*W    Stop frequency for scan MHz*/
#define SNIM_DATA_SCAN_STARTSYMB    SNIM_DATA_FIRST+17  /*W    Lowest symbol rate for scan Msym/sec*/
#define SNIM_DATA_SCAN_ENDSYMB      SNIM_DATA_FIRST+18  /*W    Howest symbol rate for scan Msym/sec*/
#define SNIM_DATA_SCAN_OPTIONS      SNIM_DATA_FIRST+19  /*W    Options for scanning (see below)*/
#define SNIM_DATA_SYSCLOCK          SNIM_DATA_FIRST+20  /*R    ZL10312 system clock MHz * 2*/
#define SNIM_DATA_DISEQCOPTIONS     SNIM_DATA_FIRST+21  /*R/W  DiSEqC options (see below) */

/* mainly used for test/debug */                    
#define SNIM_DATA_AGC               SNIM_DATA_FIRST+22  /*R   Main AGC gain reading MS 10 bits*/
#define SNIM_DATA_AGCERRDB          SNIM_DATA_FIRST+23  /*R   AGC error DB value */
#define SNIM_DATA_IRQFLAGS          SNIM_DATA_FIRST+24  /*R   Demodulator interrupt flags (from cache) (values in ZL100312.h)*/
#define SNIM_DATA_STATUS            SNIM_DATA_FIRST+25  /*R   Demodulator status flags (values in ZL100312.h)*/
#define SNIM_DATA_DEBUGFLAGS        SNIM_DATA_FIRST+26  /*R/W Set or read debug/test flags (values in snimdefs.h)*/
#define SNIM_DATA_DEBUGFLAGS_CLR    SNIM_DATA_FIRST+27  /*W   Clear debug/test flags */

/* sss ddefined */                    
#define SNIM_DATA_DISEQCOPTIONS_DISABLE     SNIM_DATA_FIRST+28  /*R/W  DiSEqC options (see below) */


/* 100 to 115: values from monitor register*/
#define SNIM_DATA_MON_FIRST         (SNIM_DATA_FIRST + 100)
#define SNIM_DATA_MONITOR(n)        (SNIM_DATA_MON_FIRST+(n))    /*R   read monitor register */
#define SNIM_DATA_IQVECTOR           SNIM_DATA_MON_FIRST        /*R   returns symbol samples 256*I + Q */
#define SNIM_DATA_DCOFFSET          (SNIM_DATA_MON_FIRST+1)        /*R   returns dc offset 256*I + Q */
#define SNIM_DATA_SYMBOLRATE        (SNIM_DATA_MON_FIRST+3)        /*R   returns symbol rate */
#define SNIM_DATA_MON_LAST          (SNIM_DATA_MON_FIRST+15)

/* read nim driver version*/
SNIM_DLL_EXPORT const char*  SnimReadDriverVersion(int iSelect);                                    
#define SNIM_VERSION_SNIM   0    /* returns MT312 Driver Version string*/
#define SNIM_VERSION_TUNER  1    /* returns Tuner Driver Version string*/



/***********************************************************************************************************\
*                              DEFINES for SnimRead() SnimnWrite() data values                              *
\***********************************************************************************************************/


/* 
 nSelect = SNIM_DATA_DEMODSTATE
 demodulator state returned by SnimRead()
*/
typedef enum ESnimState
{
    SNIM_STATE_ERROR =0,  /*psSnim sTructure has pointer errors*/
    SNIM_STATE_OFF,      /* MT312 not found or not powered*/
    SNIM_STATE_STANDBY,  /* MT312 powered but in standby power mode*/
    SNIM_STATE_IDLE,     /* fully powered, but not doing anything*/
    SNIM_STATE_LOCKED,   /* locked to a signal*/
    SNIM_STATE_WAITING,  /* waiting for external operation (e.g. diseqc) to complete*/
    SNIM_STATE_SCANNING, /* scan is in progress*/
    SNIM_STATE_BUSY      /* system busy (resetting/waiting for lock/calibrating tuner*/    
}ESnimState;

/* 
 nSelect = SNIM_DATA_DEMODSTATE
 DiSEqC state returned by SnimGetDiSEqCState()
*/
typedef enum ESnimDiSEqCState
{
    SNIM_DISEQC_STATE_ERROR =0,  /*psSnim sTructure has pointer errors*/
    SNIM_DISEQC_STATE_IDLE,     /* fully powered, but not doing anything*/
    SNIM_DISEQC_STATE_TX_WAIT,  /* waiting for external operation (e.g. diseqc) to complete*/
    SNIM_DISEQC_STATE_RX_WAIT, /* scan is in progress*/
    SNIM_DISEQC_STATE_BUSY      /* system busy (resetting/waiting for lock/calibrating tuner*/    
}ESnimDiSEqCState;

/* 
nSelect = SNIM_DATA_MPEGCLOCK
Mpeg clock setting:
SnimWrite() lData>0 desired value in kHz
SnimRead()  return value>0 actual value in kHz
otherwise values as below: 
*/ 
#define SNIM_MCLK_ERROR -1      /* error reading settings */
#define SNIM_MCLK_SYMB  -2      /* MPEG clock is symbol rate derived */
#define SNIM_MCLK_EXT   -3      /* MPEG clock is external ( MT312, or ZL10313 inc serial)*/

/*
nSelect = SNIM_DATA_DISEQCOPTIONS  
in SnimRead() or SnimWrite()
Note: According to DiSEqC rules, slave devices which have been controlled by DiSEqC messages
will no longer respond to conventional signals until they have been powered down.
*/
#define SNIM_DISOPT_POLARISATION     0x01  /* Polarisation set by Host using DiSEqC messaging */
#define SNIM_DISOPT_BANDSWITCH       0x02  /* Band selection  set by Host using DiSEqC messaging */
#define SNIM_DISOPT_SATELLITE        0x04  /* Satellite switching  set by Host using DiSEqC messaging */

/*
nSelect = SNIM_DATA_SCAN_OPTIONS
SnimWrite() to select operation. 
if both flags clear, one scan will occur with no satllite switching
if one flag is set, the appropriate satellite request will be issued at the scan start.
if both set, satellite A and Satellite B will both be scanned
*/
#define SNIM_OPTION_SATA       0x40    /* enable scanning on satelite A */
#define SNIM_OPTION_SATB       0x20    /* enable scanning on satelite B*/


 


#ifdef __cplusplus
}
#endif

/***********************************************************************************************************\
*                              Descriptions of 2wire bus routines                                           *
* These routines are required to allow the driver to read and write to the ZL10312, and the tuner           *
\***********************************************************************************************************/
/*
In a multitasking system, the bus routines should start by taking control of a mutex or other resource lock
and releasing the lock at exit. This will avoid any problems due to bus contentions. This is indicated by the 
Statements TakeMutex and ReleaseMutex in the pseudocode below.



BOOL RegisterRead(Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount)
{
Read byCount bytes from the Demod at address byID, starting at register byReg, and put the results
into the buffer pBuffer:

    TakeMutex;
    START_Condition;   / / bus start condition
    WRITE_Byte byID;   / / address byte of demodulator with R/W = Write
    WRITE_Byte byReg;  / / register address
                       / / DO NOT have a STOP_condition here
    START_Conditon;    / / repeated start condition 
    WRITE_Byte byID;   / / address byte of demodulator with R/W = Read 
    for (i = 0; i<byCount;i++)
    {
        READ_Byte pBuffer[i];  / / Read the data bytes from the MT352
    }
    STOP_condition;    / / the one and only STOP_Condition 
    ReleaseMutex;
    if (succesful) 
        return TRUE;
    else
        return FALSE;
}

BOOL RegisterWrite(Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount)
{
Write byCount bytes from pBuffer to the Demod at address byID, starting at register byReg:

    TakeMutex;
    START_Condition;   / / bus start condition
    WRITE_Byte byID;   / / address byte of demodulator with R/W = Write
    WRITE_Byte byReg;  / / register address
    for (i = 0; i<byCount;i++)
    {
        WRITE_Byte pBuffer[i];/ / Write the data bytes to the MT352
    }
    STOP_Condition;
    ReleaseMutex;
    if (succesful) 
        return TRUE;
    else
        return FALSE;
}


BOOL SlaveAccess(Uint8T byID,Uint8T bySlaveID,Uint8T byReg,Uint8T byOpen,Uint8T byClose,Uint8T * pBuffer,Sint8T cCount)
{
Read or write cCount bytes to/from the slave device (i.e. tuner) at address bySlaveID using the buffer pBuffer.
Access the slave device by writing by byOpen to the register byReg in the demod at address byID  FIRST_IPADDRESS
and writing byClose to the same register afterwards:
    TakeMutex;
    / /  Open the demod 2 wire bus port
    START_Condition;   / / bus start condition
    WRITE_Byte byID;   / / address byte of demodulator with R/W = Write
    WRITE_Byte byReg;  / / register address
    WRITE_BYTE byOpen; / / Open the port to the slave (tuner)
    STOP_Condition;    / / (this is in fact optional)
    / / Read or write bytes to the tuner
    START_Condition;
    WRITE_Byte bySlaveID; / / if cCount<0 R/W = Read, otherwise R/W = Write
    if (cCount>=0)
        for (i = 0; i<byCount;i++) WRITE_Byte pBuffer[i];/ / Write the data bytes to the tuner
    else
        for (i = 0; i<(-byCount);i++) READ_Byte pBuffer[i];  / / Read the data bytes from the tuner
  
    STOP_Condition;    / / (this is also optional)
    / / close the demod 2 wire bus port
    START_Condition;   / / bus start condition
    WRITE_Byte byID;   / / address byte of demodulator with R/W = Write
    WRITE_Byte byReg;  / / register address
    WRITE_BYTE byClose; / / Open the port to the slave (tuner)
    STOP_Condition;    / /  This one ends the activity
    ReleaseMutex;
    if (succesful) 
        return TRUE;
    else
        return FALSE;
}
This routine is only required if the hardware sleep  feature of the ZL10312 is used. byEnableNo is used
to select which hardware line is to be switched, if there is more than one in the system
BOOL Enable(BOOL bWantOn, Uint8T byEnableNo)
{
    switch (byEnableNo)
    {
    case 0:
        if (bWantOn) HardwareLine0 =LOW;
        else
            HardwareLine0 =HIGH;
        break;
    case 1:
        if (bWantOn) HardwareLine1 =LOW;
        else
            HardwareLine1 =HIGH;
        break;

    }
}
 */

#endif  /*_1E83BEB055A54fe5A2D06BB4ED36148A*/

/*END*END*END*END**END*END*Zarlink Semiconductor Swindon UK*END*END*END*END*END*END*/


⌨️ 快捷键说明

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