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

📄 net_cfg.h

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 H
📖 第 1 页 / 共 3 页
字号:
/*
*********************************************************************************************************
*                             USER DATAGRAM PROTOCOL LAYER CONFIGURATION
*
* Note(s) : (1) Configure NET_UDP_CFG_APP_API_SEL with the desired configuration for demultiplexing
*               UDP datagrams to application connections :
*
*                   NET_UDP_APP_API_SEL_SOCK        Demultiplex UDP datagrams to BSD sockets ONLY.
*                   NET_UDP_APP_API_SEL_APP         Demultiplex UDP datagrams to application-specific
*                                                       connections ONLY.
*                   NET_UDP_APP_API_SEL_SOCK_APP    Demultiplex UDP datagrams to BSD sockets first;
*                                                       if NO socket connection found to demultiplex
*                                                       a UDP datagram, demultiplex to application-
*                                                       specific connection.
*
*               See also 'net_udp.c  NetUDP_RxPktDemuxDatagram()  Note #1'
*                      & 'net_udp.c  NetUDP_RxPktDemuxAppData()   Note #1'.
*
*           (2) (a) Before a UDP Datagram Check-Sum is validated, it is necessary to check whether the
*                   UDP datagram was transmitted with or without a computed Check-Sum (see RFC #768,
*                   Section 'Fields : Checksum').
*
*               (b) Configure NET_UDP_CFG_RX_CHK_SUM_DISCARD_EN to enable/disable discarding of UDP
*                   datagrams received with NO computed check-sum :
*
*                   (1) When ENABLED,  ALL UDP datagrams received without a check-sum are discarded.
*
*                   (2) When DISABLED, ALL UDP datagrams received without a check-sum are flagged so
*                       that "an application MAY optionally ... discard ... datagrams without checksums"
*                       (see RFC #1122, Section 4.1.3.4).
*
*               See also 'net_udp.c  NetUDP_RxPktValidate()  Note #4d3A'.
*
*           (3) (a) "An application MAY optionally be able to control whether a UDP checksum will be
*                    be generated" (see RFC #1122, Section 4.1.3.4).
*
*               (b) Configure NET_UDP_CFG_TX_CHK_SUM_EN to enable/disable transmitting UDP datagrams with
*                   check-sums :
*
*                   (1) When ENABLED,  ALL UDP datagrams are transmitted with    a computed check-sum.
*
*                   (2) When DISABLED, ALL UDP datagrams are transmitted without a computed check-sum.
*
*               See also 'net_udp.c  NetUDP_TxPktPrepareHdr()  Note #3b'.
*********************************************************************************************************
*/
                                                                /* Configure UDP Receive Demultiplex Selection ...      */
                                                                /* ... (see Note #1) :                                  */
#define  NET_UDP_CFG_APP_API_SEL                NET_UDP_APP_API_SEL_SOCK
                                                                /*                       Demultiplex & Receive via ...  */
                                                                /*   NET_UDP_APP_API_SEL_SOCK      Sockets     ONLY     */
                                                                /*   NET_UDP_APP_API_SEL_APP       Application ONLY     */
                                                                /*   NET_UDP_APP_API_SEL_SOCK_APP  First by Socket,     */
                                                                /*                                 Next  by Application */

                                                                /* Configure UDP Receive Check-Sum Discard feature ...  */
                                                                /* ... (see Note #2) :                                  */
#define  NET_UDP_CFG_RX_CHK_SUM_DISCARD_EN      DEF_ENABLED
                                                                /*   DEF_DISABLED  UDP Datagrams  Received without ...  */
                                                                /*                     Check-Sums Validated             */
                                                                /*   DEF_ENABLED   UDP Datagrams  Received without ...  */
                                                                /*                     Check-Sums Discarded             */

                                                                /* Configure UDP Transmit Check-Sum feature ...         */
                                                                /* ... (see Note #3) :                                  */
