SEGGER_RTT_zephyr.c 753 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2018 omSquare s.r.o.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <kernel.h>
  7. #include <init.h>
  8. #include "SEGGER_RTT.h"
  9. /*
  10. * Common mutex for locking access to terminal buffer.
  11. * Note that SEGGER uses same lock macros for both SEGGER_RTT_Write and
  12. * SEGGER_RTT_Read functions. Because of this we are not able generally
  13. * separate up and down access using two mutexes until SEGGER library fix
  14. * this.
  15. *
  16. * If sharing access cause performance problems, consider using another
  17. * non terminal buffers.
  18. */
  19. K_MUTEX_DEFINE(rtt_term_mutex);
  20. static int rtt_init(const struct device *unused)
  21. {
  22. ARG_UNUSED(unused);
  23. SEGGER_RTT_Init();
  24. return 0;
  25. }
  26. SYS_INIT(rtt_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS);