Chinaunix首页 | 论坛 | 博客
  • 博客访问: 419593
  • 博文数量: 93
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 1052
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 11:01
文章分类

全部博文(93)

文章存档

2011年(1)

2009年(26)

2008年(66)

我的朋友

分类: LINUX

2008-07-21 18:39:14

由于linux镜像文件动则就有几百k,如果每次都用串口来传就太慢了。LIYUTAI的板子用的是RTL8019U-BOOT上面直接有驱动,只要改一下就可以用了!(狂喜!!!)

#include

#include

 

 

#ifdef CONFIG_DRIVER_RTL8019

 

#define ETH_ADDR_SFT (8)

#define EI_SHIFT(x)     ((x)<

 

#define           RTL8019_REG_00                (RTL8019_BASE + EI_SHIFT(0x00))

#define   RTL8019_REG_01                (RTL8019_BASE + EI_SHIFT(0x01))

#define   RTL8019_REG_02                (RTL8019_BASE + EI_SHIFT(0x02))

#define   RTL8019_REG_03                (RTL8019_BASE + EI_SHIFT(0x03))

#define   RTL8019_REG_04                (RTL8019_BASE + EI_SHIFT(0x04))

#define   RTL8019_REG_05                (RTL8019_BASE + EI_SHIFT(0x05))

#define   RTL8019_REG_06                (RTL8019_BASE + EI_SHIFT(0x06))

#define   RTL8019_REG_07                (RTL8019_BASE + EI_SHIFT(0x07))

#define   RTL8019_REG_08                (RTL8019_BASE + EI_SHIFT(0x08))

#define   RTL8019_REG_09                (RTL8019_BASE + EI_SHIFT(0x09))

#define   RTL8019_REG_0a                (RTL8019_BASE + EI_SHIFT(0x0a))

#define   RTL8019_REG_0b                (RTL8019_BASE + EI_SHIFT(0x0b))

#define   RTL8019_REG_0c                (RTL8019_BASE + EI_SHIFT(0x0c))

#define   RTL8019_REG_0d                (RTL8019_BASE + EI_SHIFT(0x0d))

#define   RTL8019_REG_0e                (RTL8019_BASE + EI_SHIFT(0x0e))

#define   RTL8019_REG_0f                 (RTL8019_BASE + EI_SHIFT(0x0f))

#define   RTL8019_REG_10                (RTL8019_BASE + EI_SHIFT(0x10))

#define   RTL8019_REG_1f                 (RTL8019_BASE + EI_SHIFT(0x1f))

 

#define           RTL8019_COMMAND                RTL8019_REG_00

#define           RTL8019_PAGESTART        RTL8019_REG_01

#define           RTL8019_PAGESTOP          RTL8019_REG_02

#define           RTL8019_BOUNDARY         RTL8019_REG_03

#define           RTL8019_TRANSMITSTATUS           RTL8019_REG_04

#define           RTL8019_TRANSMITPAGE        RTL8019_REG_04

#define           RTL8019_TRANSMITBYTECOUNT0 RTL8019_REG_05

#define           RTL8019_NCR                   RTL8019_REG_05

#define           RTL8019_TRANSMITBYTECOUNT1        RTL8019_REG_06

#define           RTL8019_INTERRUPTSTATUS          RTL8019_REG_07

#define           RTL8019_CURRENT           RTL8019_REG_07

#define           RTL8019_REMOTESTARTADDRESS0      RTL8019_REG_08

#define           RTL8019_CRDMA0            RTL8019_REG_08

#define           RTL8019_REMOTESTARTADDRESS1      RTL8019_REG_09

#define           RTL8019_CRDMA1                   RTL8019_REG_09

#define           RTL8019_REMOTEBYTECOUNT0     RTL8019_REG_0a

#define           RTL8019_REMOTEBYTECOUNT1     RTL8019_REG_0b

#define           RTL8019_RECEIVESTATUS        RTL8019_REG_0c

#define           RTL8019_RECEIVECONFIGURATION      RTL8019_REG_0c

#define           RTL8019_TRANSMITCONFIGURATION   RTL8019_REG_0d

#define           RTL8019_FAE_TALLY         RTL8019_REG_0d

#define           RTL8019_DATACONFIGURATION     RTL8019_REG_0e

#define           RTL8019_CRC_TALLY               RTL8019_REG_0e

#define           RTL8019_INTERRUPTMASK             RTL8019_REG_0f

#define           RTL8019_MISS_PKT_TALLY             RTL8019_REG_0f

#define           RTL8019_PHYSICALADDRESS0 RTL8019_REG_01

#define   RTL8019_PHYSICALADDRESS1 RTL8019_REG_02

#define           RTL8019_PHYSICALADDRESS2 RTL8019_REG_03

#define           RTL8019_PHYSICALADDRESS3 RTL8019_REG_04

#define           RTL8019_PHYSICALADDRESS4 RTL8019_REG_05

#define           RTL8019_PHYSICALADDRESS5 RTL8019_REG_06

#define           RTL8019_MULTIADDRESS0             RTL8019_REG_08

#define           RTL8019_MULTIADDRESS1             RTL8019_REG_09

#define           RTL8019_MULTIADDRESS2             RTL8019_REG_0a

#define           RTL8019_MULTIADDRESS3             RTL8019_REG_0b

#define           RTL8019_MULTIADDRESS4             RTL8019_REG_0c

#define           RTL8019_MULTIADDRESS5             RTL8019_REG_0d

#define           RTL8019_MULTIADDRESS6             RTL8019_REG_0e

#define           RTL8019_MULTIADDRESS7             RTL8019_REG_0f

#define           RTL8019_DMA_DATA         RTL8019_REG_10

#define           RTL8019_RESET                 RTL8019_REG_1f

 

 

#define   RTL8019_PAGE0                    0x22

#define         RTL8019_PAGE1                    0x62

#define         RTL8019_PAGE0DMAWRITE              0x12

#define         RTL8019_PAGE2DMAWRITE              0x92

#define         RTL8019_REMOTEDMAWR              0x12

#define         RTL8019_REMOTEDMARD               0x0A

#define         RTL8019_ABORTDMAWR                 0x32

#define         RTL8019_ABORTDMARD                 0x2A

#define         RTL8019_PAGE0STOP              0x21

#define         RTL8019_PAGE1STOP              0x61

#define         RTL8019_TRANSMIT              0x26

#define         RTL8019_TXINPROGRESS        0x04

#define         RTL8019_SEND                      0x1A

 

#define           RTL8019_PSTART               0x4c

#define           RTL8019_PSTOP                0x80

#define           RTL8019_TPSTART                   0x40

 

 

#endif /*end of CONFIG_DRIVER_RTL8019*/

 

调试网络的时候一直不通,后来调试之后发现原来是rtl8019.c出问题了。不知道为什么put_reg函数就有volatileget_reg就没有,问题就出现在这里了。加上去,OK

static unsigned char get_reg (unsigned int regno)

{

       return (*(volatile unsigned char *) regno);

}

 

为了调试U-BOOT,我真的详尽了办法,试了好多种方法都不能进行源码级的调试。后来发现了用RVDK可以在window下面进行调试,方法如下:(后来发现原来可以用skyeye来调试,连板子都可以不用上!谢谢skyeye的做着为我们提供这么好的平台)

修改arm_config.mk文件,增加-gdwarf选项

#PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__

 

#debug

PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__ -gdwarf-2

              接着在RVDK上面就可以进行源码级的调试了。爽啊~~~

在此要谢谢samfei的移植文档(),基本上对照着就能够完成u-boot-1.1.6。现在我把它移植到1.3.2,希望对新手有帮助。如果手上没有补丁文件,可以来信索取(E-mail: kenwucn@QQ.com)

 

2008-06-30 于佛山

 

取得补丁之后,可以直接给U-BOOT打补丁,直接得到需要的目标。

 

1)        把补丁文件放到与U-BOOT目录同级的位置

2)        进入U-BOOT目录

[root@localhost ken]# cd u-boot-1.3.2

