interrupt_descriptor_table.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 "sdkconfig.h"
  14. #include "hal/interrupt_controller_hal.h"
  15. #include "hal/interrupt_controller_ll.h"
  16. #include "soc/soc_caps.h"
  17. #include "soc/soc.h"
  18. //We should mark the interrupt for the timer used by FreeRTOS as reserved. The specific timer
  19. //is selectable using menuconfig; we use these cpp bits to convert that into something we can use in
  20. //the table below.
  21. #if CONFIG_FREERTOS_CORETIMER_0
  22. #define INT6RES INTDESC_RESVD
  23. #else
  24. #define INT6RES INTDESC_SPECIAL
  25. #endif
  26. #if CONFIG_FREERTOS_CORETIMER_1
  27. #define INT15RES INTDESC_RESVD
  28. #else
  29. #define INT15RES INTDESC_SPECIAL
  30. #endif
  31. //This is basically a software-readable version of the interrupt usage table in include/soc/soc.h
  32. const static int_desc_t interrupt_descriptor_table [32]={
  33. { 1, INTTP_LEVEL, {INTDESC_RESVD} }, //0
  34. { 1, INTTP_LEVEL, {INTDESC_RESVD} }, //1
  35. { 1, INTTP_LEVEL, {INTDESC_NORMAL} }, //2
  36. { 1, INTTP_LEVEL, {INTDESC_NORMAL} }, //3
  37. { 1, INTTP_LEVEL, {INTDESC_RESVD} }, //4
  38. { 1, INTTP_LEVEL, {INTDESC_RESVD} }, //5
  39. { 1, INTTP_NA, {INT6RES} }, //6
  40. { 1, INTTP_NA, {INTDESC_SPECIAL}}, //7
  41. { 1, INTTP_LEVEL, {INTDESC_RESVD } }, //8
  42. { 1, INTTP_LEVEL, {INTDESC_NORMAL } }, //9
  43. { 1, INTTP_EDGE , {INTDESC_NORMAL } }, //10
  44. { 3, INTTP_NA, {INTDESC_SPECIAL }}, //11
  45. { 1, INTTP_LEVEL, {INTDESC_NORMAL } }, //12
  46. { 1, INTTP_LEVEL, {INTDESC_NORMAL} }, //13
  47. { 7, INTTP_LEVEL, {INTDESC_RESVD} }, //14, NMI
  48. { 3, INTTP_NA, {INT15RES} }, //15
  49. { 5, INTTP_NA, {INTDESC_SPECIAL } }, //16
  50. { 1, INTTP_LEVEL, {INTDESC_NORMAL } }, //17
  51. { 1, INTTP_LEVEL, {INTDESC_NORMAL } }, //18
  52. { 2, INTTP_LEVEL, {INTDESC_NORMAL } }, //19
  53. { 2, INTTP_LEVEL, {INTDESC_NORMAL } }, //20
  54. { 2, INTTP_LEVEL, {INTDESC_NORMAL } }, //21
  55. { 3, INTTP_EDGE, {INTDESC_RESVD } }, //22
  56. { 3, INTTP_LEVEL, {INTDESC_NORMAL } }, //23
  57. { 4, INTTP_LEVEL, {INTDESC_RESVD } }, //24
  58. { 4, INTTP_LEVEL, {INTDESC_RESVD } }, //25
  59. { 5, INTTP_LEVEL, {INTDESC_NORMAL } }, //26
  60. { 3, INTTP_LEVEL, {INTDESC_RESVD } }, //27
  61. { 4, INTTP_EDGE, {INTDESC_NORMAL } }, //28
  62. { 3, INTTP_NA, {INTDESC_SPECIAL }}, //29
  63. { 4, INTTP_EDGE, {INTDESC_RESVD } }, //30
  64. { 5, INTTP_LEVEL, {INTDESC_RESVD } }, //31
  65. };
  66. const int_desc_t *interrupt_controller_hal_desc_table(void)
  67. {
  68. return interrupt_descriptor_table;
  69. }