📄 ctrl_rtl8019.h
字号:
/******************************************************************************
* www.21control.com
******************************************************************************/
#ifndef __CTRL_RTL8019_H__
#define __CTRL_RTL8019_H__
#ifdef LWIP
#include <stdlib.h>
#include <stdio.h>
#include "alt_types.h"
#include "system.h"
#include "lwip/netif.h"
#include "arch/sys_arch.h"
#include "alt_lwip_dev.h"
#include "sys/alt_warning.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
err_t ctrl_rtl8019_init(struct netif *netif);
void ctrl_rtl8019_rx();
typedef struct
{
alt_lwip_dev_list lwip_dev_list;
int base_addr;
int irq;
int bus_width;
sys_sem_t semaphore;
sys_sem_t arp_semaphore;
alt_u8 tx_packet_no; /* Number of packet allocated for Tx */
}ctrl_rtl8019_if;
#define CTRL_RTL8019_INSTANCE(name, dev) \
ctrl_rtl8019_if dev = \
{\
{\
ALT_LLIST_ENTRY,\
{\
0,\
name##_NAME,\
ctrl_rtl8019_init, \
ctrl_rtl8019_rx,\
},\
},\
name##_BASE,\
name##_IRQ,\
8,\
0,\
0\
}
#define CTRL_RTL8019_INIT(name, dev) alt_lwip_dev_reg(dev)
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*!
* Realtek packet header.
*/
struct nic_pkt_header {
u_char ph_status; /*!< \brief Status, contents of RSR register */
u_char ph_nextpg; /*!< \brief Page for next packet */
u_short ph_size; /*!< \brief Size of header and packet in octets */
};
/*!
* Size of a single ring buffer page.
*/
#define NIC_PAGE_SIZE 0x100
/*!
* First ring buffer page address.
*/
#define NIC_START_PAGE 0x40
/*!
* Last ring buffer page address plus 1.
*/
#define NIC_STOP_PAGE 0x60
/*!
* Number of pages in a single transmit buffer.
*
* This should be at least the MTU size.
*/
#define NIC_TX_PAGES 6
/*!
* Number of transmit buffers.
*/
#define NIC_TX_BUFFERS 2
/*!
* Controller memory layout:
*
* 0x4000 - 0x4bff 3k bytes transmit buffer
* 0x4c00 - 0x5fff 5k bytes receive buffer
*/
#define NIC_FIRST_TX_PAGE NIC_START_PAGE
#define NIC_FIRST_RX_PAGE (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)
/*!
* Standard sizing information
*/
#define TX_PAGES 12 /* Allow for 2 back-to-back frames */
#else
#warning excluding drivers for the rtl8019 as you do not have the LWIP software component selected
#define CTRL_RTL8019_INSTANCE(name, dev) extern int alt_no_storage
#define CTRL_RTL8019_INIT(name, dev) while(0)
#endif /* LWIP */
#endif /* __CTRL_RTL8019_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -