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

📄 redlogic_rtl8019.h

📁 RT8019网络控制器在FPGA中的驱动设计
💻 H
字号:
#ifndef __REDLOGIC_RTL8019_H__
#define __REDLOGIC_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
err_t redlogic_rtl8019_init(struct netif *netif);
void redlogic_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; 
}redlogic_rtl8019_if;
#define REDLOGIC_RTL8019_INSTANCE(name, dev) \
redlogic_rtl8019_if dev = \
{\
  {\
    ALT_LLIST_ENTRY,\
    {\
      0,\
      name##_NAME,\
      redlogic_rtl8019_init, \
      redlogic_rtl8019_rx,\
    },\
  },\
  name##_BASE,\
  name##_IRQ,\
  8,\
  0,\
  0\
}
#define REDLOGIC_RTL8019_INIT(name, dev)  alt_lwip_dev_reg(dev)
#ifdef __cplusplus
}
#endif
struct nic_pkt_header {
    u_char ph_status;           
    u_char ph_nextpg;           
    u_short ph_size;            
};
#define NIC_PAGE_SIZE   0x100
#define NIC_START_PAGE  0x40
#define NIC_STOP_PAGE   0x60
#define NIC_TX_PAGES    6
#define NIC_TX_BUFFERS  2
#define NIC_FIRST_TX_PAGE   NIC_START_PAGE
#define NIC_FIRST_RX_PAGE   (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)
#define TX_PAGES 12           
#else
#warning excluding drivers for the rtl8019 as you do not have the LWIP software component selected
#define REDLOGIC_RTL8019_INSTANCE(name, dev) extern int alt_no_storage
#define REDLOGIC_RTL8019_INIT(name, dev) while(0)     
#endif 
#endif 

⌨️ 快捷键说明

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