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

📄 qmcen.h

📁 这是单板上DPRAM的驱动程序
💻 H
字号:
#ifndef _QMC_EN_H
#define _QMC_EN_H 
#include "link.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 SDC_SET_EXCHANG_MAP  (SDB_QMC+5)

#define SDE_SET_SUBCH_LOOP_FAULSE (-SDB_QMC+0)
#define QMC_SUBCHAN_INVALID     (-SDB_QMC-1) 
#define QMC_SUBCHAN_IN_EXCHANG_MOD     (-SDB_QMC-2)

#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)

#define QMC_SUBCH_ATT_NORMAL   0
#define QMC_SUBCH_ATT_EXCHANG  1

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 */
    unsigned char ch;        /* 0 -> scc1, 1->scc2 , ... */
    unsigned char UseTDM;    /* 0 -> Standalone, 1 -> TDMA, 2 -> TDMB */
    unsigned char MaxRecvBD; /* 5 */
    unsigned char MaxSendBD; /* 5 */
    unsigned short MaxBufLen; /* 280 */
    unsigned char MaxSubChanNum; /* ? */
    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;
    unsigned short SubChParamOffset; /*subch param area offset from Dpram start.must  align 64.*/
    unsigned char 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);
    unsigned short MaxBufNum; /* max Buffer num in Buffer pool, must >
                                MaxSubChanNum*(MaxRecvBD+MaxSendBD) */ 
    LinkStruct FreeLink;  /*空闲链表*/
}QmcGlobalCfgStruct;

typedef struct{
    unsigned char ch;        /* subchannel 0,1,2, ... */
    unsigned char subchatt;  /*子通道属性--0:正常 1:内部交换*/
    unsigned char   ExchangSubCh; /*子通道交换映射*/    
    LinkStruct TxLink;       /*发送链表*/
    QmcGlobalCfgStruct *pGCfg;
}QmcSubChanCfgStruct;

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

typedef struct{  
    unsigned char ChanIn;
    unsigned char ChanOut;
}QMCChanMapStruct;

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);
char *QmcBspGlobalInit(char *FreeMemPtr, QmcGlobalCfgStruct *pGCfg,
                       QmcGlobalCfgStruct **id);
char *QmcBspSubChanInit(int DEV, char *FreeMemPtr, QmcSubChanCfgStruct *cfg,
                       QmcGlobalCfgStruct *id);
void QmcInitEnd(QmcGlobalCfgStruct* pGCfg);

#endif

⌨️ 快捷键说明

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