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

📄 custom_ethernet.h

📁 使用silabs提供的协议栈做的一个基于c8051f的web服务器。ps:绝不是那个常见的简单web服务器。
💻 H
字号:
//-----------------------------------------------------------------------------
// custom_ethernet.h
//-----------------------------------------------------------------------------
// Copyright 2005 Silicon Laboratories, Inc.
//
// Description:
// 	Header file for custom_ethernet.c.
//
// Generated by TCP/IP Library Builder
//

/************************************************************/
/*                                                          */
/* ETHER_RDWR                                               */
/*                                                          */
/* Read/Write Memory Location                               */
/* All reads and writes across the EMIF should generally    */
/* begin at location 0x2000 in XRAM, as this is the first   */
/* byte of off-chip xdata space.                            */
/* The lower byte of the address, ETHER_RDWR, is defined    */
/* here.                                                    */
/* The upper byte, defined as BASE_ADDRESS in               */
/* mn_userconst.h, is placed in EMI0CN.                     */
/*                                                          */
/************************************************************/
#define ETHER_RDWR ((volatile unsigned char pdata *)0x00)


/************************************************************/
/*                                                          */
/* Type Definitions                                         */
/*                                                          */
/************************************************************/
typedef TIMER_INFO_T * PTIMER_INFO;


/************************************************************/
/*                                                          */
/* Function Declarations                                    */
/*                                                          */
/************************************************************/

// mn_send_byte: Puts a byte in the transmit buffer.
void mn_send_byte(byte);

// mn_put_recv_byte: Puts a byte into the receive buffer.
// Code should check that there is space in the buffer first.
void mn_put_recv_byte(byte);

// mn_reset_timer: Resets a timer (PTIMER_INFO) to the
// specified number of sytem ticks (TIMER_TICK_T).
void mn_reset_timer(PTIMER_INFO, TIMER_TICK_T);

// mn_timer_expired: Returns true if the timer (PTIMER_INFO)
// has expired.
byte mn_timer_expired(PTIMER_INFO);

/************************************************************/
/*                                                          */
/* Variable Declarations                                    */
/*                                                          */
/************************************************************/
extern volatile byte xmit_busy;      // If set, transmit is in progress
extern byte *volatile send_out_ptr;  // Out pointer to transmit buffer
extern byte *send_in_ptr;            // In pointer to transmit buffer
extern byte *volatile recv_in_ptr;   // In pointer to receive buffer
extern byte *recv_out_ptr;           // Out pointer to receive buffer
extern volatile word16 recv_count;   // Number of bytes received
extern word16 code XMIT_BUFF_SIZE;   // Size of the transmit buffer
extern word16 code RECV_BUFF_SIZE;   // Size of the receive buffer
extern word16 code ETHER_WAIT_TICKS; // Number of ticks to wait for a packet


/************************************************************/
/*                                                          */
/* Macro Declarations                                       */
/*                                                          */
/************************************************************/
#define  MN_XMIT_BUSY_CLEAR   xmit_busy = 0


/************************************************************/
/*                                                          */
/* Constant Definitions                                     */
/*                                                          */
/************************************************************/
#ifndef  TRUE
#define  TRUE                 1
#endif

#ifndef  FALSE
#define  FALSE                0
#endif

#define  ETHER_SIZE           1518   // Maximum Ethernet frame size

/************************************************************/
/*                                                          */
/* The code below should be modified to work with a custom  */
/* Ethernet controller.                                     */
/*                                                          */
/************************************************************/

// Ethernet Controller Register Definitions
#define  TX_PORT
#define  RX_PORT
#define  TX_RESULT
#define  RX_RESULT
#define  RX_LENGTH
#define  NUM_RX_PACKETS

// TX_RESULT Bit Definitions
#define  TX_ERROR
#define  TX_OK

// RX_Result Bit Definitions
#define  RX_OK

⌨️ 快捷键说明

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