probe_tcpip_os.c
来自「嵌入式的tcpip协议栈」· C语言 代码 · 共 176 行
C
176 行
/*
*********************************************************************************************************
* uC/Probe Communication
*
* (c) Copyright 2007; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
* 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.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/Probe
*
* Communication: TCP-IP
*
* Filename : probe_tcpip_os.c
* Version : V1.40
* Programmer(s) : FBJ
* Note(s) : (1) This file is the uC/OS-II layer for the uC/Probe RS-232 Communication Module.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <includes.h>
#if (PROBE_COM_METHOD_TCPIP > 0)
/*
*********************************************************************************************************
* LOCAL DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL CONSTANTS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL TABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
static OS_STK ProbeTCPIP_OS_TaskStk[PROBE_TCPIP_TASK_STK_SIZE]; /* Stack for Probe TCPIP task. */
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static void ProbeTCPIP_OS_Task(void *p_arg); /* Server task: wait for clients to connect. */
/*
*********************************************************************************************************
*********************************************************************************************************
** GLOBAL FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* ProbeTCPIP_OS_Init()
*
* Description : Initialize the UDP server task for Probe communication.
*
* Argument(s) : none.
*
* Return(s) : none.
*********************************************************************************************************
*/
void ProbeTCPIP_OS_Init (void)
{
CPU_INT08U err;
#if (OS_TASK_CREATE_EXT_EN > 0)
#if (OS_STK_GROWTH == 1)
err = OSTaskCreateExt( ProbeTCPIP_OS_Task,
(void *)0,
&ProbeTCPIP_OS_TaskStk[PROBE_TCPIP_TASK_STK_SIZE - 1], /* Set Top-Of-Stack. */
PROBE_TCPIP_TASK_PRIO,
PROBE_TCPIP_TASK_PRIO,
&ProbeTCPIP_OS_TaskStk[0], /* Set Bottom-Of-Stack. */
PROBE_TCPIP_TASK_STK_SIZE,
(void *)0, /* No TCB extension. */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear stack. */
#else
err = OSTaskCreateExt( ProbeTCPIP_OS_Task,
(void *)0,
&ProbeTCPIP_OS_TaskStk[0], /* Set Top-Of-Stack. */
PROBE_TCPIP_TASK_PRIO,
PROBE_TCPIP_TASK_PRIO,
&ProbeTCPIP_OS_TaskStk[PROBE_TCPIP_TASK_STK_SIZE - 1], /* Set Bottom-Of-Stack. */
PROBE_TCPIP_TASK_STK_SIZE,
(void *)0, /* No TCB extension. */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear stack. */
#endif
#else
#if (OS_STK_GROWTH == 1)
err = OSTaskCreate( ProbeTCPIP_OS_Task,
(void *)0,
&ProbeTCPIP_OS_TaskStk[PROBE_TCPIP_TASK_STK_SIZE - 1],
PROBE_TCPIP_TASK_PRIO);
#else
err = OSTaskCreate( ProbeTCPIP_OS_Task,
(void *)0,
&ProbeTCPIP_OS_TaskStk[0],
PROBE_TCPIP_TASK_PRIO);
#endif
#endif
#if (OS_TASK_NAME_SIZE >= 13)
OSTaskNameSet(PROBE_TCPIP_TASK_PRIO, (CPU_INT08U *)"Probe TCPIP", &err);
#endif
}
/*
*********************************************************************************************************
*********************************************************************************************************
** LOCAL FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* ProbeTCPIP_OS_Task()
*
* Description : Receives and transmits packets.
*
* Argument(s) : p_arg Argument passed to ProbeTCPIP_OS_Task() by 'OSTaskCreate()'.
*
* Return(s) : none.
*********************************************************************************************************
*/
static void ProbeTCPIP_OS_Task (void *p_arg)
{
ProbeTCPIP_Task(p_arg); /* Call Probe TCPIP server task body. */
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?