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

📄 pppoe.h

📁 这同样是FS8610相关的代码.看起来不错啊.
💻 H
字号:
/**
 * \addtogroup pppoe
 * @{
 */

/**
 * \file pppoe.h
 * \brief  PPPoE Channel Functions Defination Header File
 * \author Stony Shen <lshen@fameg.com>
 */
 
/*
 ******************************************************************************
 *	Copyright (c) 2006  FameG Shanghai, Inc. All rights reserved.
 *
 * This is unpublished proprietary source code of FameG Shanghai,  Inc.
 *
 * The copyright notice above does not evidence any actual or intended
 * publication of such source code.
 ******************************************************************************
 */
/*
 ******************************************************************************
 * Project:  T4 L4MCU FPGA verification
 * Filename: pppoe.h
 * Date:	 04/03/06
 * Purpose:  L4HStacke Engine PPPoE Channel Functions Defination header file
 * Author:   Stony Shen
 ******************************************************************************
 */
#ifndef	_PPPOE_H
#define 	_PPPOE_H

/*===============================================*
 *              Include Files                    *
 *===============================================*/
#include "kernel/config.h"
#include "kernel/system.h" 

//#if	INCLUDE_PPPOE_CONTROL

/*===============================================*
 *              Macro Defines                    *
 *===============================================*/

/** Get Rx FIFO write pointer \hideinitializer */ 
//#define GET_PPPOE_RFWP()	(inb(PPPOE_RFIFO_WP0) | ((inb(PPPOE_RFIFO_WP1) & 0x07) << 8))
#define GET_PPPOE_RFWP()	pppoe_get_RFWP()
/** Get Rx FIFO read pointer \hideinitializer */ 
//#define GET_PPPOE_RFRP()	(inb(PPPOE_RFIFO_RP0) | ((inb(PPPOE_RFIFO_RP1) & 0x07) << 8))
#define GET_PPPOE_RFRP()	pppoe_get_RFRP()
/** Set Rx FIFO read pointer \hideinitializer */ 
#define SET_PPPOE_RFRP(rfrp)	 { outb((rfrp & 0xFF),PPPOE_RFIFO_RP0); \
							    outb(((rfrp&SMASK)>>8), PPPOE_RFIFO_RP1); } 

//#define GET_PPPOE_TFFS() (inb(PPPOE_TFIFO_FS0) | ((inb(PPPOE_TFIFO_FS1) & 0x07) << 8))
#define GET_PPPOE_TFFS()	pppoe_get_TFFS()
/** Get Tx FIFO write pointer \hideinitializer */
//#define GET_PPPOE_TFWP()	(inb(PPPOE_TFIFO_WP0) | ((inb(PPPOE_TFIFO_WP1) & 0x07) << 8))
#define GET_PPPOE_TFWP()	pppoe_get_TFWP()
/** Get Tx FIFO read pointer \hideinitializer */
//#define GET_PPPOE_TFRP()	(inb(PPPOE_TFIFO_RP0) | ((inb(PPPOE_TFIFO_RP1) & 0x07) << 8))
#define GET_PPPOE_TFRP()	pppoe_get_TFRP()
/** Set Tx FIFO write pointer \hideinitializer */
#define SET_PPPOE_TFWP(tfwp)  { outb((tfwp & 0xFF),PPPOE_TFIFO_WP0); \
								outb(((tfwp&SMASK)>>8), PPPOE_TFIFO_WP1); } 	


/** Disable PPPOE retransmission \hideinitializer */
//#define DISABLE_PPPOE_RETRANSMISSION()	outb(inb(PPPOE_RTCTRL) | PPPOE_RTE, PPPOE_RTCTRL)
/** Enable PPPOE retransmission \hideinitializer */
//#define ENABLE_PPPOE_RETRANSMISSION()		outb(inb(PPPOE_RTCTRL) & (~PPPOE_RTE), PPPOE_RTCTRL)

/** Read PPPOE interrupt status \hideinitializer */
#define PPPOE_INTERRUPT_STATUS()		inb(SYS_PPPOE_INTSTAT)

/** Read PPPOE timeout status \hideinitializer */
#define PPPOE_TIMEOUT_STATUS()		inb(PPPOE_TOSTAT)

/** Define default PPPOE interrupt enable and interrupt priority \hideinitializer */
#define PPPOE_DEFAULT_INTERRUPT_ENALBE		( PPPOE_RCEN | \
												  PPPOE_TFCEEN | \
												 PPPOE_TOEN | \
												 PPPOE_AUOKEN | \
												 PPPOE_AUFAEN)


