cs.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * cs.h
  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 version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * The initial developer of the original code is David A. Hinds
  9. * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
  10. * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
  11. *
  12. * (C) 1999 David A. Hinds
  13. */
  14. #ifndef _LINUX_CS_H
  15. #define _LINUX_CS_H
  16. #ifdef __KERNEL__
  17. #include <linux/interrupt.h>
  18. #endif
  19. /* For AccessConfigurationRegister */
  20. typedef struct conf_reg_t {
  21. u_char Function;
  22. u_int Action;
  23. off_t Offset;
  24. u_int Value;
  25. } conf_reg_t;
  26. /* Actions */
  27. #define CS_READ 1
  28. #define CS_WRITE 2
  29. /* for AdjustResourceInfo */
  30. /* Action field */
  31. #define REMOVE_MANAGED_RESOURCE 1
  32. #define ADD_MANAGED_RESOURCE 2
  33. /* For CardValues field */
  34. #define CV_OPTION_VALUE 0x01
  35. #define CV_STATUS_VALUE 0x02
  36. #define CV_PIN_REPLACEMENT 0x04
  37. #define CV_COPY_VALUE 0x08
  38. #define CV_EXT_STATUS 0x10
  39. /* ModifyConfiguration */
  40. typedef struct modconf_t {
  41. u_int Attributes;
  42. u_int Vcc, Vpp1, Vpp2;
  43. } modconf_t;
  44. /* Attributes for ModifyConfiguration */
  45. #define CONF_IRQ_CHANGE_VALID 0x0100
  46. #define CONF_VCC_CHANGE_VALID 0x0200
  47. #define CONF_VPP1_CHANGE_VALID 0x0400
  48. #define CONF_VPP2_CHANGE_VALID 0x0800
  49. #define CONF_IO_CHANGE_WIDTH 0x1000
  50. /* For RequestConfiguration */
  51. typedef struct config_req_t {
  52. u_int Attributes;
  53. u_int Vpp; /* both Vpp1 and Vpp2 */
  54. u_int IntType;
  55. u_int ConfigBase;
  56. u_char Status, Pin, Copy, ExtStatus;
  57. u_char ConfigIndex;
  58. u_int Present;
  59. } config_req_t;
  60. /* Attributes for RequestConfiguration */
  61. #define CONF_ENABLE_IRQ 0x01
  62. #define CONF_ENABLE_DMA 0x02
  63. #define CONF_ENABLE_SPKR 0x04
  64. #define CONF_ENABLE_PULSE_IRQ 0x08
  65. #define CONF_VALID_CLIENT 0x100
  66. /* IntType field */
  67. #define INT_MEMORY 0x01
  68. #define INT_MEMORY_AND_IO 0x02
  69. #define INT_CARDBUS 0x04
  70. #define INT_ZOOMED_VIDEO 0x08
  71. /* For RequestIO and ReleaseIO */
  72. typedef struct io_req_t {
  73. u_int BasePort1;
  74. u_int NumPorts1;
  75. u_int Attributes1;
  76. u_int BasePort2;
  77. u_int NumPorts2;
  78. u_int Attributes2;
  79. u_int IOAddrLines;
  80. } io_req_t;
  81. /* Attributes for RequestIO and ReleaseIO */
  82. #define IO_SHARED 0x01
  83. #define IO_FIRST_SHARED 0x02
  84. #define IO_FORCE_ALIAS_ACCESS 0x04
  85. #define IO_DATA_PATH_WIDTH 0x18
  86. #define IO_DATA_PATH_WIDTH_8 0x00
  87. #define IO_DATA_PATH_WIDTH_16 0x08
  88. #define IO_DATA_PATH_WIDTH_AUTO 0x10
  89. /* Bits in IRQInfo1 field */
  90. #define IRQ_NMI_ID 0x01
  91. #define IRQ_IOCK_ID 0x02
  92. #define IRQ_BERR_ID 0x04
  93. #define IRQ_VEND_ID 0x08
  94. #define IRQ_INFO2_VALID 0x10
  95. #define IRQ_LEVEL_ID 0x20
  96. #define IRQ_PULSE_ID 0x40
  97. #define IRQ_SHARE_ID 0x80
  98. /* Configuration registers present */
  99. #define PRESENT_OPTION 0x001
  100. #define PRESENT_STATUS 0x002
  101. #define PRESENT_PIN_REPLACE 0x004
  102. #define PRESENT_COPY 0x008
  103. #define PRESENT_EXT_STATUS 0x010
  104. #define PRESENT_IOBASE_0 0x020
  105. #define PRESENT_IOBASE_1 0x040
  106. #define PRESENT_IOBASE_2 0x080
  107. #define PRESENT_IOBASE_3 0x100
  108. #define PRESENT_IOSIZE 0x200
  109. /* For GetMemPage, MapMemPage */
  110. typedef struct memreq_t {
  111. u_int CardOffset;
  112. u_short Page;
  113. } memreq_t;
  114. /* For ModifyWindow */
  115. typedef struct modwin_t {
  116. u_int Attributes;
  117. u_int AccessSpeed;
  118. } modwin_t;
  119. /* For RequestWindow */
  120. typedef struct win_req_t {
  121. u_int Attributes;
  122. u_long Base;
  123. u_int Size;
  124. u_int AccessSpeed;
  125. } win_req_t;
  126. /* Attributes for RequestWindow */
  127. #define WIN_ADDR_SPACE 0x0001
  128. #define WIN_ADDR_SPACE_MEM 0x0000
  129. #define WIN_ADDR_SPACE_IO 0x0001
  130. #define WIN_MEMORY_TYPE 0x0002
  131. #define WIN_MEMORY_TYPE_CM 0x0000
  132. #define WIN_MEMORY_TYPE_AM 0x0002
  133. #define WIN_ENABLE 0x0004
  134. #define WIN_DATA_WIDTH 0x0018
  135. #define WIN_DATA_WIDTH_8 0x0000
  136. #define WIN_DATA_WIDTH_16 0x0008
  137. #define WIN_DATA_WIDTH_32 0x0010
  138. #define WIN_PAGED 0x0020
  139. #define WIN_SHARED 0x0040
  140. #define WIN_FIRST_SHARED 0x0080
  141. #define WIN_USE_WAIT 0x0100
  142. #define WIN_STRICT_ALIGN 0x0200
  143. #define WIN_MAP_BELOW_1MB 0x0400
  144. #define WIN_PREFETCH 0x0800
  145. #define WIN_CACHEABLE 0x1000
  146. #define WIN_BAR_MASK 0xe000
  147. #define WIN_BAR_SHIFT 13
  148. /* Flag to bind to all functions */
  149. #define BIND_FN_ALL 0xff
  150. #endif /* _LINUX_CS_H */