esp_panic.h 1.6 KB

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