jjs
jjs
驱动牛犊
驱动牛犊
  • 注册日期2001-06-12
  • 最后登录2004-06-01
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1878回复:4

请高手看看这段代码

楼主#
更多 发布于:2003-06-06 12:28
请高手看看这段代码
这段代码只是想某个设备是否存在,但是编译出来的模块不能加载,错误如下:
warning: loading ./muni.o will taint the kernel:no license
see http://www.tux.org/lkml/#export-tainted for inofrmation
about taint module

./muni.o:init_module :no such device
hint:insmod error can be cause by incorrect module parameter
,include invalid io or irq parameter
请各位大侠帮忙!!!!!!!!!

#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ioport.h>

#include <linux/delay.h>
#include <linux/version.h>
#include <asm/io.h>

#if LINUX_VERSION_CODE < 0x20407
#else

#include <linux/completion.h>
#endif

#define MUNICH256_VERSION \"1.0.0\"
#define MODNAME \"muni\"
#define MUNICH256_DRIVER_NAME   MODNAME \" Signal Process \" MUNICH256_VERSION
#define PFX MODNAME \": \"

typedef enum {
MUNICH256 = 0,
MUNICH256_CB,
SMC1211TX,
/*MPX5030,*/
DELTA256,
ADDTRON256,
DFE538TX,
MUNICH312,
} board_t;



static struct pci_device_id munich256_pci_tbl[] __devinitdata = {
{0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },

{0,}
};
MODULE_DEVICE_TABLE (pci, munich256_pci_tbl);

/* The rest of these values should never change. */
typedef struct
{
  u32 cspec_cmd;          /* 000 */
  u32 cspec_mode_rec;     /* 004 */
   u32 cspec_rec_accm;     /* 008 */
   u32 Register00c;
   u32 Register010;
   u32 cspec_mode_xmit;    /* 014 */
   u32 cspec_xmit_accm;    /* 018 */
   u32 Register01c;
   u32 cspec_buffer;       /* 020 */
   /*DESCR_PTR*/ u32 cspec_frda;      /* 024 */
   /*DESCR_PTR*/ u32 cspec_ftda;      /* 028 */
   u32 cspec_imask;        /* 02c */
   u32 Register030;
   u32 Register034;
   u32 Register038;
   u32 Register03c;
   u32 conf1;              /* 040 */
   u32 conf2;              /* 044 */
   u32 conf3;              /* 048 */
   u32 rbaft;              /* 04c */
   u32 sfdt;               /* 050 */
   u32 Register054;
   u32 tac;                /* 058 ***/
   u32 td;                 /* 05c ***/
   u32 pmiar;              /* 060 */
   u32 pmr;                /* 064 */
   u32 ren;                /* 068 */
   u32 ten;                /* 06c */
   u32 tsaia;              /* 070 */
   u32 tsad;               /* 074 */
   u32 Register078;
   u32 Register07c;
   u32 rec_accmx;          /* 080 */
   u32 rbafc;              /* 084 */
   u32 sfdia;              /* 088 */
   u32 sfdc;               /* 08c */
   u32 xmit_accmx;         /* 090 */
   u32 Register094;
   u32 Register098;
   u32 Register09c;
   u32 Register0a0;
   u32 Register0a4;
   u32 Register0a8;
   u32 Register0ac;
   u32 rbmon;              /* 0b0 */
   u32 rbth;               /* 0b4 */
   u32 Register0b8;
   u32 Register0bc;
   u32 Register0c0;
   u32 Register0c4;
   u32 Register0c8;
   u32 Register0cc;
   u32 Register0d0;
   u32 Register0d4;
   u32 Register0d8;
   u32 Register0dc;
   u32 iqia;               /* 0e0 */
   u32 iqd;                /* 0e4 */
   u32 iql;                /* 0e8 */
   u32 iqhpm;              /* 0ec */
   u32 gista;              /* 0f0 */
   u32 gmask;              /* 0f4 */
   u32 Register0f8;
   u32 Register0fc;
   u32 fconf;              /* 100 */
   u32 mtimer;             /* 104 */
   u32 intctrl;            /* 108 */
   u32 intfifo;            /* 10c */
   u32 tregsel;            /* 110 */
   u32 tdata;              /* 114 */
   u32 rregsel;            /* 118 */
   u32 rdata;              /* 11c */
   u32 fregsel;            /* 120 */
   u32 fdata;              /* 124 */
   u32 Register128;
   u32 Register12c;
   u32 Register130;
   u32 Register134;
   u32 Register138;
   u32 Register13c;
   u32 mbe2p[8];           /* 140..15c */
   u32 mbp2e[8];           /* 160..17c */
} M256_GLOBAL_REG;



