linux_compat.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * (C) 2000 R.E.Wolff@BitWizard.nl
  3.  *
  4.  *      This program is free software; you can redistribute it and/or modify
  5.  *      it under the terms of the GNU General Public License as published by
  6.  *      the Free Software Foundation; either version 2 of the License, or
  7.  *      (at your option) any later version.
  8.  *
  9.  *      This program is distributed in the hope that it will be useful,
  10.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  *      GNU General Public License for more details.
  13.  *
  14.  *      You should have received a copy of the GNU General Public License
  15.  *      along with this program; if not, write to the Free Software
  16.  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  */
  18. #include <asm/hardirq.h>
  19. #define disable(oldspl) save_flags (oldspl)
  20. #define restore(oldspl) restore_flags (oldspl)
  21. #define sysbrk(x) kmalloc ((x),in_interrupt()? GFP_ATOMIC : GFP_KERNEL)
  22. #define sysfree(p,size) kfree ((p))
  23. #define WBYTE(p,v) writeb(v, &p)
  24. #define RBYTE(p)   readb (&p)
  25. #define WWORD(p,v) writew(v, &p)
  26. #define RWORD(p)   readw(&p)
  27. #define WINDW(p,v) writew(v, p)
  28. #define RINDW(p)   readw(p)
  29. #define DEBUG_ALL
  30. #define cprintf printk
  31. #ifdef __KERNEL__
  32. #define INKERNEL
  33. #endif
  34. struct ttystatics {
  35.   struct termios tm;
  36. };
  37. #define bzero(d, n)         memset((d), 0, (n))
  38. #define bcopy(src, dest, n) memcpy ((dest), (src), (n))
  39. #define SEM_SIGIGNORE 0x1234
  40. #ifdef DEBUG_SEM
  41. #define swait(a,b)      printk ("waiting:    " __FILE__ " line %dn", __LINE__)
  42. #define ssignal(sem)    printk ("signalling: " __FILE__ " line %dn", __LINE__)
  43. #define sreset(sem)     printk ("sreset:     " __FILE__ "n")
  44. #define sem_init(sem,v) printk ("sreset:     " __FILE__ "n")
  45. #endif
  46. #define getpid()    (current->pid)
  47. #define QSIZE SERIAL_XMIT_SIZE
  48. #define pseterr(errno) return (- errno)
  49. #define V_CBAUD CBAUD
  50. /* For one reason or another rioboot.c uses delay instead of RIODelay. */
  51. #define delay(x,y) RIODelay(NULL, y)
  52. extern int rio_debug;
  53. #define RIO_DEBUG_INIT         0x000001
  54. #define RIO_DEBUG_BOOT         0x000002
  55. #define RIO_DEBUG_CMD          0x000004
  56. #define RIO_DEBUG_CTRL         0x000008
  57. #define RIO_DEBUG_INTR         0x000010
  58. #define RIO_DEBUG_PARAM        0x000020
  59. #define RIO_DEBUG_ROUTE        0x000040
  60. #define RIO_DEBUG_TABLE        0x000080
  61. #define RIO_DEBUG_TTY          0x000100
  62. #define RIO_DEBUG_FLOW         0x000200
  63. #define RIO_DEBUG_MODEMSIGNALS 0x000400
  64. #define RIO_DEBUG_PROBE        0x000800
  65. #define RIO_DEBUG_CLEANUP      0x001000
  66. #define RIO_DEBUG_IFLOW        0x002000
  67. #define RIO_DEBUG_PFE          0x004000
  68. #define RIO_DEBUG_REC          0x008000
  69. #define RIO_DEBUG_SPINLOCK     0x010000
  70. #define RIO_DEBUG_DELAY        0x020000
  71. #define RIO_DEBUG_MOD_COUNT    0x040000
  72. /* Copied over from riowinif.h . This is ugly. The winif file declares
  73. also much other stuff which is incompatible with the headers from
  74. the older driver. The older driver includes "brates.h" which shadows
  75. the definitions from Linux, and is incompatible... */
  76. /* RxBaud and TxBaud definitions... */
  77. #define RIO_B0 0x00 /* RTS / DTR signals dropped */
  78. #define RIO_B50 0x01 /* 50 baud */
  79. #define RIO_B75 0x02 /* 75 baud */
  80. #define RIO_B110 0x03 /* 110 baud */
  81. #define RIO_B134 0x04 /* 134.5 baud */
  82. #define RIO_B150 0x05 /* 150 baud */
  83. #define RIO_B200 0x06 /* 200 baud */
  84. #define RIO_B300 0x07 /* 300 baud */
  85. #define RIO_B600 0x08 /* 600 baud */
  86. #define RIO_B1200 0x09 /* 1200 baud */
  87. #define RIO_B1800 0x0A /* 1800 baud */
  88. #define RIO_B2400 0x0B /* 2400 baud */
  89. #define RIO_B4800 0x0C /* 4800 baud */
  90. #define RIO_B9600 0x0D /* 9600 baud */
  91. #define RIO_B19200 0x0E /* 19200 baud */
  92. #define RIO_B38400 0x0F /* 38400 baud */
  93. #define RIO_B56000 0x10 /* 56000 baud */
  94. #define RIO_B57600 0x11 /* 57600 baud */
  95. #define RIO_B64000 0x12 /* 64000 baud */
  96. #define RIO_B115200 0x13 /* 115200 baud */
  97. #define RIO_B2000 0x14 /* 2000 baud */