fsl_swo.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * The Clear BSD License
  3. * Copyright 2018 NXP
  4. * All rights reserved.
  5. *
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. */
  35. #ifndef _FSL_SWO_H_
  36. #define _FSL_SWO_H_
  37. #include "fsl_common.h"
  38. /*!
  39. * @addtogroup debugconsole
  40. * @{
  41. */
  42. /*******************************************************************************
  43. * Definitions
  44. ******************************************************************************/
  45. /* swo protocol */
  46. enum _swo_protocol
  47. {
  48. kSWO_ProtocolManchester = 1U, /*!< SWO manchester protocol */
  49. kSWO_ProtocolNrz = 2U, /*!< SWO UART/NRZ protocol */
  50. };
  51. /*******************************************************************************
  52. * Prototypes
  53. ******************************************************************************/
  54. #if defined(__cplusplus)
  55. extern "C" {
  56. #endif /* __cplusplus */
  57. /*!
  58. * @brief io init function.
  59. *
  60. * Call this function to init SWO.
  61. *
  62. * @param port port used to transfer data
  63. * @param baudRate SWO clock
  64. * @param clkSrcFreq core clock frequency
  65. */
  66. status_t SWO_Init(uint32_t port, uint32_t baudRate, uint32_t clkSrcFreq);
  67. /*!
  68. * @brief Deinit IO.
  69. *
  70. * Call this function to Deinit SWO.
  71. *
  72. * @param port port to deinit.
  73. * @return deinit status
  74. */
  75. void SWO_Deinit(uint32_t port);
  76. /*!
  77. * @brief io transfer function.
  78. *
  79. * Call this function to print log.
  80. *
  81. * @param port port used to transfer data
  82. * @param ch transfer buffer pointer
  83. * @param size transfer size
  84. */
  85. status_t SWO_SendBlocking(uint32_t port, uint8_t *ch, size_t size);
  86. #if defined(__cplusplus)
  87. }
  88. #endif /* __cplusplus */
  89. /*! @} */
  90. #endif /* _FSL_SWO_H_ */