11 2018 档案

摘要:内核中的数据类型主要是为了增强可移植性。 Standard C Types 从下表可以看到标准C语言各个数据类型在不同的平台上占用的存储空间(以字节计)可能不同: 为此,内核定义了长度和平台无关的数据类型:u8,u16,u32,u64。 Interface-Specific Types 内核中常用的 阅读全文
posted @ 2018-11-21 17:13 glob 阅读(201) 评论(0) 推荐(0)
摘要:写在前面:中断处理程序和其他代码同时运行,在处理中断时要注意相关数据结构和硬件的并发访问控制。 Installing an Interrupt Handler 中断连接线(interrupt lines)数量有限,是珍贵的资源,驱动程序要在使用之前请求系统分配中断连接线,使用完后还要释放。相关的函数 阅读全文
posted @ 2018-11-20 16:52 glob 阅读(459) 评论(0) 推荐(0)
摘要:I/O Ports and I/O Memory 所有的外设都通过读写其寄存器来控制,一个外设在内存地址空间或者I/O地址空间有多个寄存器。 访问I/O寄存器的操作可能会有副作用——有些寄存器在访问后会清零,因此这些寄存器的值不能缓存在高速缓存中。内核提供了相关接口: 1 #include <lin 阅读全文
posted @ 2018-11-16 15:19 glob 阅读(236) 评论(0) 推荐(0)
摘要:kmalloc kmalloc速度很快,分配的内存物理连续,但是分配的内存并未清零。kmalloc定义如下: 1 #include <linux/slab.h> 2 void *kmalloc(size_t size, int flags); flags参数会在多个方面影响kmalloc的行为,定义 阅读全文
posted @ 2018-11-15 11:29 glob 阅读(285) 评论(0) 推荐(0)
摘要:Measuring Time Lapses 系统用来计时的变量是jiffies_64,在系统启动时会初始化为0,相关的函数都定义在linux/jiffies.h中;相关的宏定义还有HZ。下列代码是jiffies和HZ的使用方法: 1 #include <linux/jiffies.h> 2 unsi 阅读全文
posted @ 2018-11-14 09:37 glob 阅读(182) 评论(0) 推荐(0)
摘要:ioctl ioctl是驱动程序向用户提供的控制设备的接口。用户空间的ioctl系统调用的形式如下: int ioctl(int fd, unsigned long cmd, ...); 驱动程序的ioctl形式有所不同: int ioctl(int fd, unsigned long cmd, . 阅读全文
posted @ 2018-11-09 17:54 glob 阅读(174) 评论(0) 推荐(0)
摘要:Device registeration The kernel uses structures of type struct cdev to represent char devices internally. Include <linux/cdev.h> so that you can use t 阅读全文
posted @ 2018-11-07 10:55 glob 阅读(169) 评论(0) 推荐(0)
摘要:/proc /proc filesystem is a special, software-created filesystem that is used by the kernel to export information to the world. If you want to work wi 阅读全文
posted @ 2018-11-07 10:46 glob 阅读(142) 评论(0) 推荐(0)
摘要:Spinlock Spinlock usually used in code that cannot sleep, thus has higher performance than semaphores. Spinlock is implemented as a bit in an integer 阅读全文
posted @ 2018-11-07 10:18 glob 阅读(199) 评论(0) 推荐(0)
摘要:简介 tty源自teletypewriter——最初用于连接Unix的物理或虚拟终端;由于终端可以建立在串口上,后来tty也指任何串口设备。 物理tty设备包括串口,USB-串口转换器,还有一些调制解调器;虚拟tty设备通过网络连接或者xterm会话登陆计算机的虚拟控制台。 下图是tty的系统结构图 阅读全文
posted @ 2018-11-06 17:09 glob 阅读(277) 评论(0) 推荐(0)
摘要:绪言 最近搜狗输入法总是弹出一些莫名其妙的东西,让人防不胜防,换一个输入法的想法涌上心头。先到知乎看了一下输入法的相关问题,发现大家对搜狗的输入法怨念很深,很多人都推荐rime。我又到腾讯软件中心查看了输入法的相关软件,得到以下备选项:google拼音、rime、QQ拼音、bing、讯飞。 goog 阅读全文
posted @ 2018-11-06 09:12 glob 阅读(1587) 评论(0) 推荐(0)
摘要:简介 PCI(Peripheral Component Interconnect)用来指明计算机的各个部分如何进行交互,用来取代ISA(Industry Standard Architecture),实现更高效的、平台独立的、使外围设备更加易于移动的总线标准。 每个PCI设备通过bus number 阅读全文
posted @ 2018-11-02 10:47 glob 阅读(303) 评论(0) 推荐(0)