/*
dm9ks.c: Version 2.03 2005/10/17
A Davicom DM9000A/DM9010 ISA NIC fast Ethernet driver for Linux.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
(C)Copyright 1997-2005 DAVICOM Semiconductor,Inc. All Rights Reserved.
V1.00 10/13/2004 Add new function Early transmit & IP/TCP/UDP Checksum
offload enable & flow control is default
V1.1 12/29/2004 Add Two packet mode & modify RX function
V1.2 01/14/2005 Add Early transmit mode
V1.3 03/02/2005 Support kernel 2.6
v1.33 06/08/2005 #define DM9KS_MDRAL 0xf4
#define DM9KS_MDRAH 0xf5
V2.00 Spenser - 01/10/2005
- Modification for PXA270 MAINSTONE.
- Modified dmfe_tx_done().
- Add dmfe_timeout().
V2.01 10/07/2005 Modified dmfe_timer()
Dected network speed 10/100M
V2.02 10/12/2005 Use link change to chage db->Speed
dmfe_open() wait for Link OK
V2.03 11/22/2005 Power-off and Power-on PHY in dmfe_init()
support IOL
*/
#if defined(MODVERSIONS)
#include <linux/modversions.h>
#endif
#include <linux/config.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/version.h>
#include <asm/dma.h>
#include <linux/spinlock.h>
//#include <linux/crc32.h> //tj1205
#include <asm/io.h>
#include <asm/irq.h>
/* Board/System/Debug information/definition ---------------- */
#define DM9KS_ID 0x90000A46
#define DM9010_ID 0x90100A46
/*-------register name-----------------------*/
#define DM9KS_NCR 0x00 /* Network control Reg.*/
#define DM9KS_NSR 0x01 /* Network Status Reg.*/
#define DM9KS_TCR 0x02 /* TX control Reg.*/
#define DM9KS_RXCR 0x05 /* RX control Reg.*/
#define DM9KS_BPTR 0x08
#define DM9KS_EPCR 0x0b
#define DM9KS_EPAR 0x0c
#define DM9KS_EPDRL 0x0d
#define DM9KS_EPDRH 0x0e
#define DM9KS_GPR 0x1f /* General purpose register */
#define DM9KS_TCR2 0x2d
#define DM9KS_SMCR 0x2f /* Special Mode Control Reg.*/
#define DM9KS_ETXCSR 0x30 /* Early Transmit control/status Reg.*/
#define DM9KS_TCCR 0x31 /* Checksum cntrol Reg. */
#define DM9KS_RCSR 0x32 /* Receive Checksum status Reg.*/
#define DM9KS_MRCMDX 0xf0
#define DM9KS_MRCMD 0xf2
#define DM9KS_MDRAL 0xf4
#define DM9KS_MDRAH 0xf5
#define DM9KS_MWCMD 0xf8
#define DM9KS_TXPLL 0xfc
#define DM9KS_TXPLH 0xfd
#define DM9KS_ISR 0xfe
#define DM9KS_IMR 0xff
/*---------------------------------------------*/
#define DM9KS_REG05 0x30 /* SKIP_CRC/SKIP_LONG */
#define DM9KS_REGFF 0xA3 /* IMR */
#define DM9KS_DISINTR 0x80
#define DM9KS_PHY 0x40 /* PHY address 0x01 */
#define DM9KS_PKT_RDY 0x01 /* Packet ready to receive */
#define DM9KS_MIN_IO 0xd0000000 //tj1204 0xd0000000
#define DM9KS_MAX_IO 0xd0000370
#define DM9K_IRQ IRQ_CS8900
#define DM9KS_VID_L 0x28
#define DM9KS_VID_H 0x29
#define DM9KS_PID_L 0x2A
#define DM9KS_PID_H 0x2B
#define DM9KS_RX_INTR 0x01
#define DM9KS_TX_INTR 0x02
#define DM9KS_LINK_INTR 0x20
#define DM9KS_DWORD_MODE 1
#define DM9KS_BYTE_MODE 2
#define DM9KS_WORD_MODE 0
#define TRUE 1
#define FALSE 0
/* Number of continuous Rx packets */
#define CONT_RX_PKT_CNT 10
#define DMFE_TIMER_WUT jiffies+(HZ*5) /* timer wakeup time : 5 second */
#if defined(DM9KS_DEBUG)
#define DMFE_DBUG(dbug_now, msg, vaule)\
if (dmfe_debug||dbug_now) printk(KERN_ERR "dmfe: %s %x\n", msg, vaule)
#else
#define DMFE_DBUG(dbug_now, msg, vaule)\
if (dbug_now) printk(KERN_ERR "dmfe: %s %x\n", msg, vaule)
#endif
#undef inb
#undef outb
#undef inw
#undef outw
#undef inl
#undef outl
typedef struct _RX_DESC
{
u8 rxbyte;
u8 status;
u16 length;
}RX_DESC;
typedef union{
u8 buf[4];
RX_DESC desc;
} rx_t;
enum DM9KS_PHY_mode {
DM9KS_10MHD = 0,
DM9KS_100MHD = 1,
DM9KS_10MFD = 4,
DM9KS_100MFD = 5,
DM9KS_AUTO = 8,
};
/* Structure/enum declaration ------------------------------- */
typedef struct board_info {
u32 reset_counter; /* counter: RESET */
u32 reset_tx_timeout; /* RESET caused by TX Timeout */
u32 io_addr; /* Register I/O base address */
u32 io_data; /* Data I/O address */
int tx_pkt_cnt;
u8 op_mode; /* PHY operation mode */
u8 io_mode; /* 0:word, 2:byte */
u8 device_wait_reset; /* device state */
u8 Speed; /* current speed */
int cont_rx_pkt_cnt;/* current number of continuos rx packets */
struct timer_list timer;
struct net_device_stats stats;
unsigned char srom[128];
spinlock_t lock;
} board_info_t;
/* Global variable declaration ----------------------------- */
/*static int dmfe_debug = 0;*/
static struct net_device * dmfe_dev = NULL;
/* For module input parameter */
static int mode = DM9KS_AUTO;
static int media_mode = DM9KS_AUTO;
static u8 irq = DM9K_IRQ;
static u32 iobase = DM9KS_MIN_IO;
static u32 lanBase = DM9KS_MIN_IO;
/* function declaration ------------------------------------- */
int dmfe_probe(struct net_device *);
static int dmfe_open(struct net_device *);
static int dmfe_start_xmit(struct sk_buff *, struct net_device *);
static void dmfe_tx_done(unsigned long);
static void dmfe_packet_receive(struct net_device *);
static int dmfe_stop(struct net_device *);
static struct net_device_stats * dmfe_get_stats(struct net_device *);
static int dmfe_do_ioctl(struct net_device *, struct ifreq *, int);
static void dmfe_interrupt(int , void *, struct pt_regs *);
static void dmfe_timer(unsigned long);
static void dmfe_init_dm9000(struct net_device *);
static unsigned long cal_CRC(unsigned char *, unsigned int, u8);
static u8 ior(board_info_t *, int);
static void iow(board_info_t *, int, u8);
static u16 phy_read(board_info_t *, int);
static void phy_write(board_info_t *, int, u16);
static u16 read_srom_word(board_info_t *, int);
static void dm9000_hash_table(struct net_device *);
static void dmfe_timeout(struct net_device *);
static void dmfe_reset(struct net_device *);
#if defined(CHECKSUM)
static u8 check_rx_ready(u8);
#endif
/* DM9000 network baord routine ---------------------------- */
static u8 inb(u16 addr);
static void outb(u8 value, u16 addr);
static u16 inw(u16 addr);
static void outw(u16 value, u16 addr);
static u32 inl(u16 addr);
static void outl(u32 value, u16 addr);
static u8 inb(volatile u16 addr)
{
return(*(volatile u8 *)(lanBase+addr));
}
static void outb(volatile u8 value, volatile u16 addr)
{
*(volatile u8 *)(lanBase+addr) = value;
}
static u16 inw(volatile u16 addr)
{
return(*(volatile u16 *)(lanBase+addr));
}
static void outw(volatile u16 value, volatile u16 addr)
{
*(volatile u16 *)(lanBase+addr) = value;
}
static u32 inl(volatile u16 addr)
{
return(*(volatile u32 *)(lanBase+addr));
}
static void outl(volatile u32 value, volatile u16 addr)
{
*(volatile u32 *)(lanBase+addr) = value;
}
/*
Search DM9000 board, allocate space and register it
*/
struct net_device * __init dmfe_probe1(void)
{
struct net_device *dev;
int err;
dev = init_etherdev(NULL, sizeof(struct board_info));
ether_setup(dev);
if(!dev)
return ERR_PTR(-ENOMEM);
SET_MODULE_OWNER(dev);
err = dmfe_probe(dev);
if (err)
goto out;
return dev;
out1:
release_region(dev->base_addr,2);
out:
return ERR_PTR(err);
}
int __init dmfe_probe(struct net_device *dev)
{
struct board_info *db; /* Point a board information structure */
u32 id_val;
u16 i, cmd_select,dm9000_found = FALSE;
BWSCON = (BWSCON & ~(BWSCON_ST3 | BWSCON_WS3 | BWSCON_DW3)) |
(BWSCON_ST3 | BWSCON_WS3 | BWSCON_DW(
没有合适的资源?快使用搜索试试~ 我知道了~
s3c2440上的bootloader移植代码
共91个文件
h:32个
o:20个
c:18个
需积分: 10 7 下载量 67 浏览量
2010-04-15
20:01:40
上传
评论
收藏 392KB RAR 举报
温馨提示
s3c2440上的bootloader移植代码,已测试成功,可以直接下载运行.rar
资源推荐
资源详情
资源评论
收起资源包目录
s3c2440上的bootloader移植代码,已测试成功,可以直接下载运行.rar (91个子文件)
bios 2440
inc
memtest.h 279B
2440addr.inc 4KB
Nand.h 1KB
profile.h 439B
2440usb.h 4KB
bootpara.h 2KB
2440slib.h 2KB
2440lib.h 2KB
norflash.h 154B
Option.h 3KB
2440addr.h 40KB
Memcfg.inc 3KB
mmu.h 1KB
def.h 276B
u2440mon.h 536B
Option.inc 4KB
bios
bios.mcp 154KB
bios_Data
DebugRel
ObjectCode
usblib.o 38KB
2440slib.o 3KB
usbsetup.o 48KB
usbmain.o 41KB
usbout.o 45KB
eeprom.o 37KB
comload.o 35KB
2440lib.o 47KB
mmu.o 33KB
nand.o 59KB
profile.o 38KB
u2440mon.o 64KB
2440init.o 9KB
memtest.o 30KB
intel_flash.o 12KB
39VF160.o 11KB
relocate_nkbin.o 35KB
lcdinit.o 31KB
usbin.o 41KB
TargetDataWindows.tdt 120KB
bios.axf 170KB
Flash_hex
TargetDataWindows.tdt 60KB
CWSettingsWindows.stg 4KB
src
eeprom.c 5KB
lcdinit.c 2KB
nand.c 22KB
dm9ks_S3C2440_v6_tj.c 29KB
2440lib.c 23KB
memtest.c 1KB
profile.c 2KB
comload.c 3KB
2440init.s 20KB
intel_flash.c 4KB
2440slib.s 7KB
mmu.c 4KB
u2440mon.c 28KB
39VF160.C 3KB
relocate_nkbin.c 5KB
usb
usbsetup.c 20KB
usbout.c 6KB
usbin.h 355B
usb.h 5KB
usblib.c 6KB
usbin.c 2KB
usbsetup.h 1KB
usbmain.h 425B
usbout.h 429B
usbmain.c 3KB
usblib.h 696B
2440_test
bios_tj
bios_tj.mcp 151KB
bios_tj_Data
DebugRel
ObjectCode
2440init.o 6KB
TargetDataWindows.tdt 57KB
bios_tj.axf 5KB
Flash_HEX
TargetDataWindows.tdt 54KB
CWSettingsWindows.stg 3KB
inc
memtest.h 279B
2440addr.inc 4KB
Nand.h 1KB
profile.h 439B
2440usb.h 4KB
bootpara.h 2KB
2440slib.h 2KB
2440lib.h 2KB
norflash.h 154B
Option.h 3KB
2440addr.h 40KB
Memcfg.inc 3KB
mmu.h 1KB
def.h 276B
u2440mon.h 536B
Option.inc 4KB
2440init.s 4KB
bios_tj.bin 120B
www.pudn.com.txt 218B
共 91 条
- 1
资源评论
zhizhen_8
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- NC65 UAP65 流程开发 – 业务流 – 推单 详细笔记
- 两种计算CDF累加分布函数的Matlab程序,可以选择使用 .rar
- Windows操作系统介绍.zip
- 汉森的广义t分布的matlab程序(金融)cdf.zip
- Three.js介绍.zip0002
- 人工智能BBSO算法,MATLAB实现,很基本的人工智能算法,里面有很多源程序
- 高端大气科技互联网项目融资商业计划书产品公司品牌介绍PPT模板.pptx
- Sora AI文字生成视频实操教程、由给定的图片生成视频的教程说明书,祝你一臂之力 轻松上手Sora
- 网络安全说明:网络安全方面的资料,+适合网络安全的初学者
- 【移动应用开发】HarmonyOS应用服务开发,移动购物应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功