#  define DPRINTK(fmt, args...) printk(KERN_DEBUG \"%s: \" fmt, __FUNCTION__ , ## args)
#  define assert(expr) do {} while (0)
typedef enum {
CH_256 = 0,
CH_256_K,
CH_256A,
CH_256B,
CH_256D,
CH_256C,
CH_256CP,
} chip_t;


/* directly indexed by chip_t, above */

#define MAX_UNITS 8
static int media[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};

static int mulch_limit = 32;
static int max_interrupt_work = 20;
MODULE_AUTHOR (\"jjs\");
MODULE_DESCRIPTION (\"Munich256 Signal Process  driver\");
MODULE_PARM (mulch_limit, \"i\");
MODULE_PARM (max_interrupt_work, \"i\");
MODULE_PARM (media, \"1-\" __MODULE_STRING(MAX_UNITS) \"i\");
MODULE_PARM (full_duplex, \"1-\" __MODULE_STRING(MAX_UNITS) \"i\");




static int __devinit Munich256_init_one (struct pci_dev *pdev,
      const struct pci_device_id *ent)
{

/* void *ioaddr = NULL;*/
static int board_idx = -1;
static int printed_version;

        printed_version=0;
DPRINTK (\"ENTER\\n\");

assert (pdev != NULL);
assert (ent != NULL);

board_idx++;

if (!printed_version)
{
printk (KERN_INFO  \"Found device\\n\");
printed_version = 1;
}


assert (ioaddr != NULL);
assert (dev != NULL);
assert (tp != NULL);


return 0;
}


static void __devexit Munich256_remove_one (struct pci_dev *pdev)
{

pdev->driver_data = NULL;

DPRINTK (\"EXIT\\n\");
}



static struct pci_driver munich256_pci_driver = {
name: MODNAME,
id_table: munich256_pci_tbl,
probe: Munich256_init_one,
remove: Munich256_remove_one,
};


static int __init Munich256_init_module (void)
{
printk(KERN_INFO \"input\");
return pci_module_init (&munich256_pci_driver);
}


static void __exit Munich256_cleanup_module (void)
{
pci_unregister_driver (&munich256_pci_driver);
}


module_init(Munich256_init_module);
module_exit(Munich256_init_module);
tigerzd
驱动老牛
驱动老牛
  • 注册日期2001-08-25
  • 最后登录2004-12-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-06-06 16:11
加上
MODULE_LICENSE(\"GPL\");
试试。
犯强汉者,虽远必诛! [img]http://www.driverdevelop.com/forum/upload/tigerzd/2002-12-13_sf10.JPG[/img]
jjs
jjs
驱动牛犊
驱动牛犊
  • 注册日期2001-06-12
  • 最后登录2004-06-01
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-06-06 16:46
谢谢!

warning: loading ./muni.o will taint the kernel:no license
see http://www.tux.org/lkml/#export-tainted for inofrmation
about taint module
这个警告没有了,可是下面的错误还在,仍旧无法加载模块
./muni.o:init_module :no such device
hint:insmod error can be cause by incorrect module parameter
,include invalid io or irq parameter
我的驱动程序是PCI卡,./muni.o:init_module :no such device是不是说我的VID,DID不对呢?
tigerzd
驱动老牛
驱动老牛
  • 注册日期2001-08-25
  • 最后登录2004-12-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-06-06 18:17
这个是你程序的逻辑错误了.建议你找相应的PCI驱动(比如显卡\\网卡)读一读.
犯强汉者,虽远必诛! [img]http://www.driverdevelop.com/forum/upload/tigerzd/2002-12-13_sf10.JPG[/img]
jjs
jjs
驱动牛犊
驱动牛犊
  • 注册日期2001-06-12
  • 最后登录2004-06-01
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2003-06-06 20:44
我的程序就是按照RTL8139的程序改的呀,只是我把PCI卡初始化的部分给去掉了
MODULE_PARM 在哪里用啊
pci_module_init 是在哪个文件里定义的呢
游客

返回顶部