esp_panic.h 1.6 KB

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