cpu_hal.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #include <stdint.h>
  14. #include <stdlib.h>
  15. #include "sdkconfig.h"
  16. #include "esp_err.h"
  17. #include "hal/cpu_hal.h"
  18. #include "hal/cpu_types.h"
  19. #include "soc/soc_caps.h"
  20. #if SOC_CPU_BREAKPOINTS_NUM > 0
  21. void cpu_hal_set_breakpoint(int id, const void* addr)
  22. {
  23. cpu_ll_set_breakpoint(id, cpu_ll_ptr_to_pc(addr));
  24. }
  25. void cpu_hal_clear_breakpoint(int id)
  26. {
  27. cpu_ll_clear_breakpoint(id);
  28. }
  29. #endif // SOC_CPU_BREAKPOINTS_NUM > 0
  30. #if SOC_CPU_WATCHPOINTS_NUM > 0
  31. void cpu_hal_set_watchpoint(int id, const void* addr, size_t size, watchpoint_trigger_t trigger)
  32. {
  33. bool on_read = false, on_write = false;
  34. if (trigger == WATCHPOINT_TRIGGER_ON_RO) {
  35. on_read = true;
  36. } else if (trigger == WATCHPOINT_TRIGGER_ON_WO) {
  37. on_write = true;
  38. } else {
  39. on_read = on_write = true;
  40. }
  41. cpu_ll_set_watchpoint(id, addr, size, on_read, on_write);
  42. }
  43. void cpu_hal_clear_watchpoint(int id)
  44. {
  45. cpu_ll_clear_watchpoint(id);
  46. }
  47. #endif // SOC_CPU_WATCHPOINTS_NUM > 0
  48. void cpu_hal_set_vecbase(const void* base)
  49. {
  50. cpu_ll_set_vecbase(base);
  51. }