serial.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * FreeRTOS Kernel V10.3.1
  3. * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. * this software and associated documentation files (the "Software"), to deal in
  7. * the Software without restriction, including without limitation the rights to
  8. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9. * the Software, and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  18. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * http://www.FreeRTOS.org
  23. * http://aws.amazon.com/freertos
  24. *
  25. * 1 tab == 4 spaces!
  26. */
  27. #ifndef SERIAL_COMMS_H
  28. #define SERIAL_COMMS_H
  29. typedef void * xComPortHandle;
  30. typedef enum
  31. {
  32. serCOM1,
  33. serCOM2,
  34. serCOM3,
  35. serCOM4,
  36. serCOM5,
  37. serCOM6,
  38. serCOM7,
  39. serCOM8
  40. } eCOMPort;
  41. typedef enum
  42. {
  43. serNO_PARITY,
  44. serODD_PARITY,
  45. serEVEN_PARITY,
  46. serMARK_PARITY,
  47. serSPACE_PARITY
  48. } eParity;
  49. typedef enum
  50. {
  51. serSTOP_1,
  52. serSTOP_2
  53. } eStopBits;
  54. typedef enum
  55. {
  56. serBITS_5,
  57. serBITS_6,
  58. serBITS_7,
  59. serBITS_8
  60. } eDataBits;
  61. typedef enum
  62. {
  63. ser50,
  64. ser75,
  65. ser110,
  66. ser134,
  67. ser150,
  68. ser200,
  69. ser300,
  70. ser600,
  71. ser1200,
  72. ser1800,
  73. ser2400,
  74. ser4800,
  75. ser9600,
  76. ser19200,
  77. ser38400,
  78. ser57600,
  79. ser115200
  80. } eBaud;
  81. xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength );
  82. xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
  83. void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength );
  84. signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime );
  85. signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime );
  86. portBASE_TYPE xSerialWaitForSemaphore( xComPortHandle xPort );
  87. void vSerialClose( xComPortHandle xPort );
  88. #endif