OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3975|回复: 3

移植在UCOSSIII系统的LWIP性能好差

[复制链接]

12

主题

51

帖子

0

精华

初级会员

Rank: 2

积分
125
金钱
125
注册时间
2015-6-7
在线时间
41 小时
发表于 2016-5-1 12:05:08 | 显示全部楼层 |阅读模式
1金钱
如标题所示,移植在UCOSSIII系统下的LWIP性能好差,非常不稳定。打开原则的实验网页,有时候图片显示不了,控制LED 蜂鸣器的时候要点击发送好几次才可以.不够在原子哥的UCOSSII的性能好。[mw_shl_code=c,true]/* * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
*    this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
*    this list of conditions and the following disclaimer in the documentation
*    and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
*    derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
/*  Porting by Michael Vysotsky <michaelvy@hotmail.com> August 2011   */

#define SYS_ARCH_GLOBALS

/* lwIP includes. */
#include "lwip/debug.h"
#include "lwip/def.h"
#include "lwip/lwip_sys.h"
#include "lwip/mem.h"
#include "includes.h"
#include "delay.h"
#include "arch/sys_arch.h"
#include "malloc.h"
#include "os_cfg_app.h"

/*----------------------------------------------------------------------------*/
/*                      DEFINITIONS                                           */
/*----------------------------------------------------------------------------*/
#define LWIP_ARCH_TICK_PER_MS       1000/OS_CFG_TICK_RATE_HZ



   

/*----------------------------------------------------------------------------*/
/*                      VARIABLES                                             */
/*----------------------------------------------------------------------------*/
static OS_MEM StackMem;  //存储分区控制块

const void * const pvNullPointer = (mem_ptr_t*)0xffffffff;

__align(4) CPU_STK       LwIP_Task_Stk[LWIP_TASK_MAX*LWIP_STK_SIZE];    //LWIP进程栈   8*256=2048     
__align(4) CPU_INT08U    LwIP_task_priopity_stask[LWIP_TASK_MAX];     //LWIP任务进程优先级 最大8个进程
OS_TCB        LwIP_task_TCB[LWIP_TASK_MAX];   //LWIP任务控制块 8      


/*----------------------------------------------------------------------------*/
/*                      PROTOTYPES                                            */
/*----------------------------------------------------------------------------*/
/*--------------------Creates an empty mailbox.-------------------------------*/
  

err_t sys_mbox_new( sys_mbox_t *mbox, int size)
{
  OS_ERR       ucErr;
      
  OSQCreate(mbox,"LWIP quiue", size, &ucErr);
  LWIP_ASSERT( "OSQCreate ", ucErr == OS_ERR_NONE );
  
  if( ucErr == OS_ERR_NONE){
    return 0;
  }
  return -1;
}

/*-----------------------------------------------------------------------------------*/
/*
  Deallocates a mailbox. If there are messages still present in the如果当邮箱被释放 仍有消息存在邮箱中
  mailbox when the mailbox is deallocated, it is an indication of a 将会有一个处理错误在LWIP中
  programming error in lwIP and the developer should be notified.  开发者应该注意
*/
void sys_mbox_free(sys_mbox_t * mbox)
{
    OS_ERR     ucErr;
    LWIP_ASSERT( "sys_mbox_free ", mbox != SYS_MBOX_NULL );      
        
    OSQFlush(mbox,& ucErr);
   
    OSQDel(mbox, OS_OPT_DEL_ALWAYS, &ucErr);
    LWIP_ASSERT( "OSQDel ", ucErr == OS_ERR_NONE );
}

/*-----------------------------------------------------------------------------------
*   Posts the "msg" to the mailbox.
*/
void sys_mbox_post(sys_mbox_t *mbox, void *msg)
{
  OS_ERR     ucErr;
  CPU_INT08U  i=0;
  if( msg == NULL ) msg = (void*)&pvNullPointer;
  /* try 10 times */
  while(i<10){
    OSQPost(mbox, msg,0,OS_OPT_POST_ALL,&ucErr);
    if(ucErr == OS_ERR_NONE)
      break;
    i++;
    OSTimeDly(5,OS_OPT_TIME_DLY,&ucErr);
  }
  LWIP_ASSERT( "sys_mbox_post error!\n", i !=10 );  
}

