cs.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. /* For AccessConfigurationRegister */
  17. typedef struct conf_reg_t {
  18. u_char Function;
  19. u_int Action;
  20. off_t Offset;
  21. u_int Value;
  22. } conf_reg_t;
  23. /* Actions */
  24. #define CS_READ 1
  25. #define CS_WRITE 2
  26. /* for AdjustResourceInfo */
  27. /* Action field */
  28. #define REMOVE_MANAGED_RESOURCE 1
  29. #define ADD_MANAGED_RESOURCE 2
  30. typedef struct event_callback_args_t {
  31. struct pcmcia_device *client_handle;
  32. void *client_data;
  33. } event_callback_args_t;
  34. /* For CardValues field */
  35. #define CV_OPTION_VALUE 0x01
  36. #define CV_STATUS_VALUE 0x02
  37. #define CV_PIN_REPLACEMENT 0x04
  38. #define CV_COPY_VALUE 0x08
  39. #define CV_EXT_STATUS 0x10
  40. /* For GetFirst/NextClient */
  41. typedef struct client_req_t {
  42. socket_t Socket;
  43. u_int Attributes;
  44. } client_req_t;
  45. #define CLIENT_THIS_SOCKET 0x01
  46. /* ModifyConfiguration */
  47. typedef struct modconf_t {
  48. u_int Attributes;
  49. u_int Vcc, Vpp1, Vpp2;
  50. } modconf_t;
  51. /* Attributes for ModifyConfiguration */
  52. #define CONF_IRQ_CHANGE_VALID 0x0100
  53. #define CONF_VCC_CHANGE_VALID 0x0200
  54. #define CONF_VPP1_CHANGE_VALID 0x0400
  55. #define CONF_VPP2_CHANGE_VALID 0x0800
  56. #define CONF_IO_CHANGE_WIDTH 0x1000
  57. /* For RequestConfiguration */
  58. typedef struct config_req_t {
  59. u_int Attributes;
  60. u_int Vpp; /* both Vpp1 and Vpp2 */
  61. u_int IntType;
  62. u_int ConfigBase;
  63. u_char Status, Pin, Copy, ExtStatus;
  64. u_char ConfigIndex;
  65. u_int Present;
  66. } config_req_t;
  67. /* Attributes for RequestConfiguration */
  68. #define CONF_ENABLE_IRQ 0x01
  69. #define CONF_ENABLE_DMA 0x02
  70. #define CONF_ENABLE_SPKR 0x04
  71. #define CONF_VALID_CLIENT 0x100
  72. /* IntType field */
  73. #define INT_MEMORY 0x01
  74. #define INT_MEMORY_AND_IO 0x02
  75. #define INT_CARDBUS 0x04
  76. #define INT_ZOOMED_VIDEO 0x08
  77. /* For RequestIO and ReleaseIO */
  78. typedef struct io_req_t {
  79. u_int BasePort1;
  80. u_int NumPorts1;
  81. u_int Attributes1;
  82. u_int BasePort2;
  83. u_int NumPorts2;
  84. u_int Attributes2;
  85. u_int IOAddrLines;
  86. } io_req_t;
  87. /* Attributes for RequestIO and ReleaseIO */
  88. #define IO_SHARED 0x01
  89. #define IO_FIRST_SHARED 0x02
  90. #define IO_FORCE_ALIAS_ACCESS 0x04
  91. #define IO_DATA_PATH_WIDTH 0x18
  92. #define IO_DATA_PATH_WIDTH_8 0x00
  93. #define IO_DATA_PATH_WIDTH_16 0x08
  94. #define IO_DATA_PATH_WIDTH_AUTO 0x10
  95. /* For RequestIRQ and ReleaseIRQ */
  96. typedef struct irq_req_t {
  97. u_int Attributes;
  98. u_int AssignedIRQ;
  99. u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */
  100. void *Handler;
  101. void *Instance;
  102. } irq_req_t;
  103. /* Attributes for RequestIRQ and ReleaseIRQ */
  104. #define IRQ_TYPE 0x03
  105. #define IRQ_TYPE_EXCLUSIVE 0x00
  106. #define IRQ_TYPE_TIME 0x01
  107. #define IRQ_TYPE_DYNAMIC_SHARING 0x02
  108. #define IRQ_FORCED_PULSE 0x04
  109. #define IRQ_FIRST_SHARED 0x08
  110. #define IRQ_HANDLE_PRESENT 0x10
  111. #define IRQ_PULSE_ALLOCATED 0x100
  112. /* Bits in IRQInfo1 field */
  113. #define IRQ_MASK 0x0f
  114. #define IRQ_NMI_ID 0x01
  115. #define IRQ_IOCK_ID 0x02
  116. #define IRQ_BERR_ID 0x04
  117. #define IRQ_VEND_ID 0x08
  118. #define IRQ_INFO2_VALID 0x10
  119. #define IRQ_LEVEL_ID 0x20
  120. #define IRQ_PULSE_ID 0x40
  121. #define IRQ_SHARE_ID 0x80
  122. typedef struct eventmask_t {
  123. u_int Attributes;
  124. u_int EventMask;
  125. } eventmask_t;
  126. #define CONF_EVENT_MASK_VALID 0x01
  127. /* Configuration registers present */
  128. #define PRESENT_OPTION 0x001
  129. #define PRESENT_STATUS 0x002
  130. #define PRESENT_PIN_REPLACE 0x004
  131. #define PRESENT_COPY 0x008
  132. #define PRESENT_EXT_STATUS 0x010
  133. #define PRESENT_IOBASE_0 0x020
  134. #define PRESENT_IOBASE_1 0x040
  135. #define PRESENT_IOBASE_2 0x080
  136. #define PRESENT_IOBASE_3 0x100
  137. #define PRESENT_IOSIZE 0x200
  138. /* For GetMemPage, MapMemPage */
  139. typedef struct memreq_t {
  140. u_int CardOffset;
  141. page_t Page;
  142. } memreq_t;
  143. /* For ModifyWindow */
  144. typedef struct modwin_t {
  145. u_int Attributes;
  146. u_int AccessSpeed;
  147. } modwin_t;
  148. /* For RequestWindow */
  149. typedef struct win_req_t {
  150. u_int Attributes;
  151. u_long Base;
  152. u_int Size;
  153. u_int AccessSpeed;
  154. } win_req_t;
  155. /* Attributes for RequestWindow */
  156. #define WIN_ADDR_SPACE 0x0001
  157. #define WIN_ADDR_SPACE_MEM 0x0000
  158. #define WIN_ADDR_SPACE_IO 0x0001
  159. #define WIN_MEMORY_TYPE 0x0002
  160. #define WIN_MEMORY_TYPE_CM 0x0000
  161. #define WIN_MEMORY_TYPE_AM 0x0002
  162. #define WIN_ENABLE 0x0004
  163. #define WIN_DATA_WIDTH 0x0018
  164. #define WIN_DATA_WIDTH_8 0x0000
  165. #define WIN_DATA_WIDTH_16 0x0008
  166. #define WIN_DATA_WIDTH_32 0x0010
  167. #define WIN_PAGED 0x0020
  168. #define WIN_SHARED 0x0040
  169. #define WIN_FIRST_SHARED 0x0080
  170. #define WIN_USE_WAIT 0x0100
  171. #define WIN_STRICT_ALIGN 0x0200
  172. #define WIN_MAP_BELOW_1MB 0x0400
  173. #define WIN_PREFETCH 0x0800
  174. #define WIN_CACHEABLE 0x1000
  175. #define WIN_BAR_MASK 0xe000
  176. #define WIN_BAR_SHIFT 13
  177. typedef struct error_info_t {
  178. int func;
  179. int retcode;
  180. } error_info_t;
  181. /* Flag to bind to all functions */
  182. #define BIND_FN_ALL 0xff
  183. /* Events */
  184. #define CS_EVENT_PRI_LOW 0
  185. #define CS_EVENT_PRI_HIGH 1
  186. #define CS_EVENT_WRITE_PROTECT 0x000001
  187. #define CS_EVENT_CARD_LOCK 0x000002
  188. #define CS_EVENT_CARD_INSERTION 0x000004
  189. #define CS_EVENT_CARD_REMOVAL 0x000008
  190. #define CS_EVENT_BATTERY_DEAD 0x000010
  191. #define CS_EVENT_BATTERY_LOW 0x000020
  192. #define CS_EVENT_READY_CHANGE 0x000040
  193. #define CS_EVENT_CARD_DETECT 0x000080
  194. #define CS_EVENT_RESET_REQUEST 0x000100
  195. #define CS_EVENT_RESET_PHYSICAL 0x000200
  196. #define CS_EVENT_CARD_RESET 0x000400
  197. #define CS_EVENT_REGISTRATION_COMPLETE 0x000800
  198. #define CS_EVENT_PM_SUSPEND 0x002000
  199. #define CS_EVENT_PM_RESUME 0x004000
  200. #define CS_EVENT_INSERTION_REQUEST 0x008000
  201. #define CS_EVENT_EJECTION_REQUEST 0x010000
  202. #define CS_EVENT_MTD_REQUEST 0x020000
  203. #define CS_EVENT_ERASE_COMPLETE 0x040000
  204. #define CS_EVENT_REQUEST_ATTENTION 0x080000
  205. #define CS_EVENT_CB_DETECT 0x100000
  206. #define CS_EVENT_3VCARD 0x200000
  207. #define CS_EVENT_XVCARD 0x400000
  208. #endif /* _LINUX_CS_H */