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

📄 mmc.h

📁 can4linux-3.5.3.gz can4 linux
💻 H
字号:
/************************************************************************//* hardware access functions or macros *//************************************************************************//* Index memory adress * Two meory adresses are defined * first the first address hast to be written with the adress of *    the CAN register to be addressed * second on the second adress read or write the value */#ifdef CAN_INDEXED_MEM_IOstatic inline unsigned Indexed_Inb(void __iomem *base, u32 adr) {unsigned val;    writeb(adr, (void __iomem *)base);    val = readb(base + 1);#ifdef IODEBUG  printk("CANin: base: %x adr: %x, got: %x\n",  	(u32)base, (u8)adr, (u8)val);#endif    return val;}#ifdef IODEBUG#define CANout(bd,adr,v)	do {\        printk("CANout bd:%x base:%p reg:%x val:%x\n", \                bd, (void __iomem *)can_base[bd], \		(u32) &regbase->adr, v); \        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(v, (void __iomem *)can_base[bd] + 1); \  } while(0)#define CANin(bd,adr) 		\	Indexed_Inb((void __iomem *)can_base[bd], (u32)&regbase->adr)#define CANset(bd,adr,m)  {\        unsigned val; \        val = Indexed_Inb((void __iomem *)can_base[bd], (u32) &regbase->adr);\        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(val | m, (void __iomem *)can_base[bd] + 1); \	}#define CANreset(bd,adr,m)  {\        unsigned val; \        val = Indexed_Inb((void __iomem *)can_base[bd], (u32) &regbase->adr);\        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(val & ~m, (void __iomem *)can_base[bd] + 1); \}/* not used, not filled, causes error at compile time */#define CANtest(bd,adr,m) (x)#else   /* IODEBUG */#define CANout(bd,adr,v)	do {\        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(v, (void __iomem *)can_base[bd] + 1); \  } while(0)#define CANin(bd,adr) 		\	Indexed_Inb((void __iomem *)can_base[bd], (u32)&regbase->adr)#define CANset(bd,adr,m)  {\        unsigned val; \        val = Indexed_Inb((void __iomem *)can_base[bd], (u32) &regbase->adr);\        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(val | m, (void __iomem *)can_base[bd] + 1); \	}#define CANreset(bd,adr,m)  {\        unsigned val; \        val = Indexed_Inb((void __iomem *)can_base[bd], (u32) &regbase->adr);\        writeb((u32) &regbase->adr, (void __iomem *)can_base[bd]); \        writeb(val & ~m, (void __iomem *)can_base[bd] + 1); \}/* not used, not filled, causes error at compile time */#define CANtest(bd,adr,m) (x)#endif#endif

⌨️ 快捷键说明

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