/* Try to post the "msg" to the mailbox. */
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
{
  OS_ERR     ucErr;
  if(msg == NULL ) msg = (void*)&pvNullPointer;  
  OSQPost(mbox, msg,0,OS_OPT_POST_ALL,&ucErr);   
  if(ucErr != OS_ERR_NONE){
    return ERR_MEM;
  }
  return ERR_OK;
}

/*-----------------------------------------------------------------------------------*/
/*
  Blocks the thread until a message arrives in the mailbox, but does
  not block the thread longer than "timeout" milliseconds (similar to
  the sys_arch_sem_wait() function). The "msg" argument is a result
  parameter that is set by the function (i.e., by doing "*msg =
  ptr"). The "msg" parameter maybe NULL to indicate that the message
  should be dropped.

  The return values are the same as for the sys_arch_sem_wait() function:
  Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a
  timeout.

  Note that a function with a similar name, sys_mbox_fetch(), is
  implemented by lwIP.    等待消息达到邮箱
*/
//等待邮箱中的消息
//*mbox:消息邮箱
//*msg:消息
//timeout:超时时间,如果timeout为0的话,就一直等待
//返回值:当timeout不为0时如果成功的话就返回等待的时间,
//                失败的话就返回超时SYS_ARCH_TIMEOUT
u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
{
  OS_ERR        ucErr;
  OS_MSG_SIZE   msg_size;
  CPU_TS        ucos_timeout;  
  CPU_TS        in_timeout = timeout/LWIP_ARCH_TICK_PER_MS;
  if(timeout && in_timeout == 0)
    in_timeout = 1;
  *msg  = OSQPend (mbox,                  //消息队列
                   in_timeout,            //等待时间
                   OS_OPT_PEND_BLOCKING,  //等待选项
                   &msg_size,             //消息大小
                   &ucos_timeout,         //获取时间戳
                   &ucErr);               //错误代码

  if ( ucErr == OS_ERR_TIMEOUT )
      ucos_timeout = SYS_ARCH_TIMEOUT;  
  return ucos_timeout;
}
/**
  * Check if an mbox is valid/allocated:       检查一个消息邮箱是否有效
  * @param sys_mbox_t *mbox pointer mail box
  * @return 1 for valid, 0 for invalid
  */
int sys_mbox_valid(sys_mbox_t *mbox)
{
  if(mbox->NamePtr)  
    return (strcmp(mbox->NamePtr,"?Q"))? 1:0;
  else
    return 0;
}
/**
  * Set an mbox invalid so that sys_mbox_valid returns 0
  */      
void sys_mbox_set_invalid(sys_mbox_t *mbox)
{
  if(sys_mbox_valid(mbox))
    sys_mbox_free(mbox);
}
/*   创建一个信号量
*  Creates and returns a new semaphore. The "count" argument specifies
*  the initial state of the semaphore. TBD finish and test
*/

err_t sys_sem_new(sys_sem_t * sem, u8_t count)
{  
  OS_ERR        ucErr;
  OSSemCreate (sem,"LWIP Sem",count,&ucErr);
  if(ucErr != OS_ERR_NONE ){
    LWIP_ASSERT("OSSemCreate ",ucErr == OS_ERR_NONE );
    return -1;   
  }
  return 0;
}
/*
  Blocks the thread while waiting for the semaphore to be
  signaled. If the "timeout" argument is non-zero, the thread should
  only be blocked for the specified time (measured in
  milliseconds).

  If the timeout argument is non-zero, the return value is the number of
  milliseconds spent waiting for the semaphore to be signaled. If the
  semaphore wasn't signaled within the specified time, the return value is
  SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore
  (i.e., it was already signaled), the function may return zero.

  Notice that lwIP implements a function with a similar name,
  sys_sem_wait(), that uses the sys_arch_sem_wait() function. 等待一个信号量
*/
u32_t
sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
{
  OS_ERR        ucErr;
  CPU_TS        ucos_timeout;
  CPU_TS        in_timeout = timeout/LWIP_ARCH_TICK_PER_MS;   //LWIP_ARCH_TICK_PER_MS=1000/OS_CFG_TICK_RATE_HZ=1
  if(timeout && in_timeout == 0)
    in_timeout = 1;  
  OSSemPend (sem,                      //信号量
             in_timeout,               //等待时间
             OS_OPT_PEND_BLOCKING,     //等待选项
             &ucos_timeout,            //获取时间戳
             &ucErr);                  //错误代码
    /*  only when timeout! */
  if(ucErr == OS_ERR_TIMEOUT)
      ucos_timeout = SYS_ARCH_TIMEOUT;       
  return ucos_timeout;
}

/*
*       Signals a semaphore     发送一个信号量
*/

void
sys_sem_signal(sys_sem_t *sem)
{
  OS_ERR        ucErr;  
  OSSemPost(sem,OS_OPT_POST_ALL,&ucErr);
  LWIP_ASSERT("OSSemPost ",ucErr == OS_ERR_NONE );  
}

/*
*      Deallocates a semaphore 释放一个信号量
*/
void
sys_sem_free(sys_sem_t *sem)
{
    OS_ERR     ucErr;
    OSSemDel(sem, OS_OPT_DEL_ALWAYS, &ucErr );
    LWIP_ASSERT( "OSSemDel ", ucErr == OS_ERR_NONE );
}
//查询一个信号量的状态,无效或有效
int sys_sem_valid(sys_sem_t *sem)
{
  if(sem->NamePtr)
    return (strcmp(sem->NamePtr,"?SEM"))? 1:0;
  else
    return 0;
}

/** Set a semaphore invalid so that sys_sem_valid returns 0 设置一个信号量无效*/
void sys_sem_set_invalid(sys_sem_t *sem)
{
  if(sys_sem_valid(sem))
    sys_sem_free(sem);
}
/*-----------------------------------------------------------------------------------*/
/*            memory interface                                                       */
/*-----------------------------------------------------------------------------------*/


/*
* Initialize sys arch
*/
void
sys_init(void)
{
  OS_ERR ucErr;
  memset(LwIP_task_priopity_stask,0,sizeof(LwIP_task_priopity_stask));
  /* init mem used by sys_mbox_t, use ucosII functions */
   //为LWIP创建8个任务(进程)
  OSMemCreate(&StackMem,            //存储控制块
              "LWIP TASK STK",      //存储块名字
              (void*)LwIP_Task_Stk, //存储区域的首地址
              LWIP_TASK_MAX,        //存储块的个数  8
              LWIP_STK_SIZE*sizeof(CPU_STK), //存储块的大小,4字节为一个单位   256*8=2048
             &ucErr);
  LWIP_ASSERT( "sys_init: failed OSMemCreate STK", ucErr == OS_ERR_NONE );
}



/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
// TBD
/*-----------------------------------------------------------------------------------*/
/* 此函数的功能是创建一个新的进程并启动进程
  Starts a new thread with priority "prio" that will begin its execution in the
  function "thread()". The "arg" argument will be passed as an argument to the
  thread() function. The id of the new thread is returned. Both the id and
  the priority are system dependent.
*/
sys_thread_t sys_thread_new(const char *name,       //进程名字                    "tcpip_thread"
                            lwip_thread_fn thread,  //进程任务                   tcpip_thread
                            void *arg,              //进程任务参数               NULL
                            int stacksize,          //进程任务堆栈大小           1024
                            int prio)               //进程任务优先级            
{
         int i;
          OS_ERR      ucErr;                 //返回的错误参数
    CPU_INT08U  ubPrio = LWIP_TASK_START_PRIO;    //3
   CPU_STK * task_stk ;    //任务堆栈
    int tsk_prio ;         //任务优先级
        arg = arg;
   
    if(prio){
      ubPrio +=(prio-1);
      for(i=0; i<LWIP_TASK_MAX; ++i)      //8        //第一次创建,任务优先级数组全为0
        if(LwIP_task_priopity_stask == ubPrio)
          break;
      if(i == LWIP_TASK_MAX){                          //当i= LWIP_TASK_MAX,1.代表没有找到相同的优先级的任务,2.设置的优先级超过范围了
        for(i=0; i<LWIP_TASK_MAX; ++i)
          if(LwIP_task_priopity_stask==0){
            LwIP_task_priopity_stask = ubPrio;          //设置其中一个任务优先级   LwIP_task_priopity_stask[0]=3
            break;
          }
        if(i == LWIP_TASK_MAX){                             //优先级满了
          LWIP_ASSERT( "sys_thread_new: there is no space for priority", 0 );
          return (-1);
        }        
      }else
        prio = 0;
    }
  /* Search for a suitable priority 寻找一个合适的优先级*/     
    if(!prio){
      ubPrio = LWIP_TASK_START_PRIO;       //从开始的第一个优先级开始查找,找到最后一个优先级 3~11
      while(ubPrio < (LWIP_TASK_START_PRIO+LWIP_TASK_MAX)){   //3<11
        for(i=0; i<LWIP_TASK_MAX; ++i)
          if(LwIP_task_priopity_stask == ubPrio){     //如果此时想设置的优先级已经存在,加1,继续判断下一个是否存在
            ++ubPrio;
            break;
          }                                         //不等于对比下一个
        if(i == LWIP_TASK_MAX)
          break;
      }
      if(ubPrio < (LWIP_TASK_START_PRIO+LWIP_TASK_MAX))
        for(i=0; i<LWIP_TASK_MAX; ++i)
          if(LwIP_task_priopity_stask==0){
            LwIP_task_priopity_stask = ubPrio;
            break;
          }
      if(ubPrio >= (LWIP_TASK_START_PRIO+LWIP_TASK_MAX) || i == LWIP_TASK_MAX){
        LWIP_ASSERT( "sys_thread_new: there is no free priority", 0 );
        return (-1);
      }
    }
    if(stacksize > LWIP_STK_SIZE || !stacksize)   
        stacksize = LWIP_STK_SIZE;
  /* get Stack from pool */
   // CPU_STK * task_stk = OSMemGet( &StackMem, &ucErr );
                task_stk = OSMemGet( &StackMem, &ucErr );
    if(ucErr != OS_ERR_NONE){
      LWIP_ASSERT( "sys_thread_new: impossible to get a stack", 0 );
      return (-1);
    }
    //int
                tsk_prio = ubPrio-LWIP_TASK_START_PRIO;
    OSTaskCreate(&LwIP_task_TCB[tsk_prio],
                 (CPU_CHAR  *)name,
                 (OS_TASK_PTR)thread,
                 (void      *)0,
                 (OS_PRIO    )ubPrio,
                 (CPU_STK   *)&task_stk[0],
                 (CPU_STK    )(stacksize/10),
                 (CPU_STK_SIZE)stacksize,
                 (OS_MSG_QTY )0,
                 (OS_TICK    )0,
                 (void      *)0,
                 (OS_OPT     )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR    *)&ucErr);   
   
    return ubPrio;
}
/**
* Sleep for some ms. Timeouts are NOT processed while sleeping.
*
* @param ms number of milliseconds to sleep
*/
void sys_msleep(u32_t ms)
{
        delay_ms(ms);
}
//获取系统时间,LWIP1.4.1增加的函数
//返回值:当前系统时间(单位:毫秒)
u32_t sys_now(void)
{
        OS_TICK os_tick_ctr;
        CPU_SR_ALLOC();

        CPU_CRITICAL_ENTER();
        os_tick_ctr = OSTickCtr;
        CPU_CRITICAL_EXIT();

        return os_tick_ctr;
}

/*
  This optional function does a "fast" critical region protection and returns
  the previous protection level. This function is only called during very short
  critical regions. An embedded system which supports ISR-based drivers might
  want to implement this function by disabling interrupts. Task-based systems
  might want to implement this by using a mutex or disabling tasking. This
  function should support recursive calls from the same task or interrupt. In
  other words, sys_arch_protect() could be called while already protected. In
  that case the return value indicates that it is already protected.

  sys_arch_protect() is only required if your port is supporting an operating
  system.
*/
sys_prot_t sys_arch_protect(void)
{
        CPU_SR_ALLOC();

        CPU_CRITICAL_ENTER();
        return 1;
}
/*
  This optional function does a "fast" set of critical region protection to the
  value specified by pval. See the documentation for sys_arch_protect() for
  more information. This function is only required if your port is supporting
  an operating system.
*/
void sys_arch_unprotect(sys_prot_t pval)
{
        CPU_SR_ALLOC();

        LWIP_UNUSED_ARG(pval);
        CPU_CRITICAL_EXIT();
}
                                                  
[/mw_shl_code]

上面是sys_arch.c文件[mw_shl_code=c,true]#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
#include <includes.h>

//线程优先级
#ifndef TCPIP_THREAD_PRIO
#define TCPIP_THREAD_PRIO                        2        //定义内核任务的优先级为5 【已修改:原来为1】
#endif
#undef  DEFAULT_THREAD_PRIO
#define DEFAULT_THREAD_PRIO                        2


/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory
* allocation and deallocation.  如果你想inter-task保护某些关键区域在缓冲区分配、回收和内存分配和重分配
*/
#define SYS_LIGHTWEIGHT_PROT    1       //为1时使用实时操作系统的轻量级保护,保护关键代码不被中断打断   【原为0】

/**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities.
*/
#define NO_SYS                  0

/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
   byte alignment -> define MEM_ALIGNMENT to 2. */

#define MEM_ALIGNMENT           4            //字节对齐


/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */   

#define MEM_SIZE                (16000) //【已修改:原为1024】

/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
   sends a lot of data out of ROM (or other static memory), this
   should be set high. */
                //原为10
#define MEMP_NUM_PBUF           100   //MEMP_NUM_PBUF:memp结构的pbuf数量,如果应用从ROM或者静态存储区发送大量数据时,这个值应该设置大一点
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
   per active UDP "connection". */

#define MEMP_NUM_UDP_PCB        6
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
   connections. */

#define MEMP_NUM_TCP_PCB        10
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
   connections. */

#define MEMP_NUM_TCP_PCB_LISTEN 6
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
   segments. */

#define MEMP_NUM_TCP_SEG        15
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
   timeouts. */

#define MEMP_NUM_SYS_TIMEOUT    8


/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */

#define PBUF_POOL_SIZE          20      //PBUF_POOL_SIZE:pbuf内存池个数 原为10

/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */

#define PBUF_POOL_BUFSIZE       1500 /* LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN) */


/* ---------- TCP options ---------- */
#define LWIP_TCP                1      
#define TCP_TTL                 255


#define TCPIP_THREAD_STACKSIZE                  1024

/* Controls if TCP should queue segments that arrive out of
   order. Define to 0 if your device is low on memory. */
#undef TCP_QUEUE_OOSEQ
#define TCP_QUEUE_OOSEQ         0       //当TCP的数据段超出队列时的控制位,当设备的内存过小的时候此项应为0

/**
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
* The queue size value itself is platform-dependent, but is passed to
* sys_mbox_new() when tcpip_init is called.
*/
#undef TCPIP_MBOX_SIZE
#define TCPIP_MBOX_SIZE         MAX_QUEUE_ENTRIES

/**
* DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
* NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
* to sys_mbox_new() when the recvmbox is created.
*/
#undef DEFAULT_TCP_RECVMBOX_SIZE
#define DEFAULT_TCP_RECVMBOX_SIZE       MAX_QUEUE_ENTRIES


/**
* DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
* The queue size value itself is platform-dependent, but is passed to
* sys_mbox_new() when the acceptmbox is created.
*/
#undef DEFAULT_ACCEPTMBOX_SIZE
#define DEFAULT_ACCEPTMBOX_SIZE         MAX_QUEUE_ENTRIES

/* TCP Maximum segment size. */

#define TCP_MSS                 (1500 - 40)          /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */

/* TCP sender buffer space (bytes). */

#define TCP_SND_BUF             (4*TCP_MSS)

/* TCP sender buffer space (pbufs). This must be at least = 2 *
   TCP_SND_BUF/TCP_MSS for things to work. */

#define TCP_SND_QUEUELEN        (2 * TCP_SND_BUF)/TCP_MSS

/* TCP receive window. */

#define TCP_WND                 (2*TCP_MSS)


/* ---------- ICMP options ---------- */
#define LWIP_ICMP                       1


/* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
   interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
   turning this on does currently not work. */
