⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.c

📁 世纪民生公司的带网络功能的单片机CS6209开发POP3服务器演示源代码。
💻 C
字号:
/*
 * 
 * config.c
 * 
 * Part of the Myson Century CS620X	demo program.
 *
 * Authors: LY Lin, WM Wang, IJ Chen, WH Lee
 *
 * config.c contains the configuration of CS620X ethernet.
 *
 * This	program	was developed using the Keil 8051 C uVision 2 system.
 * The Keil compiler MUST be used if working with Myson Century supplied
 * firmware.
 *
 * This	program	must be linked with the 620xlib.LIB library 
 * supplied	by Myson Century in object module form.  
 * 
 */

#include "hpserver.h"
#include "620xenet.h"
#include "timer.h"
#include "ether.h"
#include "netutil.h"
#include "net.h"
#include "ip.h"
#include "tcp.h"
#include "config.h"

/* Ethernet MAC address*/
xdata BYTE my_mac_addr[6] = {0x00,0xC0,0xB4,0x83,0xf0,0xff};

/* Static IP address*/
xdata BYTE my_ip_addr[] = "172.16.200.201";

/* IP address Mask*/
xdata BYTE my_ip_mask[] = "255.255.255.0";

/* Gateway IP address */
xdata BYTE my_gateway_addr[] = "172.16.200.254";

/* 
 Device driver buffer (Ethernet, serial port)
 set the NIC receive buffer to the size of (RXSTOP-RXSTART) number of pages
 and each page is 256 bytes.  This buffer has to be on a 256-byte boundary.
*/
xdata unsigned char nic_rcv_buf [(RXSTOP-RXSTART)*256] _at_ RXSTART00;

/* Set the NIC xmit buffer.  This buffer has to be on a 256 byte boundary.*/
xdata unsigned char nic_xmit_buf [3072/*MAXFRAMEC*/] _at_ RXSTOP00;

#ifndef UDP_ONLY
/* The Socket structures are defined here.
 NSOCKS is the number of sockets defined in config.h*/
TSOCK tsocks[NSOCKS]; 

/*

 ** Total buffer space for Socket TRANSMIT buffers **

 _CBUFFLEN_ is defined in netutil.h, and it defines the socket 
 txb or rxb circular buffer size.  Actually this size can be different 
 for each socket.  In the following we allocat socket transmit buffers 
 with the assumption that txb buffer size for all sockets are the same.
 
 If you assign different size txb buffers to sockets, you have to change
 the txb buffer space allocation, and at initialization you have to 
 link the buffers to each socket individually.

 Because of the design of the circular buffer handling routines, You have 
 to make sure the size of the buffer is a power of 2.  The recommended
 minimum circular buffer size is 2K (2048) bytes.

*/

BYTE tsock_txb [NSOCKS*_CBUFFLEN_];

/*

 ** Total buffer space for Socket RECEIVE buffers **

 Each socket can have a recevie circular buffer assigned or not.
 If a receive circular buffer is assigned, the TCP will write the 
 received data in the socket receive buffer first.  If not, the data
 is routed to the application directly.

 Depending on your application requirement, you can decide whether to use
 a reveive buffer for a socket or not.  For application sending requests
 in one TCP segment, it is sensible to forgo the socket receive buffer 
 to save data space.  For applications sending one logical data record in 
 several TCP segments, it might be easier to have the TCP assemble the 
 segments in the socket receive buffer.

 The data memory space is limited.  If the buffer space allocated
 for the sockets takes up too much space, that means the number of
 sockets that can be supported is less.  You have to make the design
 trade-off as to whether you need a receive buffer for each socket, or
 you need to support more sockets.

 For an example, let us say your design allocates a total of 12K bytes
 for socket buffer storage.  Each socket transmit buffer takes 2K, 
 and each receive buffer takes 2K.  So each socket takes 4K buffer space.
 This means you can support 3 sockets in total.  If you do not use the 
 socket receive buffer, the buffer space taken up by one socket (only the 
 transmit buffer) is 2K, and that means you can support 6 sockets.

 For each socket, you have the freedom to choose whether to use the 
 receive buffer or not.  If you decice to use the reveive buffer, the
 sizeof the buffer can be different for each socket too.  You specify the
 size of the buffer at initialization time.

 If you do not use the socket receive buffer, or you only use the socket
 receive buffer for some of the sockets, then you have to modify the 
 following line.
*/
#if (!NO_SOCKET_RXB)
BYTE tsock_rxb [NSOCKS*_CBUFFLEN_];
#endif
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -