在程序中调用下面这段代码可以读到DM9000的ID号: #define DM9000_BASE 0x20000300 #define DM9000_DATA_OFFSET 4 static U8 dm9000_ior(int reg) { *(volatile U8 *)DM9000_BASE = reg; return *(volatile U8 *)(DM9000_BASE+DM9000_DATA_OFFSET); } static void rd_dm9000_id(void) { U16 id; id = dm9000_ior(0x28) | (dm9000_ior(0x29)<<8); printf(“read dm9000 vid = 0x%x\n”, id); id = dm9000_ior(0x2a) | (dm9000_ior(0x2b)<<8); printf(“read dm9000 pid = 0x%x\n”, id); id = dm9000_ior(0x8) | (dm9000_ior(0x9)<<8); printf(“read dm9000 reg(0x09,0x08) = 0x%x\n”, id); printf(“dm9000 isr = 0x%x\n”, dm9000_ior(0xfe)); }
转载于:https://www.cnblogs.com/xilentz/archive/2010/07/12/1775546.html
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/110756.html原文链接:https://javaforall.cn