sci.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /** @file sci.h
  2. * @brief SCI Driver Definition File
  3. * @date 29.May.2013
  4. * @version 03.05.02
  5. *
  6. */
  7. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  8. #ifndef __SCI_H__
  9. #define __SCI_H__
  10. #include "reg_sci.h"
  11. /** @enum sciIntFlags
  12. * @brief Interrupt Flag Definitions
  13. *
  14. * Used with sciEnableNotification, sciDisableNotification
  15. */
  16. enum sciIntFlags
  17. {
  18. SCI_FE_INT = 0x04000000U, /* framing error */
  19. SCI_OE_INT = 0x02000000U, /* overrun error */
  20. SCI_PE_INT = 0x01000000U, /* parity error */
  21. SCI_RX_INT = 0x00000200U, /* receive buffer ready */
  22. SCI_TX_INT = 0x00000100U, /* transmit buffer ready */
  23. SCI_WAKE_INT = 0x00000002U, /* wakeup */
  24. SCI_BREAK_INT = 0x00000001U /* break detect */
  25. };
  26. /** @def SCI_IDLE
  27. * @brief Alias name for the SCI IDLE Flag
  28. *
  29. * This is an alias name for the SCI IDLE Flag.
  30. *
  31. */
  32. #define SCI_IDLE 0x00000004U
  33. /** @struct sciBase
  34. * @brief SCI Register Definition
  35. *
  36. * This structure is used to access the SCI module registers.
  37. */
  38. /** @typedef sciBASE_t
  39. * @brief SCI Register Frame Type Definition
  40. *
  41. * This type is used to access the SCI Registers.
  42. */
  43. enum sciPinSelect
  44. {
  45. PIN_SCI_TX = 0U,
  46. PIN_SCI_RX = 1U
  47. };
  48. /**
  49. * @defgroup SCI SCI
  50. * @brief Serial Communication Interface Module.
  51. *
  52. * The SCI module is a universal asynchronous receiver-transmitter that implements the standard nonreturn
  53. * to zero format. The SCI can be used to communicate, for example, through an RS-232 port or over a K-line.
  54. *
  55. * Related Files
  56. * - reg_sci.h
  57. * - sci.h
  58. * - sci.c
  59. * @addtogroup SCI
  60. * @{
  61. */
  62. /* SCI Interface Functions */
  63. void sciInit(void);
  64. void sciSetFunctional(sciBASE_t *sci, uint32 port);
  65. void sciSetBaudrate(sciBASE_t *sci, uint32 baud);
  66. uint32 sciIsTxReady(sciBASE_t *sci);
  67. void sciSendByte(sciBASE_t *sci, uint8 byte);
  68. void sciSend(sciBASE_t *sci, uint32 length, uint8 * data);
  69. uint32 sciIsRxReady(sciBASE_t *sci);
  70. uint32 sciIsIdleDetected(sciBASE_t *sci);
  71. uint32 sciRxError(sciBASE_t *sci);
  72. uint32 sciReceiveByte(sciBASE_t *sci);
  73. void sciReceive(sciBASE_t *sci, uint32 length, uint8 * data);
  74. void sciEnableNotification(sciBASE_t *sci, uint32 flags);
  75. void sciDisableNotification(sciBASE_t *sci, uint32 flags);
  76. void sciEnableLoopback(sciBASE_t *sci, loopBackType_t Loopbacktype);
  77. void sciDisableLoopback(sciBASE_t *sci);
  78. /** @fn void sciNotification(sciBASE_t *sci, uint32 flags)
  79. * @brief Interrupt callback
  80. * @param[in] sci - sci module base address
  81. * @param[in] flags - copy of error interrupt flags
  82. *
  83. * This is a callback that is provided by the application and is called upon
  84. * an interrupt. The parameter passed to the callback is a copy of the
  85. * interrupt flag register.
  86. */
  87. void sciNotification(sciBASE_t *sci, uint32 flags);
  88. /**@}*/
  89. #endif