tty.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*++
  2. Copyright (c) 2017 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. tty.h
  9. Abstract:
  10. This header contains the definition of a global variable that converts
  11. baud rates into speed_t values.
  12. Author:
  13. Evan Green 12-Apr-2017
  14. Environment:
  15. POSIX
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. #include <termios.h>
  21. //
  22. // --------------------------------------------------------------------- Macros
  23. //
  24. //
  25. // ---------------------------------------------------------------- Definitions
  26. //
  27. //
  28. // ------------------------------------------------------ Data Type Definitions
  29. //
  30. /*++
  31. Structure Description:
  32. This structure stores a terminal baud rate speed conversion.
  33. Members:
  34. Name - Stores the name of the speed.
  35. Value - Stores the value to set in the baud rate member.
  36. Rate - Stores the actual baud rate as a decimal value.
  37. --*/
  38. typedef struct _TTY_BAUD_RATE {
  39. PSTR Name;
  40. speed_t Value;
  41. ULONG Rate;
  42. } TTY_BAUD_RATE, *PTTY_BAUD_RATE;
  43. //
  44. // -------------------------------------------------------------------- Globals
  45. //
  46. TTY_BAUD_RATE TtyBaudRates[] = {
  47. {"0", B0, 0},
  48. {"50", B50, 50},
  49. {"75", B75, 75},
  50. {"110", B110, 110},
  51. {"134", B134, 134},
  52. {"150", B150, 150},
  53. {"200", B200, 200},
  54. {"300", B300, 300},
  55. {"600", B600, 600},
  56. {"1200", B1200, 1200},
  57. {"1800", B1800, 1800},
  58. {"2400", B2400, 2400},
  59. {"4800", B4800, 4800},
  60. {"9600", B9600, 9600},
  61. {"19200", B19200, 19200},
  62. {"38400", B38400, 38400},
  63. {"57600", B57600, 57600},
  64. {"115200", B115200, 115200},
  65. {"230400", B230400, 230400},
  66. #ifdef B460800
  67. {"460800", B460800, 460800},
  68. #endif
  69. #ifdef B500000
  70. {"500000", B500000, 500000},
  71. #endif
  72. #ifdef B576000
  73. {"576000", B576000, 576000},
  74. #endif
  75. #ifdef B921600
  76. {"921600", B921600, 921600},
  77. #endif
  78. #ifdef B1000000
  79. {"1000000", B1000000, 1000000},
  80. #endif
  81. #ifdef B152000
  82. {"1152000", B1152000, 1152000},
  83. #endif
  84. #ifdef B1500000
  85. {"1500000", B1500000, 1500000},
  86. #endif
  87. #ifdef B2000000
  88. {"2000000", B2000000, 2000000},
  89. #endif
  90. #ifdef B2500000
  91. {"2500000", B2500000, 2500000},
  92. #endif
  93. #ifdef B3000000
  94. {"3000000", B3000000, 3000000},
  95. #endif
  96. #ifdef B3500000
  97. {"3500000", B3500000, 3500000},
  98. #endif
  99. #ifdef B4000000
  100. {"4000000", B4000000, 4000000},
  101. #endif
  102. {NULL, 0, 0}
  103. };
  104. //
  105. // -------------------------------------------------------- Function Prototypes
  106. //