[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/l2_c2k/common/7074STAT.H b/mcu/interface/protocol/l2_c2k/common/7074STAT.H
new file mode 100644
index 0000000..c9988bd
--- /dev/null
+++ b/mcu/interface/protocol/l2_c2k/common/7074STAT.H
@@ -0,0 +1,296 @@
+/*************************************************************
+*
+* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
+*
+* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
+*
+* Copyright (c) 2002-2010 VIA Telecom, Inc. All rights reserved.
+*
+*************************************************************/
+/*************************************************************************
+ *
+ * File Name: 7074stat.h
+ * Project: NSPE stack
+ *
+ * Original Author: Steve Pye
+ * Creation Date: July 13, 1998
+ *
+ * Description:
+ * Restrictions:
+ * Dependencies:
+ *
+ ************************************************************************/
+
+#ifndef _7074STAT_H_
+#define _7074STAT_H_ 1
+#include "kal_public_defs.h"
+#include "kal_public_api.h"
+
+#include "7074CUST.H"
+#include "PPPAPI.H"
+#include "PP_FRAME.H"
+#include "IP_CUSTM.H"
+#include "USER_API.H"
+#include "hlpapi.h"
+
+/* IS-707 Applications */
+#define IS707_APP_ASYNC_TCP 0
+#define IS707_APP_PACKET_RLP 1
+#define IS707_APP_BROWSER_UDP 2
+#define IS707_APP_PACKET_UART 3
+#define IS707_APP_BROWSER_ON_ASYNC 4
+#define IS707_APP_BROWSER_CKT_TCP 5
+#define IS707_APP_BROWSER_PKT_TCP 6
+#define IS707_APP_PPP_ONLY 7
+#define IS707_APP_ACS_STREAM 8
+#define IS707_APP_MAIN_CONN 9
+#define IS707_APP_NULL 10 /* Adding any new type should be before this */
+#define IS707_NUM_APPS 11
+
+/*add for Trace, keep in the same order as IS707_APP...#defines above*/
+typedef enum
+{
+ NSPE_ASYNC_TCP,
+ NSPE_PACKET_RLP,
+ NSPE_BROWSER_UDP,
+ NSPE_PACKET_UART,
+ NSPE_BROWSER_ON_ASYNC,
+ NSPE_BROWSER_CKT_TCP,
+ NSPE_BROWSER_PKT_TCP,
+ NSPE_PPP_ONLY,
+ NSPE_ACS_STREAM,
+ NSPE_MAIN_CONN,
+ NSPE_NULL,
+ NSPE_APP_MAX_NUM
+} NspeAppsT;
+
+/* IS-707 Task states */
+#define IS707_S_IDLE 0
+#define IS707_S_RLP_CONNECTING 1
+#define IS707_S_NET_CONNECTING 2
+#define IS707_S_TCP_CONNECTING 3
+#define IS707_S_PPP_CONNECTING 4
+#define IS707_S_LCP_CONNECTED 5
+#define IS707_S_PPP_CONNECTED 6
+#define IS707_S_NET_CONNECTED 7
+#define IS707_S_ABORTING 8
+#define IS707_S_CLOSING 9
+#define IS707_S_UM_RENEGOTIATION 10
+#define IS707_S_DEREGISTERING 11
+
+/*add for Trace, keep in the same order as IS707_S...#defines above*/
+typedef enum
+{
+ NSPE_IDLE,
+ NSPE_RLP_CONNECTING ,
+ NSPE_NET_CONNECTING,
+ NSPE_TCP_CONNECTING,
+ NSPE_PPP_CONNECTING,
+ NSPE_LCP_CONNECTED,
+ NSPE_PPP_CONNECTED,
+ NSPE_NET_CONNECTED,
+ NSPE_ABORTING,
+ NSPE_CLOSING,
+ NSPE_UM_RENEGO,
+ NSPE_DEREGISTERING,
+ NSPE_STATE_MAX_NUM
+} NspeStatesT;
+
+/* Mobile IP states */
+#define MIP_NULL_STATE 0
+#define MIP_INIT_STATE 1
+#define MIP_AGENT_DIS_STATE 2
+#define MIP_REGISTRATION_STATE 3
+#define MIP_ACTIVE_STATE 4
+#define MIP_TERMINATE_STATE 5
+
+/*add for Trace, keep in the same order as MIP_..._STATE#defines above*/
+typedef enum
+{
+ MIP_NULL_ST,
+ MIP_INIT_ST ,
+ MIP_AGENT_DIS_ST,
+ MIP_REGISTRATION_ST,
+ MIP_ACTIVE_ST,
+ MIP_TERMINATE_ST,
+ MIP_ST_MAX_NUM
+} MipStatesT;
+
+struct nspeBufferType
+{
+ kal_uint8 pppIpScratch[ PPP_BUFFERSIZE*2 ];
+ kal_uint8 mbufPool[ IS707_MBUF_POOL_SIZE ];
+};
+
+struct scb
+{
+ kal_uint8 SocketRxBuf[ IS707_APPINT_RX_BUFFERSIZE ];
+ kal_bool tcpPassive;
+ kal_bool tcpPeerClosing;
+ kal_bool tcpWereClosing;
+
+ kal_uint8 sap;
+ kal_uint8 ipProtocol;
+ kal_uint16 nDataToRead;
+ kal_bool bCloseWaitDefer;
+
+ /* Application Interface variables */
+ kal_bool appIntRecvReady;
+ kal_bool appIntSendPending;
+ kal_bool bDataPending;
+ SendRequest appIntSendRqst;
+ ReceiveRequest appIntRecvRqst;
+ SendToRequest appIntSendToRqst;
+ ReceiveFromRequest appIntRecvFromRqst;
+ /* variables for pending */
+ kal_bool bTCPOrUDPDataReqPending;
+ kal_bool bSocketConnectReqPending;
+ kal_bool bSocketCloseReqPending;
+ kal_bool bSocketShutdownReqPending;
+ HlpTcpbDataSendReqMsgT PendingTCPDataRqstToSend;
+ HlpUpbSendDataMsgT PendingUDPDataRqstToSend;
+ HlpSocketConnectMsgT PendingSktConnMsg;
+ HlpSocketCloseMsgT PendingSktCloseMsg;
+ HlpSocketShutDownMsgT PendingSktShutDownMsg;
+};
+
+struct nspeGlobalsType
+{
+ /* RLP variables */
+ kal_uint8 rlpApp;
+ kal_uint8 uartApp;
+ kal_uint8 rlpAppAccess;
+ kal_bool rlpFlushPending;
+ kal_bool rlpTransparent;
+
+ /* Packet variables */
+ kal_uint8 packetUdpSap;
+ kal_bool packetBrowserMode;
+
+ /* PPP variables */
+ kal_uint8 *pppRxData;
+ kal_uint16 pppRxDataSize;
+ kal_uint16 pppSendMTU;
+
+ /* PPP variables for RM interface to Uart */
+ kal_uint8 *pppUartRxData;
+ kal_uint16 pppUartRxDataSize;
+
+
+ /* TCP variables */
+ kal_bool tcpPassive;
+ kal_bool tcpPeerClosing;
+ kal_bool tcpWereClosing;
+
+ kal_bool tcpFlowOn;
+ kal_uint8 tcpSap;
+
+ /* Application Interface variables */
+ kal_bool appIntRxReady;
+ kal_bool appIntTxPending;
+ SendRequest appIntTxRqst;
+/* ReceiveRequest appIntRxRqst; */
+
+ /* Browser UDP variables */
+ kal_bool DoubleStackUpperLayerDown;
+ /* variable handle rlpresetInd */
+ kal_bool RlpReset; /* set after rlpReset, */
+ kal_bool RlpOpenRspRcvd; /* set after receive rlpOpenRsp which caused by rlpReset */
+ kal_bool Um_Rm_Connected; /*set after UM and RM interface are both connected */
+ kal_bool Um_DataPending; /* set to KAL_TRUE is there is data pending which is ready to be sent to Rm */
+ kal_bool Rm_DataPending; /* set to KAL_TRUE is there is data pending which is ready to be sent to Um */
+ kal_bool Um_Renegotiating;
+#ifdef TEST
+ /* these variablee can be removed */
+ kal_bool enableIpFlowControlIteMessages;
+ kal_bool enableTcpRxDataIteMessages;
+#endif
+};
+
+struct Pending_Data
+{
+ kal_bool canBeSent;
+ kal_bool dormant_flag; /* Remember the current Mode*/
+ kal_bool Data_Pending; /* Set the flag if we saved any data.*/
+ kal_bool Tx_Pending; /* pending flag cuased by UDP busy */
+ SendToRequest saved; /* save the data */
+};
+
+struct Um_Dormant
+{
+ kal_bool dataPending;
+ kal_bool dormant;
+};
+
+void nspeUmDormantReconnect(void);
+void UmProcessPendingData(void);
+
+struct Interface_Busy
+{
+ kal_bool rx_busy;
+ kal_bool tx_busy;
+};
+
+extern struct Interface_Busy um_rlp;
+extern struct Interface_Busy rm_uart;
+
+extern struct nspeGlobalsType nspe;
+extern struct nspeBufferType nspeBuffers;
+extern struct scb nspeSCB[IP_NTCBS];
+extern kal_uint8 pppAccStrmScratch[PPP_BUFFERSIZE*2];
+
+/* Prototypes */
+void Shut_TCP_Quietly( void );
+void nspeTxReq( void );
+void udpTxReq( void );
+void nspeSetState( kal_uint8 app, kal_uint8 state );
+kal_uint8 nspeGetState( kal_uint8 app );
+void nspeSetRlpAppAccess(kal_uint8 rlpAppAcs);
+kal_uint8 nspeGetRlpAppAccess(void);
+void nspeSetIpAddr( kal_uint8 app, kal_uint32 ip_address );
+kal_uint32 nspeGetIpAddr( kal_uint8 app );
+void nspeSetPppPort( kal_uint8 app, kal_uint16 ppp_port );
+kal_uint16 nspeGetPppPort( kal_uint8 app );
+void nspeSetPppSending( kal_uint8 app, kal_bool sending );
+kal_bool nspeGetPppSending( kal_uint8 app );
+kal_uint32 nspeGetApp( kal_uint16 ppp_port );
+void nspeInit( kal_uint8 app );
+void nspeInitApps(void);
+void nspeCleanPort( kal_uint8 app );
+void nspePassIpDataToPpp( kal_uint8 app );
+void nspePurgeIPDataQueue( kal_uint8 app );
+
+kal_uint8 nspeGetAppByPDNId(kal_uint8 PDNId);
+void nspeSetPdnId( kal_uint8 app, kal_uint8 PdnId );
+kal_uint8 nspeGetPdnId( kal_uint8 app);
+void nspeIpData2Ppp(kal_uint8 app);
+#ifdef WeDoPacketMode
+
+kal_bool nspeGetBufferfromTxQueue( kal_uint8 *buffer, kal_uint16 *size, kal_uint8 app );
+void nspePacketBufferRxd( kal_uint8 app, kal_uint8 *data, kal_uint16 len, kal_uint16 prot );
+void nspePassPacketDataToHost( kal_uint8 app );
+void nspePerformMqueueFlowCtl( void );
+void nspeQueuePacket( kal_uint8 app, kal_uint8 *data, kal_uint16 len, kal_uint16 prot );
+void nspeDequeuePacket( kal_uint8 app, kal_uint8 *data, kal_uint16 *len, kal_uint16 *prot );
+void nspePassIpDataToPacket( void );
+void nspePacketInit( void );
+
+#else
+
+#define nspePacketBufferRxd( a,b,c,d )
+#define nspeQueuePacket( a,b,c,d )
+#define nspeDequeuePacket( a,b,c,d )
+#define nspePassIpDataToPacket()
+
+#endif /* WeDoPacketMode */
+
+/* functions support network layer */
+void umReConnected(void);
+
+struct scb* nspeAllocScb(void);
+struct scb* nspeGetScbBySap(kal_uint8 sap);
+
+
+#endif /* _7074STAT_H_ */
+
+