esp_rom_sys.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "sdkconfig.h"
  16. #include <stdint.h>
  17. #include "soc/reset_reasons.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief Print formated string to console device
  23. * @note float and long long data are not supported!
  24. *
  25. * @param fmt Format string
  26. * @param ... Additional arguments, depending on the format string
  27. * @return int: Total number of characters written on success; A negative number on failure.
  28. */
  29. int esp_rom_printf(const char *fmt, ...);
  30. /**
  31. * @brief Pauses execution for us microseconds
  32. *
  33. * @param us Number of microseconds to pause
  34. */
  35. void esp_rom_delay_us(uint32_t us);
  36. /**
  37. * @brief esp_rom_printf can print message to different channels simultaneously.
  38. * This function can help install the low level putc function for esp_rom_printf.
  39. *
  40. * @param channel Channel number (startting from 1)
  41. * @param putc Function pointer to the putc implementation. Set NULL can disconnect esp_rom_printf with putc.
  42. */
  43. void esp_rom_install_channel_putc(int channel, void (*putc)(char c));
  44. /**
  45. * @brief Install UART1 as the default console channel, equivalent to `esp_rom_install_channel_putc(1, esp_rom_uart_putc)`
  46. */
  47. void esp_rom_install_uart_printf(void);
  48. /**
  49. * @brief Get reset reason of CPU
  50. *
  51. * @param cpu_no CPU number
  52. * @return Reset reason code (see in soc/reset_reasons.h)
  53. */
  54. soc_reset_reason_t esp_rom_get_reset_reason(int cpu_no);
  55. #ifdef __cplusplus
  56. }
  57. #endif