stack.h

来自「阿根廷教授编写的嵌入式internet的实验教程的高质量代码」· C头文件 代码 · 共 59 行

H
59
字号
/******************************************************************************************
   Stack.h (v1.0)
-------------------------------------------------------------------------------------
This code is from the book:
"Embedded Internet: TCP/IP Basics, Implementation and Applications" by Sergio Scaglia
[Pearson Education, 2006 - ISBN: 0-32-130638-4]

This code is copyright (c) 2006 by Sergio Scaglia, and it may only be used for educational
purposes.  For commercial use, please contact me at sscaglia@intramarket.com.ar
For more information and updates, please visit www.embeddedinternet.org
******************************************************************************************/

#ifndef __stack_H
#define __stack_H

#include "hardware.h"
#include "stackcfg.h"
#ifdef PPP_LINK
  #define PACKET_BUF_SIZE	      1504      // we don't consider the FCS (last two bytes)
  #define DATALINK_HDR_SIZE 4
#endif

#include "debug.h"

extern char rx_buf[];
extern char tx_buf[];

#ifdef PPP_LINK

#define PPP_CLOSED	           	0x00
#define PPP_OPENED	           	0x01
#define PPP_WAIT	           	0x02	 // the PPP is connecting/disconnecting...
#define PPP_ERROR_MODEM		   	0x04
#define PPP_ERROR_DIAL_BUSY		0x08
#define PPP_ERROR_DIAL_NO_CARRIER       0x09
#define PPP_ERROR_DIAL_NO_DIALTONE      0x0A
#define PPP_ERROR_DIAL_NO_ANSWER	0x0B
#define PPP_ERROR_NEGOTIATION   	0x10
#define PPP_ERROR_AUTH		   	0x20
#define PPP_ERROR_PHY_LINK	   	0x40
#define PPP_ERROR_SERVER_CLOSE 		0x80

#define PPP_STATUS_NO_ERROR             ppp_status <= 0x02
#define PPP_STATUS_ERROR                ppp_status > 0x02
extern char ppp_status;
#endif


void stack_init(void);
void stack_process(void);

#ifdef PPP_LINK
void ppp_open(char *,char *,char *);
void ppp_close(void);
#endif

#endif

⌨️ 快捷键说明

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