[DemoCode下载] 新唐NUC472系列FreeRTOS_lwIP_TCP_Client DemoCode

[复制链接]
 楼主| YWBIN 发表于 2015-8-28 14:40 | 显示全部楼层 |阅读模式
如下程序为在新唐NUC472系列上实现的FreeRTOS_lwIP_TCP_Client DemoCode,有需要的朋友可以参考下。
 楼主| YWBIN 发表于 2015-8-28 14:40 | 显示全部楼层
程序。

FreeRTOS_lwIP_TCP_Client.rar

1.21 MB, 下载次数: 188

huangcunxiake 发表于 2015-10-25 15:30 | 显示全部楼层
作为网络的终端设备使用的方法吗
643757107 发表于 2015-10-26 22:11 来自手机 | 显示全部楼层
FreeRTOS_lwIP_TCP_Client DemoCode,有需要的朋友可以参考
玛尼玛尼哄 发表于 2015-10-27 13:48 | 显示全部楼层
  1. /*
  2.     FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.

  3.     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT
  4.     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.

  5.     ***************************************************************************
  6.      *                                                                       *
  7.      *    FreeRTOS tutorial books are available in pdf and paperback.        *
  8.      *    Complete, revised, and edited pdf reference manuals are also       *
  9.      *    available.                                                         *
  10.      *                                                                       *
  11.      *    Purchasing FreeRTOS documentation will not only help you, by       *
  12.      *    ensuring you get running as quickly as possible and with an        *
  13.      *    in-depth knowledge of how to use FreeRTOS, it will also help       *
  14.      *    the FreeRTOS project to continue with its mission of providing     *
  15.      *    professional grade, cross platform, de facto standard solutions    *
  16.      *    for microcontrollers - completely free of charge!                  *
  17.      *                                                                       *
  18.      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
  19.      *                                                                       *
  20.      *    Thank you for using FreeRTOS, and thank you for your support!      *
  21.      *                                                                       *
  22.     ***************************************************************************


  23.     This file is part of the FreeRTOS distribution.

  24.     FreeRTOS is free software; you can redistribute it and/or modify it under
  25.     the terms of the GNU General Public License (version 2) as published by the
  26.     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.

  27.     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
  28.     distribute a combined work that includes FreeRTOS without being obliged to
  29.     provide the source code for proprietary components outside of the FreeRTOS
  30.     kernel.

  31.     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
  32.     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  33.     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  34.     details. You should have received a copy of the GNU General Public License
  35.     and the FreeRTOS license exception along with FreeRTOS; if not itcan be
  36.     viewed here: http://www.freertos.org/a00114.html and also obtained by
  37.     writing to Real Time Engineers Ltd., contact details for whom are available
  38.     on the FreeRTOS WEB site.

  39.     1 tab == 4 spaces!

  40.     ***************************************************************************
  41.      *                                                                       *
  42.      *    Having a problem?  Start by reading the FAQ "My application does   *
  43.      *    not run, what could be wrong?"                                     *
  44.      *                                                                       *
  45.      *    http://www.FreeRTOS.org/FAQHelp.html                               *
  46.      *                                                                       *
  47.     ***************************************************************************


  48.     http://www.FreeRTOS.org - Documentation, books, training, latest versions,
  49.     license and Real Time Engineers Ltd. contact details.

  50.     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  51.     including FreeRTOS+Trace - an indispensable productivity tool, and our new
  52.     fully thread aware and reentrant UDP/IP stack.

  53.     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
  54.     Integrity Systems, who sell the code with commercial support,
  55.     indemnification and middleware, under the OpenRTOS brand.

  56.     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
  57.     engineered and independently SIL3 certified version for use in safety and
  58.     mission critical applications that require provable dependability.
  59. */

  60. /******************************************************************************
  61. * >>>>>> NOTE 1: <<<<<<
  62. *
  63. * main() can be configured to create either a very simple LED flasher demo, or
  64. * a more comprehensive test/demo application.
  65. *
  66. * To create a very simple LED flasher example, set the
  67. * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY constant (defined below) to 1.  When
  68. * this is done, only the standard demo flash tasks are created.  The standard
  69. * demo flash example creates three tasks, each of which toggle an LED at a
  70. * fixed but different frequency.
  71. *
  72. * To create a more comprehensive test and demo application, set
  73. * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0.
  74. *
  75. * >>>>>> NOTE 2: <<<<<<
  76. *
  77. * In addition to the normal set of standard demo tasks, the comprehensive test
  78. * makes heavy use of the floating point unit, and forces floating point
  79. * instructions to be used from interrupts that nest three deep.  The nesting
  80. * starts from the tick hook function, resulting is an abnormally long context
  81. * switch time.  This is done purely to stress test the FPU context switching
  82. * implementation, and that part of the test can be removed by setting
  83. * configUSE_TICK_HOOK to 0 in FreeRTOSConfig.h.
  84. ******************************************************************************
  85. *
  86. * main() creates all the demo application tasks and software timers, then starts
  87. * the scheduler.  The web documentation provides more details of the standard
  88. * demo application tasks, which provide no particular functionality, but do
  89. * provide a good example of how to use the FreeRTOS API.
  90. *
  91. */

  92. /* A TCP echo server which is implemented with LwIP under FreeRTOS.
  93.    The server listen to port 80, IP address could configure statically
  94.    to 192.168.1.2 or assign by DHCP server. This server replies
  95.    "Hello World!!" if the received string is "nuvoton", otherwise
  96.     reply "Wrong Password!!" to its client. */

  97. #include <stdio.h>

  98. /* Kernel includes. */
  99. #include "FreeRTOS.h"
  100. #include "task.h"
  101. #include "timers.h"
  102. #include "semphr.h"

  103. /* Demo application includes. */
  104. #include "partest.h"
  105. #include "flash.h"
  106. #include "flop.h"
  107. #include "integer.h"
  108. #include "PollQ.h"
  109. #include "semtest.h"
  110. #include "dynamic.h"
  111. #include "BlockQ.h"
  112. #include "blocktim.h"
  113. #include "countsem.h"
  114. #include "GenQTest.h"
  115. #include "QueueSet.h"
  116. #include "recmutex.h"
  117. #include "death.h"

  118. /* Hardware and starter kit includes. */
  119. #include "NUC472_442.h"


  120. #include "lwip/api.h"
  121. #include "lwip/netif.h"
  122. #include "lwip/tcpip.h"
  123. #include "ethernetif.h"
  124. #include "tcp_client.h"

  125. /* Priorities for the demo application tasks. */
  126. #if 0
  127. #define mainFLASH_TASK_PRIORITY            ( tskIDLE_PRIORITY + 1UL )
  128. #define mainQUEUE_POLL_PRIORITY            ( tskIDLE_PRIORITY + 2UL )
  129. #define mainSEM_TEST_PRIORITY              ( tskIDLE_PRIORITY + 1UL )
  130. #define mainBLOCK_Q_PRIORITY               ( tskIDLE_PRIORITY + 2UL )
  131. #define mainCHECK_TASK_PRIORITY            ( tskIDLE_PRIORITY + 3UL )
  132. #else
  133. #define mainFLASH_TASK_PRIORITY            ( tskIDLE_PRIORITY + 1UL )
  134. #define mainQUEUE_POLL_PRIORITY            ( tskIDLE_PRIORITY + 1UL )
  135. #define mainSEM_TEST_PRIORITY              ( tskIDLE_PRIORITY + 1UL )
  136. #define mainCHECK_TASK_PRIORITY            ( tskIDLE_PRIORITY + 3UL )
  137. #endif

  138. #define mainCHECK_TASK_STACK_SIZE            ( configMINIMAL_STACK_SIZE )

  139. /* The time between cycles of the 'check' task. */
  140. #define mainCHECK_DELAY                        ( ( portTickType ) 5000 / portTICK_RATE_MS )

  141. /* The LED used by the check timer. */
  142. #define mainCHECK_LED                         ( 3UL )

  143. /* A block time of zero simply means "don't block". */
  144. #define mainDONT_BLOCK                        ( 0UL )

  145. /* The period after which the check timer will expire, in ms, provided no errors
  146. have been reported by any of the standard demo tasks.  ms are converted to the
  147. equivalent in ticks using the portTICK_RATE_MS constant. */
  148. #define mainCHECK_TIMER_PERIOD_MS            ( 3000UL / portTICK_RATE_MS )

  149. /* The period at which the check timer will expire, in ms, if an error has been
  150. reported in one of the standard demo tasks.  ms are converted to the equivalent
  151. in ticks using the portTICK_RATE_MS constant. */
  152. #define mainERROR_CHECK_TIMER_PERIOD_MS     ( 200UL / portTICK_RATE_MS )

  153. /* Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 1 to create a simple demo.
  154. Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0 to create a much more
  155. comprehensive test application.  See the comments at the top of this file, and
  156. the documentation page on the http://www.FreeRTOS.org web site for more
  157. information. */
  158. #define mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY        0

  159. #define CHECK_TEST
  160. //#define USE_DHCP

  161. #ifdef USE_DHCP
  162. #include "lwip/dhcp.h"
  163. #endif
  164. /*-----------------------------------------------------------*/

  165. /*
  166. * Set up the hardware ready to run this demo.
  167. */
  168. static void prvSetupHardware( void );
  169. /*-----------------------------------------------------------*/

  170. #ifdef CHECK_TEST
  171. static void vCheckTask( void *pvParameters );
  172. #endif

  173. unsigned char my_mac_addr[6] = {0x00, 0x00, 0x00, 0x55, 0x66, 0x77};
  174. struct netif netif;
  175. static void vWebTask( void *pvParameters );

  176. int main(void)
  177. {
  178.     /* Configure the hardware ready to run the test. */
  179.     prvSetupHardware();

  180.     xTaskCreate( vWebTask, ( signed portCHAR * ) "Web", TCPIP_THREAD_STACKSIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

  181. #ifdef CHECK_TEST
  182.     xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
  183. #endif

  184.     //vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
  185.     vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
  186.     vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
  187.     vStartGenericQueueTasks( tskIDLE_PRIORITY );
  188.     vStartQueueSetTasks();


  189.     printf("FreeRTOS is starting ...\n");

  190.     /* Start the scheduler. */
  191.     vTaskStartScheduler();

  192.     /* If all is well, the scheduler will now be running, and the following line
  193.     will never be reached.  If the following line does execute, then there was
  194.     insufficient FreeRTOS heap memory available for the idle and/or timer tasks
  195.     to be created.  See the memory management section on the FreeRTOS web site
  196.     for more details. */
  197.     for( ;; );
  198. }
  199. /*-----------------------------------------------------------*/

  200. static void prvSetupHardware( void )
  201. {
  202.     /* Unlock protected registers */
  203.     SYS_UnlockReg();

  204.     /* Enable External XTAL (4~24 MHz) */
  205.     CLK_EnableXtalRC(CLK_PWRCTL_HXTEN_Msk);

  206.     /* Waiting for 12MHz clock ready */
  207.     CLK_WaitClockReady( CLK_STATUS_HXTSTB_Msk);

  208.     /* Switch HCLK clock source to HXT */
  209.     CLK_SetHCLK(CLK_CLKSEL0_HCLKSEL_HXT,CLK_CLKDIV0_HCLK(1));

  210.     /* Set PLL to power down mode and PLL_STB bit in CLKSTATUS register will be cleared by hardware.*/
  211.     CLK->PLLCTL |= CLK_PLLCTL_PD_Msk;

  212.     /* Set PLL frequency */
  213.     CLK->PLLCTL = CLK_PLLCTL_84MHz_HXT;

  214.     /* Waiting for clock ready */
  215.     CLK_WaitClockReady(CLK_STATUS_PLLSTB_Msk);

  216.     /* Switch HCLK clock source to PLL */
  217.     CLK_SetHCLK(CLK_CLKSEL0_HCLKSEL_PLL,CLK_CLKDIV0_HCLK(1));

  218.     /* Enable IP clock */
  219.     CLK_EnableModuleClock(UART0_MODULE);
  220.     CLK_EnableModuleClock(EMAC_MODULE);

  221.     /* Select IP clock source */
  222.     CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UARTSEL_HXT, CLK_CLKDIV0_UART(1));

  223.     // Configure MDC clock rate to HCLK / (127 + 1) = 656 kHz if system is running at 84 MHz
  224.     CLK_SetModuleClock(EMAC_MODULE, 0, CLK_CLKDIV3_EMAC(127));

  225.     /* Update System Core Clock */
  226.     /* User can use SystemCoreClockUpdate() to calculate SystemCoreClock. */
  227.     SystemCoreClockUpdate();


  228.     /*---------------------------------------------------------------------------------------------------------*/
  229.     /* Init I/O Multi-function                                                                                 */
  230.     /*---------------------------------------------------------------------------------------------------------*/
  231.     /* Set GPG multi-function pins for UART0 RXD and TXD */
  232.     SYS->GPG_MFPL = SYS_GPG_MFPL_PG1MFP_UART0_RXD | SYS_GPG_MFPL_PG2MFP_UART0_TXD ;
  233.     // Configure RMII pins
  234.     SYS->GPC_MFPL = SYS_GPC_MFPL_PC0MFP_EMAC_REFCLK |
  235.                     SYS_GPC_MFPL_PC1MFP_EMAC_MII_RXERR |
  236.                     SYS_GPC_MFPL_PC2MFP_EMAC_MII_RXDV |
  237.                     SYS_GPC_MFPL_PC3MFP_EMAC_MII_RXD1 |
  238.                     SYS_GPC_MFPL_PC4MFP_EMAC_MII_RXD0 |
  239.                     SYS_GPC_MFPL_PC6MFP_EMAC_MII_TXD0 |
  240.                     SYS_GPC_MFPL_PC7MFP_EMAC_MII_TXD1;


  241.     SYS->GPC_MFPH = SYS_GPC_MFPH_PC8MFP_EMAC_MII_TXEN;
  242.     // Enable high slew rate on all RMII pins
  243.     PC->SLEWCTL |= 0x1DF;

  244.     // Configure MDC, MDIO at PB14 & PB15
  245.     SYS->GPB_MFPH = SYS_GPB_MFPH_PB14MFP_EMAC_MII_MDC | SYS_GPB_MFPH_PB15MFP_EMAC_MII_MDIO;

  246.     /* Lock protected registers */
  247.     SYS_LockReg();

  248.     /* Init UART to 115200-8n1 for print message */
  249.     UART_Open(UART0, 115200);
  250. }

  251. /*-----------------------------------------------------------*/

  252. void vApplicationMallocFailedHook( void )
  253. {
  254.     /* vApplicationMallocFailedHook() will only be called if
  255.     configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h.  It is a hook
  256.     function that will get called if a call to pvPortMalloc() fails.
  257.     pvPortMalloc() is called internally by the kernel whenever a task, queue,
  258.     timer or semaphore is created.  It is also called by various parts of the
  259.     demo application.  If heap_1.c or heap_2.c are used, then the size of the
  260.     heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
  261.     FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
  262.     to query the size of free heap space that remains (although it does not
  263.     provide information on how the remaining heap might be fragmented). */
  264.     taskDISABLE_INTERRUPTS();
  265.     for( ;; );
  266. }
  267. /*-----------------------------------------------------------*/

  268. void vApplicationIdleHook( void )
  269. {
  270.     /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
  271.     to 1 in FreeRTOSConfig.h.  It will be called on each iteration of the idle
  272.     task.  It is essential that code added to this hook function never attempts
  273.     to block in any way (for example, call xQueueReceive() with a block time
  274.     specified, or call vTaskDelay()).  If the application makes use of the
  275.     vTaskDelete() API function (as this demo application does) then it is also
  276.     important that vApplicationIdleHook() is permitted to return to its calling
  277.     function, because it is the responsibility of the idle task to clean up
  278.     memory allocated by the kernel to any task that has since been deleted. */
  279. }
  280. /*-----------------------------------------------------------*/

  281. void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
  282. {
  283.     ( void ) pcTaskName;
  284.     ( void ) pxTask;

  285.     /* Run time stack overflow checking is performed if
  286.     configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook
  287.     function is called if a stack overflow is detected. */
  288.     taskDISABLE_INTERRUPTS();
  289.     for( ;; );
  290. }
  291. /*-----------------------------------------------------------*/

  292. void vApplicationTickHook( void )
  293. {
  294.     /* This function will be called by each tick interrupt if
  295.     configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be
  296.     added here, but the tick hook is called from an interrupt context, so
  297.     code must not attempt to block, and only the interrupt safe FreeRTOS API
  298.     functions can be used (those that end in FromISR()).  */

  299. #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
  300.     {
  301.         /* In this case the tick hook is used as part of the queue set test. */
  302.         vQueueSetAccessQueueSetFromISR();
  303.     }
  304. #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
  305. }

  306. static void vWebTask( void *pvParameters )
  307. {
  308.     struct ip_addr ipaddr;
  309.     struct ip_addr netmask;
  310.     struct ip_addr gw;

  311.     IP4_ADDR(&gw, 192,168,1,1);
  312.     IP4_ADDR(&ipaddr, 192,168,1,2);
  313.     IP4_ADDR(&netmask, 255,255,255,0);

  314.     printf("Local IP:192.168.1.2\n");

  315.     tcpip_init(NULL, NULL);

  316.     netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input);

  317.     netif_set_default(&netif);
  318. #ifdef USE_DHCP
  319.     dhcp_start(&netif);
  320. #else
  321.     netif_set_up(&netif);
  322. #endif
  323.     //NVIC_SetPriority(EMAC_TX_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
  324.     NVIC_EnableIRQ(EMAC_TX_IRQn);
  325.     //NVIC_SetPriority(EMAC_RX_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
  326.     NVIC_EnableIRQ(EMAC_RX_IRQn);

  327.     tcp_client_init();

  328.     vTaskSuspend( NULL );

  329. }


  330. /*-----------------------------------------------------------*/
  331. #ifdef CHECK_TEST
  332. static void vCheckTask( void *pvParameters )
  333. {
  334.     portTickType xLastExecutionTime;

  335.     xLastExecutionTime = xTaskGetTickCount();

  336.     printf("Check Task is running ...\n");

  337.     for( ;; ) {
  338.         /* Perform this check every mainCHECK_DELAY milliseconds. */
  339.         vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY );
  340.         if( xArePollingQueuesStillRunning() != pdTRUE ) {
  341.             printf( "ERROR IN POLL Q\n" );
  342.         }
  343.     }
  344. }
  345. #endif


玛尼玛尼哄 发表于 2015-10-27 13:48 | 显示全部楼层


  1. /* Includes ------------------------------------------------------------------*/
  2. #include "lwip/opt.h"
  3. #include "lwip/arch.h"
  4. #include "lwip/api.h"
  5. #include "string.h"
  6. #include "tcp_client.h"


  7. /* Private typedef -----------------------------------------------------------*/
  8. /* Private define ------------------------------------------------------------*/
  9. #define TCP_CLIENT_THREAD_PRIO    ( tskIDLE_PRIORITY + 2UL )
  10. #define TCP_CLIENT_THREAD_STACKSIZE  200
  11. /* Private macro -------------------------------------------------------------*/
  12. /* Private variables ---------------------------------------------------------*/
  13. u32_t nPageHits = 0;


  14. /* Private function prototypes -----------------------------------------------*/
  15. /* Private functions ---------------------------------------------------------*/

  16. /**
  17.   * [url=home.php?mod=space&uid=247401]@brief[/url] serve tcp connection
  18.   * @param conn: pointer on connection structure
  19.   * @retval None
  20.   */
  21. void tcp_client_serve(struct netconn *conn)
  22. {
  23.     struct netbuf *inbuf;
  24.     char* buf;
  25.     u16_t buflen;

  26.     printf("Wait for TCP data       ...");

  27.     /* Read the data from the port, blocking if nothing yet there.
  28.      We assume the request (the part we care about) is in one netbuf */
  29.     netconn_recv(conn,&inbuf);

  30.     printf(" [OK] ...\n");
  31.     if (inbuf != NULL)
  32.                 {
  33.         if (netconn_err(conn) == ERR_OK)
  34.                                 {
  35.             netbuf_data(inbuf, (void**)&buf, &buflen);
  36.                                                 netconn_write(conn, (const unsigned char*)buf, (size_t)buflen, NETCONN_NOCOPY);
  37.         }
  38.     }

  39.     /* Delete the buffer (netconn_recv gives us ownership,
  40.      so we have to make sure to deallocate the buffer) */
  41.     netbuf_delete(inbuf);

  42.     printf(" [OK] ...\n");
  43. }


  44. /**
  45.   * @brief  tcp client thread
  46.   * @param arg: pointer on argument(not used here)
  47.   * @retval None
  48.   */
  49. static void tcp_client_thread(void *arg)
  50. {
  51.     struct netconn *conn;
  52.     err_t err;
  53.           
  54.           struct ip_addr ipaddr;

  55.     IP4_ADDR(&ipaddr, 192,168,1,3);

  56.     /* Create a new TCP connection handle */
  57.     conn = netconn_new(NETCONN_TCP);

  58.     if (conn!= NULL)
  59.                 {
  60.         /* Bind to port 80 (HTTP) with default IP address */
  61.         err = netconn_bind(conn, NULL, 80);
  62.                        

  63.         if (err == ERR_OK)
  64.                                 {
  65.                                           err = netconn_connect(conn, &ipaddr, 80);
  66.                                        
  67.                                           if(err == ERR_OK)
  68.                                                 {
  69.                                                     printf("Connect server succeed ! \n");
  70.                                                           netconn_write(conn, (const unsigned char*)"Hello server !", (size_t)strlen("Hello server !"), NETCONN_NOCOPY);
  71.                                                           
  72.                                                           while(1)
  73.                                                     {
  74.                     tcp_client_serve(conn);
  75.                 }
  76.                                                 }
  77.                                                 else
  78.                                                 {
  79.                                                     printf("Connect server fail ! \n");
  80.                                                 }
  81.         }
  82.                                 else
  83.                                 {
  84.             printf("can not bind netconn");
  85.         }
  86.     }
  87.                 else
  88.                 {
  89.         printf("can not create netconn");
  90.     }
  91. }

  92. /**
  93.   * @brief  Initialize the tcp client (start its thread)
  94.   * @param  none
  95.   * @retval None
  96.   */
  97. void tcp_client_init()
  98. {
  99.     sys_thread_new("TCPCLIENT", tcp_client_thread, NULL, TCP_CLIENT_THREAD_STACKSIZE, TCP_CLIENT_THREAD_PRIO);
  100. }


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

本版积分规则

21

主题

46

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部

21

主题

46

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部