mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-21 18:35:54 +08:00
更新硬件SDK
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_custom.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes: customized features of Channel Centre for Input/Output(CCIO) service
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_CUSTOM_H
|
||||
#define CCIO_CUSTOM_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* customed device executed flags definition, which is a subset of 'CcioDevExecFlags_e'
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CCIO_DEF_CUST_BEGIN = 0x0DEFC000,
|
||||
CCIO_DEF_CUST_A = CCIO_DEF_CUST_BEGIN,
|
||||
CCIO_DEF_CUST_B,
|
||||
CCIO_DEF_CUST_END = 0x0DEFFFFF
|
||||
}CcioCustDevExecFlags_e;
|
||||
|
||||
/*
|
||||
* customed device status flags definition, which is a subset of 'CcioDevStatusFlags_e'
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CCIO_DSF_CUST_BEGIN = 0x0D5FE000,
|
||||
CCIO_DSF_CUST_A = CCIO_DSF_CUST_BEGIN,
|
||||
CCIO_DSF_CUST_B,
|
||||
CCIO_DSF_CUST_END = 0x0D5FFFFF
|
||||
}CcioCustDevStatusFlags_e;
|
||||
|
||||
/*
|
||||
* customed entity status flags definition, which is a subset of 'CcioEntStatusFlags_e'
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CCIO_ESF_CUST_BEGIN = 0x0E5FC000,
|
||||
CCIO_ESF_CUST_A = CCIO_DSF_CUST_BEGIN,
|
||||
CCIO_ESF_CUST_B,
|
||||
CCIO_ESF_CUST_END = 0x0E5FFFFF
|
||||
}CcioCustEntStatusFlags_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* control msg */
|
||||
CCIO_CHAN_CMSG_CUST_BEGIN = CCIO_CHAN_CMSG_CUST_FLAG,
|
||||
CCIO_CHAN_CMSG_CUST_A = CCIO_CHAN_CMSG_CUST_BEGIN,
|
||||
CCIO_CHAN_CMSG_CUST_B,
|
||||
|
||||
CCIO_CHAN_CMSG_CUST_MAXID,
|
||||
CCIO_CHAN_CMSG_CUST_END = (CCIO_CHAN_CMSG_CUST_FLAG | CCIO_CHAN_MSG_CODE_MASK),
|
||||
|
||||
/* data msg */
|
||||
CCIO_CHAN_DMSG_CUST_BEGIN = CCIO_CHAN_DMSG_CUST_FLAG,
|
||||
CCIO_CHAN_DMSG_CUST_A = CCIO_CHAN_DMSG_CUST_BEGIN,
|
||||
CCIO_CHAN_DMSG_CUST_B,
|
||||
|
||||
CCIO_CHAN_DMSG_CUST_MAXID,
|
||||
CCIO_CHAN_DATA_CUST_END = (CCIO_CHAN_DMSG_CUST_FLAG | CCIO_CHAN_MSG_CODE_MASK),
|
||||
|
||||
/* error msg */
|
||||
CCIO_CHAN_EMSG_CUST_BEGIN = CCIO_CHAN_EMSG_CUST_FLAG,
|
||||
CCIO_CHAN_EMSG_CUST_A = CCIO_CHAN_EMSG_CUST_BEGIN,
|
||||
CCIO_CHAN_EMSG_CUST_B,
|
||||
|
||||
CCIO_CHAN_EMSG_CUST_MAXID,
|
||||
CCIO_CHAN_EMSG_CUST_END = (CCIO_CHAN_EMSG_CUST_FLAG | CCIO_CHAN_MSG_CODE_MASK)
|
||||
}CcioCustChanMessageId_e;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* CCIO_DEF_CUST_A */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioDeaCustA_t;
|
||||
|
||||
/* CCIO_DEF_CUST_B */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioDeaCustB_t;
|
||||
|
||||
/* CCIO_DSF_CUST_A */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioDsaCustA_t;
|
||||
|
||||
/* CCIO_DSF_CUST_B */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioDsaCustB_t;
|
||||
|
||||
/* CCIO_ESF_CUST_A */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioEsaCustA_t;
|
||||
|
||||
/* CCIO_ESF_CUST_B */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
}CcioEsaCustB_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
int32_t ccioInitCustTxTask(void *args);
|
||||
int32_t ccioDeinitCustTxTask(void *args);
|
||||
int32_t ccioSendToCustTxTask(void *msg, uint32_t timeout);
|
||||
|
||||
int32_t usbdExecCustInstr(uint32_t flags, void *args);
|
||||
int32_t uartdExecCustInstr(uint32_t flags, void *args);
|
||||
int32_t radiodExecCustInstr(uint32_t flags, void *args);
|
||||
|
||||
int32_t ccioHandleCustDevStatus(uint32_t flags, void *args);
|
||||
int32_t ccioHandleCustEntStatus(uint32_t flags, void *args);
|
||||
|
||||
int32_t ccioHandleCustChanMsg(CcioChanMessage_t *chmsg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_message.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_MESSAGE_H
|
||||
#define CCIO_MESSAGE_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_pub.h"
|
||||
#include "ccio_device.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* universal flag */
|
||||
#define CCIO_CHAN_MSG_FLAG 0x7
|
||||
|
||||
/* ctrl/data/err msg type flag */
|
||||
#define CCIO_CHAN_CMSG_TYPE 0xC
|
||||
#define CCIO_CHAN_DMSG_TYPE 0xD
|
||||
#define CCIO_CHAN_EMSG_TYPE 0xE
|
||||
|
||||
#define CCIO_CHAN_CMSG_MAXNUM (CCIO_CHAN_CMSG_MAXID & CCIO_CHAN_MSG_CODE_MASK)
|
||||
#define CCIO_CHAN_DMSG_MAXNUM (CCIO_CHAN_DMSG_MAXID & CCIO_CHAN_MSG_CODE_MASK)
|
||||
#define CCIO_CHAN_EMSG_MAXNUM (CCIO_CHAN_EMSG_MAXID & CCIO_CHAN_MSG_CODE_MASK)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
/* control msg */
|
||||
CCIO_CHAN_CMSG_BEGIN = CCIO_CHAN_CMSG_FLAG,
|
||||
CCIO_CHAN_DEV_ADD = CCIO_CHAN_CMSG_BEGIN,
|
||||
CCIO_CHAN_DEV_DEL,
|
||||
CCIO_CHAN_ULPDU_FREE,
|
||||
CCIO_CHAN_DLPDU_FREE,
|
||||
CCIO_CHAN_RBUF_FLUSH,
|
||||
CCIO_CHAN_SYSTEM_RESET,
|
||||
CCIO_CHAN_SYSTEM_PWOFF,
|
||||
CCIO_CHAN_SLP_MODE_SWITCH,
|
||||
CCIO_CHAN_SERL_CONF_CHG,
|
||||
CCIO_CHAN_SERL_CTS_CHG,
|
||||
CCIO_CHAN_SERL_DTR_CHG,
|
||||
CCIO_CHAN_SERL_STATE_SET,
|
||||
CCIO_CHAN_AUTO_BAUDRATE,
|
||||
CCIO_CHAN_USB_STATE,
|
||||
CCIO_CHAN_SCT_USB_STATE,
|
||||
CCIO_CHAN_SCT_USB_TXDONE,
|
||||
CCIO_CHAN_SCT_USB_T_EXPIRY,
|
||||
CCIO_CHAN_SCT_USB_EP_UNBLOCK,
|
||||
CCIO_CHAN_RNDIS_INIT,
|
||||
CCIO_CHAN_RNDIS_DEINIT,
|
||||
CCIO_CHAN_ECM_SET_FILTER,
|
||||
CCIO_CHAN_WAN_MEDIA_NOTIF,
|
||||
CCIO_CHAN_PPP_SESSN_START,
|
||||
CCIO_CHAN_PPP_SESSN_STOP,
|
||||
CCIO_CHAN_PPP_SESSN_RESUME,
|
||||
CCIO_CHAN_PPP_SESSN_TMCTRL,
|
||||
CCIO_CHAN_PPP_SPEC_PATTN,
|
||||
CCIO_CHAN_DATA_MODE_HS_REQ,
|
||||
CCIO_CHAN_ULFC_MEM_EVENT,
|
||||
CCIO_CHAN_DLFC_MEM_EVENT,
|
||||
CCIO_CHAN_TFC_POLICY_ENABLE,
|
||||
CCIO_CHAN_CMSG_MAXID,
|
||||
CCIO_CHAN_CMSG_END = (CCIO_CHAN_CMSG_FLAG | CCIO_CHAN_MSG_CODE_MASK),
|
||||
|
||||
/* data msg */
|
||||
CCIO_CHAN_DMSG_BEGIN = CCIO_CHAN_DMSG_FLAG,
|
||||
CCIO_CHAN_AT = CCIO_CHAN_DMSG_BEGIN,
|
||||
CCIO_CHAN_PPP,
|
||||
CCIO_CHAN_ECM,
|
||||
CCIO_CHAN_RNDIS,
|
||||
CCIO_CHAN_DIAG,
|
||||
CCIO_CHAN_OPAQ,
|
||||
|
||||
CCIO_CHAN_DMSG_MAXID,
|
||||
CCIO_CHAN_DATA_END = (CCIO_CHAN_DMSG_FLAG | CCIO_CHAN_MSG_CODE_MASK),
|
||||
|
||||
/* error msg */
|
||||
CCIO_CHAN_EMSG_BEGIN = CCIO_CHAN_EMSG_FLAG,
|
||||
CCIO_CHAN_RBUF_EBNA = CCIO_CHAN_EMSG_BEGIN,
|
||||
CCIO_CHAN_USB_ESTATUS,
|
||||
CCIO_CHAN_AHB_EADDR,
|
||||
|
||||
CCIO_CHAN_EMSG_MAXID,
|
||||
CCIO_CHAN_EMSG_END = (CCIO_CHAN_EMSG_FLAG | CCIO_CHAN_MSG_CODE_MASK)
|
||||
}CcioChanMessageId_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t msgId;
|
||||
const int8_t *msgName; /* recommended MAX length: 32 */
|
||||
chanMsgHandleFunc msgHandlFn;
|
||||
}CcioChanMsgTblEntry_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool_t isUsed;
|
||||
CcioChanMsgTblEntry_t *entry;
|
||||
}CcioChanMsgTblIdx_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
void ccioInitChanMsgTbls(void);
|
||||
void ccioDeinitChanMsgTbls(void);
|
||||
int32_t ccioHandleChanMsg(CcioChanMessage_t *chmsg, CcioChanMsgTblIdx_t *tblIdx, uint32_t maxItems);
|
||||
|
||||
int32_t ccioBuildMsgDevAdd(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaDevAdd_t *dsaDevAdd);
|
||||
int32_t ccioBuildMsgDevDel(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaDevDel_t *dsaDevDel);
|
||||
int32_t ccioBuildMsgUlPduFree(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaUlPduFree_t *dsaPduFree);
|
||||
int32_t ccioBuildMsgDlPduFree(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaDlPduFree_t *dsaPduFree);
|
||||
|
||||
int32_t ccioBuildMsgSystemReset(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdResetSystem_t *resetSys);
|
||||
int32_t ccioBuildMsgSystemPwOff(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdPwOffSystem_t *powerOffSys);
|
||||
int32_t ccioBuildMsgSlpModeSwitch(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdSwitchSlpMode_t *slpMode);
|
||||
int32_t ccioBuildMsgSerlConfChg(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdChgSerlConf_t *serlConf);
|
||||
int32_t ccioBuildMsgSerlCtsChg(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaCtsChg_t *ctsChg);
|
||||
int32_t ccioBuildMsgSerlDtrChg(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaDtrChg_t *dtrChg);
|
||||
int32_t ccioBuildMsgSerlStateSet(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioSerlState_t *serlState);
|
||||
int32_t ccioBuildMsgTfcPolicyEnable(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioTfcPolicyEnable_t *tfcEnable);
|
||||
int32_t ccioBuildMsgUlfcMemEvent(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioUlfcMemEvent_t *ulfcMemEvt);
|
||||
int32_t ccioBuildMsgDlfcMemEvent(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDlfcMemEvent_t *dlfcMemEvt);
|
||||
|
||||
int32_t ccioBuildMsgWanMediaNotif(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaWanMediaNotif_t *dsaWanNotif);
|
||||
|
||||
int32_t ccioBuildMsgAutoBaudRate(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaAutoBaudRate_t *dsaAutoBaud);
|
||||
|
||||
int32_t ccioBuildMsgUsbState(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaUsbState_t *dsaUsbState);
|
||||
int32_t ccioBuildMsgSctUsbTxDone(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaSctTxDone_t *dsaTxDone);
|
||||
int32_t ccioBuildMsgSctUsbState(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaSctUsbState_t *dsaSctState);
|
||||
int32_t ccioBuildMsgSctUsbTExpiry(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaSctUsbTmExpr_t *dsaTmExpr);
|
||||
int32_t ccioBuildMsgSctUsbEpUnblock(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaSctUsbUnblkEp_t *dsaUnblkEp);
|
||||
int32_t ccioBuildMsgRndisInit(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaRndisInit_t *dsaRndisInit);
|
||||
int32_t ccioBuildMsgRndisDeinit(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaRndisDeinit_t *dsaRndisDeinit);
|
||||
int32_t ccioBuildMsgEcmSetFilter(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaEcmSetFilter_t *dsaEcmFilter);
|
||||
int32_t ccioBuildMsgPppSessnStart(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdStartPppSessn_t *pppStart);
|
||||
int32_t ccioBuildMsgPppSessnStop(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdStopPppSessn_t *pppStop);
|
||||
int32_t ccioBuildMsgPppSessnResume(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdResumePppSessn_t *pppResume);
|
||||
int32_t ccioBuildMsgPppSessnTmCtrl(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdTmCtrlPppSessn_t *pppTmCtrl);
|
||||
int32_t ccioBuildMsgDataModeHSReq(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, AtCmdReqDataModeHS_t *dataModeHS);
|
||||
|
||||
int32_t ccioBuildMsgDevInXfer(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDevInXfer_t *inXfer);
|
||||
int32_t ccioBuildMsgDevOutXfer(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDevOutXfer_t *outXfer);
|
||||
int32_t ccioBuildMsgRxStatus(CcioChanMessage_t *chmsg, CcioChanMessageId_e msgId, CcioDsaRxStatus_t *dsaRxStatus);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_monitor.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_MONITOR_H
|
||||
#define CCIO_MONITOR_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CCIO_CHAN_MSGQ_DELAY_NONE 0
|
||||
#define CCIO_CHAN_MSGQ_DELAT_TIME 500
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
void ccioInitMonitor(uint8_t bmTaskCreateFlag);
|
||||
void ccioDeinitMonitor(uint8_t bmTaskKillFlag);
|
||||
|
||||
void ccioReportUlfcMemEvent(OsaUlfcMemEvtFlags_e flags, OsaUlfcMemEvtArgs_t *args);
|
||||
void ccioReportDlfcMemEvent(OsaDlfcMemEvtFlags_e flags, OsaDlfcMemEvtArgs_t *args);
|
||||
|
||||
int32_t ccioSetRxSyncFlag(uint8_t isSync);
|
||||
int32_t ccioGetRxSyncFlag(void);
|
||||
|
||||
int32_t ccioSetUpChannels(uint8_t chanType, void *chent);
|
||||
int32_t ccioPullDownChannels(uint8_t chanType, void *chent);
|
||||
|
||||
int32_t ccioHandleDevStatus(uint32_t flags, void *args);
|
||||
int32_t ccioHandleEntStatus(uint32_t flags, void *args);
|
||||
|
||||
uint32_t ccioQueryChanPendTccm(void);
|
||||
|
||||
uint8_t ccioIsUldpPppSchemAvlb(void);
|
||||
|
||||
void* ccioGetEutraServEnt(void);
|
||||
void* ccioGetEtherServEnt(void);
|
||||
void* ccioGetPppServEnt(void);
|
||||
|
||||
int32_t ccioDisablePmuSleep(uint32_t lanMedia, uint32_t slpState);
|
||||
int32_t ccioEnablePmuSleep(uint32_t lanMedia, uint32_t slpState);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_provider.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_PROVIDER_H
|
||||
#define CCIO_PROVIDER_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_base.h"
|
||||
#include "ccio_misc.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The size of a ring buffer malloced actually.
|
||||
* CCIO_RBUF_XTRA_SIZE is used only when the data is splitted
|
||||
* into two blocks and not cycled in the ring.
|
||||
*/
|
||||
#define CCIO_RBUF_REAL_SIZE(sz) ((sz) + CCIO_RBUF_XTRA_SIZE)
|
||||
#ifdef __USER_CODE__
|
||||
#define DIAG_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_128)
|
||||
#define ATOSN_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_2K) /* Normal atos */
|
||||
#define ATOSC_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_8) /* atos for rf calibration */
|
||||
#define PPPOS_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_2K)
|
||||
#define OPAQOS_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_8) /* opaque or raw data */
|
||||
#define ETHER_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_16K)
|
||||
#else
|
||||
#define DIAG_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_128)
|
||||
#define ATOSN_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_4K) /* Normal atos */
|
||||
#define ATOSC_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_8K) /* atos for rf calibration */
|
||||
#define PPPOS_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_8K)
|
||||
#define OPAQOS_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_4K) /* opaque or raw data */
|
||||
#define ETHER_RBUF_REAL_SIZE CCIO_RBUF_REAL_SIZE(CCIO_BUF_SIZE_16K)
|
||||
#endif
|
||||
#define RNDIS_RBUF_REAL_SIZE ETHER_RBUF_REAL_SIZE
|
||||
#define ECM_RBUF_REAL_SIZE ETHER_RBUF_REAL_SIZE
|
||||
|
||||
#define DIAG_RBUF_AVLB_THRES CCIO_BUF_SIZE_32
|
||||
#define ATOS_RBUF_AVLB_THRES 1600 /* ceiling of ETH MTU */
|
||||
#define PPPOS_RBUF_AVLB_THRES 1600
|
||||
#define OPAQOS_RBUF_AVLB_THRES 1600
|
||||
#define RNDIS_RBUF_AVLB_THRES (CCIO_RNDIS_XFER_MAXSIZE + CCIO_RBUF_NPT_HDR_SIZE * (CCIO_RNDIS_MAX_PKT_PER_XFER + 1))
|
||||
#define ECM_RBUF_AVLB_THRES 1600
|
||||
|
||||
/**
|
||||
* cycle ctrl tail size of rbuf,
|
||||
* determining when writeIdx is started from the beginning.
|
||||
*/
|
||||
#define USB_RBUF_PT_CCT_SIZE 0
|
||||
#define USB_RBUF_NPT_CCT_SIZE CCIO_RBUF_NPT_HDR_SIZE
|
||||
#define UART_RBUF_CCT_SIZE 0
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *chent;
|
||||
void *respArgs; //passed in atRespFunc/atRespPduFunc
|
||||
}CcioAtCmdCtx_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
\fn void ccioInitAtServProvider(CcioDevice_t *chdev, uint8_t isForPpp)
|
||||
\brief init AT service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitAtServProvider(CcioDevice_t *chdev, uint8_t isForPpp);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitAtServProvider(CcioEntity_t *chent, uint8_t isForPpp)
|
||||
\brief deinit AT service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitAtServProvider(CcioEntity_t *chent, uint8_t isForPpp);
|
||||
|
||||
/**
|
||||
\fn void ccioInitDiagServProvider(CcioDevice_t *chdev)
|
||||
\brief init diag service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitDiagServProvider(CcioDevice_t *chdev);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitDiagServProvider(CcioEntity_t *chent)
|
||||
\brief deinit diag service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitDiagServProvider(CcioEntity_t *chent);
|
||||
|
||||
/**
|
||||
\fn void ccioInitOpaqServProvider(CcioDevice_t *chdev)
|
||||
\brief init opaque service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitOpaqServProvider(CcioDevice_t *chdev);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitOpaqServProvider(CcioEntity_t *chent)
|
||||
\brief deinit opaque service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitOpaqServProvider(CcioEntity_t *chent);
|
||||
|
||||
/**
|
||||
\fn void ccioInitRndisServProvider(CcioDevice_t *chdev)
|
||||
\brief init rndis service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitRndisServProvider(CcioDevice_t *chdev);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitRndisServProvider(CcioEntity_t *chent)
|
||||
\brief deinit rndis service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitRndisServProvider(CcioEntity_t *chent);
|
||||
|
||||
/**
|
||||
\fn void ccioInitEcmServProvider(CcioDevice_t *chdev)
|
||||
\brief init ecm service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitEcmServProvider(CcioDevice_t *chdev);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitEcmServProvider(CcioEntity_t *chent)
|
||||
\brief deinit ecm service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitEcmServProvider(CcioEntity_t *chent);
|
||||
|
||||
/**
|
||||
\fn void ccioInitEutraServProvider(CcioDevice_t *chdev)
|
||||
\brief init eutra service provider
|
||||
\return
|
||||
*/
|
||||
void ccioInitEutraServProvider(CcioDevice_t *chdev);
|
||||
|
||||
/**
|
||||
\fn void ccioDeinitEutraServProvider(CcioEntity_t *chent)
|
||||
\brief deinit eutra service provider
|
||||
\return
|
||||
*/
|
||||
void ccioDeinitEutraServProvider(CcioEntity_t *chent);
|
||||
|
||||
/**
|
||||
\fn void* ccioPreGetDeviceRbuf(CcioRbufUsage_e rbUsage, uint8_t hwtype, uint8_t llsn, CcioRbufXtras_t *rbXtras)
|
||||
\brief get the rbuf of a certain device in advance
|
||||
\return void*
|
||||
*/
|
||||
void* ccioPreGetDeviceRbuf(CcioRbufUsage_e rbUsage, uint8_t hwtype, uint8_t llsn, CcioRbufXtras_t *rbXtras);
|
||||
|
||||
/**
|
||||
\fn void ccioPreUngetDeviceRbuf(CcioRbufUsage_e rbUsage, uint8_t* rbuf)
|
||||
\brief get the rbuf of related provider
|
||||
\return
|
||||
*/
|
||||
void ccioPreUngetDeviceRbuf(CcioRbufUsage_e rbUsage, uint8_t* rbuf);
|
||||
|
||||
/**
|
||||
\fn void* ccioGetProviderRbuf(CcioRbufUsage_e rbUsage, uint16_t chanId, CcioRbufXtras_t *rbXtras)
|
||||
\brief get the rbuf of related provider
|
||||
\return void*
|
||||
*/
|
||||
void* ccioGetProviderRbuf(CcioRbufUsage_e rbUsage, uint16_t chanId, CcioRbufXtras_t *rbXtras);
|
||||
|
||||
/**
|
||||
\fn void ccioUngetProviderRbuf(CcioRbufUsage_e rbUsage, uint8_t* rbuf)
|
||||
\brief get the rbuf of related provider
|
||||
\return
|
||||
*/
|
||||
void ccioUngetProviderRbuf(CcioRbufUsage_e rbUsage, uint8_t* rbuf);
|
||||
|
||||
/**
|
||||
\fn uint16_t ccioGetRbufCctSize(uint8_t hwType, CcioDevHwAcm_e bmHwAcm, CcioRbufUsage_e rbUsage)
|
||||
\brief get the cct size of the rbuf
|
||||
\return void*
|
||||
*/
|
||||
uint16_t ccioGetRbufCctSize(uint8_t hwType, CcioDevHwAcm_e bmHwAcm, CcioRbufUsage_e rbUsage);
|
||||
|
||||
/**
|
||||
\fn uint8_t ccioIsMultiLanDevEnabled(void)
|
||||
\brief enable single or multiple devices
|
||||
\return uint8_t
|
||||
*/
|
||||
uint8_t ccioIsMultiLanDevEnabled(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: radio_device.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef RADIO_DEVICE_H
|
||||
#define RADIO_DEVICE_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_base.h"
|
||||
#include "ccio_misc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* only one device for ctrl plane */
|
||||
#define RADIO_DEV_REAL_MAXNUM 1
|
||||
|
||||
#define EUTRA_DEV_CTRLPLANE_CID 0
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* configuration about a uart device.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bmCreateFlag; /**< refer to 'CcioTaskOperFlag_e', bitmap type */
|
||||
uint8_t rsvd[3];
|
||||
}RadioDevConf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lanType; /* refer to 'CcioLanMediaType_e' */
|
||||
uint8_t isWakeUp;
|
||||
uint16_t mtu;
|
||||
}CcioLanLinkUp_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lanType; /* refer to 'CcioLanMediaType_e' */
|
||||
uint8_t rsvd[3];
|
||||
}CcioLanLinkDown_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief radioDevCreate(uint8_t cid)
|
||||
* @details create a radio device of dtype with 'cid'
|
||||
*
|
||||
* @param pdpCid pdp context id
|
||||
* @param radioConf The configuration about a radio device
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevCreate(uint8_t pdpCid, RadioDevConf_t *radioConf);
|
||||
|
||||
/**
|
||||
* @brief radioDevDestroy(uint8_t cid)
|
||||
* @details destroy/delete a radio device of dtype with 'cid'
|
||||
*
|
||||
* @param cid pdp context id
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevDestroy(uint8_t pdpCid);
|
||||
|
||||
/**
|
||||
* @brief radioDevFreeUlPduList(UlPduBlock_t *list)
|
||||
* @details free ulpdu block list.
|
||||
*
|
||||
* @param ulpdu head of ulpdu list
|
||||
* @return void
|
||||
*/
|
||||
void radioDevFreeUlPduList(UlPduBlock_t *list);
|
||||
|
||||
/**
|
||||
* @brief radioDevQueryLocalMac(CcioMacAddr_t *localMac)
|
||||
* @details get local mac addr
|
||||
*
|
||||
* @param localMac info of local mac
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevQueryLocalMac(CcioMacAddr_t *localMac);
|
||||
|
||||
/**
|
||||
* @brief radioDevNotifyTcpipDataPathCapability(void *lanDataPathCap)
|
||||
* @details lan data path capability notification from ps/lwip
|
||||
*
|
||||
* @param lanDataPathCap capability of lan data path
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevNotifyTcpipDataPathCapability(void *lanDataPathCap);
|
||||
|
||||
/**
|
||||
* @brief radioDevQueryTcpipDataPathCapability(CcioLanMediaType_e lanType, CcioDataPathCap_t *dataPath)
|
||||
* @details query lan data path capability
|
||||
*
|
||||
* @param lanType lan(ecm/rndis/ppp) media type
|
||||
* @param dataPath query capability of lan data path
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevQueryTcpipDataPathCapability(CcioLanMediaType_e lanType, CcioDataPathCap_t *dataPath);
|
||||
|
||||
/**
|
||||
* @brief radioDevQueryDataPathHostConf(CcioLanMediaType_e lanType, CcioDataPathHostConf_t *hostConf)
|
||||
* @details query host addr/dns config
|
||||
*
|
||||
* @param lanType lan(rndis/ppp) media type
|
||||
* @param queryWan query info of wan media
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevQueryDataPathHostConf(CcioLanMediaType_e lanType, CcioDataPathHostConf_t *hostConf);
|
||||
|
||||
/**
|
||||
* @brief radioDevLanLinkStatusChange(CcioLanMedia_t *linkStatus)
|
||||
* @details lan media state report to ps/lwip
|
||||
*
|
||||
* @param changeLan info of lan link status change
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevLanLinkStatusChange(CcioLanMedia_t *linkStatus);
|
||||
|
||||
/**
|
||||
* @brief radioDevLanLinkUp(CcioLanLinkUp_t *linkUp)
|
||||
* @details notify ps/lwip that LAN link is up
|
||||
*
|
||||
* @param linkUp info of LAN link up
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevLanLinkUp(CcioLanLinkUp_t *linkUp);
|
||||
|
||||
/**
|
||||
* @brief radioDevLanLinkDown(CcioLanLinkDown_t *linkDown)
|
||||
* @details notify ps/lwip that LAN link is down
|
||||
*
|
||||
* @param linkDown info of LAN link down
|
||||
* @return void.
|
||||
*/
|
||||
void radioDevLanLinkDown(CcioLanLinkDown_t *linkDown);
|
||||
|
||||
/**
|
||||
* @brief radioDevHoldOnPppSessn(uint8_t atCid)
|
||||
* @details notify ps to switch to online command mode
|
||||
*
|
||||
* @param atCid at cid No from PS
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevHoldOnPppSessn(uint8_t atCid);
|
||||
|
||||
/**
|
||||
* @brief radioDevAbortPppSessn(uint8_t atCid, uint8_t pdp4Cid, uint8_t pdp6Cid)
|
||||
* @details notify ps that ppp sessn is disconnected
|
||||
*
|
||||
* @param atCid at cid No from PS
|
||||
* @param pdp4Cid ipv4 pdp context id
|
||||
* @param pdp6Cid ipv6 pdp context id
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevAbortPppSessn(uint8_t atCid, uint8_t pdp4Cid, uint8_t pdp6Cid);
|
||||
|
||||
/**
|
||||
* @brief radioDevSetPppAuth(uint8_t pdpCid, CcioAuthType_e authType, CcioAuthInfo_t *authInfo)
|
||||
* @details set auth for ppp sessn
|
||||
*
|
||||
* @param pdpCid pdp context id
|
||||
* @param authType auth type(pap/chap/none)
|
||||
* @param authInfo auth info
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevSetPppAuth(uint8_t pdpCid, CcioAuthType_e authType, CcioAuthInfo_t *authInfo);
|
||||
|
||||
/**
|
||||
* @brief radioDevActPppBearer(uint8_t pdpCid)
|
||||
* @details activate pdp context for ppp sessn
|
||||
*
|
||||
* @param pdpCid pdp context id
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t radioDevActPppBearer(uint8_t pdpCid);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: uart_device.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef UART_DEVICE_H
|
||||
#define UART_DEVICE_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include "Driver_USART.h"
|
||||
#include "ccio_pub.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** \brief configuration struct for initializing UART hardware */
|
||||
typedef struct
|
||||
{
|
||||
ARM_POWER_STATE powerMode; /**< UART power mode, ARM_POWER_FULL or ARM_POWER_LOW */
|
||||
uint32_t ctrlSetting; /**< setting value passed to ARM Control API */
|
||||
uint32_t baudRate; /**< baudrate value */
|
||||
}UartHwConf_t;
|
||||
|
||||
/**
|
||||
* configuration about a uart device.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UartHwConf_t hwConf;
|
||||
ARM_DRIVER_USART *drvHandler; /**< uart driver handler */
|
||||
uint8_t mainUsage; /**< refer to 'CsioDevType_e' */
|
||||
uint8_t speedType; /**< refer to 'CcioSpeedType_e' */
|
||||
uint8_t bmCreateFlag; /**< refer to 'CcioTaskOperFlag_e', bitmap type */
|
||||
uint8_t isDftAtPort :1; /* < default uartIdx for AT or not */
|
||||
uint8_t rsvd :7;
|
||||
}UartDevConf_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief uartDevCreate(uint32_t uartIdx, UartDevConf_t *uartConf)
|
||||
* @details create a uart device of 'uartIdx'
|
||||
*
|
||||
* @param uartIdx The index of uart port
|
||||
* @param uartConf The configuration about a uart device
|
||||
* @return NULL failure; !NULL the created uart device.
|
||||
*/
|
||||
CcioDevice_t* uartDevCreate(uint32_t uartIdx, UartDevConf_t *uartConf);
|
||||
|
||||
/**
|
||||
* @brief uartDevDestroy(uint32_t uartIdx)
|
||||
* @details destroy/delete a uart device of 'uartIdx'
|
||||
*
|
||||
* @param uartIdx index of uart port
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t uartDevDestroy(uint32_t uartIdx);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: usb_device.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef USB_DEVICE_H
|
||||
#define USB_DEVICE_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_pub.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define INVALID_USB_IF_NUM (0xf)//4 bit
|
||||
#define INVALID_USB_EP_NUM (0xf)//4 bit
|
||||
#define INVALID_USB_IF_TYEP_NUM (0x0)//3 bit,=USB_INTERFACE_NONE
|
||||
#define MAX_USB_IF_NUM_PER_TYEP (4)//max 4 ifs per if type. e.g. max 4 AT ifs, enough
|
||||
|
||||
|
||||
#define MAX_OUT_EP_NUM (13)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
typedef struct UsbIf2Ep
|
||||
{
|
||||
uint16_t usbIfIdx :4; /* usb interface Id, used to */
|
||||
uint16_t usbIfType :3; /* usb interface type, refer to UsbIfType_e */
|
||||
uint16_t inEpNum :4; /* in ep number of this interface */
|
||||
uint16_t outEpNum :4; /* out ep number of this interface */
|
||||
uint16_t hasIntEp :1; /* is this interface has an interrupt ep */
|
||||
uint16_t intEpNum :4; /* interrupt ep number of this interface */
|
||||
uint16_t resv :12; /* reserved */
|
||||
uint16_t maxNextXferSize; /*next usb recv size for this if, set by ccio*/
|
||||
|
||||
}UsbIf2Ep_t;
|
||||
|
||||
|
||||
typedef struct UsbType2If
|
||||
{
|
||||
uint32_t ethIfIdx :4; /* eth(rndis/ecm) If idx, get from usr define table */
|
||||
uint32_t atIfIdx :4; /* at If idx, get from usr define table */
|
||||
uint32_t logIfIdx :4; /* log If idx, get from usr define table */
|
||||
uint32_t pppIfIdx :4; /* ppp If idx, get from usr define table */
|
||||
uint32_t rawIfIdx :4; /* raw If idx, get from usr define table */
|
||||
uint32_t resv :12; /* reserved */
|
||||
|
||||
}UsbType2If_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* configuration about a usb device.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bmCreateFlag; /**< refer to 'CcioTaskOperFlag_e', bitmap type */
|
||||
uint8_t rsvd[3];
|
||||
}UsbDevConf_t;
|
||||
|
||||
|
||||
|
||||
// max support 5 interfaces
|
||||
typedef enum
|
||||
{
|
||||
USB_INTERACE_0 = 0,
|
||||
USB_INTERACE_1,
|
||||
USB_INTERACE_2,
|
||||
USB_INTERACE_3,
|
||||
USB_INTERACE_4,
|
||||
USB_INTERACE_MAXCNT
|
||||
} UsbIfIdx_e;
|
||||
|
||||
|
||||
typedef struct UsbIfEpMap
|
||||
{
|
||||
UsbIf2Ep_t usbIf2Ep[USB_INTERACE_MAXCNT];
|
||||
|
||||
uint8_t epNum2IfIdx[MAX_OUT_EP_NUM];/*get If idx from oep num, used by uldp recv callback*/
|
||||
|
||||
uint8_t ulgInepNum;
|
||||
|
||||
UsbType2If_t type2If;
|
||||
|
||||
uint8_t usbEnumSpeed;
|
||||
|
||||
}UsbIfEpMap_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief usbDevCreate(uint32_t usbIfIdx, UsbDevConf_t *usbConf)
|
||||
* @details create a usb device of 'usbIfIdx'
|
||||
*
|
||||
* @param usbIfIdx idx of usb port
|
||||
* @param usbConf The configurattion of a usb port
|
||||
* @return NULL failure; !NULL the created uart device.
|
||||
*/
|
||||
CcioDevice_t* usbDevCreate(uint32_t usbIfIdx, UsbDevConf_t *usbConf);
|
||||
|
||||
/**
|
||||
* @brief usbDevDestroy(uint32_t usbIfIdx)
|
||||
* @details destroy/delete a usb device of 'usbIfIdx'
|
||||
*
|
||||
* @param usbIfIdx idx of usb port
|
||||
* @return 0 succ; < 0 failure with errno.
|
||||
*/
|
||||
int32_t usbDevDestroy(uint32_t usbIfIdx);
|
||||
|
||||
/**
|
||||
* @brief usbDevInput(uint32_t usbIfIdx, uint32_t xferCnt, uint32_t event)
|
||||
* @details handle the IRQ from usb driver
|
||||
*
|
||||
* @param epNum out epNum of usb port
|
||||
* @param xferCnt The xfer data size
|
||||
* @param event usb IRQ event
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevInput(uint8_t epNum, uint32_t xferCnt, uint32_t event);
|
||||
|
||||
/**
|
||||
* @brief usbDevNotifyEcmEvent(uint32_t flags, void *args)
|
||||
* @details ecm ctrl event notification
|
||||
*
|
||||
* @param flags ecm event flags
|
||||
* @param args ecm event args
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevNotifyEcmEvent(uint32_t flags, void *args);
|
||||
|
||||
/**
|
||||
* @brief usbDevNotifyRndisEvent(uint32_t flags, void *args)
|
||||
* @details rndis ctrl event notification
|
||||
*
|
||||
* @param flags rndis event flags
|
||||
* @param args rndis event args
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevNotifyRndisEvent(uint32_t flags, void *args);
|
||||
|
||||
/**
|
||||
* @brief usbDevNotifySerlEvent(uint32_t flags, void *args)
|
||||
* @details serial ctrl event notification
|
||||
*
|
||||
* @param flags serial event flags
|
||||
* @param args serial event args
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevNotifySerlEvent(uint32_t flags, void *args);
|
||||
|
||||
/**
|
||||
* @brief usbDevNotifyTxDoneToSct(void)
|
||||
* @details notify sct that usb tx is completed
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevNotifyTxDoneToSct(uint32_t evt);
|
||||
|
||||
/**
|
||||
* @brief usbDevNotifyStateToSct(uint32_t stateEvt)
|
||||
* @details notify sct that usb device state is changed
|
||||
*
|
||||
* @param stateEvt state event id of usb device
|
||||
* @return void.
|
||||
*/
|
||||
void usbDevNotifyStateToSct(uint32_t stateEvt);
|
||||
|
||||
uint8_t usbDevGetEpNumFromIf(UsbIfIdx_e ifIdx);
|
||||
void usbDevGetIfRbAddrLen(UsbIfIdx_e ifIdx, uint32_t *len, uint32_t *addr );
|
||||
int32_t usbDevCfgOutXfer(UsbIfIdx_e ifIdx);
|
||||
uint8_t usbDevGetUlgInEpNum( void );
|
||||
uint8_t usbDevGetLogIfIdx( void );
|
||||
uint8_t usbDevGetEnumSpd( void );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,360 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_base.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes: basic elements of Channel Centre for Input/Output(CCIO) service
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_BASE_H
|
||||
#define CCIO_BASE_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include DEBUG_LOG_HEADER_FILE
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* buffer size */
|
||||
#define CCIO_BUF_SIZE_8 (8)
|
||||
#define CCIO_BUF_SIZE_16 (16)
|
||||
#define CCIO_BUF_SIZE_32 (32)
|
||||
#define CCIO_BUF_SIZE_64 (64)
|
||||
#define CCIO_BUF_SIZE_128 (128)
|
||||
#define CCIO_BUF_SIZE_256 (256)
|
||||
#define CCIO_BUF_SIZE_512 (512)
|
||||
#define CCIO_BUF_SIZE_1K (1024)
|
||||
#define CCIO_BUF_SIZE_2K (2048)
|
||||
#define CCIO_BUF_SIZE_4K (4096)
|
||||
#define CCIO_BUF_SIZE_8K (CCIO_BUF_SIZE_4K << 1)
|
||||
#define CCIO_BUF_SIZE_16K (CCIO_BUF_SIZE_4K << 2)
|
||||
#define CCIO_BUF_SIZE_32K (CCIO_BUF_SIZE_4K << 3)
|
||||
|
||||
/* alignment size */
|
||||
#define CCIO_ALIGN_SIZE_1 (1 << 0)
|
||||
#define CCIO_ALIGN_SIZE_2 (1 << 1)
|
||||
#define CCIO_ALIGN_SIZE_4 (1 << 2)
|
||||
#define CCIO_ALIGN_SIZE_8 (1 << 3)
|
||||
|
||||
#define CCIO_INFINITE_CYCLE_CNT 0xffff
|
||||
/* mac addr length */
|
||||
#define CCIO_MAC_ADDR_MAXSIZE 6
|
||||
/* ipv4 addr length */
|
||||
#define CCIO_IP4_ADDR_MAXSIZE 4
|
||||
/* ipv6 addr length */
|
||||
#define CCIO_IP6_ADDR_MAXSIZE 16
|
||||
/* ipv6 interface id length */
|
||||
#define CCIO_IP6_ID_MAXSIZE 8
|
||||
|
||||
/* 5bits */
|
||||
#define CCIO_CHAN_MAXNUM 32
|
||||
|
||||
/* lan channel: usb/uart */
|
||||
#define CCIO_CHAN_LAN_MAXNUM CCIO_DEV_NO_BASE_SPI
|
||||
#define CCIO_CHAN_WAN_MAXNUM (CCIO_CHAN_MAXNUM - CCIO_DEV_NO_BASE_RADIO)
|
||||
|
||||
#define CCIO_CHAN_ID_ANY 0xFFFF
|
||||
#define CCIO_CHAN_ID_UNDEF CCIO_DEV_ID_UNDEF
|
||||
#define CCIO_CHAN_NO_GET(chanId) CCIO_DEV_NO_GET(chanId)
|
||||
|
||||
/* chanId & devId has the same definition,
|
||||
* whose format is described as follows.
|
||||
* *******************************************
|
||||
* 16 14 11 9 5 0
|
||||
* |rsvd+-type-+-st-+--llsn--+----No.----|
|
||||
* |====+======+====+========+===========|
|
||||
* | Channel/Device ID |
|
||||
* |====+======+====+========+===========|
|
||||
*/
|
||||
#define CCIO_DEV_NO_BASE_USB 0
|
||||
#define CCIO_DEV_NO_BASE_UART 6
|
||||
#define CCIO_DEV_NO_BASE_SPI 10
|
||||
/*
|
||||
* 10~15 is reserved for other hw type, such as spi, i2c, i2s...
|
||||
*/
|
||||
#define CCIO_DEV_NO_BASE_RADIO 16
|
||||
|
||||
#define CCIO_DEV_ID_UNDEF CCIO_BITMASK(16,0)
|
||||
#define CCIO_DEV_NO_UNDEF CCIO_BITMASK(5,0)
|
||||
#define CCIO_DEV_LLSN_UNDEF CCIO_BITMASK(4,0)
|
||||
#define CCIO_DEV_SUBTYPE_UNDEF CCIO_BITMASK(2,0)
|
||||
#define CCIO_DEV_TYPE_UNDEF CCIO_BITMASK(3,0)
|
||||
|
||||
#define CCIO_DEV_ID_MASK CCIO_BITMASK(16,0)
|
||||
#define CCIO_DEV_NO_MASK CCIO_BITMASK(5,0)
|
||||
#define CCIO_DEV_LLSN_MASK CCIO_BITMASK(4,5)
|
||||
#define CCIO_DEV_SUBTYPE_MASK CCIO_BITMASK(2,9)
|
||||
#define CCIO_DEV_TYPE_MASK CCIO_BITMASK(3,11)
|
||||
|
||||
#define CCIO_DEV_NO_GET(id) ( (id) & CCIO_DEV_NO_MASK)
|
||||
#define CCIO_DEV_LLSN_GET(id) (((id) & CCIO_DEV_LLSN_MASK) >> 5)
|
||||
#define CCIO_DEV_SUBTYPE_GET(id) (((id) & CCIO_DEV_SUBTYPE_MASK) >> 9)
|
||||
#define CCIO_DEV_TYPE_GET(id) (((id) & CCIO_DEV_TYPE_MASK) >> 11)
|
||||
|
||||
#define CCIO_DEV_ID_SET(dt,st,llsn,no) ((((dt) << 11) & CCIO_DEV_TYPE_MASK) | \
|
||||
(((st) << 9) & CCIO_DEV_SUBTYPE_MASK) | \
|
||||
(((llsn) << 5) & CCIO_DEV_LLSN_MASK) | \
|
||||
((no) & CCIO_DEV_NO_MASK))
|
||||
|
||||
#define CCIO_BITMASK(nbits,lsh) (((1 << (nbits)) - 1) << lsh)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef bool bool_t;
|
||||
|
||||
typedef void CcioPbuf_t;
|
||||
|
||||
/**
|
||||
* The type which is used to hold the size
|
||||
* and the indicies of the buffer.
|
||||
*/
|
||||
typedef uint16_t RbufSize_t;
|
||||
|
||||
/* 2bits: ccio speed type definition */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_ST_SLOW = 0,
|
||||
CCIO_ST_MEDIUM,
|
||||
CCIO_ST_HIGH,
|
||||
|
||||
CCIO_ST_MAXNUM
|
||||
}CcioSpeedType_e;
|
||||
|
||||
/* 3bits: ccio hardware type definition */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_HT_USB = 0,
|
||||
CCIO_HT_UART,
|
||||
//CCIO_HT_SPI,
|
||||
CCIO_HT_RADIO,
|
||||
CCIO_HT_HWIND, /* hw independent */
|
||||
|
||||
CCIO_HT_MAXNUM
|
||||
}CcioHwType_e;
|
||||
|
||||
/* 3bits: ccio device type definition */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_DT_SERIAL = 0,
|
||||
CCIO_DT_RNDIS,
|
||||
CCIO_DT_ECM,
|
||||
CCIO_DT_EUTRA,
|
||||
|
||||
CCIO_DT_MAXNUM
|
||||
}CcioDevType_e;
|
||||
|
||||
/* 2bits: Serial device subtype definition */
|
||||
typedef enum
|
||||
{
|
||||
CSIO_DT_AT = 0,
|
||||
CSIO_DT_PPP,
|
||||
CSIO_DT_DIAG,
|
||||
CSIO_DT_OPAQ,
|
||||
|
||||
CSIO_DT_MAXNUM
|
||||
}CsioDevType_e;
|
||||
|
||||
/* 2bits: rndis/ecm(Net) device subtype definition */
|
||||
typedef enum
|
||||
{
|
||||
CNIO_DT_ETHER = 0,
|
||||
|
||||
CNIO_DT_MAXNUM
|
||||
}CnioDevType_e;
|
||||
|
||||
/* 2bits: eUtra device subtype definition: cp&up? */
|
||||
typedef enum
|
||||
{
|
||||
CUIO_DT_CTRL = 0,
|
||||
CUIO_DT_DATA,
|
||||
|
||||
CUIO_DT_MAXNUM
|
||||
}CuioDevType_e;
|
||||
|
||||
/* 2bits: disable/en~ uplink/downlink hardware acceleration mechanism */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_DEV_HWACM_NONE = 0,
|
||||
CCIO_DEV_HWACM_UL = (1 << 0), /* bit0 */
|
||||
CCIO_DEV_HWACM_DL = (1 << 1), /* bit1 */
|
||||
|
||||
CCIO_DEV_HWACM_MAXNUM
|
||||
}CcioDevHwAcm_e;
|
||||
|
||||
/* 2bits: ccio device working state definition */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_DWS_UNDEF = 0,
|
||||
CCIO_DWS_INITIAL,
|
||||
CCIO_DWS_ASSIGNED,
|
||||
CCIO_DWS_WORKING,
|
||||
|
||||
CCIO_DWS_MAXNUM
|
||||
}CcioDevWorkState_e;
|
||||
|
||||
/** \brief List of channel Tx/Rx task create/kill flag */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_TASK_FLAG_NONE = 0x0, /**< None of send and recv task is created */
|
||||
CCIO_TASK_FLAG_TX = 0x1, /**< Will create/kill send task during device initialization */
|
||||
CCIO_TASK_FLAG_RX = 0x2, /**< Will create/kill recv task during device initialization and start to recv after successful call */
|
||||
}CcioTaskOperFlag_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_SERL_STATE_DCD = 0,
|
||||
CCIO_SERL_STATE_RI,
|
||||
|
||||
CCIO_SERL_STATE_MAXNUM
|
||||
}CcioSerlState_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_SERL_DCD_OFF = 0,
|
||||
CCIO_SERL_DCD_ON,
|
||||
}CcioSerlDcdState_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t stateId; /* CcioSerlState_e */
|
||||
uint8_t rsvd[3];
|
||||
uint32_t data;
|
||||
uint32_t extras;
|
||||
void *chdev;
|
||||
}CcioSerlState_t;
|
||||
|
||||
/* lan media state between DTE & DCE */
|
||||
typedef enum
|
||||
{
|
||||
CCIO_LMS_DISCONNECTED = 0,
|
||||
CCIO_LMS_NEGOTIATING,
|
||||
CCIO_LMS_CONNECTED
|
||||
}CcioLanMediaState_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_LAN_MEDIA_UNDEF = 0,
|
||||
CCIO_LAN_MEDIA_RNDIS,
|
||||
CCIO_LAN_MEDIA_ECM,
|
||||
CCIO_LAN_MEDIA_PPP,
|
||||
CCIO_LAN_MEDIA_AT,
|
||||
|
||||
CCIO_LAN_MEDIA_MAXNUM = CCIO_LAN_MEDIA_AT
|
||||
}CcioLanMediaType_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lanType; /* refer to 'CcioLanMediaType_e' */
|
||||
uint8_t lanState; /* refer to 'CcioLanMediaState_e' */
|
||||
uint8_t rsvd[2];
|
||||
void *chdev;
|
||||
}CcioLanMedia_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t isAvlb;
|
||||
uint8_t isPppType; /* 0-eth, 1-ppp */
|
||||
uint8_t pdp4Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
uint8_t pdp6Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
}CcioDataPathCap_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_IP4_TYPE = (1 << 0),
|
||||
CCIO_IP6_TYPE = (1 << 1)
|
||||
}CcioIpType_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ipType; /* CcioIpType_e */
|
||||
uint8_t pdp4Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
uint8_t pdp6Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
uint8_t rsvd;
|
||||
|
||||
uint8_t ip4Addr[CCIO_IP4_ADDR_MAXSIZE];
|
||||
uint8_t ip6Id[CCIO_IP6_ID_MAXSIZE];
|
||||
|
||||
uint8_t ip4Dns[2][CCIO_IP4_ADDR_MAXSIZE];
|
||||
uint8_t ip6Dns[2][CCIO_IP6_ADDR_MAXSIZE];
|
||||
}CcioDataPathHostConf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t mac[CCIO_MAC_ADDR_MAXSIZE];
|
||||
}CcioMacAddr_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_AUTH_NONE = 0,
|
||||
CCIO_AUTH_PAP,
|
||||
CCIO_AUTH_CHAP
|
||||
}CcioAuthType_e;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t userLen;
|
||||
uint16_t pwdLen;
|
||||
uint8_t user[CCIO_BUF_SIZE_64];
|
||||
uint8_t pwd[CCIO_BUF_SIZE_64];
|
||||
}CcioAuthPap_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t challLen;
|
||||
uint16_t respLen;
|
||||
uint8_t chall[CCIO_BUF_SIZE_64];
|
||||
uint8_t resp[CCIO_BUF_SIZE_64];
|
||||
}CcioAuthChap_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
CcioAuthPap_t pap;
|
||||
CcioAuthChap_t chap;
|
||||
}CcioAuthInfo_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CCIO_EOK = 0, /* operation completed successfull */
|
||||
CCIO_ERR = -1, /* unspecified error: no other errno fits */
|
||||
CCIO_EARGS = -2, /* invalid argument(s) */
|
||||
CCIO_EFOUND = -3, /* item not found */
|
||||
CCIO_EEXIST = -4, /* item already exists */
|
||||
CCIO_EPERM = -5, /* operation/scenario not permitted */
|
||||
CCIO_EMALLOC = -6, /* memory alloc failure */
|
||||
CCIO_EMFREE = -7, /* memory free failure */
|
||||
CCIO_EMATCHED = -8, /* unmatched value/item */
|
||||
CCIO_EEMPTY = -9, /* table/list is empty */
|
||||
|
||||
CCIO_STATUS_RSVD = 0x7FFFFFFF
|
||||
}CcioStatus_e;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_misc.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes: adaptor layer of reference data type(struct/macro/...)
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_MISC_H
|
||||
#define CCIO_MISC_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "uldp.h"
|
||||
#include "pspdu.h"
|
||||
#include "osaulfcmem.h"
|
||||
#include "osadlfcmem.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
//#define CCIO_ULPDU_FAST_FREE_ENABLE
|
||||
|
||||
/* ip net MTU of data */
|
||||
#define CCIO_IPNET_DATA_MTU 1500
|
||||
|
||||
/* min size of recv window for each channel */
|
||||
#define CCIO_RX_WIN_MINSIZE 512
|
||||
|
||||
/* NOTE: must be LE than sizeof(NmAtiGetNetInfoRet) */
|
||||
#define CCIO_WAN_CONF_MAXSIZE 128
|
||||
|
||||
/* max rndis packets in one transfer */
|
||||
#define CCIO_RNDIS_MAX_PKT_PER_XFER 10//RNDIS_MAX_PACK_PER_XFER
|
||||
|
||||
/* max size of rndis packet */
|
||||
#define CCIO_RNDIS_XFER_MAXSIZE 3584//ALIGNUP(RNDIS_RX_BUFFER_SIZE)
|
||||
|
||||
/* max size of ecm packet */
|
||||
#define CCIO_ECM_XFER_MAXSIZE 1536 //ALIGNUP(eth mtu 1514)
|
||||
|
||||
/* max size of ppp packet over serial */
|
||||
#define CCIO_PPP_XFER_MAXSIZE 1536 //ALIGNUP(ppp mtu 1508)
|
||||
|
||||
/* max size of normal packet over serial, e.g. AT, OPAQ
|
||||
* [caution]: as being restricted by usb driver,
|
||||
* some data of particular size(e.g 512/1024) can't be transfered @maxsize = 1536!
|
||||
*/
|
||||
#define CCIO_NORM_XFER_MAXSIZE 512
|
||||
|
||||
/**
|
||||
* extra size for managing ulpdu link node
|
||||
* when data was written in two contiguous ram blocks.
|
||||
* and it often occurs when the size between write_idx
|
||||
* and the buffer end is smaller than data length and
|
||||
* it has to split it and write the remaining data to
|
||||
* the ring buffer head again.
|
||||
*/
|
||||
#define CCIO_RBUF_XTRA_SIZE CCIO_RBUF_NPT_HDR_SIZE
|
||||
|
||||
/**
|
||||
* fixed size for uldp control block
|
||||
* and it equals to sizeof(UldpHdrInfo_t) + sizeof(UlPduBlock_t).
|
||||
*/
|
||||
#define CCIO_RBUF_NPT_HDR_SIZE (sizeof(UldpHdrInfo_t) + sizeof(UlPduBlock_t))
|
||||
|
||||
#define CCIO_ALIGN_UP(x,sz) (((x) + ((sz) - 1)) & (~((sz) - 1)))
|
||||
#define CCIO_ALIGN_DOWN(x,sz) ((x) & (~((sz) - 1)))
|
||||
|
||||
#define CCIO_CASE_UPPER(c) ((((c) >= 'a') && ((c) <= 'z')) ? ((c) - ('a' - 'A')) : (c))
|
||||
#define CCIO_CASE_LOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) + ('a' - 'A')) : (c))
|
||||
|
||||
#define CCIO_MAX(x,y) (((x) > (y)) ? (x) : (y))
|
||||
#define CCIO_MIN(x,y) (((x) < (y)) ? (x) : (y))
|
||||
#define CCIO_ELEMNUM(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#if 1
|
||||
#define CCIO_HTONS(x) ((((x) & 0x00ffUL) << 8) | (((x) & 0xff00UL) >> 8))
|
||||
#define CCIO_HTONL(x) ((((x) & 0x000000ffUL) << 24) | \
|
||||
(((x) & 0x0000ff00UL) << 8) | \
|
||||
(((x) & 0x00ff0000UL) >> 8) | \
|
||||
(((x) & 0xff000000UL) >> 24))
|
||||
#else /* Big Endian */
|
||||
#define CCIO_HTONS(x)
|
||||
#define CCIO_HTONL(x)
|
||||
#endif
|
||||
#define CCIO_NTOHS(x) CCIO_HTONS(x)
|
||||
#define CCIO_NTOHL(x) CCIO_HTONL(x)
|
||||
|
||||
#define CCIO_RBUF_ULDP_HDR_BUILD(uldph, len, isCmplt, crcRes) \
|
||||
do\
|
||||
{\
|
||||
(uldph)->magicNum = ULDP_HDR_MAGIC;\
|
||||
(uldph)->msgLen = (len);\
|
||||
(uldph)->isRdsPppCmpl = (isCmplt);\
|
||||
(uldph)->crcResult = (crcRes);\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_RBUF_ULPDU_BUILD(ulpdu, chno, buf, len, bsame, bcont, next) \
|
||||
UL_PDU_BLOCK_SET_BASICS(ulpdu, chno, UL_RBUF_MEM, bsame, buf, len, 0, bcont, next)
|
||||
|
||||
#define CCIO_HEAP_DLPDU_BUILD(dlpdu, buf, len) \
|
||||
DL_PDU_BLOCK_SET_BASICS(dlpdu, DL_HEAP_MEM, buf, len, 0, NULL)
|
||||
|
||||
#define CCIO_ULPDU_LIST_APPEND(list, ulpdu) \
|
||||
do\
|
||||
{\
|
||||
if(((UlPduBlockList_t*)(list))->tail)\
|
||||
{\
|
||||
((UlPduBlockList_t*)(list))->tail->pNext = (ulpdu);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
((UlPduBlockList_t*)(list))->head = ((UlPduBlockList_t*)(list))->tail = (ulpdu);\
|
||||
}\
|
||||
while(((UlPduBlockList_t*)(list))->tail->pNext)\
|
||||
{\
|
||||
((UlPduBlockList_t*)(list))->tail = ((UlPduBlockList_t*)(list))->tail->pNext;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_ULPDU_LIST_APPEND_LIST(list, hd, tl) \
|
||||
do\
|
||||
{\
|
||||
if(((UlPduBlockList_t*)(list))->tail)\
|
||||
{\
|
||||
((UlPduBlockList_t*)(list))->tail->pNext = (hd);\
|
||||
((UlPduBlockList_t*)(list))->tail = (tl);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
((UlPduBlockList_t*)(list))->head = (hd);\
|
||||
((UlPduBlockList_t*)(list))->tail = (tl);\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_DLPDU_LIST_APPEND(list, dlpdu) \
|
||||
do\
|
||||
{\
|
||||
if(((DlPduBlockList_t*)(list))->tail)\
|
||||
{\
|
||||
((DlPduBlockList_t*)(list))->tail->pNext = (dlpdu);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
((DlPduBlockList_t*)(list))->head = ((DlPduBlockList_t*)(list))->tail = (dlpdu);\
|
||||
}\
|
||||
while(((DlPduBlockList_t*)(list))->tail->pNext)\
|
||||
{\
|
||||
((DlPduBlockList_t*)(list))->tail = ((DlPduBlockList_t*)(list))->tail->pNext;\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_DLPDU_LIST_APPEND_LIST(list, head, tail) \
|
||||
do\
|
||||
{\
|
||||
if(((DlPduBlockList_t*)(list))->tail)\
|
||||
{\
|
||||
((DlPduBlockList_t*)(list))->tail->pNext = (head);\
|
||||
((DlPduBlockList_t*)(list))->tail = (tail);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
((DlPduBlockList_t*)(list))->head = (head);\
|
||||
((DlPduBlockList_t*)(list))->tail = (tail);\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_CONVTO_LANTYPE(lmt) (((lmt) == CCIO_LAN_MEDIA_RNDIS) ? NM_LAN_TYPE_RNDIS \
|
||||
: (((lmt) == CCIO_LAN_MEDIA_ECM) ? NM_LAN_TYPE_ECM \
|
||||
: (((lmt) == CCIO_LAN_MEDIA_PPP) ? NM_LAN_TYPE_PPP \
|
||||
: NM_LAN_TYPE_INVALID)))
|
||||
#define CCIO_CONVTO_LANNETTYPE(lmt) ((((lmt) == CCIO_LAN_MEDIA_RNDIS) || ((lmt) == CCIO_LAN_MEDIA_ECM)) ? NM_LAN_NET_TYPE_ETH \
|
||||
: (((lmt) == CCIO_LAN_MEDIA_PPP) ? NM_LAN_NET_TYPE_PPP \
|
||||
: NM_LAN_NET_TYPE_INVALID))
|
||||
#define CCIO_CONVTO_LANMEDIA(lt) (((lt) == NM_LAN_TYPE_RNDIS) ? CCIO_LAN_MEDIA_RNDIS \
|
||||
: (((lt) == NM_LAN_TYPE_ECM) ? CCIO_LAN_MEDIA_ECM \
|
||||
: (((lt) == NM_LAN_TYPE_PPP) ? CCIO_LAN_MEDIA_PPP \
|
||||
: CCIO_LAN_MEDIA_UNDEF)))
|
||||
|
||||
#define CCIO_CONVTO_LANSTATUS(lms) (((lms) == CCIO_LMS_CONNECTED) ? NM_LAN_LINK_STATUS_CONNECTED \
|
||||
: NM_LAN_LINK_STATUS_DISCONNECTED)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CUST_RBUF_FOR_DIAG = 0,
|
||||
CUST_RBUF_FOR_AT_NORM,
|
||||
CUST_RBUF_FOR_AT_CALI,
|
||||
CUST_RBUF_FOR_OPAQ,
|
||||
CUST_RBUF_FOR_PPP,
|
||||
CUST_RBUF_FOR_RNDIS,
|
||||
CUST_RBUF_FOR_ECM
|
||||
}CcioRbufUsage_e;
|
||||
|
||||
/**
|
||||
* extra info about customized rbuf.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t xtraSize;
|
||||
uint8_t isPreGet;
|
||||
uint8_t rsvd[2];
|
||||
uint16_t avlbThres;
|
||||
uint16_t totalSize; /* real size, including xtra size */
|
||||
}CcioRbufXtras_t;
|
||||
|
||||
typedef UlPduBlock UlPduBlock_t;
|
||||
typedef DlPduBlock DlPduBlock_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UlPduBlock_t *head;
|
||||
UlPduBlock_t *tail;
|
||||
}UlPduBlockList_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DlPduBlock_t *head;
|
||||
DlPduBlock_t *tail;
|
||||
}DlPduBlockList_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OsaUlfcMemEvtFlags_e flags;
|
||||
OsaUlfcMemEvtArgs_t *args;
|
||||
}CcioUlfcMemEvent_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OsaDlfcMemEvtFlags_e flags;
|
||||
OsaDlfcMemEvtArgs_t *args;
|
||||
}CcioDlfcMemEvent_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_pub.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes: public & universal definition of Channel Centre for Input/Output(CCIO) service
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_PUB_H
|
||||
#define CCIO_PUB_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_base.h"
|
||||
#include "RTE_Device.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CCIO_CHAN_MSG_TYPE_MASK 0xFF000000
|
||||
#define CCIO_CHAN_MSG_CTRL_MASK 0x00FF0000
|
||||
#define CCIO_CHAN_MSG_CODE_MASK 0x0000FFFF
|
||||
|
||||
/* universal msg type flags */
|
||||
#define CCIO_CHAN_CMSG_FLAG 0x7C000000
|
||||
#define CCIO_CHAN_DMSG_FLAG 0x7D000000
|
||||
#define CCIO_CHAN_EMSG_FLAG 0x7E000000
|
||||
|
||||
/* customized msg type flag */
|
||||
#define CCIO_CHAN_CMSG_CUST_FLAG 0x3C000000
|
||||
#define CCIO_CHAN_DMSG_CUST_FLAG 0x3D000000
|
||||
#define CCIO_CHAN_EMSG_CUST_FLAG 0x3E000000
|
||||
|
||||
/* msg ctrl flag1(0x000F0000): Class Of Service */
|
||||
#define CCIO_CHAN_MSG_CF_COS0 0x00000000 /* msg with cos 0, e.g. Rx: ctrl/err msg, Tx: primary channel, mandary */
|
||||
#define CCIO_CHAN_MSG_CF_COS1 0x00010000 /* msg with cos 1, e.g. Rx: ppp/eth data, Tx: secondary channel, optional */
|
||||
#define CCIO_CHAN_MSG_CF_COS2 0x00020000 /* msg with cos 2, e.g. Rx: at/diag command, Tx: customed channel, optional */
|
||||
|
||||
/* msg ctrl flag2(0x00F00000) */
|
||||
#define CCIO_CHAN_MSG_CF_DIN 0x00400000 /* input data to device? for data msg only! */
|
||||
#define CCIO_CHAN_MSG_CF_IRQ 0x00800000 /* is triggered by IRQ? */
|
||||
|
||||
#define CCIO_CHAN_MSG_IS_DIN(msgId) ((msgId) & CCIO_CHAN_MSG_CF_DIN ? 1 : 0)
|
||||
#define CCIO_CHAN_MSG_IS_IRQ(msgId) ((msgId) & CCIO_CHAN_MSG_CF_IRQ ? 1 : 0)
|
||||
|
||||
#define CCIO_CHAN_MSG_ID_BUILD(id, isIrq, isDin, cos) ((id) | ((isIrq) ? CCIO_CHAN_MSG_CF_IRQ : 0) \
|
||||
| ((isDin) ? CCIO_CHAN_MSG_CF_DIN : 0) \
|
||||
| ((cos) & 0x000F0000))
|
||||
#define CCIO_CHAN_MSG_BUILD(chmsg, id, chdev, flgs, dat, xtr) \
|
||||
do\
|
||||
{\
|
||||
((CcioChanMessage_t*)(chmsg))->msgId = id;\
|
||||
((CcioChanMessage_t*)(chmsg))->lanDev = (CcioDevice_t*)(chdev);\
|
||||
((CcioChanMessage_t*)(chmsg))->flags = (flgs);\
|
||||
((CcioChanMessage_t*)(chmsg))->info.data = (uint32_t)(dat);\
|
||||
((CcioChanMessage_t*)(chmsg))->extras.data = (uint32_t)(xtr);\
|
||||
}while(0)
|
||||
|
||||
#define CCIO_CHAN_MSG_TBL_ENTRY(id, idDesc, func) {id, (const int8_t*)(idDesc), (chanMsgHandleFunc)func}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* prototype definition */
|
||||
struct CcioDevice;
|
||||
struct CcioEntity;
|
||||
|
||||
/*-Function prototype for device init functions by driver,
|
||||
* @param dev: the device to be initialized.
|
||||
*/
|
||||
typedef int32_t (*chdevInitFunc)(struct CcioDevice *dev, uint8_t llsn, void *extras);
|
||||
|
||||
/*-This function is called by channel monitor when it wants
|
||||
* to send a packet on the device driver.
|
||||
* Note: packets to be Tx out should be inserted into the "txHead/txTail" under "CcioDevice_t"
|
||||
*/
|
||||
typedef int32_t (*chdevOutFunc)(struct CcioDevice *dev, void *extras);
|
||||
|
||||
/*-This function is called by I/O device driver
|
||||
* to pass a packet up to the channel monitor.
|
||||
*/
|
||||
typedef int32_t (*chdevInCallback)(struct CcioDevice *dev, uint32_t xferCnt, void *extras);
|
||||
/**This function is called by channel monitor to set configs of the device
|
||||
* @param flags: device config event.
|
||||
* @param args : device config info.
|
||||
*/
|
||||
typedef int32_t (*chdevExecFunc)(uint32_t flags, void *args);
|
||||
/*-Function prototype for notifying entity that device status is changed.
|
||||
* @param flags: device status event.
|
||||
* @param args : device status info.
|
||||
*/
|
||||
typedef int32_t (*chdevStatusCallback)(uint32_t flags, void *args);
|
||||
|
||||
|
||||
typedef struct CcioDevice
|
||||
{
|
||||
struct CcioDevice *next;
|
||||
|
||||
uint16_t devId; /* guid generated by monitor! */
|
||||
uint16_t isPwOn :1; /* the device is power on or off, via monitor */
|
||||
uint16_t speedType :2; /* refer to 'CcioSpeedType_e', via driver */
|
||||
uint16_t hwtype :3; /* refer to 'CcioHwType_e', via driver */
|
||||
uint16_t type :3; /* refer to 'CcioDevType_e', via driver */
|
||||
uint16_t subtype :2; /* more details about device, via driver */
|
||||
uint16_t dedicate :1; /* common/dedicate device(attr), via driver */
|
||||
uint16_t llsn :4; /* lower-level serial number, via driver */
|
||||
uint32_t wkState :2; /* refer to 'CcioDevWorkState_e', via monitor */
|
||||
uint32_t bmHwAcm :2; /* refer to 'CcioDevHwAcm_e', via monitor */
|
||||
uint32_t isWaitTxCmplt :1; /* wait Tx complete IRQ or not, via driver */
|
||||
uint32_t asgnTxCos :2; /* the assigned tx channel(primary/secondary/customed), via monitor */
|
||||
uint32_t rsvdBits :25;
|
||||
void *chent; /* for fast accessing, via monitor */
|
||||
|
||||
chdevOutFunc chdevOutFn; /* via driver */
|
||||
chdevInCallback chdevInCb; /* via monitor */
|
||||
chdevExecFunc chdevExecFn; /* via driver */
|
||||
chdevStatusCallback chdevStatusCb; /* via monitor */
|
||||
|
||||
void *txHead; /* chain head for tx dlpdu, via driver */
|
||||
void *txTail; /* chain tail for tx dlpdu, via driver */
|
||||
|
||||
void *extras; /* privacy field for driver. */
|
||||
}CcioDevice_t;
|
||||
|
||||
|
||||
/**This function is called by CCIO channel monitor
|
||||
* when it wants to pass a packet for further handling.
|
||||
*/
|
||||
typedef int32_t (*chentInCallback)(void *chent, CcioPbuf_t *custPbuf, void *extras);
|
||||
/**This function is called by the l2 layer or same layer entity
|
||||
* when it wants to send a packet via a certain of I/O channel Entity.
|
||||
*/
|
||||
typedef int32_t (*chentOutFunc)(void *chent, CcioPbuf_t *custPbuf, void *extras);
|
||||
/**Function prototype for notifying user that entity status is changed.
|
||||
* @param flags: entity status event.
|
||||
* @param args : entity status info.
|
||||
*/
|
||||
typedef int32_t (*chentStatusCallback)(uint32_t flags, void *args);
|
||||
/**Function prototype for init channel entity
|
||||
*/
|
||||
typedef int32_t (*chentInitCallback)(void *chent, chentStatusCallback statusCb, void *extras);
|
||||
/**Function prototype for deinit channel entity
|
||||
*/
|
||||
typedef int32_t (*chentDeinitCallback)(void *chent);
|
||||
|
||||
|
||||
typedef struct CcioEntity
|
||||
{
|
||||
struct CcioEntity *next;
|
||||
|
||||
uint16_t chanId; /* same as chdev->devId finally */
|
||||
uint16_t open :1; /* set it TRUE if device has been assigned, via monitor */
|
||||
uint16_t chanType :3; /* channel type set by user, same as chdev->type */
|
||||
uint16_t servType :2; /* service type set by user, same as chdev->subtype */
|
||||
uint16_t txDelay :1; /* atcmd/netdata is delayed to be delivered to Tx task */
|
||||
uint16_t rsvdBit :9;
|
||||
void *chdev; /* init & enable it, via monitor */
|
||||
void *rbuf; /* rbuf to recv data, via monitor */
|
||||
|
||||
chentOutFunc chentOutFn; /* via monitor */
|
||||
chentInCallback chentInCb; /* via monitor */
|
||||
chentStatusCallback chentStatusCb; /* via user */
|
||||
}CcioEntity_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* inherited field & MUST be placed on the top! */
|
||||
CcioEntity_t base;
|
||||
|
||||
uint8_t lanState; /* refer to 'CcioLanMediaState_e', via monitor/user */
|
||||
uint8_t pdp4Cid; /* ipv4 pdp context Id, via monitor */
|
||||
uint8_t pdp6Cid; /* ipv6 pdp context Id, via monitor */
|
||||
uint8_t isWanAvlb :1;
|
||||
uint8_t notifAgain :1;
|
||||
uint8_t rsvd :6;
|
||||
|
||||
void *extras; /* for user context. */
|
||||
|
||||
/* TODO: statistic, via monitor */
|
||||
}EtherEntity_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t msgId;
|
||||
CcioDevice_t *lanDev; /* src/dest lan chdev, NULL for monitor */
|
||||
/*
|
||||
* [flags/info/xtras]: customed field, fill whatever you want!
|
||||
*/
|
||||
uint32_t flags;
|
||||
union
|
||||
{
|
||||
uint32_t data;
|
||||
uint8_t *dataPtr;
|
||||
}info;
|
||||
union
|
||||
{
|
||||
uint32_t data;
|
||||
uint8_t *dataPtr;
|
||||
}extras;
|
||||
}CcioChanMessage_t;
|
||||
|
||||
typedef int32_t (*chanMsgBuildFunc)(CcioChanMessage_t *chmsg, uint32_t msgId, void *args);
|
||||
typedef int32_t (*chanMsgHandleFunc)(CcioChanMessage_t *chmsg);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
int32_t ccioSendMsgToRxTask(uint32_t msgId, void *args, chanMsgBuildFunc buildFn);
|
||||
int32_t ccioSendMsgToTxTask(uint32_t msgId, void *args, chanMsgBuildFunc buildFn);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_atcmd.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: Rev1.0 2020-02-24
|
||||
*
|
||||
* Notes: uart/usb at command header file
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_ATCMD_H
|
||||
#define CCIO_ATCMD_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_misc.h"
|
||||
#include "ccio_base.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* dummy atCid when AT channel is removed! */
|
||||
#define CCIO_DUMMY_AT_CHANID 1
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t delayMs;
|
||||
void *chdev;
|
||||
}AtCmdResetSystem_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t mode;
|
||||
uint8_t atCid;
|
||||
uint8_t rsvd[2];
|
||||
void *chdev;
|
||||
}AtCmdPwOffSystem_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t mode;
|
||||
uint8_t rsvd[3];
|
||||
void *chdev;
|
||||
}AtCmdSwitchSlpMode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t isSave;
|
||||
uint8_t rsvd[3];
|
||||
uint32_t baudRate;
|
||||
uint32_t frameFmt;
|
||||
void *chdev;
|
||||
}AtCmdChgSerlConf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *chdev;
|
||||
}AtCmdReqDataModeHS_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t pdp4Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
uint8_t pdp6Cid; /* bit7: 0/1 exist or not; others: cid info! */
|
||||
uint16_t flags;
|
||||
void *chdev;
|
||||
}AtCmdStartPppSessn_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t isClosed;
|
||||
uint8_t rsvd[3];
|
||||
void *chdev;
|
||||
}AtCmdStopPppSessn_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rsvd[4];
|
||||
void *chdev;
|
||||
}AtCmdResumePppSessn_t;
|
||||
|
||||
/* timing-controlling */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t msgId; /* CcioChanMessageId_e */
|
||||
uint32_t data;
|
||||
uint32_t extras;
|
||||
void *chdev;
|
||||
}AtCmdTmCtrlPppSessn_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
int32_t atCmdInput(uint8_t atCid, uint8_t *atStr, uint16_t atStrLen);
|
||||
int32_t atCmdOutput(uint8_t atCid, uint8_t *atStr, uint16_t atStrLen);
|
||||
int32_t atCmdOutputDlPdu(uint8_t atCid, uint8_t outFmt, DlPduBlock_t *dlpdu);
|
||||
|
||||
/**
|
||||
\brief Bypass SEND task and send string to uart directly
|
||||
\param[in] atCid at chanId from PS
|
||||
\param[in] strPtr pointer to string body
|
||||
\param[in] strLen string length
|
||||
\return void
|
||||
\note Used only in specific cases, such as sleep entering procedure where we should not switch out from IDLE task
|
||||
*/
|
||||
int32_t atCmdDirectOutput(uint8_t atCid, uint8_t *strPtr, uint16_t strLen);
|
||||
|
||||
uint8_t atCmdGetChanNo(uint8_t atCid);
|
||||
|
||||
void atCmdResetOutMode(void);
|
||||
|
||||
void atCmdRestoreOutMode(void);
|
||||
|
||||
/*
|
||||
* dcdState: 0 - DCD off (high level), 1 - DCD on (low level)
|
||||
*/
|
||||
int32_t atCmdSetDcdState(uint8_t atCid, uint8_t dcdState);
|
||||
|
||||
/**
|
||||
\brief request to set pstn serial ri signal to mcu or host
|
||||
\param[in] atCid at chanId from PS
|
||||
\param[in] cycleCnt the count of cycle(0-unset ri, 0xffff(CCIO_INFINITE_CYCLE_CNT)-square wave)
|
||||
\param[in] dutyCyclePct percentage of duty cycle(0-100)
|
||||
\param[in] cycleTimeMs cycle time in msec unit
|
||||
\return 0-succ, < 0-failure
|
||||
\note
|
||||
*/
|
||||
int32_t atCmdReqSetRiState(uint8_t atCid, uint16_t cycleCnt, uint16_t dutyCyclePct, uint32_t cycleTimeMs);
|
||||
|
||||
/**
|
||||
\brief Get IPR string for AT CMD AT+IPR print out
|
||||
\param[in] atCid at chanId from PS
|
||||
\return pointer to IPR string
|
||||
*/
|
||||
uint8_t* atCmdGetIPRString(uint8_t atCid);
|
||||
|
||||
/**
|
||||
\brief Get supported baudrate list string for AT CMD print out
|
||||
\param[in] atCid at chanId from PS
|
||||
\return pointer to ECIPR string
|
||||
*/
|
||||
uint8_t* atCmdGetBaudRateString(uint8_t atCid);
|
||||
|
||||
/**
|
||||
\brief Check if UART baud rate valid or not
|
||||
\param[in] atCid at chanId from PS
|
||||
\param[in] baudRate baud rate need to check
|
||||
\return true if pass otherwise false
|
||||
*/
|
||||
bool_t atCmdIsBaudRateValid(uint8_t atCid, uint32_t baudRate);
|
||||
|
||||
int32_t atCmdStartPppSessn(uint8_t atCid, uint8_t pdp4Cid, uint8_t pdp6Cid, bool_t needAct);
|
||||
int32_t atCmdStopPppSessn(uint8_t atCid, uint32_t args);
|
||||
int32_t atCmdResumePppSessn(uint8_t atCid, uint32_t args);
|
||||
|
||||
int32_t atCmdReqDataModeHS(uint8_t atCid, uint32_t args);
|
||||
|
||||
void atCmdPowerOff(uint8_t atCid, uint8_t mode);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_netdata.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2021/1/19 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_NETDATA_H
|
||||
#define CCIO_NETDATA_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_misc.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
void netifSetFastChkInfo(void *fastChkInfo, UINT16 infoLen);
|
||||
void* netifGetFastChkInfo(void);
|
||||
|
||||
int32_t ethDataInput(UlPduBlock_t *ulpdu, void *extras);
|
||||
int32_t ethDataOutput(uint8_t lanType, DlPduBlock_t *head, DlPduBlock_t *tail);
|
||||
int32_t ethDataFastOutput(uint8_t lanType);
|
||||
|
||||
int32_t netDataInput(UlPduBlock_t *ulpdu, void *extras);
|
||||
int32_t netDataOutput(DlPduBlock_t *head, DlPduBlock_t *tail);
|
||||
int32_t netDataFastOutput(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/******************************************************************************
|
||||
|
||||
*(C) Copyright 2018 AirM2M International Ltd.
|
||||
|
||||
* All Rights Reserved
|
||||
|
||||
******************************************************************************
|
||||
* Filename: ccio_opaq.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* History: 2022/3/15 created by xuwang
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef CCIO_OPAQ_H
|
||||
#define CCIO_OPAQ_H
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* INCLUDES *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "ccio_misc.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* MACROS *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* DATA TYPE DEFINITION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* GLOBAL FUNCTIONS DECLEARATION *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
\fn int32_t opaqDataInput(UlPduBlock_t *ulpdu, void *extras)
|
||||
\brief to further handle opaq data received from serial device
|
||||
\return
|
||||
\note invoked by RxTask automatically once opaq data is received
|
||||
*/
|
||||
int32_t opaqDataInput(UlPduBlock_t *ulpdu, void *extras);
|
||||
|
||||
/**
|
||||
\fn int32_t opaqDataOutput(uint8_t chanNo, DlPduBlock_t *dlpdu, void *extras)
|
||||
\brief to send opaq data out of serial device
|
||||
\return
|
||||
\note invoked by customer's AppTask for outputting opaq data
|
||||
*/
|
||||
int32_t opaqDataOutput(uint8_t chanNo, DlPduBlock_t *dlpdu, void *extras);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user