1 /* 2 * Copyright (C) 2005 Meilhaus Electronic GmbH (support@meilhaus.de) 3 * 4 * Source File : meioctl.h 5 * Author : GG (Guenter Gebhardt) <g.gebhardt@meilhaus.de> 6 */ 7 8 #ifndef _MEIOCTL_H_ 9 #define _MEIOCTL_H_ 10 11 12 /*============================================================================= 13 Types for the input/output ioctls 14 ===========================================================================*/ 15 16 typedef struct me_io_irq_start { 17 int device; 18 int subdevice; 19 int channel; 20 int irq_source; 21 int irq_edge; 22 int irq_arg; 23 int flags; 24 int errno; 25 } me_io_irq_start_t; 26 27 28 typedef struct me_io_irq_wait { 29 int device; 30 int subdevice; 31 int channel; 32 int irq_count; 33 int value; 34 int time_out; 35 int flags; 36 int errno; 37 } me_io_irq_wait_t; 38 39 40 typedef struct me_io_irq_stop { 41 int device; 42 int subdevice; 43 int channel; 44 int flags; 45 int errno; 46 } me_io_irq_stop_t; 47 48 49 typedef struct me_io_reset_device { 50 int device; 51 int flags; 52 int errno; 53 } me_io_reset_device_t; 54 55 56 typedef struct me_io_reset_subdevice { 57 int device; 58 int subdevice; 59 int flags; 60 int errno; 61 } me_io_reset_subdevice_t; 62 63 64 typedef struct me_io_single_config { 65 int device; 66 int subdevice; 67 int channel; 68 int single_config; 69 int ref; 70 int trig_chan; 71 int trig_type; 72 int trig_edge; 73 int flags; 74 int errno; 75 } me_io_single_config_t; 76 77 78 typedef struct me_io_single { 79 meIOSingle_t *single_list; 80 int count; 81 int flags; 82 int errno; 83 } me_io_single_t; 84 85 86 typedef struct me_io_stream_config { 87 int device; 88 int subdevice; 89 meIOStreamConfig_t *config_list; 90 int count; 91 meIOStreamTrigger_t trigger; 92 int fifo_irq_threshold; 93 int flags; 94 int errno; 95 } me_io_stream_config_t; 96 97 98 typedef struct me_io_stream_new_values { 99 int device; 100 int subdevice; 101 int time_out; 102 int count; 103 int flags; 104 int errno; 105 } me_io_stream_new_values_t; 106 107 108 typedef struct me_io_stream_read { 109 int device; 110 int subdevice; 111 int read_mode; 112 int *values; 113 int count; 114 int flags; 115 int errno; 116 } me_io_stream_read_t; 117 118 119 typedef struct me_io_stream_start { 120 meIOStreamStart_t *start_list; 121 int count; 122 int flags; 123 int errno; 124 } me_io_stream_start_t; 125 126 127 typedef struct me_io_stream_status { 128 int device; 129 int subdevice; 130 int wait; 131 int status; 132 int count; 133 int flags; 134 int errno; 135 } me_io_stream_status_t; 136 137 138 typedef struct me_io_stream_stop { 139 meIOStreamStop_t *stop_list; 140 int count; 141 int flags; 142 int errno; 143 } me_io_stream_stop_t; 144 145 146 typedef struct me_io_stream_write { 147 int device; 148 int subdevice; 149 int write_mode; 150 int *values; 151 int count; 152 int flags; 153 int errno; 154 } me_io_stream_write_t; 155 156 157 /*============================================================================= 158 Types for the lock ioctls 159 ===========================================================================*/ 160 161 typedef struct me_lock_device { 162 int device; 163 int lock; 164 int flags; 165 int errno; 166 } me_lock_device_t; 167 168 169 typedef struct me_lock_driver { 170 int flags; 171 int lock; 172 int errno; 173 } me_lock_driver_t; 174 175 176 typedef struct me_lock_subdevice { 177 int device; 178 int subdevice; 179 int lock; 180 int flags; 181 int errno; 182 } me_lock_subdevice_t; 183 184 185 /*============================================================================= 186 Types for the query ioctls 187 ===========================================================================*/ 188 189 typedef struct me_query_info_device { 190 int device; 191 int vendor_id; 192 int device_id; 193 int serial_no; 194 int bus_type; 195 int bus_no; 196 int dev_no; 197 int func_no; 198 int plugged; 199 int errno; 200 } me_query_info_device_t; 201 202 203 typedef struct me_query_description_device { 204 int device; 205 char *name; 206 int count; 207 int errno; 208 } me_query_description_device_t; 209 210 211 typedef struct me_query_name_device { 212 int device; 213 char *name; 214 int count; 215 int errno; 216 } me_query_name_device_t; 217 218 219 typedef struct me_query_name_device_driver { 220 int device; 221 char *name; 222 int count; 223 int errno; 224 } me_query_name_device_driver_t; 225 226 227 typedef struct me_query_version_main_driver { 228 int version; 229 int errno; 230 } me_query_version_main_driver_t; 231 232 233 typedef struct me_query_version_device_driver { 234 int device; 235 int version; 236 int errno; 237 } me_query_version_device_driver_t; 238 239 240 typedef struct me_query_number_devices { 241 int number; 242 int errno; 243 } me_query_number_devices_t; 244 245 246 typedef struct me_query_number_subdevices { 247 int device; 248 int number; 249 int errno; 250 } me_query_number_subdevices_t; 251 252 253 typedef struct me_query_number_channels { 254 int device; 255 int subdevice; 256 int number; 257 int errno; 258 } me_query_number_channels_t; 259 260 261 typedef struct me_query_number_ranges { 262 int device; 263 int subdevice; 264 int channel; 265 int unit; 266 int number; 267 int errno; 268 } me_query_number_ranges_t; 269 270 271 typedef struct me_query_subdevice_by_type { 272 int device; 273 int start_subdevice; 274 int type; 275 int subtype; 276 int subdevice; 277 int errno; 278 } me_query_subdevice_by_type_t; 279 280 281 typedef struct me_query_subdevice_type { 282 int device; 283 int subdevice; 284 int type; 285 int subtype; 286 int errno; 287 } me_query_subdevice_type_t; 288 289 290 typedef struct me_query_subdevice_caps { 291 int device; 292 int subdevice; 293 int caps; 294 int errno; 295 } me_query_subdevice_caps_t; 296 297 298 typedef struct me_query_subdevice_caps_args { 299 int device; 300 int subdevice; 301 int cap; 302 int args[8]; 303 int count; 304 int errno; 305 } me_query_subdevice_caps_args_t; 306 307 308 typedef struct me_query_timer { 309 int device; 310 int subdevice; 311 int timer; 312 int base_frequency; 313 long long min_ticks; 314 long long max_ticks; 315 int errno; 316 } me_query_timer_t; 317 318 319 typedef struct me_query_range_by_min_max { 320 int device; 321 int subdevice; 322 int channel; 323 int unit; 324 int min; 325 int max; 326 int max_data; 327 int range; 328 int errno; 329 } me_query_range_by_min_max_t; 330 331 332 typedef struct me_query_range_info { 333 int device; 334 int subdevice; 335 int channel; 336 int unit; 337 int range; 338 int min; 339 int max; 340 int max_data; 341 int errno; 342 } me_query_range_info_t; 343 344 345 /*============================================================================= 346 Types for the configuration ioctls 347 ===========================================================================*/ 348 349 typedef struct me_cfg_tcpip_location { 350 int access_type; 351 char *remote_host; 352 int remote_device_number; 353 } me_cfg_tcpip_location_t; 354 355 356 typedef union me_cfg_tcpip { 357 int access_type; 358 me_cfg_tcpip_location_t location; 359 } me_cfg_tcpip_t; 360 361 362 typedef struct me_cfg_pci_hw_location { 363 unsigned int bus_type; 364 unsigned int bus_no; 365 unsigned int device_no; 366 unsigned int function_no; 367 } me_cfg_pci_hw_location_t; 368 369 /* 370 typedef struct me_cfg_usb_hw_location { 371 unsigned int bus_type; 372 unsigned int root_hub_no; 373 } me_cfg_usb_hw_location_t; 374 */ 375 376 typedef union me_cfg_hw_location { 377 unsigned int bus_type; 378 me_cfg_pci_hw_location_t pci; 379 // me_cfg_usb_hw_location_t usb; 380 } me_cfg_hw_location_t; 381 382 383 typedef struct me_cfg_device_info { 384 unsigned int vendor_id; 385 unsigned int device_id; 386 unsigned int serial_no; 387 me_cfg_hw_location_t hw_location; 388 } me_cfg_device_info_t; 389 390 391 typedef struct me_cfg_subdevice_info { 392 int type; 393 int sub_type; 394 unsigned int number_channels; 395 } me_cfg_subdevice_info_t; 396 397 398 typedef struct me_cfg_range_entry { 399 int unit; 400 double min; 401 double max; 402 unsigned int max_data; 403 } me_cfg_range_entry_t; 404 405 406 typedef struct me_cfg_mux32m_device { 407 int type; 408 int timed; 409 unsigned int ai_channel; 410 unsigned int dio_device; 411 unsigned int dio_subdevice; 412 unsigned int timer_device; 413 unsigned int timer_subdevice; 414 unsigned int mux32s_count; 415 } me_cfg_mux32m_device_t; 416 417 418 typedef struct me_cfg_demux32_device { 419 int type; 420 int timed; 421 unsigned int ao_channel; 422 unsigned int dio_device; 423 unsigned int dio_subdevice; 424 unsigned int timer_device; 425 unsigned int timer_subdevice; 426 } me_cfg_demux32_device_t; 427 428 429 typedef union me_cfg_external_device { 430 int type; 431 me_cfg_mux32m_device_t mux32m; 432 me_cfg_demux32_device_t demux32; 433 } me_cfg_external_device_t; 434 435 436 typedef struct me_cfg_subdevice_entry { 437 me_cfg_subdevice_info_t info; 438 me_cfg_range_entry_t *range_list; 439 unsigned int count; 440 int locked; 441 me_cfg_external_device_t external_device; 442 } me_cfg_subdevice_entry_t; 443 444 445 typedef struct me_cfg_device_entry { 446 me_cfg_tcpip_t tcpip; 447 me_cfg_device_info_t info; 448 me_cfg_subdevice_entry_t *subdevice_list; 449 unsigned int count; 450 } me_cfg_device_entry_t; 451 452 453 typedef struct me_config_load { 454 me_cfg_device_entry_t *device_list; 455 unsigned int count; 456 int errno; 457 } me_config_load_t; 458 459 460 /*============================================================================= 461 The ioctls of the board 462 ===========================================================================*/ 463 464 #define MEMAIN_MAGIC 'y' 465 466 #define ME_IO_IRQ_ENABLE _IOR (MEMAIN_MAGIC, 1, me_io_irq_start_t) 467 #define ME_IO_IRQ_WAIT _IOR (MEMAIN_MAGIC, 2, me_io_irq_wait_t) 468 #define ME_IO_IRQ_DISABLE _IOR (MEMAIN_MAGIC, 3, me_io_irq_stop_t) 469 470 #define ME_IO_RESET_DEVICE _IOW (MEMAIN_MAGIC, 4, me_io_reset_device_t) 471 #define ME_IO_RESET_SUBDEVICE _IOW (MEMAIN_MAGIC, 5, me_io_reset_subdevice_t) 472 473 #define ME_IO_SINGLE _IOWR(MEMAIN_MAGIC, 6, me_io_single_t) 474 #define ME_IO_SINGLE_CONFIG _IOW (MEMAIN_MAGIC, 7, me_io_single_config_t) 475 476 #define ME_IO_STREAM_CONFIG _IOW (MEMAIN_MAGIC, 8, me_io_stream_config_t) 477 #define ME_IO_STREAM_NEW_VALUES _IOR (MEMAIN_MAGIC, 9, me_io_stream_new_values_t) 478 #define ME_IO_STREAM_READ _IOR (MEMAIN_MAGIC, 10, me_io_stream_read_t) 479 #define ME_IO_STREAM_START _IOW (MEMAIN_MAGIC, 11, me_io_stream_start_t) 480 #define ME_IO_STREAM_STATUS _IOR (MEMAIN_MAGIC, 12, me_io_stream_status_t) 481 #define ME_IO_STREAM_STOP _IOW (MEMAIN_MAGIC, 13, me_io_stream_stop_t) 482 #define ME_IO_STREAM_WRITE _IOW (MEMAIN_MAGIC, 14, me_io_stream_write_t) 483 484 #define ME_LOCK_DRIVER _IOW (MEMAIN_MAGIC, 15, me_lock_driver_t) 485 #define ME_LOCK_DEVICE _IOW (MEMAIN_MAGIC, 16, me_lock_device_t) 486 #define ME_LOCK_SUBDEVICE _IOW (MEMAIN_MAGIC, 17, me_lock_subdevice_t) 487 488 #define ME_QUERY_DESCRIPTION_DEVICE _IOR (MEMAIN_MAGIC, 18, me_query_description_device_t) 489 490 #define ME_QUERY_INFO_DEVICE _IOR (MEMAIN_MAGIC, 19, me_query_info_device_t) 491 492 #define ME_QUERY_NAME_DEVICE _IOR (MEMAIN_MAGIC, 20, me_query_name_device_t) 493 #define ME_QUERY_NAME_DEVICE_DRIVER _IOR (MEMAIN_MAGIC, 21, me_query_name_device_driver_t) 494 495 #define ME_QUERY_NUMBER_DEVICES _IOR (MEMAIN_MAGIC, 22, me_query_number_devices_t) 496 #define ME_QUERY_NUMBER_SUBDEVICES _IOR (MEMAIN_MAGIC, 23, me_query_number_subdevices_t) 497 #define ME_QUERY_NUMBER_CHANNELS _IOR (MEMAIN_MAGIC, 24, me_query_number_channels_t) 498 #define ME_QUERY_NUMBER_RANGES _IOR (MEMAIN_MAGIC, 25, me_query_number_ranges_t) 499 500 #define ME_QUERY_RANGE_BY_MIN_MAX _IOR (MEMAIN_MAGIC, 26, me_query_range_by_min_max_t) 501 #define ME_QUERY_RANGE_INFO _IOR (MEMAIN_MAGIC, 27, me_query_range_info_t) 502 503 #define ME_QUERY_SUBDEVICE_BY_TYPE _IOR (MEMAIN_MAGIC, 28, me_query_subdevice_by_type_t) 504 #define ME_QUERY_SUBDEVICE_TYPE _IOR (MEMAIN_MAGIC, 29, me_query_subdevice_type_t) 505 #define ME_QUERY_SUBDEVICE_CAPS _IOR (MEMAIN_MAGIC, 29, me_query_subdevice_caps_t) 506 #define ME_QUERY_SUBDEVICE_CAPS_ARGS _IOR (MEMAIN_MAGIC, 30, me_query_subdevice_caps_args_t) 507 508 #define ME_QUERY_TIMER _IOR (MEMAIN_MAGIC, 31, me_query_timer_t) 509 510 #define ME_QUERY_VERSION_DEVICE_DRIVER _IOR (MEMAIN_MAGIC, 32, me_query_version_device_driver_t) 511 #define ME_QUERY_VERSION_MAIN_DRIVER _IOR (MEMAIN_MAGIC, 33, me_query_version_main_driver_t) 512 513 #define ME_CONFIG_LOAD _IOWR(MEMAIN_MAGIC, 34, me_config_load_t) 514 515 #endif 516