Includeasmx86io32h

#define BUILDIO(bwl,bw,type) \

static inline void out##bwl##_local(unsigned type value, int port) { \

_asm_ _volatile_("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \

bwl accepts one of the three values b, l, or w depending on the data type for which the function is defined. type specifies the corresponding C data type. The macro is called as follows to define char operations or byte operations:

BUILDIO(b,b,char)

After processing by the pre-processor, the C file contains the following code (extra line breaks have been added to improve readability):

static inline void outb_local(unsigned char value, int port) { _ _asm_ _volatile_("out" "b" " %" "b" "0, %w1"

Continue reading here: Driversblockataflopc

Was this article helpful?

0 0