interrupt.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Copyright 2018 Canaan Inc.
  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. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef _BSP_INTERRUPT_H
  16. #define _BSP_INTERRUPT_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* clang-format off */
  21. /* Machine interrupt mask for 64 bit system, 0x8000 0000 0000 0000 */
  22. #define CAUSE_MACHINE_IRQ_MASK (0x1ULL << 63)
  23. /* Machine interrupt reason mask for 64 bit system, 0x7FFF FFFF FFFF FFFF */
  24. #define CAUSE_MACHINE_IRQ_REASON_MASK (CAUSE_MACHINE_IRQ_MASK - 1)
  25. /* Hypervisor interrupt mask for 64 bit system, 0x8000 0000 0000 0000 */
  26. #define CAUSE_HYPERVISOR_IRQ_MASK (0x1ULL << 63)
  27. /* Hypervisor interrupt reason mask for 64 bit system, 0x7FFF FFFF FFFF FFFF */
  28. #define CAUSE_HYPERVISOR_IRQ_REASON_MASK (CAUSE_HYPERVISOR_IRQ_MASK - 1)
  29. /* Supervisor interrupt mask for 64 bit system, 0x8000 0000 0000 0000 */
  30. #define CAUSE_SUPERVISOR_IRQ_MASK (0x1ULL << 63)
  31. /* Supervisor interrupt reason mask for 64 bit system, 0x7FFF FFFF FFFF FFFF */
  32. #define CAUSE_SUPERVISOR_IRQ_REASON_MASK (CAUSE_SUPERVISOR_IRQ_MASK - 1)
  33. /* clang-format on */
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* _BSP_INTERRUPT_H */