(没分了,不好意思,只有这点了。)
我在驱动程序中有下面两个函数
[code=C/C++][/code]
static int tp_mdio_read(struct file *filp, int phy_id, int phyreg)
{
unsigned long timeout = jiffies + ((HZ * 100) / 1000); /* 100mS */
int lps;
__raw_writel(((phy_id << 8) | phyreg), ENET_MADR(MDIO_IOBASE));
__raw_writel(MCMD_READ, ENET_MCMD(MDIO_IOBASE));
/* Wait for unbusy status */
while (__raw_readl(ENET_MIND(MDIO_IOBASE)) & MIND_BUSY)
{
if (jiffies > timeout){
printk( KERN_INFO DEV_NAME " I/O error\n");
return -EIO;
}
cpu_relax();
}
lps = (int) __raw_readl(ENET_MRDD(MDIO_IOBASE));
__raw_writel(0, ENET_MCMD(MDIO_IOBASE));
return lps;
}
static int tp_mdio_write(struct file *filp, int phy_id, int phyreg, u16 phydata)
{
unsigned long timeout = jiffies + ((HZ * 100) / 1000); /* 100mS */
__raw_writel(((phy_id << 8) | phyreg), ENET_MADR(MDIO_IOBASE));
__raw_writel(phydata, ENET_MWTD(MDIO_IOBASE));
/* Wait for completion */
while (__raw_readl(ENET_MIND(MDIO_IOBASE)) & MIND_BUSY)
{
if (jiffies > timeout){
printk( KERN_INFO DEV_NAME " I/O error\n");
return -EIO;
}
cpu_relax();
}
return 0;
}
想请教一下,我怎样写测试程序?才能给他们传参数。直接read和write肯定不行呀。有谁知道可以告诉一下吗。
------解决方案--------------------
[Quote=引用:]
(没分了,不好意思,只有这点了。)
我在驱动程序中有下面两个函数
[code=C/C++][/code]
static int tp_mdio_read(struct file *filp, int phy_id, int phyreg)
{
unsigned long timeout = jiffies + ((HZ * 100) / 1000); /* 10……
[/Quote]
需要测试什么呢
------解决方案--------------------
[Quote=引用:]
[Quote=引用:]
[Quote=引用:]
(没分了,不好意思,只有这点了。)
我在驱动程序中有下面两个函数
- C/C++ code
static int tp_mdio_read(struct file *filp, int phy_id, int phyreg){ u……