#define LWIP_DHCP               0


/* ---------- UDP options ---------- */
#define LWIP_UDP                1      
#define UDP_TTL                 255     
//#define DEFAULT_UDP_RECVMBOX_SIZE       MAX_QUEUE_ENTRIES

///* -----------RAW options -----------*/         
//#define DEFAULT_RAW_RECVMBOX_SIZE       MAX_QUEUE_ENTRIES
//#define DEFAULT_ACCEPTMBOX_SIZE         MAX_QUEUE_ENTRIES

/* ---------- Statistics options ---------- */     
#define LWIP_STATS 0
#define LWIP_PROVIDE_ERRNO 1


/*
   --------------------------------------
   ---------- Checksum options ----------
   --------------------------------------
*/

/*
The STM32F107 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
- To use this feature let the following define uncommented.
- To disable it and process by CPU comment the  the checksum.
*/
#define CHECKSUM_BY_HARDWARE


#ifdef CHECKSUM_BY_HARDWARE
  /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/         
  #define CHECKSUM_GEN_IP                 0
  /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/     
  #define CHECKSUM_GEN_UDP                0
  /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  #define CHECKSUM_GEN_TCP                0
  /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/            
  #define CHECKSUM_CHECK_IP               0
  /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/         
  #define CHECKSUM_CHECK_UDP              0
  /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/      
  #define CHECKSUM_CHECK_TCP              0
#else
  /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  #define CHECKSUM_GEN_IP                 1
  /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  #define CHECKSUM_GEN_UDP                1
  /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  #define CHECKSUM_GEN_TCP                1
  /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  #define CHECKSUM_CHECK_IP               1
  /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  #define CHECKSUM_CHECK_UDP              1
  /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  #define CHECKSUM_CHECK_TCP              1
#endif


/*
   ----------------------------------------------
   ---------- Sequential layer options ----------
   ----------------------------------------------
*/
/**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/
#define LWIP_NETCONN                    1
/*
   ------------------------------------
   ---------- Socket options ----------
   ------------------------------------
*/
/**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/
#define LWIP_SOCKET                     1

#define LWIP_COMPAT_MUTEX               1

#define LWIP_SO_RCVTIMEO                1  //通过定义LWIP_SO_RCVTIMEO使能netconn结构体中recv_timeout,使用recv_timeout可以避免阻塞线程
#endif /* __LWIPOPTS_H__ */

//LWIP调试选项
#define LWIP_DEBUG                             0         //关闭DEBUG选项
#define ICMP_DEBUG                      LWIP_DBG_OFF //开启/关闭ICMPdebug
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

[/mw_shl_code]上面是配置文件的内容

哪位大哥帮忙看看,是哪里问题?或者是怎样配置才能达到最佳性能

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

12

主题

51

帖子

0

精华

初级会员

Rank: 2

积分
125
金钱
125
注册时间
2015-6-7
在线时间
41 小时
 楼主| 发表于 2016-5-1 12:05:53 | 显示全部楼层
上面有个地方写错了,是"打开原子的实验网页"
回复

使用道具 举报

88

主题

7377

帖子

5

精华

资深版主

Rank: 8Rank: 8

积分
14980
金钱
14980
注册时间
2013-11-13
在线时间
1823 小时
发表于 2016-5-1 12:13:05 | 显示全部楼层
UCOSIII我们也移植过,但是出现不稳定等原因,本来说是要修改的,但是一直忙也就给耽误了,后面找个时间移植一下UCOSIII+LWIP的
开往春天的手扶拖拉机
回复

使用道具 举报

12

主题

51

帖子

0

精华

初级会员

Rank: 2

积分
125
金钱
125
注册时间
2015-6-7
在线时间
41 小时
 楼主| 发表于 2016-5-8 23:23:12 | 显示全部楼层
zuozhongkai 发表于 2016-5-1 12:13
UCOSIII我们也移植过,但是出现不稳定等原因,本来说是要修改的,但是一直忙也就给耽误了,后面找个时间移 ...

忠哥,什么时候移植啊?我自己弄的很不稳定啊......找不到原因,lwip的配置已经按照你们的基于UCOSII跑的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-24 22:13

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表