#define  NET_UDP_CFG_TX_CHK_SUM_EN              DEF_ENABLED
                                                                /*   DEF_DISABLED  Transmit Check-Sums  DISABLED        */
                                                                /*   DEF_ENABLED   Transmit Check-Sums   ENABLED        */


/*$PAGE*/
/*
*********************************************************************************************************
*                          TRANSMISSION CONTROL PROTOCOL LAYER CONFIGURATION
*
* Note(s) : (1) (a) Configure NET_TCP_CFG_NBR_CONN with the desired number of TCP connection objects.
*
*               (b) Since TCP requires network sockets (see 'net_tcp.h  Note #2'), the configured number
*                   of sockets MUST be greater than the configured number of TCP connections.
*
*               See also 'net_sock.h  MODULE  Note #1',
*                        'net_tcp.h   MODULE  Note #1',
*                      & 'net_cfg_net.h  NETWORK SOCKET LAYER CONFIGURATION  Note #4'.
*
*           (2) Stevens, TCP/IP Illustrated, Volume 1, 8th Printing, Section 20.4, Page 282 states that
*               "4.2BSD defaulted the send and receive buffer" (i.e. socket buffer/TCP window) "to 2048
*               bytes each.  With 4.3BSD both were increased to 4096 bytes ... Other systems, such as
*               ... 4.4BSD ... use larger default buffer sizes, such as 8192 or 16384 bytes.
*
*               The common default of 4096 bytes ... is not optimal for Ethernet.  An approximate 40%
*               increase in throughput is seen by just increasing both buffers to 16384 bytes."
*
*           (3) RFC #793, Section 3.3 'Sequence Numbers : Knowing When to Keep Quiet' states that
*               "the Maximum Segment Lifetime (MSL) is ... to be 2 minutes ... [but] may be changed
*               if experience indicates it is desirable to do so".
*
*               See also 'net_tcp.h  TCP CONNECTION TIMEOUT DEFINES  Note #1'.
*
*           (4) RFC #2581, Section 4.2 states that "an ACK ... MUST be generated within 500 ms of the
*               arrival of the first unacknowledged packet".
*
*               See also 'net_tcp.h  TCP CONGESTION CONTROL DEFINES  Note #6b'
*                      & 'net_tcp.c  NetTCP_TxConnAck()  Note #6a2'.
*
*           (5) Configure timeout values in integer number of milliseconds.  Timeout values may also
*               be configured with network time constant, NET_TMR_TIME_INFINITE, to never timeout.
*********************************************************************************************************
*/

#define  NET_TCP_CFG_NBR_CONN                             10    /* Configure total number of TCP connections.           */


                                                                /* Configure TCP connections' window sizes ...          */
                                                                /* ... in integer number of octets (see Note #2) :      */

#define  NET_TCP_CFG_RX_WIN_SIZE_OCTET                  4096    /* Configure TCP connection receive  window size.       */
#define  NET_TCP_CFG_TX_WIN_SIZE_OCTET                  8192    /* Configure TCP connection transmit window size.       */


                                                                /* Configure TCP connections' default maximum ...       */
                                                                /* ... segment lifetime timeout (MSL) value,  ...       */
#define  NET_TCP_CFG_TIMEOUT_CONN_MAX_SEG_SEC              3    /* ... in integer seconds (see Note #3).                */


                                                                /* Configure TCP acknowledgement delay ...              */
#define  NET_TCP_CFG_TIMEOUT_CONN_ACK_DLY_MS             500    /* ... in integer milliseconds (see Note #4).           */


                                                                /* Configure TCP timeouts (see Note #5) :               */
#define  NET_TCP_CFG_TIMEOUT_CONN_RX_Q_MS               3000    /* Configure TCP connection receive  queue timeout.     */
#define  NET_TCP_CFG_TIMEOUT_CONN_TX_Q_MS               3000    /* Configure TCP connection transmit queue timeout.     */


