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 <stdint.h>
  16. #include "soc/reset_reasons.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /**
  21. * @brief Print formated string to console device
  22. * @note float and long long data are not supported!
  23. *
  24. * @param fmt Format string
  25. * @param ... Additional arguments, depending on the format string
  26. * @return int: Total number of characters written on success; A negative number on failure.
  27. */
  28. int esp_rom_printf(const char *fmt, ...);
  29. /**
  30. * @brief Pauses execution for us microseconds
  31. *
  32. * @param us Number of microseconds to pause
  33. */
  34. void esp_rom_delay_us(uint32_t us);
  35. /**
  36. * @brief esp_rom_printf can print message to different channels simultaneously.
  37. * This function can help install the low level putc function for esp_rom_printf.
  38. *
  39. * @param channel Channel number (startting from 1)
  40. * @param putc Function pointer to the putc implementation. Set NULL can disconnect esp_rom_printf with putc.
  41. */
  42. void esp_rom_install_channel_putc(int channel, void (*putc)(char c));
  43. /**
  44. * @brief Install UART1 as the default console channel, equivalent to `esp_rom_install_channel_putc(1, esp_rom_uart_putc)`
  45. */
  46. void esp_rom_install_uart_printf(void);
  47. /**
  48. * @brief Get reset reason of CPU
  49. *
  50. * @param cpu_no CPU number
  51. * @return Reset reason code (see in soc/reset_reasons.h)
  52. */
  53. soc_reset_reason_t esp_rom_get_reset_reason(int cpu_no);
  54. #ifdef __cplusplus
  55. }
  56. #endif