/[H8]/trunk/docs/Microchip TCP_IP stack/TCPIP Stack/UDPPerformanceTest.c
ViewVC logotype

Contents of /trunk/docs/Microchip TCP_IP stack/TCPIP Stack/UDPPerformanceTest.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Thu Apr 19 09:01:15 2007 UTC (17 years, 2 months ago) by hedin
File MIME type: text/plain
File size: 4977 byte(s)
added the TCP/IP stack, source code.
1 /*********************************************************************
2 *
3 * UDP Performance Test
4 * Module for Microchip TCP/IP Stack
5 * -Sends out dummy packets from ROM memory
6 * -Reference: None. This is for testing only.
7 *
8 *********************************************************************
9 * FileName: UDPPerformanceTest.c
10 * Dependencies: TCPIP.h
11 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
12 * Complier: Microchip C18 v3.02 or higher
13 * Microchip C30 v2.01 or higher
14 * Company: Microchip Technology, Inc.
15 *
16 * Software License Agreement
17 *
18 * Copyright © 2002-2007 Microchip Technology Inc. All rights
19 * reserved.
20 *
21 * Microchip licenses to you the right to use, modify, copy, and
22 * distribute:
23 * (i) the Software when embedded on a Microchip microcontroller or
24 * digital signal controller product (“Device”) which is
25 * integrated into Licensee’s product; or
26 * (ii) ONLY the Software driver source files ENC28J60.c and
27 * ENC28J60.h ported to a non-Microchip device used in
28 * conjunction with a Microchip ethernet controller for the
29 * sole purpose of interfacing with the ethernet controller.
30 *
31 * You should refer to the license agreement accompanying this
32 * Software for additional information regarding your rights and
33 * obligations.
34 *
35 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
36 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
37 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
38 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
40 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
41 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
42 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
43 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
44 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
45 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
46 *
47 *
48 * Author Date Comment
49 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50 * Howard Schlunder 01/29/07 Original
51 ********************************************************************/
52 #define __UDPPERFORMANCETEST_C
53
54 #include "TCPIP Stack/TCPIP.h"
55 #if defined(STACK_USE_UDP_PERFORMANCE_TEST)
56
57 #define PERFORMANCE_PORT 12345
58
59
60 /*********************************************************************
61 * Function: void UDPPerformanceTask(void)
62 *
63 * PreCondition: Stack is initialized()
64 *
65 * Input: None
66 *
67 * Output: None
68 *
69 * Side Effects: None
70 *
71 * Overview: Opens a UDP socket, transmits a big packet, closes UDP scoket
72 *
73 * Note: None
74 ********************************************************************/
75 void UDPPerformanceTask(void)
76 {
77 UDP_SOCKET MySocket;
78 NODE_INFO Remote;
79 WORD wTemp;
80
81 // Set the socket's destination to be a broadcast over our IP
82 // subnet
83 // Set the MAC destination to be a broadcast
84 memset(&Remote, 0xFF, sizeof(Remote));
85
86 // Open a UDP socket for outbound transmission
87 MySocket = UDPOpen(0, &Remote, PERFORMANCE_PORT);
88
89 // Abort operation if no UDP sockets are available
90 // If this ever happens, incrementing MAX_UDP_SOCKETS in
91 // StackTsk.h may help (at the expense of more global memory
92 // resources).
93 if(MySocket == INVALID_UDP_SOCKET)
94 return;
95
96 // Make certain the socket can be written to
97 if(!UDPIsPutReady(MySocket))
98 {
99 UDPClose(MySocket);
100 return;
101 }
102
103 wTemp = UDPPutROMArray((ROM BYTE*)
104 "The quick brown fox tried to jump over the yellow dog. Unfortunately, the yellow dog stood up while the fox was in mid-jump. As a result, the two collided. Then, the dog, being the omnivore that it is, ate the quick brown fox. This line is 256 bytes.\r\n"
105 "The quick brown fox tried to jump over the yellow dog. Unfortunately, the yellow dog stood up while the fox was in mid-jump. As a result, the two collided. Then, the dog, being the omnivore that it is, ate the quick brown fox. This line is 256 bytes.\r\n"
106 "The quick brown fox tried to jump over the yellow dog. Unfortunately, the yellow dog stood up while the fox was in mid-jump. As a result, the two collided. Then, the dog, being the omnivore that it is, ate the quick brown fox. This line is 256 bytes.\r\n"
107 "The quick brown fox tried to jump over the yellow dog. Unfortunately, the yellow dog stood up while the fox was in mid-jump. As a result, the two collided. Then, the dog, being the omnivore that it is, ate the quick brown fox. This line is 256 bytes.\r\n", 1024);
108
109 // Send the packet
110 UDPFlush();
111
112 // Close the socket so it can be used by other modules
113 UDPClose(MySocket);
114 }
115
116 #endif //#if defined(STACK_USE_UDP_PERFORMANCE_TEST)

  ViewVC Help
Powered by ViewVC 1.1.20