esp_panic.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef PANIC_H
  2. #define PANIC_H
  3. #ifdef __cplusplus
  4. extern "C"
  5. {
  6. #endif
  7. #define PANIC_RSN_NONE 0
  8. #define PANIC_RSN_DEBUGEXCEPTION 1
  9. #define PANIC_RSN_DOUBLEEXCEPTION 2
  10. #define PANIC_RSN_KERNELEXCEPTION 3
  11. #define PANIC_RSN_COPROCEXCEPTION 4
  12. #define PANIC_RSN_INTWDT_CPU0 5
  13. #define PANIC_RSN_INTWDT_CPU1 6
  14. #define PANIC_RSN_CACHEERR 7
  15. #define PANIC_RSN_MAX 7
  16. #ifndef __ASSEMBLER__
  17. #include "esp_err.h"
  18. /**
  19. * @brief If an OCD is connected over JTAG. set breakpoint 0 to the given function
  20. * address. Do nothing otherwise.
  21. * @param data Pointer to the target breakpoint position
  22. */
  23. void esp_set_breakpoint_if_jtag(void *fn);
  24. #define ESP_WATCHPOINT_LOAD 0x40000000
  25. #define ESP_WATCHPOINT_STORE 0x80000000
  26. #define ESP_WATCHPOINT_ACCESS 0xC0000000
  27. /**
  28. * @brief Set a watchpoint to break/panic when a certain memory range is accessed.
  29. *
  30. * @param no Watchpoint number. On the ESP32, this can be 0 or 1.
  31. * @param adr Base address to watch
  32. * @param size Size of the region, starting at the base address, to watch. Must
  33. * be one of 2^n, with n in [0..6].
  34. * @param flags One of ESP_WATCHPOINT_* flags
  35. *
  36. * @return ESP_ERR_INVALID_ARG on invalid arg, ESP_OK otherwise
  37. *
  38. * @warning The ESP32 watchpoint hardware watches a region of bytes by effectively
  39. * masking away the lower n bits for a region with size 2^n. If adr does
  40. * not have zero for these lower n bits, you may not be watching the
  41. * region you intended.
  42. */
  43. esp_err_t esp_set_watchpoint(int no, void *adr, int size, int flags);
  44. /**
  45. * @brief Clear a watchpoint
  46. *
  47. * @param no Watchpoint to clear
  48. *
  49. */
  50. void esp_clear_watchpoint(int no);
  51. /**
  52. * @brief Stops panic WDT
  53. */
  54. void esp_panic_wdt_stop(void);
  55. #endif
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif