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

📄 isomodem.h

📁 modem数据通信源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define SLEEP_STATE_TO_RELEASE_UART			1
#define	SLEEP_STATE_TO_RELEASE_UART_NOW		2
#define SLEEP_STATE_UART_RELEASED			3
#define SLEEP_STATE_TO_SLEEP_UART_TASK		4

typedef struct
{
    unsigned int rece_data_flag;
    unsigned int send_data_flag;
    unsigned int txrate;
    unsigned int rxrate;
}_v80_s;

struct hdlc_frame_info
{
    unsigned int  type;  /*帧类型*/
    unsigned char addr;     /* 帧地址 */
    unsigned char nr;  /*N(R),欲接收的下一帧编号*/
    unsigned char ns;      /*N(S),欲发送的下一帧编号*/
    unsigned char pf;       /*Poll(command)/Final(response)*/
    unsigned char control;  /*控制字节*/
};

#define     MAX_SDLC_FRAME_LEN  1024+128

typedef struct
{
    uchar addr;
    uchar can_send;
    uchar send_flag;
    uchar frmr_type;
    unsigned int status;
    unsigned int vr;
    unsigned int vs;
    unsigned int re_cnt;    //重发次数
    unsigned int re_count;	//已经重发次数
    struct hdlc_frame_info frmr_data;
    unsigned char resend_buf[MAX_SDLC_FRAME_LEN];/*用来保存发送数据的重发缓冲区 */
    unsigned int  resend_len;				/*发送缓冲区内的重发数据长度*/    
}_hdlc_s;

typedef struct
{
    char   v80_sendbuf[MAX_SDLC_FRAME_LEN*2];
    unsigned int    v80_sendbuf_len;
    _loopbuf  *hdlc_recvbuf;
    _loopbuf  *v80_recvbuf;    
    _loopbuf  *serial_recvbuf;
    _v80_s      v80_s;
    _hdlc_s     hdlc_s;
    NU_MAILBOX  serial_MB;
    NU_TASK		serial_TASK;
    VOID		*pTaskSerailMem;
    NU_SEMAPHORE    serial_SEM;
    NU_SEMAPHORE    drv_api_SEM;
    unsigned int UMCOM1Bak;
    unsigned int mode;
    unsigned int modem;
    unsigned int dev;
    unsigned int sleep_state;
    DevHandle uarthandle;
    unsigned int online;    
    NU_TIMER    timer_10ms;
    char    dialing_buf[256];
    unsigned int    dialing_buf_len;
    unsigned int    dial_err;
    unsigned int    max_time_toconnect;
    unsigned int    max_time_todata;
    UNSIGNED    dial_start;
    UNSIGNED    dial_connect;
    UNSIGNED    ring_start;
    UNSIGNED    dialoff_start;
    uchar       ucBPS;
    uchar       ucPAR;
    uchar       ucDBS;
    uchar       ring_detect;
    unsigned int       ring_cnt;
    unsigned int    ppp_state;
}EM_modem_STS;

#define     MAX_PATCH_CKM_LEN       32
#define     MAX_PATCH_VER_LEN       32

typedef struct _patch_info
{
    uchar   ucProfileUse;
    uchar   ucDevType;
    char    m_cDispName[22+1];
    uint    uiPatchLen;
    char    *m_pcPatch;
    char    m_cPatchCkm[MAX_PATCH_CKM_LEN+1];
    char    m_cPatchVer[MAX_PATCH_VER_LEN+1];
    uint    uiInitSdlcLen;
    char    *m_pcInitSdlc;
    uint    uiInitAsysLen;
    char    *m_pcInitAsys;
    uint    uiProfileElse;
    char    *m_pcProfileElse;
}EM_modem_patch;

/* ISOModem_AT.c */
int EI_WriteUart(char *buf,unsigned int len);
void EI_ClearUartRecvBuf(void);
int EI_ReadUart_OK(unsigned int time);
int EI_SendAT_OK(char *atcmd,unsigned int time);
int EI_SendATE0_OK(void);
void EI_SendAT(char *atcmd);
unsigned int EI_CalcCrLf(char *buf);
uchar EI_si_AT_R6C(int	*piEcho);
uchar EI_cx_AT_TRV(float	*pfEcho);
uchar EI_cx_AT_IDC(float	*pfEcho);
uchar EI_At_TillStr(char *atcmd,char *resp,unsigned int time);
uchar EI_SendAT_OK_Recv(char *atcmd,char *resp,unsigned int max,unsigned int time);

/* ISOModem.c */
uchar EI_JudgeModemHandle(DevHandle hDevHandle, uchar *pucMode);
uchar	EI_VerifyHandle_asyn(DevHandle hDev);
uchar	EI_VerifyHandle_sync(DevHandle hDev);
uchar	EI_VerifyHandle_ppp(DevHandle hDev);
int EI_modem_init(void);
void EI_vSerialTask_new(UNSIGNED argc, VOID *argv);
void EI_DialingResp(uchar data);
void EI_DialingTout(void);
void EI_ModemConnect(void);
void EI_ModemOffline(void);
int EI_JudegModem(void);
void EI_SetModemRTS(void);
void EI_StartTaskSerail(void);
int EI_OpenSerial(void);
int EI_StopSerial(void);
void EI_SetModemOnline(unsigned int online);
uchar   EI_PatchModem(void);
uchar	EI_Ifexistdialtone(void);
uchar EI_InitDial(uchar ucBPS, uchar ucPAR, uchar ucDBS);
void	EI_DetectRing(UNSIGNED id);
uchar   EI_ActiveModem(void);
uchar   EI_ResetModem(void);
uchar   EI_PatchInit(void);
uchar   EI_PatchSet(EM_modem_patch *gptIMPROFILE,char *pdata);
uchar   EI_ProfileType(uchar type);
uchar	EI_PatchCx(EM_modem_patch *patch);
uchar	EI_PatchSi(EM_modem_patch *patch);
uchar EI_GetDevType(void);
uchar EI_StopCx(void);
uchar EI_StopSi(void);
uchar EI_DoStop(void);
void EI_Dcd(void);
void	EI_vOffHook(void);
void	EI_vOnHook(void);
void	EI_vLineToModem(void);
void	EI_vLineToPhone(void);
void	EI_vInitMnwk(void);
void	EI_vUnMnwk(void);
uchar	EI_ucMnwkSendSdlc(uint uiLen,char *pcBuf);
void EI_vShow(uchar show,uchar icon);
uchar EI_ATPatch(char *caATCmd);
uchar EI_ucIoctlDebug(int debug);
uchar EI_ucModemIoctl(char *buf);
uchar	EI_PatchAT(char *pcStr,uint uiMaxlen);
void EI_ucTestLine(void);
void EI_ucSetConnectTime(char *argu);
void EI_ucSetSnrmTime(char *argu);

uchar   EA_MODEM_ucDrvOpen(void);
uchar   EA_MODEM_ucDrvClose(DevHandle hDevHandle);
uchar   EA_ucAnswerModem(DevHandle hDev,uchar ucBPS,uchar *pucSTS);
uchar	EA_ucClrModemRecBuf(DevHandle hDev);
uchar	EA_ucDial(DevHandle hDev, const char *pcsBuf);
uchar	EA_ucDialOff(DevHandle hDev);
uchar	EA_ucGetLineStatus(DevHandle hDev, uchar *pucSTS);
uchar   EA_ucIfExistDialTone(DevHandle hDev);
uchar 	EA_ucIfModemRecBufEmpty(DevHandle hDev,uchar *pucBufStatus);
uchar   EA_ucIfPhoneUsed(DevHandle hDevHandle);
uchar	EA_ucInitDial(DevHandle hDev, uchar ucBPS, uchar ucPAR, uchar ucDBS);
uchar	EA_ucInitRingDetect(DevHandle hDev);
uchar	EA_ucInitSdlc(DevHandle hDev,uchar ucBPS,
					  uchar ucSdlcAD, uchar ucSST);
uchar	EA_ucReadAsys(DevHandle hDev, uint uiSecond , uint uiReadLen , 
					  void *pvBuf , uint *puiBufSize);
uchar	EA_ucReadSdlc(DevHandle hDevHandle , uint uiSecond , void *pvBuf , uint *puiRealLen );
uchar	EA_ucRingDetect(DevHandle hDev);
uchar	EA_ucSendAsys(DevHandle hDev, uint uiBufSize , const char *pcsBuf);
uchar   EA_ucSendSdlc(DevHandle hDevHandle , uint uiLen , const char *pcBuf);
uchar   EA_ucModemIoctl(DevHandle hDev,ulong cmd,void *argu);

/* ISOModem_HDLC.c */
void EI_SetHdlc_sendflag(uchar status);
void EI_Init_hdlc(void);
void EI_hdlc_protocol_process(void);
void EI_hdlc_send_iframe(unsigned char *buf , unsigned int len);

/* ISOModem_v80.c */
void EI_hdlc_receive_v80tohdlc(unsigned char temp);
char EI_hdlc_transmit_hdlctov80(unsigned char *buf , unsigned int len);
void EI_Init_v80(void);

/* ISOModem_ppp.c*/
void EI_ModemStartPpp(void);
uchar EA_MODEM_ucCallPpp(DevHandle hDevHandle, void *pt );
uchar EA_MODEM_ucGetState( DevHandle hDevHandle , void *pt );
uchar EA_MODEM_ucInitPpp(DevHandle hDevHandle);
uchar EA_MODEM_ucDialOffPpp(DevHandle hDevHandle);

/* main.c */
void EA_vExit(void);
void EI_vIntoPowerSave( void );
void EI_vOutOfPowerSave( void );
void EI_vModemModulePowerDown_NULL(ulong argc,void *argv);
void EI_vModemModulePowerUp_NULL(ulong argc,void *argv);
void uprintf(char *fmt,...);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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