/*$PAGE*/
/*
*********************************************************************************************************
*                                 NETWORK SOCKET LAYER CONFIGURATION
*
* Note(s) : (1) Network Socket Module NOT required for all application interfaces (see 'net_sock.h
*               MODULE  Note #1').
*
*           (2) See 'net_sock.h  NETWORK SOCKET FAMILY & PROTOCOL DEFINES  Note #1' for supported
*               Network Socket Family types.
*
*           (3) Configure timeout values in integer number of milliseconds.  Timeout values may also
*               be configured with network time constant, NET_TMR_TIME_INFINITE, to never timeout.
*********************************************************************************************************
*/
                                                                /* Configure socket family type (see Note #2) :         */
#define  NET_SOCK_CFG_FAMILY                    NET_SOCK_FAMILY_IP_V4

#define  NET_SOCK_CFG_NBR_SOCK                            10    /* Configure total number of sockets.                   */

                                                        /* Configure socket blocking/non-blocking behavior :            */
#define  NET_SOCK_CFG_BLOCK_SEL                 NET_SOCK_BLOCK_SEL_BLOCK
                                                        /*   NET_SOCK_BLOCK_SEL_DFLT        Default blocking; run-time  */
                                                        /*                                  ... options can override    */
                                                        /*   NET_SOCK_BLOCK_SEL_BLOCK       Always  block               */
                                                        /*   NET_SOCK_BLOCK_SEL_NO_BLOCK    Never   block               */

                                                        /* Configure stream-type sockets' accept queue maximum size.    */
#define  NET_SOCK_CFG_CONN_ACCEPT_Q_SIZE_MAX               5

#define  NET_SOCK_CFG_PORT_NBR_RANDOM_BASE             65000    /* Configure random ports' starting port number.        */


                                                                /* Configure socket timeout values (see Note #3) :      */
#define  NET_SOCK_CFG_TIMEOUT_RX_Q_MS                   3000    /* Configure socket receive    queue   timeout.         */
#define  NET_SOCK_CFG_TIMEOUT_CONN_REQ_MS              10000    /* Configure socket connection request timeout.         */
#define  NET_SOCK_CFG_TIMEOUT_CONN_ACCEPT_MS            3000    /* Configure socket connection accept  timeout.         */
#define  NET_SOCK_CFG_TIMEOUT_CONN_CLOSE_MS            10000    /* Configure socket connection close   timeout.         */


/*
*********************************************************************************************************
*                                     BSD 4.x LAYER CONFIGURATION
*
* Note(s) : (1) BSD 4.x Layer API NOT required for all applications (see 'net_bsd.h  MODULE  Note #1b').
*********************************************************************************************************
*/

#define  NET_BSD_CFG_API_EN                     DEF_ENABLED     /* Configure BSD 4.x Layer API (see Note #1) :          */
                                                                /*   DEF_DISABLED  BSD 4.x Layer API DISABLED           */
                                                                /*   DEF_ENABLED   BSD 4.x Layer API ENABLED            */


/*$PAGE*/
/*
*********************************************************************************************************
*                             NETWORK CONNECTION MANAGEMENT CONFIGURATION
*
* Note(s) : (1) Connection Management NOT required for all application interfaces (see 'net_conn.h
*               MODULE  Note #1').
*
*           (2) See 'net_def.h  NETWORK CONNECTION MANAGEMENT DEFINES' for supported Family types.
*
*           (3) The configured number of connections MUST be greater than the configured/required/expected
*               number of application connections & transport layer connections.
*
*               See also 'net_cfg_net.h  NETWORK CONNECTION MANAGEMENT CONFIGURATION  Note #4'.
*********************************************************************************************************
*/
                                                                /* Configure connection family type      (see Note #2). */
#define  NET_CONN_CFG_FAMILY                    NET_CONN_FAMILY_IP_V4_SOCK

#define  NET_CONN_CFG_NBR_CONN                            20    /* Configure total number of connections (see Note #3). */

⌨️ 快捷键说明

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