cs.h 5.5 KB

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