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

📄 qmc.h

📁 这是单板上DPRAM的驱动程序
💻 H
字号:
#ifndef _QMC_h
#define _QMC_h 

#define SDB_QMC      160000
#define SDC_SET_TS_MAP (SDB_QMC+0)
#define SDC_SET_SUBCH_LOOP (SDB_QMC+1)
#define SDC_SET_SUBCH_UNLOOP (SDB_QMC+2)
#define SDC_LIMITE_REINIT  (SDB_QMC+4)

#define SDE_SET_SUBCH_LOOP_FAULSE (-SDB_QMC+0)

#define QMC_RESERVE (0x1c<<7)
#define QMC_STOP_TX (1<<12)
#define QMC_STOP_RX (0<<12)

#define QMC_GLOB_OV     (1<<0)
#define QMC_GLOB_UN     (1<<1) 
#define QMC_GLOB_INT    (1<<2)
#define QMC_GLOB_IQOV   (1<<3)

#ifndef BD_QMC_CHAN_NUM
#define BD_QMC_CHAN_NUM  14
#endif

#ifndef BD_QMC_CHAN_NUM
#define BD_QMC_CHAN_NUM  14
#endif
#ifndef SDN_FRP1_SIG
#define SDN_FRP1_SIG  (10+3) 
#endif
#ifndef BYTE
#define BYTE  unsigned char
#endif

typedef union {  
    struct  {   
        volatile USHORT v     :1;
        volatile USHORT w     :1;    
        volatile USHORT nid   :1;
        volatile USHORT idl   :1;
        volatile USHORT chnum :6;
        volatile USHORT mrf   :1;       
        volatile USHORT un    :1;
        volatile USHORT rxf   :1;
        volatile USHORT bsy   :1;
        volatile USHORT txb   :1;
        volatile USHORT rxb   :1;
    } Bit;
    volatile USHORT  Word16;
}IntEntryStruct;
 
typedef struct {
    volatile USHORT v       :1;
    volatile USHORT w       :1;
    volatile USHORT mask0_1 :2;
    volatile USHORT chp     :6;
    volatile USHORT mask2_7 :6;
}TimeSlotStruct;

typedef struct {
    volatile USHORT mode      :1;
    volatile USHORT bit1      :1;
    volatile USHORT idlm      :1;
    volatile USHORT ent       :1;
    volatile USHORT reserved1 :3;
    volatile USHORT pol       :1;
    volatile USHORT crc       :1;
    volatile USHORT reserved0 :3;
    volatile USHORT nof       :4;
}ChanModeStruct;

typedef struct {
    volatile ULONG  mcbase;
    volatile USHORT qmcstate;
    volatile USHORT mrblr;
    volatile USHORT tx_s_ptr;
    volatile USHORT rxptr;
    volatile USHORT grfthr;
    volatile USHORT grfcnt;
    volatile ULONG  intbase;
    volatile ULONG  intptr;
    volatile USHORT rx_s_ptr;
    volatile USHORT txptr;
    volatile ULONG  cmask32;
    volatile TimeSlotStruct tsatr[32];
    volatile TimeSlotStruct tsatt[32];
    volatile USHORT cmask16;
    volatile ULONG  temp_rba;
    volatile ULONG  temp_crc;
} QmcGlobalParamStruct;

typedef struct {
    volatile USHORT tbase;
    volatile ChanModeStruct chamr;
    volatile ULONG  tstate;
    volatile ULONG  reserve0;
    volatile USHORT tbptr;
    volatile USHORT reserve1;
    volatile ULONG  tupack;
    volatile ULONG  zistate;
    volatile ULONG  tcrc;
    volatile USHORT intmask;
    volatile USHORT bdflags;
    volatile USHORT rbase;
    volatile USHORT mflr;
    volatile ULONG  rstate;
    volatile ULONG  reserve2;
    volatile USHORT rbptr;
    volatile USHORT reserve3;
    volatile ULONG  rpack;
    volatile ULONG  zdstate;
    volatile ULONG  rcrc;
    volatile USHORT max_cnt;
    volatile USHORT tmp_mb;
}QmcSubChanParamStruct;

   
typedef struct{
    char *UncachedBuffer; /* Buffer */
    int ch;        /* 0 -> scc1, 1->scc2 , ... */
    int UseTDM;    /* 0 -> Standalone, 1 -> TDMA, 2 -> TDMB */
    int MaxRecvBD; /* 5 */
    int MaxSendBD; /* 5 */
    int MaxBufLen; /* 272 */
    int MaxSubChanNum; /* 3 */
    unsigned char MaxRecvTSAEntry;
    unsigned char MaxSendTSAEntry;
    char *BDTable; /* Uncached buffer */
    void *IsrParam[64]; /* Isr Param for every subchannel */
    unsigned short IntTableLen; /* Int Table length */
    IntEntryStruct *IntTable; /*Uncached buffer */
    IntEntryStruct *IntTablePtr;
    ULONG SubChParamOffset; /*subch param area offset from Dpram start.must
                            align 64.*/
    int IsSuperChan;
    UCHAR RecvTsTable[32];
    UCHAR SendTsTable[32];                       
    int (*SetSubChLoop)(void* pCfg,char value); /*value: 1 loop;0 unloop
                                                  ret: 0 sucess; <0 false*/
    void (*InitTDM)(void);
    void (*InitSIMODE)(void);
    void (*InitIOMap)(void); 
    }QmcGlobalCfgStruct;

typedef struct{
    int ch;        /* subchannel 0,1,2, ... */
    QmcGlobalCfgStruct *pGCfg;
}QmcSubChanCfgStruct;

typedef struct{
    UCHAR RecvTsTable[32];
    UCHAR SendTsTable[32];
}QmcSupChanTsCfgStruct;    

void QmcGlobalInit(void *pDataBuf, QmcGlobalCfgStruct *pGCfg);
void QmcSubChanInit(void *pDataBuf, QmcSubChanCfgStruct *cfg);
int QmcRead(void *pDataBuf,void *pBuf, int MaxLen);
int QmcWrite(void *pDataBuf,void *pBuf, int MaxLen);         
int QmcCntrl(void *pDataBuf, int cmd, void *pParam, int maxlen);
UCHAR *QmcBspGlobalInit(UCHAR *FreeMemPtr, QmcGlobalCfgStruct *pGCfg,
                       QmcGlobalCfgStruct **id);
UCHAR *QmcBspSubChanInit(int DEV, UCHAR *FreeMemPtr, QmcSubChanCfgStruct *cfg,
                       QmcGlobalCfgStruct *id);
void QmcInitEnd(QmcGlobalCfgStruct* pGCfg);
#ifdef QMCPOLLING
void QmcIsr(void *pDataBuf);
#endif
/*added by tianrongen 2005-9-17*/
BYTE HdlcPathInit(UCHAR byHdlcWid);
#endif

⌨️ 快捷键说明

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