📄 net_api.h
字号:
#ifndef NET_API_H
#define NET_API_H
/************************************************************************
*
* NET_api.h
*
* The 'NET_api' module defines the NET subsystem
* interface.
*
*
* ######################################################################
*
* Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved.
*
* Unpublished rights reserved under the Copyright Laws of the United States of
* America.
*
* This document contains information that is proprietary to MIPS Technologies,
* Inc. ("MIPS Technologies"). Any copying, modifying or use of this information
* (in whole or in part) which is not expressly permitted in writing by MIPS
* Technologies or a contractually-authorized third party is strictly
* prohibited. At a minimum, this information is protected under unfair
* competition laws and the expression of the information contained herein is
* protected under federal copyright laws. Violations thereof may result in
* criminal penalties and fines.
* MIPS Technologies or any contractually-authorized third party reserves the
* right to change the information contained in this document to improve
* function, design or otherwise. MIPS Technologies does not assume any
* liability arising out of the application or use of this information. Any
* license under patent rights or any other intellectual property rights owned
* by MIPS Technologies or third parties shall be conveyed by MIPS Technologies
* or any contractually-authorized third party in a separate license agreement
* between the parties.
* The information contained in this document constitutes one or more of the
* following: commercial computer software, commercial computer software
* documentation or other commercial items. If the user of this information, or
* any related documentation of any kind, including related technical data or
* manuals, is an agency, department, or other entity of the United States
* government ("Government"), the use, duplication, reproduction, release,
* modification, disclosure, or transfer of this information, or any related
* documentation of any kind, is restricted in accordance with Federal
* Acquisition Regulation 12.212 for civilian agencies and Defense Federal
* Acquisition Regulation Supplement 227.7202 for military agencies. The use of
* this information by the Government is further restricted in accordance with
* the terms of the license agreement(s) and/or applicable contract terms and
* conditions covering this information from MIPS Technologies or any
* contractually-authorized third party.
*
************************************************************************/
/************************************************************************
* Include files
************************************************************************/
#include <sysdefs.h>
#include <syserror.h>
/************************************************************************
* NET, ERROR completion codes
*************************************************************************/
typedef enum NET_error_ids
{
ERROR_NET_ARP_TIME_OUT /* 00 No ARP response */
= ERROR_NET,
ERROR_NET_NO_RESOURCES, /* 01 No available buffers or links */
ERROR_NET_INVALID_HOST_IP, /* 02 Host IP-address is not valid */
ERROR_NET_INVALID_BOARD_IP, /* 03 Board IP-address is not valid */
ERROR_NET_TFTP_ERROR, /* 04 TFTP time out or ERROR */
ERROR_NET_TFTP_READ_ERROR, /* 05 TFTP READ-REQ ERROR */
ERROR_NET_TFTP_READ_TIMEOUT_ERROR, /* 06 TFTP READ-REQ timeout ERROR */
ERROR_NET_TFTP_WRITE_ERROR, /* 07 TFTP WRITE-REQ ERROR */
ERROR_NET_TFTP_WRITE_TIMEOUT_ERROR, /* 08 TFTP WRITE-REQ timeout ERROR */
ERROR_NET_TFTP_DATA_ERROR, /* 09 TFTP DATA ERROR */
ERROR_NET_TFTP_DATA_TIMEOUT_ERROR, /* 0A TFTP DATA timeout ERROR */
ERROR_NET_USER_BREAK, /* 0B User made ctrl C */
ERROR_NET_INVALID_GATEWAY_IP, /* 0C Gateway IP-address is not set */
ERROR_NET_NOT_ON_SAME_SUBNET_IP, /* 0D Our IP & GW not on same subnet*/
ERROR_NET_UNKNOWN_GATEWAY_IP, /* 0E ARP timeout on Gateway IP */
ERROR_NET_TFTP_FILE_TOO_BIG, /* 0F TFTP File bigger than 32 MB */
ERROR_NET_INVALID_SUBNET_MASK, /* 10 Subnetmask is not set */
ERROR_NET_PING_TIME_OUT, /* 11 No response from ping server */
ERROR_NET_MAC_NOT_INITIALIZED, /* 12 MAC module has not been init */
ERROR_NET_MAC_FATAL_STATE, /* 13 MAC module is in fatal state */
ERROR_NET_MAC_INVALID_HANDLE, /* 14 MAC module detected inv. hand */
ERROR_NET_MAC_NO_FREE_SAP, /* 15 MAC module is out of SAP space*/
ERROR_NET_MAC_NO_SAP, /* 16 MAC module found no reg. SAP */
ERROR_NET_MAC_SAP_CLOSED, /* 17 MAC module SAP closed */
ERROR_NET_MAC_INVALID_LENGTH, /* 18 MAC module detected length error */
ERROR_NET_ARP_NOT_INITIALIZED, /* 19 ARP module has not been init */
ERROR_NET_ARP_FATAL_STATE, /* 1A ARP module is in fatal state */
ERROR_NET_ARP_INVALID_OPCODE, /* 1B ARP module detected inv. opcode */
ERROR_NET_ARP_INVALID_IP_ADDR, /* 1C ARP module detected inv. IPadr */
ERROR_NET_ARP_MAC_NOT_RESOLUTED, /* 1D ARP module not resoluted MACadr */
ERROR_NET_IP_NOT_INITIALIZED, /* 1E IP module has not been init */
ERROR_NET_IP_FATAL_STATE, /* 1F IP module is in fatal state */
ERROR_NET_IP_INVALID_HANDLE, /* 20 IP module detected inv. hand */
ERROR_NET_IP_NO_FREE_SAP, /* 21 IP module is out of SAP space */
ERROR_NET_IP_NO_SAP, /* 22 IP module found no reg. SAP */
ERROR_NET_IP_SAP_CLOSED, /* 23 IP module SAP closed */
ERROR_NET_IP_INVALID_OWN_IP_ADDR, /* 24 IP module detected inv. own IP*/
ERROR_NET_IP_INVALID_DST_IP_ADDR, /* 25 IP module detected inv. dst IP*/
ERROR_NET_IP_INVALID_SUBNET, /* 26 IP module detected inv. subnet */
ERROR_NET_IP_INVALID_GATEWAY, /* 27 IP module detected inv. gw */
ERROR_NET_IP_NO_PATH, /* 28 IP module, gateway and this
station, not on same subnet */
ERROR_NET_IP_INVALID_CHECKSUM, /* 29 IP module detected checksum err */
ERROR_NET_IP_INVALID_LENGTH, /* 2A IP module detected length error */
ERROR_NET_ICMP_NOT_INITIALIZED, /* 2B ICMP module has not been init */
ERROR_NET_ICMP_FATAL_STATE, /* 2C ICMP module is in fatal state */
ERROR_NET_ICMP_INVALID_DATA_SIZE, /* 2D ICMP module detected data size
error */
ERROR_NET_ICMP_INVALID_CHECKSUM, /* 2E ICMP module detected checksum err */
ERROR_NET_ICMP_INVALID_ID, /* 2F ICMP module detected id err */
ERROR_NET_ICMP_NO_USER, /* 30 ICMP module detected no
user for reply */
ERROR_NET_ICMP_INVALID_TYPE, /* 31 ICMP module detected type err */
ERROR_NET_UDP_NOT_INITIALIZED, /* 32 UDP module has not been init */
ERROR_NET_UDP_FATAL_STATE, /* 33 UDP module is in fatal state */
ERROR_NET_UDP_INVALID_HANDLE, /* 34 UDP module detected inv. hand */
ERROR_NET_UDP_NO_FREE_SAP, /* 35 UDP module is out of SAP space */
ERROR_NET_UDP_INVALID_CHECKSUM, /* 36 UDP module detected checksum err */
ERROR_NET_UDP_SAP_INUSE, /* 37 UDP module is out of SAP space */
ERROR_NET_UDP_NO_SAP, /* 38 UDP module found no SAP */
ERROR_NET_UDP_INVALID_LENGTH, /* 39 UDP module detected length error */
ERROR_NET_TFTPC_NOT_INITIALIZED, /* 3A TFTPC module has not been init */
ERROR_NET_TFTPC_FATAL_STATE, /* 3B TFTPC module is in fatal state */
ERROR_NET_TFTPC_INVALID_HANDLE, /* 3C TFTPC module detected inv. hand */
ERROR_NET_TFTPC_NO_FREE_SAP, /* 3D TFTPC module is out of SAP space */
ERROR_NET_TFTPC_INVALID_FILENAME, /* 3E TFTPC module is out of SAP space */
ERROR_NET_TFTPC_SAP_ERROR_STATE, /* 3F TFTPC module this SAP is in ERR */
ERROR_NET_TFTPC_INVALID_TID, /* 40 TFTPC module detected invalid TID */
ERROR_NET_TFTPC_INVALID_BLOCK_NUMBER,/* 41 TFTPC module detected
invalid block number */
ERROR_NET_TFTPC_EOF, /* 42 TFTPC module End Of File */
ERROR_NET_TFTPC_NO_DATA, /* 43 TFTPC module no data */
ERROR_NET_TFTPC_CONGESTION, /* 44 TFTPC module SAP in congestion */
ERROR_NET_TFTPC_RRQ_TIMEOUT, /* 45 TFTPC module SAP RRQ time out */
ERROR_NET_TFTPC_DATA_TIMEOUT, /* 46 TFTPC module SAP DATA time out */
/******* ADD NEW IO ERROR TAGS JUST BEFORE THIS LINE ONLY *******/
} t_NET_error_ids;
/************************************************************************
* Parameter definitions
*************************************************************************/
/* Default ping datagram size */
#define PING_DEFAULT_DATAGRAM_SIZE 64
/* Maximum ping datagram size */
#define PING_MAX_DATAGRAM_SIZE 1472
/* Maximum TFTP file size */
#define TFTP_FILE_MAX_SIZE (0x7fff * 512)
/************************************************************************
* NET services:
*************************************************************************/
UINT32
NET_init( void ) ;
UINT32
net_open( UINT32 ipadr, char *filename ) ;
char
net_getchar( void ) ;
UINT32
net_getbyte( UINT8 *byte ) ;
UINT32
NET_file_read( UINT32 ipadr,
char *filename,
UINT8 *buffer,
UINT32 *size ) ;
UINT32
NET_file_write( UINT32 ipadr,
char *filename,
UINT8 *buffer,
UINT32 *size ) ;
UINT32
NET_poll( void ) ;
UINT32
NET_ping( UINT32 ipadr, UINT32 data_size ) ;
#endif /* #ifndef NET_API_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -