io_edgeport.h 3.8 KB

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