[root@localhost u-boot-1.3.2]#

3)        打补丁(如果文件是gz格式)

[root@localhost u-boot-1.3.2]# gzip -dc ../u-boot-1.3.2-kenwucn.patch.gz | patch -p1

(以下为终端输出信息)

patching file arm_config.mk

patching file board/armsys/44B0/44B0.c

patching file board/armsys/44B0/config.mk

patching file board/armsys/44B0/flash.c

patching file board/armsys/44B0/lowlevel_init.S

patching file board/armsys/44B0/Makefile

patching file board/armsys/44B0/u-boot.lds

patching file board/armsys/common/flash.c

patching file board/armsys/common/fpga.c

patching file board/armsys/common/nand.c

patching file board/armsys/common/nand.h

patching file board/armsys/common/pci.c

patching file board/bf533-ezkit/.gitignore

patching file board/bf533-stamp/.gitignore

patching file board/bf537-stamp/.gitignore

patching file board/bf561-ezkit/.gitignore

patching file common/cmd_mem.c

patching file common/cmd_nand.c

patching file common/cmd_net.c

patching file common/dlmalloc.c

patching file cpu/s3c44b0/interrupts.c

patching file cpu/s3c44b0/serial.c

patching file cpu/s3c44b0/start.S

patching file drivers/mtd/nand/nand.c

patching file drivers/mtd/nand/nand_ids.c

patching file drivers/mtd/nand_legacy/nand_legacy.c

patching file drivers/net/8390.h

patching file drivers/net/ne2000.c

patching file drivers/net/ne2000.h

patching file drivers/net/rtl8019.c

patching file drivers/net/rtl8019.h

patching file examples/.gitignore

patching file .gdbtkinit

patching file .gitignore

patching file include/configs/44B0.h

patching file include/.gitignore

patching file include/linux/mtd/nand_ids.h

patching file include/net.h

patching file Makefile

patching file net/eth.c

patching file net/Makefile

patching file net/net.c

patching file net/tftp.c

patching file tools/.gitignore

4)        打补丁(如果文件是文本格式(以patch结尾))

[root@localhost u-boot-1.3.2]# patch -p1 < ../u-boot-1.3.2-kenwucn.patch

(以下为终端输出信息)

patching file arm_config.mk

patching file board/armsys/44B0/44B0.c

patching file board/armsys/44B0/config.mk

patching file board/armsys/44B0/flash.c

patching file board/armsys/44B0/lowlevel_init.S

patching file board/armsys/44B0/Makefile

patching file board/armsys/44B0/u-boot.lds

patching file board/armsys/common/flash.c

patching file board/armsys/common/fpga.c

patching file board/armsys/common/nand.c

patching file board/armsys/common/nand.h

patching file board/armsys/common/pci.c

patching file board/bf533-ezkit/.gitignore

patching file board/bf533-stamp/.gitignore

patching file board/bf537-stamp/.gitignore

patching file board/bf561-ezkit/.gitignore

patching file common/cmd_mem.c

patching file common/cmd_nand.c

patching file common/cmd_net.c

patching file common/dlmalloc.c

patching file cpu/s3c44b0/interrupts.c

patching file cpu/s3c44b0/serial.c

patching file cpu/s3c44b0/start.S

patching file drivers/mtd/nand/nand.c

patching file drivers/mtd/nand/nand_ids.c

patching file drivers/mtd/nand_legacy/nand_legacy.c

patching file drivers/net/8390.h

patching file drivers/net/ne2000.c

patching file drivers/net/ne2000.h

patching file drivers/net/rtl8019.c

patching file drivers/net/rtl8019.h

patching file examples/.gitignore

patching file .gdbtkinit

patching file .gitignore

patching file include/configs/44B0.h

patching file include/.gitignore

patching file include/linux/mtd/nand_ids.h

patching file include/net.h

patching file Makefile

patching file net/eth.c

patching file net/Makefile

patching file net/net.c

patching file net/tftp.c

patching file tools/.gitignore

 

(全文完)

 

阅读(1949) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~