#if 0
typedef struct _tx_channel_data
{
    UINT8 macctrl_lenl;       /* CH_TDSC00 */
    UINT8 ip_lb_lenh;         /* CH_TDSC01 */
    UINT8 pkttype_ctrl;       /* CH_TDSC02 */
    UINT8 protocol_ctrl;      /* CH_TDSC03 */
    UINT8 tcp_ctrl;           /* CH_TDSC04 */
    UINT8 pppoe_ctrl;         /* CH_TDSC05 */
    UINT8 tos_lnurg0;         /* CH_TDSC06 */
    UINT8 ttl_lnurg1;         /* CH_TDSC07 */
    UINT8 icmp_dip0;          /* CH_TDSC08 */
    UINT8 icmp_dip1;          /* CH_TDSC09 */
    UINT8 icmp_dip2;          /* CH_TDSC10 */
    UINT8 icmp_dip3;          /* CH_TDSC11 */
    UINT8 udp_dp0;            /* CH_TDSC12 */
    UINT8 udp_dp1;            /* CH_TDSC13 */
    UINT8 udp_ck0;            /* CH_TDSC14 */
    UINT8 udp_ck1;            /* CH_TDSC15 */
    UINT8 payload[1];		/* playload offset */
} tx_channel_data_T;


typedef struct _rx_channel_data
{
    UINT8 error_type;         /* CH_RDSC00 */
    UINT8 link_type;          /* CH_RDSC01 */
    UINT8 payload_lenl;       /* CH_RDSC02 */
    UINT8 pkt_type_lenh;      /* CH_RDSC03 */
    UINT8 address_type;       /* CH_RDSC04 */
    UINT8 ip_tcp_flag;        /* CH_RDSC05 */
    UINT8 ip_tcp_opt;         /* CH_RDSC06 */
    UINT8 ip_tos;             /* CH_RDSC07 */
    UINT8 type_tcp_up0;       /* CH_RDSC08 */
    UINT8 code_tcp_up1;       /* CH_RDSC09 */
    UINT8 udp_rsp0;           /* CH_RDSC10 */
    UINT8 udp_rsp1;           /* CH_RDSC11 */
    UINT8 udp_rsip0;          /* CH_RDSC12 */
    UINT8 udp_rsip1;          /* CH_RDSC13 */
    UINT8 udp_rsip2;          /* CH_RDSC14 */
    UINT8 udp_rsip3;          /* CH_RDSC15 */
    UINT8	payload[1];		/* playload offset */	
} rx_channel_data_T;


/** PPPoE protocol header */
typedef struct _pppoe_header
{
	UINT8	ver_type;	/**< High 4-bit: version; Low 4-bit: type */
	UINT8	code_num;   /**< Code field */
	UINT16	session_id;	/**< Session ID, network byte order, big-endian */
	UINT16	length;		/**< payload length, network byte order, big-endian */
} pppoe_header_T;
#endif



/*===============================================*
 *              Function Prototype declaration                    *
 *===============================================*/
void pppoe_channel_init();
void pppoe_set_stage(const UINT8 stage);
void pppoe_get_stage(UINT8 XDATA *stage);
//RETURN_TYPE pppoe_retry_config(const UINT8 timeout_value, const UINT8 retry_counter);
void pppoe_set_dest_macaddr(const UINT8 *addr);
//void pppoe_set_dest_macaddr(const UINT8 *addr);
void pppoe_get_dest_macaddr(UINT8 XDATA *addr);
void pppoe_set_session_id(const UINT16 session_ID);
void pppoe_get_session_id(UINT16 XDATA *session_ID);

//void pppoe_chennel_reset(void);
void pppoe_write_to_fifo(struct tx_descriptor_t XDATA *desc, UINT8 XDATA *txbuf, UINT16 buf_len);
RETURN_TYPE pppoe_read_from_fifo( struct rx_descriptor_t *desc, UINT8 *rxbuf, UINT16 *buf_len);
//void pppoe_int_config(const UINT8 int_mask, BOOL int_priority);
void register_pppoe_interrupt(const UINT8 int_mask, void (*handler)(void));
void unregister_pppoe_interrupt();



UINT8 pppoeRXBUF_not_empty(void);

void pppoe_tfce_reset(void);

UINT16 pppoe_get_TFRP(void);
UINT16 pppoe_get_TFWP(void);
UINT16 pppoe_get_RFRP(void);
UINT16 pppoe_get_RFWP(void);
UINT16 pppoe_get_TFFS(void);
	
//#endif	/* INCLUDE_PPPOE_CONTROL */

#endif	/*_PPPOE_H */
/** @} */

⌨️ 快捷键说明

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