udpcli.c
来自「mcf5307实验源代码」· C语言 代码 · 共 291 行 · 第 1/2 页
C
291 行
/*************************************************************************/
/* */
/* Copyright (c) 1993 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* UDPCLI.C PLUS 1.1 */
/* */
/* */
/* DESCRIPTION */
/* */
/* Example UDP program */
/* It sends data to a server and waits for a response, */
/* printing the response when received. */
/* */
/* */
/* AUTHOR */
/* */
/* Bill Haggerty, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* udp_client_task_ptr; Pointer to UDP client task */
/* control block. */
/* socketQueue; Pointer to socket queue */
/* control block. */
/* */
/* FUNCTIONS */
/* */
/* Application_Initialize Initialize Nucleus PLUS */
/* application environment */
/* UDP_client_task UDP client task */
/* */
/* DEPENDENCIES */
/* */
/* externs.h External definitions for functions in NCSA */
/* Telnet. */
/* nucleus.h contains system constants common to both the */
/* application and Nucleus PLUS components. */
/* socketd.h socket interface structures */
/* tcpdefs.h definitions for Nucleus - UDP program */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* B. Haggerty 06-25-1997 Created version 1.0 */
/* M. Phillips 07-14-1997 Created version 1.1 */
/* */
/*************************************************************************/
#include <string.h>
#ifdef MEMORY_DEBUG
#include "memdebug.h"
#endif
#include "externs.h"
#include "nucleus.h"
#include "socketd.h" /* socket interface structures */
#include "tcpdefs.h"
/* Define Application data structures. */
NU_MEMORY_POOL System_Memory;
NU_TASK udp_client_task_ptr;
/* Define prototypes for function references. */
void UDP_client_task(UNSIGNED argc, VOID *argv);
/* Define external referances to global variables */
#ifdef INTERRUPT
extern sint NU_Vect_Number;
#endif /* INTERRUPT */
/* Define the Application_Initialize routine that determines the initial
Nucleus PLUS application environment. */
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* Application_Initialize */
/* */
/* DESCRIPTION */
/* */
/* Define the Application_Initialize routine that determines the */
/* initial Nucleus PLUS application environment. */
/* */
/* AUTHOR */
/* */
/* Neil Henderson, Accelerated Technology, Inc. */
/* */
/* CALLS */
/* */
/* NU_Create_Memory_Pool Create dynamic memory pool */
/* NU_Allocate_Memory Allocate memory from memory pool */
/* NU_Create_Task Create an application task. */
/* NU_Create_Queue Create a message Queue */
/* NU_Create_Semaphore Create a counting Semaphore */
/* NU_Init_Net Set up Nucleus NET internal data */
/* structures and initialize network */
/* hardware. */
/* */
/* INPUTS */
/* */
/* first_available_memory Pointer to first available */
/* memory address */
/* */
/* OUTPUTS */
/* */
/* none */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* N. Henderson 06-28-1994 Created initial version 1.0 */
/* MQ Qian 09-05-1995 Modified for QUICC */
/* */
/*************************************************************************/
void Application_Initialize (void *first_available_memory)
{
VOID *pointer;
STATUS status;
/* Create a system memory pool that will be used to allocate task stacks,
queue areas, etc. */
status = NU_Create_Memory_Pool(&System_Memory, "SYSMEM",
first_available_memory, 400000, 50, NU_FIFO);
if (status != NU_SUCCESS)
while(1);
/* Create each task in the system. */
/* Create udp_client_task. */
status = NU_Allocate_Memory (&System_Memory, &pointer, 2000, NU_NO_SUSPEND);
if (status != NU_SUCCESS)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?