亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

no-crashes-allowed

  • net_tcp.h

    /* ********************************************************************************************************* *                                             uC/TCP-IP V2 *                                      The Embedded TCP/IP Suite * *                          (c) Copyright 2003-2010; Micrium, Inc.; Weston, FL * *               All rights reserved.  Protected by international copyright laws. * *               uC/TCP-IP is provided in source form to registered licensees ONLY.  It is  *               illegal to distribute this source code to any third party unless you receive  *               written permission by an authorized Micrium representative.  Knowledge of  *               the source code may NOT be used to develop a similar product. * *               Please help us continue to provide the Embedded community with the finest  *               software available.  Your honesty is greatly appreciated. * *               You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * *                                          NETWORK TCP LAYER *                                   (TRANSMISSION CONTROL PROTOCOL) * * Filename      : net_tcp.h * Version       : V2.10 * Programmer(s) : ITJ ********************************************************************************************************* * Note(s)       : (1) Supports Transmission Control Protocol as described in RFC #793 with the following *                     restrictions/constraints : * *                     (a) TCP Security & Precedence NOT supported               RFC # 793, Section 3.6 * *                     (b) TCP Urgent Data           NOT supported               RFC # 793, Section 3.7 *                                                                                'The Communication of *                                                                                  Urgent Information' * *                     (c) The following TCP options NOT supported :              * *                         (1) Window Scale                                      RFC #1072, Section 2 *                                                                               RFC #1323, Section 2 *                         (2) Selective Acknowledgement (SACK)                  RFC #1072, Section 3 *                                                                               RFC #2018 *                                                                               RFC #2883 *                         (3) TCP Echo                                          RFC #1072, Section 4 *                         (4) Timestamp                                         RFC #1323, Section 3.2 *                         (5) Protection Against Wrapped Sequences (PAWS)       RFC #1323, Section 4 * *                     (d) #### IP-Options-to-TCP-Connection                     RFC #1122, Section 4.2.3.8 *                                Handling NOT           supported * *                     (e) #### ICMP-Error-Message-to-TCP-Connection             RFC #1122, Section 4.2.3.9 *                                Handling NOT currently supported * *                 (2) TCP Layer assumes/requires Network Socket Layer (see 'net_sock.h  MODULE  Note #1a2'). ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* *                                               MODULE * * Note(s) : (1) TCP Layer module is NOT required for UDP-to-Application API configuration. * *               See also 'net_cfg.h  TRANSPORT LAYER CONFIGURATION' *                      & 'net_cfg.h  USER DATAGRAM PROTOCOL LAYER CONFIGURATION'. * *               See also 'net_tcp.h  Note #2'. * *           (2) The following TCP-module-present configuration value MUST be pre-#define'd in  *               'net_cfg_net.h' PRIOR to all other network modules that require TCP Layer *               configuration (see 'net_cfg_net.h  TCP LAYER CONFIGURATION  Note #2b') : * *                   NET_TCP_MODULE_PRESENT ********************************************************************************************************* */ #ifdef   NET_TCP_MODULE_PRESENT                                 /* See Note #2.                                         */ /* ********************************************************************************************************* *                                               EXTERNS ********************************************************************************************************* */ #if ((defined(NET_TCP_MODULE)) && \      (defined(NET_GLOBALS_EXT))) #define  NET_TCP_EXT #else #define  NET_TCP_EXT  extern #endif /*$PAGE*/ /* ********************************************************************************************************* *                                               DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* *                                         TCP HEADER DEFINES * * Note(s) : (1) The following TCP value MUST be pre-#define'd in 'net_def.h' PRIOR to 'net_buf.h' so that *               the Network Buffer Module can configure maximum buffer header size (see 'net_def.h  TCP *               LAYER DEFINES' & 'net_buf.h  NETWORK BUFFER INDEX & SIZE DEFINES  Note #1') : * *               (a) NET_TCP_HDR_SIZE_MAX                  60        (NET_TCP_HDR_LEN_MAX *                                                                  * NET_TCP_HDR_LEN_WORD_SIZE) * *           (2) Urgent pointer & data NOT supported (see 'net_tcp.h  Note #1b'). ********************************************************************************************************* */ #define  NET_TCP_HDR_LEN_MASK                         0xF000u #define  NET_TCP_HDR_LEN_SHIFT                            12u #define  NET_TCP_HDR_LEN_NONE                              0u #define  NET_TCP_HDR_LEN_MIN                               5u #define  NET_TCP_HDR_LEN_MAX                              15u #define  NET_TCP_HDR_LEN_WORD_SIZE                       CPU_WORD_SIZE_32 #define  NET_TCP_HDR_SIZE_MIN                           (NET_TCP_HDR_LEN_MIN * NET_TCP_HDR_LEN_WORD_SIZE) #if 0                                                           /* See Note #1a.                                        */ #define  NET_TCP_HDR_SIZE_MAX                           (NET_TCP_HDR_LEN_MAX * NET_TCP_HDR_LEN_WORD_SIZE) #endif #define  NET_TCP_HDR_SIZE_TOT_MIN                       (NET_IP_HDR_SIZE_TOT_MIN + NET_TCP_HDR_SIZE_MIN) #define  NET_TCP_HDR_SIZE_TOT_MAX                       (NET_IP_HDR_SIZE_TOT_MAX + NET_TCP_HDR_SIZE_MAX) #define  NET_TCP_PSEUDO_HDR_SIZE                          12u   /*  = sizeof(NET_TCP_PSEUDO_HDR)                        */ #define  NET_TCP_PORT_NBR_RESERVED                       NET_PORT_NBR_RESERVED #define  NET_TCP_PORT_NBR_NONE                           NET_TCP_PORT_NBR_RESERVED #define  NET_TCP_HDR_URG_PTR_NONE                     0x0000u   /* See Note #2.                                         */ /*$PAGE*/ /* ********************************************************************************************************* *                                       TCP HEADER FLAG DEFINES * * Note(s) : (1) See 'TCP HEADER  Note #2' for flag fields. * *           (2) Urgent pointer & data NOT supported (see 'net_tcp.h  Note #1b'). ********************************************************************************************************* */ #define  NET_TCP_HDR_FLAG_MASK                        0x0FFFu #define  NET_TCP_HDR_FLAG_NONE                    DEF_BIT_NONE #define  NET_TCP_HDR_FLAG_RESERVED                    0x0FE0u   /* MUST be '0'.                                         */ #define  NET_TCP_HDR_FLAG_URGENT                  DEF_BIT_05    /* See Note #2.                                         */ #define  NET_TCP_HDR_FLAG_ACK                     DEF_BIT_04 #define  NET_TCP_HDR_FLAG_PUSH                    DEF_BIT_03 #define  NET_TCP_HDR_FLAG_RESET                   DEF_BIT_02 #define  NET_TCP_HDR_FLAG_SYNC                    DEF_BIT_01 #define  NET_TCP_HDR_FLAG_FIN                     DEF_BIT_00 #define  NET_TCP_HDR_FLAG_CLOSE                   NET_TCP_HDR_FLAG_FIN /* ********************************************************************************************************* *                                          TCP FLAG DEFINES ********************************************************************************************************* */                                                                 /* ------------------ NET TCP FLAGS ------------------- */ #define  NET_TCP_FLAG_NONE                        DEF_BIT_NONE #define  NET_TCP_FLAG_USED                        DEF_BIT_00    /* TCP conn cur used; i.e. NOT in free TCP conn pool.   */                                                                 /* ------------------ TCP TX  FLAGS ------------------- */                                                                 /* TCP tx flags copied from TCP hdr flags.              */ #define  NET_TCP_FLAG_TX_FIN                      NET_TCP_HDR_FLAG_FIN #define  NET_TCP_FLAG_TX_CLOSE                    NET_TCP_FLAG_TX_FIN #define  NET_TCP_FLAG_TX_SYNC                     NET_TCP_HDR_FLAG_SYNC #define  NET_TCP_FLAG_TX_RESET                    NET_TCP_HDR_FLAG_RESET #define  NET_TCP_FLAG_TX_PUSH                     NET_TCP_HDR_FLAG_PUSH #define  NET_TCP_FLAG_TX_ACK                      NET_TCP_HDR_FLAG_ACK #define  NET_TCP_FLAG_TX_URGENT                   NET_TCP_HDR_FLAG_URGENT #define  NET_TCP_FLAG_TX_BLOCK                    DEF_BIT_07                                                                 /* ------------------ TCP RX  FLAGS ------------------- */ #define  NET_TCP_FLAG_RX_DATA_PEEK                DEF_BIT_08 #define  NET_TCP_FLAG_RX_BLOCK                    DEF_BIT_15 /*$PAGE*/ /* ********************************************************************************************************* *                                          TCP TYPE DEFINES * * Note(s) : (1) NET_TCP_TYPE_&&& #define values specifically chosen as ASCII representations of the TCP *               types.  Memory displays of TCP types will display with their chosen ASCII names. ********************************************************************************************************* */                                                                 /* ------------------ NET TCP TYPES ------------------- */ #if     (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) #define  NET_TCP_TYPE_NONE                        0x4E4F4E45u   /* "NONE" in ASCII.                                     */ #define  NET_TCP_TYPE_CONN                        0x54435020u   /* "TCP " in ASCII.                                     */ #else #if     (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_32) #define  NET_TCP_TYPE_NONE                        0x454E4F4Eu   /* "NONE" in ASCII.                                     */ #define  NET_TCP_TYPE_CONN                        0x20504354u   /* "TCP " in ASCII.                                     */ #elif   (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_16) #define  NET_TCP_TYPE_NONE                        0x4F4E454Eu   /* "NONE" in ASCII.                                     */ #define  NET_TCP_TYPE_CONN                        0x43542050u   /* "TCP " in ASCII.                                     */ #else                                                           /* Dflt CPU_WORD_SIZE_08.                               */ #define  NET_TCP_TYPE_NONE                        0x4E4F4E45u   /* "NONE" in ASCII.                                     */ #define  NET_TCP_TYPE_CONN                        0x54435020u   /* "TCP " in ASCII.                                     */ #endif #endif /* ********************************************************************************************************* *                                     TCP SEQUENCE NUMBER DEFINES * * Note(s) : (1) TCP initial transmit sequence number is incremented by a fixed value, preferably a large *               prime value or a large value with multiple unique factors. * *               (a) One reasonable TCP initial transmit sequence number increment value example : * *                       65527  =  37 * 23 * 11 * 7 * * *               #### NET_TCP_TX_SEQ_NBR_CTR_INC could be developer-configured in 'net_cfg.h'. * *               See also 'NET_TCP_TX_GET_SEQ_NBR()  Notes #1b2 & #1c2'. ********************************************************************************************************* */ #define  NET_TCP_SEQ_NBR_NONE                              0u #define  NET_TCP_ACK_NBR_NONE                            NET_TCP_SEQ_NBR_NONE #define  NET_TCP_TX_SEQ_NBR_CTR_INC                    65527u   /* See Note #1.                                         */ #define  NET_TCP_ACK_NBR_DUP_WIN_SIZE_SCALE                4 /*$PAGE*/ /* ********************************************************************************************************* *                                    TCP DATA/TOTAL LENGTH DEFINES * * Note(s) : (1) (a) TCP total length #define's (NET_TCP_TOT_LEN)  relate to the total size of a complete *                   TCP packet, including the packet's TCP header.  Note that a complete TCP packet MAY *                   be fragmented in multiple Internet Protocol packets. * *               (b) TCP data  length #define's (NET_TCP_DATA_LEN) relate to the data  size of a complete *                   TCP packet, equal to the total TCP packet length minus its TCP header size.  Note  *                   that a complete TCP packet MAY be fragmented in multiple Internet Protocol packets. ********************************************************************************************************* */                                                                                 /* See Notes #1a & #1b.                 */ #define  NET_TCP_DATA_LEN_MIN                              0u #define  NET_TCP_TOT_LEN_MIN                            (NET_TCP_HDR_SIZE_MIN + NET_TCP_DATA_LEN_MIN) #define  NET_TCP_TOT_LEN_MAX                            (NET_IP_TOT_LEN_MAX   - NET_IP_HDR_SIZE_MIN ) #define  NET_TCP_DATA_LEN_MAX                           (NET_TCP_TOT_LEN_MAX  - NET_TCP_HDR_SIZE_MIN) /*$PAGE*/ /* ********************************************************************************************************* *                                      TCP SEGMENT SIZE DEFINES * * Note(s) : (1) (a) RFC # 879, Section 3 states that the TCP Maximum Segment Size "counts only *                   data octets in the segment, ... not the TCP header or the IP header". * *               (b) RFC #1122, Section 4.2.2.6 requires that : * *                   (1) "The MSS value to be sent in an MSS option must be less than or equal to * *                        (A) MMS_R - 20 * *                        where MMS_R is the maximum size for a transport-layer message that can *                        be received." * *                   (2) "If an MSS option is not received at connection setup, TCP MUST assume a *                        default send MSS of 536 (576 - 40)." * *                   See also 'net_ip.h  IP DATA/TOTAL LENGTH DEFINES  Note #1'. ********************************************************************************************************* */                                                                                         /* See Note #1.                 */ #define  NET_TCP_MAX_SEG_SIZE_DFLT                      (NET_IP_MAX_DATAGRAM_SIZE_DFLT - NET_IP_HDR_SIZE_MIN - NET_TCP_HDR_SIZE_MIN) #define  NET_TCP_MAX_SEG_SIZE_DFLT_RX                    NET_TCP_DATA_LEN_MAX           /* See Note #1b1.               */ #define  NET_TCP_MAX_SEG_SIZE_DFLT_TX                    NET_TCP_MAX_SEG_SIZE_DFLT      /* See Note #1b2.               */ #define  NET_TCP_MAX_SEG_SIZE_NONE                         0u #define  NET_TCP_MAX_SEG_SIZE_MIN                        NET_TCP_MAX_SEG_SIZE_DFLT #define  NET_TCP_MAX_SEG_SIZE_MAX                        NET_TCP_DATA_LEN_MAX #define  NET_TCP_SEG_LEN_MIN                             NET_TCP_DATA_LEN_MIN #define  NET_TCP_SEG_LEN_MAX                             NET_TCP_DATA_LEN_MAX #define  NET_TCP_SEG_LEN_SYNC                              1u #define  NET_TCP_SEG_LEN_FIN                               1u #define  NET_TCP_SEG_LEN_CLOSE                           NET_TCP_SEG_LEN_FIN #define  NET_TCP_SEG_LEN_ACK                               0u #define  NET_TCP_SEG_LEN_RESET                             0u #define  NET_TCP_SEG_LEN_PROBE                             0u #define  NET_TCP_DATA_LEN_TX_SYNC                          0u #define  NET_TCP_DATA_LEN_TX_FIN                           0u #define  NET_TCP_DATA_LEN_TX_CLOSE                       NET_TCP_DATA_LEN_TX_FIN #define  NET_TCP_DATA_LEN_TX_ACK                           0u #define  NET_TCP_DATA_LEN_TX_PROBE_NO_DATA                 0u #define  NET_TCP_DATA_LEN_TX_PROBE_DATA                    1u #define  NET_TCP_DATA_LEN_TX_RESET                         0u #define  NET_TCP_TX_PROBE_DATA                          0x00u /* ********************************************************************************************************* *                                       TCP WINDOW SIZE DEFINES * * Note(s) : (1) Although NO RFC specifies the absolute minimum TCP connection window size value allowed, *               RFC #793, Section 3.7 'Data Communication : Managing the Window' states that for "the *               window ... there is an assumption that this is related to the currently available data *               buffer space available for this connection". ********************************************************************************************************* */ #define  NET_TCP_WIN_SIZE_NONE                             0u #define  NET_TCP_WIN_SIZE_MIN                            NET_TCP_MAX_SEG_SIZE_MIN #define  NET_TCP_WIN_SIZE_MAX                            DEF_INT_16U_MAX_VAL /*$PAGE*/ /* ********************************************************************************************************* *                                     TCP HEADER OPTIONS DEFINES * * Note(s) : (1) See the following RFC's for TCP options summary : * *               (a) RFC # 793, Section  3.1 'Header Format : Options' *               (b) RFC #1122; Sections 4.2.2.5, 4.2.2.6 * *           (2) TCP option types are encoded in the first octet for each TCP option as follows : * *                           -------- *                           | TYPE | *                           -------- * *               The TCP option type value determines the TCP option format : * *               (a) The following TCP option types are single-octet TCP options -- i.e. the option type *                   octet is the ONLY octet for the TCP option. * *                   (1) TYPE =  0   End of Options List *                   (2) TYPE =  1   No Operation * * *               (b) All other TCP options MUST be multi-octet TCP options (see RFC #1122, Section 4.2.2.5) : * *                           ------------------------------ *                           | TYPE | LEN  |   TCP OPT    | *                           ------------------------------ * *                       where  *                               TYPE        Indicates the specific TCP option type *                               LEN         Indicates the total    TCP option length, in octets, including  *                                                the option type & the option length octets *                               TCP OPT     Additional TCP option octets, if any, that contain the remaining *                                                TCP option information * *                   The following TCP option types are multi-octet TCP options where the option's second *                   octet specify the total TCP option length, in octets, including the option type & the *                   option length octets : * *                   (1) TYPE =  2   Maximum Segment Size        See RFC # 793, Section  3.1 'Header Format : *                                                                   Options : Maximum Segment Size'; *                                                                   RFC #1122, Section 4.2.2.6; *                                                                   RFC # 879, Section 3 * *                   (2) TYPE =  3   Window  Scale               See 'net_tcp.h  Note #1c1' *                   (3) TYPE =  4   SACK Allowed                See 'net_tcp.h  Note #1c2' *                   (4) TYPE =  5   SACK Option                 See 'net_tcp.h  Note #1c2' *                   (5) TYPE =  6   Echo Request                See 'net_tcp.h  Note #1c3' *                   (6) TYPE =  7   Echo Reply                  See 'net_tcp.h  Note #1c3' *                   (7) TYPE =  8   Timestamp                   See 'net_tcp.h  Note #1c4' * *           (3) TCP header allows for a maximum option list length of 40 octets : * *                   NET_TCP_HDR_OPT_SIZE_MAX = NET_TCP_HDR_SIZE_MAX - NET_TCP_HDR_SIZE_MIN * *                                            = 60 - 20 * *                                            = 40 * *           (4) 'NET_TCP_OPT_SIZE'  MUST be pre-defined PRIOR to all definitions that require TCP option  *                size data type. ********************************************************************************************************* */ /*$PAGE*/ #define  NET_TCP_HDR_OPT_END_LIST                          0u #define  NET_TCP_HDR_OPT_NOP                               1u #define  NET_TCP_HDR_OPT_MAX_SEG_SIZE                      2u #define  NET_TCP_HDR_OPT_WIN_SCALE                         3u #define  NET_TCP_HDR_OPT_SACK_PERMIT                       4u #define  NET_TCP_HDR_OPT_SACK                              5u #define  NET_TCP_HDR_OPT_ECHO_REQ                          6u #define  NET_TCP_HDR_OPT_ECHO_REPLY                        7u #define  NET_TCP_HDR_OPT_TS                                8u #define  NET_TCP_HDR_OPT_PAD                             NET_TCP_HDR_OPT_END_LIST #define  NET_TCP_HDR_OPT_LEN_END_LIST                      1u #define  NET_TCP_HDR_OPT_LEN_NOP                           1u #define  NET_TCP_HDR_OPT_LEN_MAX_SEG_SIZE                  4u #define  NET_TCP_HDR_OPT_LEN_WIN_SCALE                     3u #define  NET_TCP_HDR_OPT_LEN_SACK_PERMIT                   2u #define  NET_TCP_HDR_OPT_LEN_ECHO_REQ                      6u #define  NET_TCP_HDR_OPT_LEN_ECHO_REPLY                    6u #define  NET_TCP_HDR_OPT_LEN_TS                           10u #define  NET_TCP_HDR_OPT_LEN_SACK_MIN                      6u #define  NET_TCP_HDR_OPT_LEN_SACK_MAX                     38u #define  NET_TCP_HDR_OPT_LEN_MIN                           1u #define  NET_TCP_HDR_OPT_LEN_MIN_LEN                       2u #define  NET_TCP_HDR_OPT_LEN_MAX                          38u typedef  CPU_INT32U  NET_TCP_OPT_SIZE;                          /* TCP opt size data type (see Note #4).                */ #define  NET_TCP_HDR_OPT_SIZE_WORD               (sizeof(NET_TCP_OPT_SIZE)) #define  NET_TCP_HDR_OPT_SIZE_MAX                       (NET_TCP_HDR_SIZE_MAX - NET_TCP_HDR_SIZE_MIN) #define  NET_TCP_HDR_OPT_NBR_MIN                           0u #define  NET_TCP_HDR_OPT_NBR_MAX                        (NET_TCP_HDR_OPT_SIZE_MAX / NET_TCP_HDR_OPT_SIZE_WORD) #define  NET_TCP_HDR_OPT_IX                              NET_TCP_HDR_SIZE_MIN /*$PAGE*/ /* ********************************************************************************************************* *                                TCP OPTION CONFIGURATION TYPE DEFINES * * Note(s) : (1) NET_TCP_OPT_CFG_TYPE_&&& #define values specifically chosen as ASCII representations of  *               the TCP option configuration types.  Memory displays of TCP option configuration buffers  *               will display the TCP option configuration TYPEs with their chosen ASCII names. ********************************************************************************************************* */                                                                 /* ---------------- TCP OPT CFG TYPES ----------------- */ #if     (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) #define  NET_TCP_OPT_CFG_TYPE_NONE                0x4E4F4E45u   /* "NONE" in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x4D535320u   /* "MSS " in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x57494E20u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x53434B50u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK                0x5341434Bu   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x45524551u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4543484Fu   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_TS                  0x54532020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */ #else #if     (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_32) #define  NET_TCP_OPT_CFG_TYPE_NONE                0x454E4F4Eu   /* "NONE" in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x2053534Du   /* "MSS " in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x204E4957u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x504B4353u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK                0x4B434153u   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x51455245u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4F484345u   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_TS                  0x20205354u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */ #elif   (CPU_CFG_DATA_SIZE   == CPU_WORD_SIZE_16) #define  NET_TCP_OPT_CFG_TYPE_NONE                0x4F4E454Eu   /* "NONE" in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x534D2053u   /* "MSS " in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x4957204Eu   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x4353504Bu   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK                0x41534B43u   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x52455145u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x43454F48u   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_TS                  0x53542020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */ #else                                                           /* Dflt CPU_WORD_SIZE_08.                               */ #define  NET_TCP_OPT_CFG_TYPE_NONE                0x4E4F4E45u   /* "NONE" in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_MAX_SEG_SIZE        0x4D535320u   /* "MSS " in ASCII.                                     */ #define  NET_TCP_OPT_CFG_TYPE_WIN_SCALE           0x57494E20u   /* "WIN " in ASCII (see 'net_tcp.h  Note #1c1').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK_PERMIT         0x53434B50u   /* "SCKP" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_SACK                0x5341434Bu   /* "SACK" in ASCII (see 'net_tcp.h  Note #1c2').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REQ            0x45524551u   /* "EREQ" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_ECHO_REPLY          0x4543484Fu   /* "ECHO" in ASCII (see 'net_tcp.h  Note #1c3').        */ #define  NET_TCP_OPT_CFG_TYPE_TS                  0x54532020u   /* "TS  " in ASCII (see 'net_tcp.h  Note #1c4').        */ #endif #endif /*$PAGE*/ /* ********************************************************************************************************* *                                   TCP CONNECTION TIMEOUT DEFINES * * Note(s) : (1) (a) (1) RFC #1122, Section 4.2.2.13 'DISCUSSION' states that "the graceful close algorithm *                       of TCP requires that the connection state remain defined on (at least) one end of *                       the connection, for a timeout period of 2xMSL ... During this period, the (remote  *                       socket, local socket) pair that defines the connection is busy and cannot be reused". * *                   (2) The following sections reiterate that the TIME-WAIT state timeout scalar is two *                       maximum segment lifetimes (2 MSL) : * *                       (A) RFC #793, Section 3.9 'Event Processing : SEGMENT ARRIVES : *                               Check Sequence Number : TIME-WAIT STATE' *                       (B) RFC #793, Section 3.9 'Event Processing : SEGMENT ARRIVES : *                               Check FIN Bit         : TIME-WAIT STATE' * *               (b) (1) RFC #793, Section 3.3 'Sequence Numbers : Knowing When to Keep Quiet' states that *                       "the Maximum Segment Lifetime (MSL) is ... to be 2 minutes.  This is an engineering *                       choice, and may be changed if experience indicates it is desirable to do so". * *                   (2) Microsoft Corporation's Windows XP defaults MSL to 15 seconds. ********************************************************************************************************* */                                                                                     /* Max seg timeout (see Note #1b) : */ #define  NET_TCP_CONN_TIMEOUT_MAX_SEG_MIN_SEC   (  0u                           )   /* ... min  =  0 seconds            */ #define  NET_TCP_CONN_TIMEOUT_MAX_SEG_MAX_SEC   (  2u * DEF_TIME_NBR_SEC_PER_MIN)   /* ... max  =  2 minutes            */ #define  NET_TCP_CONN_TIMEOUT_MAX_SEG_DFLT_SEC  ( 15u                           )   /* ... dflt = 15 seconds            */ #define  NET_TCP_CONN_TIMEOUT_MAX_SEG_SCALAR       2u                               /* ... scalar (see Note #1a).       */ #define  NET_TCP_CONN_TIMEOUT_CONN_DFLT_SEC     (120u * DEF_TIME_NBR_SEC_PER_MIN)   /* Dflt conn timeout = 120 minutes  */ #define  NET_TCP_CONN_TIMEOUT_USER_DFLT_SEC     ( 30u * DEF_TIME_NBR_SEC_PER_MIN)   /* Dflt user timeout =  30 minutes  */ /*$PAGE*/ /* ********************************************************************************************************* *                                        TCP CONNECTION STATES * * Note(s) : (1) See the following RFC's for TCP state machine summary : * *               (a) RFC # 793; Sections 3.2, 3.4, 3.5, 3.9 *               (b) RFC #1122; Sections 4.2.2.8, 4.2.2.10, 4.2.2.11, 4.2.2.13, 4.2.2.18, 4.2.2.20 * *           (2) (a) #### Additional closing-data-available state used for closing connections to allow the *                   application layer to receive any remaining data. * *                   See also 'net_tcp.c  NetTCP_RxPktConnHandlerFinWait1()  Note #2f5A2', *                            'net_tcp.c  NetTCP_RxPktConnHandlerFinWait2()  Note #2f5B', *                            'net_tcp.c  NetTCP_RxPktConnHandlerClosing()   Note #2d2B2a1B', *                          & 'net_tcp.c  NetTCP_RxPktConnHandlerLastAck()   Note #2d2A1b'. ********************************************************************************************************* */ #define  NET_TCP_CONN_STATE_NONE                           0u #define  NET_TCP_CONN_STATE_FREE                           1u #define  NET_TCP_CONN_STATE_CLOSED                        10u #define  NET_TCP_CONN_STATE_LISTEN                        20u #define  NET_TCP_CONN_STATE_SYNC_RXD                      30u #define  NET_TCP_CONN_STATE_SYNC_RXD_PASSIVE              31u #define  NET_TCP_CONN_STATE_SYNC_RXD_ACTIVE               32u #define  NET_TCP_CONN_STATE_SYNC_TXD                      35u #define  NET_TCP_CONN_STATE_CONN                          40u #define  NET_TCP_CONN_STATE_FIN_WAIT_1                    50u #define  NET_TCP_CONN_STATE_FIN_WAIT_2                    51u #define  NET_TCP_CONN_STATE_CLOSING                       52u #define  NET_TCP_CONN_STATE_TIME_WAIT                     53u #define  NET_TCP_CONN_STATE_CLOSE_WAIT                    55u #define  NET_TCP_CONN_STATE_LAST_ACK                      56u #define  NET_TCP_CONN_STATE_CLOSING_DATA_AVAIL            59u   /* See Note #2a.                                        */ /* ********************************************************************************************************* *                                     TCP CONNECTION QUEUE STATES ********************************************************************************************************* */ #define  NET_TCP_RX_Q_STATE_NONE                           0u #define  NET_TCP_RX_Q_STATE_CLOSED                       100u #define  NET_TCP_RX_Q_STATE_CLOSING                      101u #define  NET_TCP_RX_Q_STATE_SYNC                         110u #define  NET_TCP_RX_Q_STATE_CONN                         111u #define  NET_TCP_TX_Q_STATE_NONE                           0u #define  NET_TCP_TX_Q_STATE_CLOSED                       200u #define  NET_TCP_TX_Q_STATE_CLOSING                      201u #define  NET_TCP_TX_Q_STATE_SYNC                         210u #define  NET_TCP_TX_Q_STATE_CONN                         211u #define  NET_TCP_TX_Q_STATE_SUSPEND                      215u #define  NET_TCP_TX_Q_STATE_CLOSED_SUSPEND               220u #define  NET_TCP_TX_Q_STATE_CLOSING_SUSPEND              221u /*$PAGE*/ /* ********************************************************************************************************* *                                     TCP CONNECTION CODE DEFINES **************

    標簽: tcp uCOS-II

    上傳時間: 2015-11-22

    上傳用戶:the same kong

  • 基于FPGA技術的微弱GPS信號實時處理的實現.rar

    普通GPS接收機在特殊環境下,如在高樓林立的城市中心,林木遮擋的森林公路,特別是在隧道和室內環境的情況下,由于衛星信號非常微弱,載噪比(Carrier Noise Ratio,C/No)通常都在34dB-Hz以下,很難有效捕獲到衛星信號,導致無法正常定位。惡劣條件下的定位有廣闊的發展和應用前景,特別是在交通事故、火災和地震等極端環境下,快速準確定位當事者所處位置對于降低事態損失和營救受傷者是極為重要的。歐美和日本等發達國家也都制定了相應的提高惡劣條件下高靈敏度定位能力的發展政策。而高靈敏度GPS接收機定位的關鍵在于GPS微弱信號的處理。 本課題的主要研究內容是針對GPS微弱信號改進處理方法。針對傳統GPS接收機信號捕獲中的串行搜索方法提出了基于批處理的微弱信號捕獲方法,來提高低信噪比情況下微弱信號的捕獲能力,實現快速高靈敏度的準確捕獲;針對捕獲微弱信號處理大量數據導致的運算量激增,運用雙塊零拓展(Double Block Zero Padding,DBZP)處理方法減少運算量同時縮短捕獲時間。針對傳統GPS接收機延遲鎖相環跟蹤算法提出了基于卡爾曼濾波的新型捕獲算法,減小延遲鎖相環失鎖造成的信號跟蹤丟失概率,來提高惡劣環境下低信噪比信號的跟蹤能力,實現微弱信號的連續可靠跟蹤。通過提高GPS微弱信號的捕獲與跟蹤能力,進而使GPS接收機在惡劣環境下衛星信號微弱時能夠實現較好的定位與導航。 通過擬合GPS接收機實際接收到的原始數據,構造出不同載噪比的數字信號,分別對提出的針對微弱信號的捕獲與跟蹤算法進行仿真比較驗證,結果表明,對接收機后端信號處理部分作出的算法改進使得GPS接收機可以更好的處理微弱信號,并且具有較高的靈敏度和精度。文章同時針對提出的數據處理特征使用FPGA技術對算法主要的數據處理部分進行了初步的構架實現并進行了板級驗證,結果表明,利用FPGA技術可以較好的實現算法的數據處理功能。文章最后給出了結論,通過提出的基于批處理和基于DBZP方法的捕獲算法以及基于卡爾曼濾波的信號跟蹤算法,可以有效地解決微弱GPS信號處理的難題,進而實現微弱信號環境下的定位與導航。

    標簽: FPGA GPS 信號實時處理

    上傳時間: 2013-05-31

    上傳用戶:cccole0605

  • AltiumDesigner原理圖元件庫集錦.rar

    共有7個元件庫,如下: NO.1 CMOS&TTL74原理圖元件庫(896個) NO.2 IC集成電路原理圖元件庫(135個) NO.3 jointbar連接器原理圖元件庫(59個) NO.4 photounit光電元件原理圖元件庫(22個) NO.5 電阻電容電感晶振二極管三極管原理圖元件庫(54個) NO.6 others其他原理圖元件庫(42個) NO.7 雜原理圖元件庫(277個)

    標簽: AltiumDesigner 原理圖 元件庫

    上傳時間: 2013-06-27

    上傳用戶:lhc9102

  • 表面貼裝設計和焊盤圖形標準通用要求

    IPC-7351不只是一個強調新的元件系列更新的焊盤圖形的標準,如方型扁平無引線封裝QFN (Quad Flat No-Lead)和小外型無引線封裝SON (Small Outline No-Lead);還是一個反映焊盤圖形方面的研發、分類和定義——這些建立新的工業CAD數據庫的關鍵元素——的全新變化的標準。

    標簽: 表面貼裝 焊盤 圖形 標準

    上傳時間: 2013-05-27

    上傳用戶:mdrd3080

  • 基于FPGA的無線信道仿真器設計與實現

    隨著人們對無線通信需求和質量的要求越來越高,無線通信設備的研發也變得越來越復雜,系統測試在整個設備研發過程中所占的比重也越來越大。為了能夠盡快縮短研發周期,測試人員需要在實驗室模擬出無線信道的各種傳播特性,以便對所設計的系統進行調試與測試。無線信道仿真器是進行無線通信系統硬件調試與測試不可或缺的儀器之一。 本文設計的無線信道仿真器是以Clarke信道模型為參考,采用基于Jakes模型的改進算法,使用Altera公司的StratixⅡ EP2S180模擬實現了頻率選擇性衰落信道。信道仿真器實現了四根天線數據的上行接收,每根天線由八條可分辨路徑,每條可分辨路徑由64個反射體構成,每根天線可分辨路徑和反射體的數目可以獨立配置。通過對每個反射體初始角度和初始相位的設置,并且保證反射體的角度和相位是均勻分布的隨機數,可以使得同一條路徑不同反射體之間的非相關特性,得到的多徑傳播信道是一個離散的廣義平穩非相關散射模型(WSSUS)。無線信道仿真器模擬了上行數據傳輸環境,上行數據由后臺產生后儲存在單板上的SDRAM中。啟動測試之后,上行數據在CPU的控制下通過信道仿真器,然后送達基帶處理板解調,最后測試數據的誤碼率和誤塊率,從而分析基站的上行接收性能。 首先,本文研究了3GPP TS 25.141協議中對通信設備測試的要求和無線信道自身的特點,完成了對無線信道仿真器系統設計方案的吸收和修改。 其次,針對FPGA內部資源結構,研究了信道仿真器FPGA實現過程中的困難和資源的消耗,進行了模塊劃分。主要完成了時延模塊、瑞利衰落模塊、背板接口模塊等的RTL級代碼的開發、仿真、綜合和板上調試;完成了FPGA和后臺軟件的聯合調試;完成了兩天線到四天線的改版工作,使FPGA內部的工作頻率翻了一倍,大幅降低了FPGA資源的消耗。 最后,在完成無線信道仿真器的硬件設計之后,對無線信道仿真器的測試根據3GPP TS 25.141 V6.13.0協議中的要求進行,即在數據誤塊率(BLER)一定的情況下,對不同信道傳播環境和不同傳輸業務下的信噪比(Eb/No)進行測試,單天線和多天線的測試結果符合協議中規定的信噪比(Eb/No)的要求。

    標簽: FPGA 無線信道 仿真器

    上傳時間: 2013-04-24

    上傳用戶:小楊高1

  • FPGA技術的微弱GPS信號實時處理

    普通GPS接收機在特殊環境下,如在高樓林立的城市中心,林木遮擋的森林公路,特別是在隧道和室內環境的情況下,由于衛星信號非常微弱,載噪比(Carrier Noise Ratio,C/No)通常都在34dB-Hz以下,很難有效捕獲到衛星信號,導致無法正常定位。惡劣條件下的定位有廣闊的發展和應用前景,特別是在交通事故、火災和地震等極端環境下,快速準確定位當事者所處位置對于降低事態損失和營救受傷者是極為重要的。歐美和日本等發達國家也都制定了相應的提高惡劣條件下高靈敏度定位能力的發展政策。而高靈敏度GPS接收機定位的關鍵在于GPS微弱信號的處理。 本課題的主要研究內容是針對GPS微弱信號改進處理方法。針對傳統GPS接收機信號捕獲中的串行搜索方法提出了基于批處理的微弱信號捕獲方法,來提高低信噪比情況下微弱信號的捕獲能力,實現快速高靈敏度的準確捕獲;針對捕獲微弱信號處理大量數據導致的運算量激增,運用雙塊零拓展(Double Block Zero Padding,DBZP)處理方法減少運算量同時縮短捕獲時間。針對傳統GPS接收機延遲鎖相環跟蹤算法提出了基于卡爾曼濾波的新型捕獲算法,減小延遲鎖相環失鎖造成的信號跟蹤丟失概率,來提高惡劣環境下低信噪比信號的跟蹤能力,實現微弱信號的連續可靠跟蹤。通過提高GPS微弱信號的捕獲與跟蹤能力,進而使GPS接收機在惡劣環境下衛星信號微弱時能夠實現較好的定位與導航。 通過擬合GPS接收機實際接收到的原始數據,構造出不同載噪比的數字信號,分別對提出的針對微弱信號的捕獲與跟蹤算法進行仿真比較驗證,結果表明,對接收機后端信號處理部分作出的算法改進使得GPS接收機可以更好的處理微弱信號,并且具有較高的靈敏度和精度。文章同時針對提出的數據處理特征使用FPGA技術對算法主要的數據處理部分進行了初步的構架實現并進行了板級驗證,結果表明,利用FPGA技術可以較好的實現算法的數據處理功能。文章最后給出了結論,通過提出的基于批處理和基于DBZP方法的捕獲算法以及基于卡爾曼濾波的信號跟蹤算法,可以有效地解決微弱GPS信號處理的難題,進而實現微弱信號環境下的定位與導航。

    標簽: FPGA GPS 信號實時處理

    上傳時間: 2013-04-24

    上傳用戶:變形金剛

  • QFN SMT工藝設計指導

    QFN SMT工藝設計指導.pdf 一、基本介紹 QFN(Quad Flat No Lead)是一種相對比較新的IC封裝形式,但由于其獨特的優勢,其應用得到了快速的增長。QFN是一種無引腳封裝,它有利于降低引腳間的自感應系數,在高頻領域的應用優勢明顯。QFN外觀呈正方形或矩形,大小接近于CSP,所以很薄很輕。元件底部具有與底面水平的焊端,在中央有一個大面積裸露焊端用來導熱,圍繞大焊端的外圍四周有實現電氣連接的I/O焊端,I/O焊端有兩種類型:一種只裸露出元件底部的一面,其它部分被封裝在元件內;另一種焊端有裸露在元件側面的部分。 QFN采用周邊引腳方式使PCB布線更靈活,中央裸露的銅焊端提供了良好的導熱性能和電性能。這些特點使QFN在某些對體積、重量、熱性能、電性能要求高的電子產品中得到了重用。 由于QFN是一種較新的IC封裝形式,IPC-SM-782等PCB設計指南上都未包含相關內容,本文可以幫助指導用戶進行QFN的焊盤設計和生產工藝設計。但需要說明的是本文只是提供一些基本知識供參考,用戶需要在實際生產中不斷積累經驗,優化焊盤設計和生產工藝設計方案,以取得令人滿意的焊接效果

    標簽: QFN SMT 工藝 設計指導

    上傳時間: 2013-04-24

    上傳用戶:吳之波123

  • DS18B20中文資料

    FEATURES  Unique 1-Wire interface requires only one port pin for communication  Multidrop capability simplifies distributed temperature sensing applications  Requires no external components  Can be powered from data line. Power supply range is 3.0V to 5.5V  Zero standby power required  Measures temperatures from -55°C to +125°C. Fahrenheit equivalent is -67°F to +257°F  ±0.5°C accuracy from -10°C to +85°C  Thermometer resolution is programmable from 9 to 12 bits  Converts 12-bit temperature to digital word in 750 ms (max.)  User-definable, nonvolatile temperature alarm settings  Alarm search command identifies and addresses devices whose temperature is outside of programmed limits (temperature alarm condition)  Applications include thermostatic controls, industrial systems, consumer products, thermometers, or any thermally sensitive system

    標簽: 18B B20 DS 18

    上傳時間: 2013-08-04

    上傳用戶:CHENKAI

  • 如何利用CPLD與單片機實現并行I/O接口的擴展

    ]本文介紹了如何利用CPLD(復雜可編程邏輯器件)與單片機的結合實現并行I/\r\nO(輸入/輸出)接口的擴展。該設計與用8255做并行I/O接口相比,與單片機軟件完全兼容,\r\n同時擁有速度快,功耗低,價格便宜,使用靈活等特點

    標簽: CPLD 如何利用 單片機 并行

    上傳時間: 2013-08-14

    上傳用戶:xa_lgy

  • 雙絞線和低通濾波器降低EMI_RFI

    Abstract: Alexander Graham Bell patented twisted pair wires in 1881. We still use them today because they work so well. In addition we have the advantage ofincredible computer power within our world. Circuit simulators and filter design programs are available for little or no cost. We combine the twisted pair and lowpassfilters to produce spectacular rejection of radio frequency interference (RFI) and electromagnetic interference (EMI). We also illustrate use of a precision resistorarray to produce a customizable differential amplifier. The precision resistors set the gain and common mode rejection ratios, while we choose the frequencyresponse.

    標簽: EMI_RFI 雙絞線 低通濾波器

    上傳時間: 2014-11-26

    上傳用戶:Vici

主站蜘蛛池模板: 石渠县| 普兰县| 江永县| 新田县| 郓城县| 通城县| 江达县| 韩城市| 漾濞| 库尔勒市| 塘沽区| 湖南省| 铁力市| 邹城市| 彭州市| 昌都县| 增城市| 手机| 宝清县| 包头市| 保定市| 临城县| 芜湖市| 孟州市| 略阳县| 辽阳县| 遵义市| 宣武区| 清水河县| 什邡市| 尚志市| 小金县| 宣威市| 武汉市| 自贡市| 黑山县| 巴彦县| 上思县| 洪洞县| 杨浦区| 织金县|