test_dport_xt_highint5.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include <xtensa/coreasm.h>
  2. #include <xtensa/corebits.h>
  3. #include <xtensa/config/system.h>
  4. #include "freertos/xtensa_context.h"
  5. #include "esp_private/panic_reason.h"
  6. #include "sdkconfig.h"
  7. #include "soc/soc.h"
  8. #include "soc/dport_reg.h"
  9. #ifndef CONFIG_FREERTOS_UNICORE
  10. #define L5_INTR_STACK_SIZE 12
  11. #define L5_INTR_A2_OFFSET 0
  12. #define L5_INTR_A3_OFFSET 4
  13. #define L5_INTR_A4_OFFSET 8
  14. .data
  15. _l5_intr_stack:
  16. .space L5_INTR_STACK_SIZE
  17. .section .iram1,"ax"
  18. .global xt_highint5
  19. .type xt_highint5,@function
  20. .align 4
  21. xt_highint5:
  22. movi a0, xt_highint5_read_apb
  23. l32i a0, a0, 0
  24. bnez a0, .read_apb_reg
  25. // Short interrupt
  26. movi a0, 0
  27. wsr a0, CCOMPARE2
  28. esync
  29. rsr a0, EXCSAVE_5 // restore a0
  30. rfi 5
  31. // read APB reg 10 time.
  32. .read_apb_reg:
  33. movi a0, _l5_intr_stack
  34. s32i a2, a0, L5_INTR_A2_OFFSET
  35. s32i a3, a0, L5_INTR_A3_OFFSET
  36. s32i a4, a0, L5_INTR_A4_OFFSET
  37. movi a4, 10 // count of reading
  38. movi a0, 0x3ff40078 // read APB reg
  39. l32i a2, a0, 0
  40. .loop_read_apb_reg:
  41. l32i a3, a0, 0
  42. bne a3, a2, .need_set_apb_test_result
  43. addi a4, a4, -1
  44. l32i a2, a0, 0
  45. bnez a4, .loop_read_apb_reg
  46. j 1f
  47. .need_set_apb_test_result:
  48. movi a0, apb_intr_test_result // set fail
  49. movi a2, 0
  50. s32i a2, a0, 0
  51. memw
  52. 1:
  53. movi a0, _l5_intr_stack
  54. l32i a2, a0, L5_INTR_A2_OFFSET
  55. l32i a3, a0, L5_INTR_A3_OFFSET
  56. l32i a4, a0, L5_INTR_A4_OFFSET
  57. rsync
  58. .L_xt_highint5_exit:
  59. rsr a0, EXCSAVE_5 // restore a0
  60. rfi 5
  61. /* The linker has no reason to link in this file; all symbols it exports are already defined
  62. (weakly!) in the default int handler. Define a symbol here so we can use it to have the
  63. linker inspect this anyway. */
  64. .global ld_include_test_dport_xt_highint5
  65. ld_include_test_dport_xt_highint5:
  66. #endif // CONFIG_FREERTOS_UNICORE