随笔分类 - linux驱动随笔
摘要:// 当用户进程使用select()或poll()方式访问active属性文件时,用户进程可能会进入阻塞状态,// 该函数用来唤醒因访问active属性文件而阻塞的进程void console_sysfs_notify(void){if (consdev)sysfs_notify(&consdev-...
阅读全文
摘要:问题:应用程序如何通过一个字符设备文件找到对应的字符设备?本文主要分析linux-2.6.28内核版本的字符设备抽象层源码文件char_dev.c。该文件代码量不大,但其为linux应用程序访问实际字符型硬件设备搭建了桥梁,进一步限定了linux字符设备驱动的设计框架。 1 // 初始化kobj_...
阅读全文
摘要:linux DM9000网卡驱动中设置多播地址函数代码为: 1 static void 2 dm9000_hash_table_unlocked(struct net_device *dev) 3 { 4 board_info_t *db = netdev_priv(dev); 5 struct netdev_hw_addr *ha; 6 int i, oft; 7 u32 hash_val; 8 u16 hash_table[4]; 9 u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN;10 11 ...
阅读全文
摘要:本文描述基于mini6410平台的time.c中的相关代码,主要描述下对部分代码的理解。先贴上代码: 1 /* we use the shifted arithmetic to work out the ratio of timer ticks 2 * to usecs, as often the peripheral clock is not a nice even multiple 3 * of 1MHz. 4 * 5 * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok 6 * for the cur...
阅读全文

浙公网安备 33010602011771号