Quick Reference
This chapter introduced the following symbols related to hardware management:
-
#include <asm/io.h>
,unsigned inb(unsigned port);
,void outb(unsigned char byte, unsigned port);
,unsigned inw(unsigned port);
,void outw(unsigned short word, unsigned port);
,unsigned inl(unsigned port);
,void outl(unsigned doubleword, unsigned port);
These functions are used to read and write I/O ports. They can also be called by user-space programs, provided they have the right privileges to access ports. Not all the platforms support all the functions, which depend on underlying hardware design.
-
SLOW_DOWN_IO;
,unsigned inb_p(unsigned port);
,...
The statement
SLOW_DOWN_IO
is sometimes needed to deal with slow ISA boards on the x86 platform. If a small delay is needed after an I/O operation, you can use the six pausing counterparts of the functions introduced above, whose names end in_p
.-
void insb(unsigned port, void *addr, unsigned long count);
,void outsb(unsigned port, void *addr, unsigned long count);
,void insw(unsigned port, void *addr, unsigned long count);
,void outsw(unsigned port, void *addr, unsigned long count);
,void insl(unsigned port, void *addr, unsigned long count);
,void outsl(unsigned port, void *addr, unsigned long count);
The ``string functions'' are optimized to transfer data from an input port to a region of memory, or the other way round. Such transfers are performed by reading or writing the same port
count
times.-
unsigned readb(address); ...
Get Linux Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.