io_edgeport.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /************************************************************************
  2. *
  3. * io_edgeport.h Edgeport Linux Interface definitions
  4. *
  5. * Copyright (C) 2000 Inside Out Networks, Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. *
  13. ************************************************************************/
  14. #if !defined(_IO_EDGEPORT_H_)
  15. #define _IO_EDGEPORT_H_
  16. #define MAX_RS232_PORTS 8 /* Max # of RS-232 ports per device */
  17. /* typedefs that the insideout headers need */
  18. #ifndef LOW8
  19. #define LOW8(a) ((unsigned char)(a & 0xff))
  20. #endif
  21. #ifndef HIGH8
  22. #define HIGH8(a) ((unsigned char)((a & 0xff00) >> 8))
  23. #endif
  24. #ifndef __KERNEL__
  25. #define __KERNEL__
  26. #endif
  27. #include "io_usbvend.h"
  28. /* The following table is used to map the USBx port number to
  29. * the device serial number (or physical USB path), */
  30. #define MAX_EDGEPORTS 64
  31. struct comMapper {
  32. char SerialNumber[MAX_SERIALNUMBER_LEN+1]; /* Serial number/usb path */
  33. int numPorts; /* Number of ports */
  34. int Original[MAX_RS232_PORTS]; /* Port numbers set by IOCTL */
  35. int Port[MAX_RS232_PORTS]; /* Actual used port numbers */
  36. };
  37. #define EDGEPORT_CONFIG_DEVICE "/proc/edgeport"
  38. /* /proc/edgeport Interface
  39. * This interface uses read/write/lseek interface to talk to the edgeport driver
  40. * the following read functions are supported: */
  41. #define PROC_GET_MAPPING_TO_PATH 1
  42. #define PROC_GET_COM_ENTRY 2
  43. #define PROC_GET_EDGE_MANUF_DESCRIPTOR 3
  44. #define PROC_GET_BOOT_DESCRIPTOR 4
  45. #define PROC_GET_PRODUCT_INFO 5
  46. #define PROC_GET_STRINGS 6
  47. #define PROC_GET_CURRENT_COM_MAPPING 7
  48. /* The parameters to the lseek() for the read is: */
  49. #define PROC_READ_SETUP(Command, Argument) ((Command) + ((Argument)<<8))
  50. /* the following write functions are supported: */
  51. #define PROC_SET_COM_MAPPING 1
  52. #define PROC_SET_COM_ENTRY 2
  53. /* The following structure is passed to the write */
  54. struct procWrite {
  55. int Command;
  56. union {
  57. struct comMapper Entry;
  58. int ComMappingBasedOnUSBPort; /* Boolean value */
  59. } u;
  60. };
  61. /*
  62. * Product information read from the Edgeport
  63. */
  64. struct edgeport_product_info {
  65. __u16 ProductId; /* Product Identifier */
  66. __u8 NumPorts; /* Number of ports on edgeport */
  67. __u8 ProdInfoVer; /* What version of structure is this? */
  68. __u32 IsServer :1; /* Set if Server */
  69. __u32 IsRS232 :1; /* Set if RS-232 ports exist */
  70. __u32 IsRS422 :1; /* Set if RS-422 ports exist */
  71. __u32 IsRS485 :1; /* Set if RS-485 ports exist */
  72. __u32 IsReserved :28; /* Reserved for later expansion */
  73. __u8 RomSize; /* Size of ROM/E2PROM in K */
  74. __u8 RamSize; /* Size of external RAM in K */
  75. __u8 CpuRev; /* CPU revision level (chg only if s/w visible) */
  76. __u8 BoardRev; /* PCB revision level (chg only if s/w visible) */
  77. __u8 BootMajorVersion; /* Boot Firmware version: xx. */
  78. __u8 BootMinorVersion; /* yy. */
  79. __le16 BootBuildNumber; /* zzzz (LE format) */
  80. __u8 FirmwareMajorVersion; /* Operational Firmware version:xx. */
  81. __u8 FirmwareMinorVersion; /* yy. */
  82. __le16 FirmwareBuildNumber; /* zzzz (LE format) */
  83. __u8 ManufactureDescDate[3]; /* MM/DD/YY when descriptor template was compiled */
  84. __u8 HardwareType;
  85. __u8 iDownloadFile; /* What to download to EPiC device */
  86. __u8 EpicVer; /* What version of EPiC spec this device supports */
  87. struct edge_compatibility_bits Epic;
  88. };
  89. /*
  90. * Edgeport Stringblock String locations
  91. */
  92. #define EDGESTRING_MANUFNAME 1 /* Manufacture Name */
  93. #define EDGESTRING_PRODNAME 2 /* Product Name */
  94. #define EDGESTRING_SERIALNUM 3 /* Serial Number */
  95. #define EDGESTRING_ASSEMNUM 4 /* Assembly Number */
  96. #define EDGESTRING_OEMASSEMNUM 5 /* OEM Assembly Number */
  97. #define EDGESTRING_MANUFDATE 6 /* Manufacture Date */
  98. #define EDGESTRING_ORIGSERIALNUM 7 /* Serial Number */
  99. struct string_block {
  100. __u16 NumStrings; /* Number of strings in block */
  101. __u16 Strings[1]; /* Start of string block */
  102. };
  103. #endif