root/include/asm/io.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. outb
  2. inb
  3. outb_p
  4. inb_p

   1 #ifndef _ASM_IO_H
   2 #define _ASM_IO_H
   3 
   4 /*
   5  * Thanks to James van Artsdalen for a better timing-fix than
   6  * the two short jumps: using outb's to a nonexistent port seems
   7  * to guarantee better timings even on fast machines.
   8  *
   9  * On the other hand, I'd like to be sure of a non-existent port:
  10  * I feel a bit unsafe abou using 0x80.
  11  *
  12  *              Linus
  13  */
  14 
  15 #ifdef SLOW_IO_BY_JUMPING
  16 #define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
  17 #else
  18 #define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
  19 #endif
  20 
  21 #ifdef REALLY_SLOW_IO
  22 #define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
  23 #else
  24 #define SLOW_DOWN_IO __SLOW_DOWN_IO
  25 #endif
  26 
  27 extern inline void outb(char value, unsigned short port)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29 __asm__ __volatile__ ("outb %%al,%%dx"
  30                 ::"a" ((char) value),"d" ((unsigned short) port));
  31 }
  32 
  33 extern inline unsigned int inb(unsigned short port)
     /* [previous][next][first][last][top][bottom][index][help] */
  34 {
  35         unsigned int _v;
  36 __asm__ __volatile__ ("inb %%dx,%%al"
  37                 :"=a" (_v):"d" ((unsigned short) port),"0" (0));
  38         return _v;
  39 }
  40 
  41 extern inline void outb_p(char value, unsigned short port)
     /* [previous][next][first][last][top][bottom][index][help] */
  42 {
  43 __asm__ __volatile__ ("outb %%al,%%dx"
  44                 ::"a" ((char) value),"d" ((unsigned short) port));
  45         SLOW_DOWN_IO;
  46 }
  47 
  48 extern inline unsigned int inb_p(unsigned short port)
     /* [previous][next][first][last][top][bottom][index][help] */
  49 {
  50         unsigned int _v;
  51 __asm__ __volatile__ ("inb %%dx,%%al"
  52                 :"=a" (_v):"d" ((unsigned short) port),"0" (0));
  53         SLOW_DOWN_IO;
  54         return _v;
  55 }
  56 
  57 #endif

/* [previous][next][first][last][top][bottom][index][help] */