You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
491 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #include "chip.h"
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. uint8_t g_port_exit_critical_count;
  6. // NVIC_EnableIRQ
  7. // NVIC_GetEnableIRQ
  8. // NVIC_DisableIRQ
  9. void chip_critical_enter(void) {
  10. if (g_port_exit_critical_count == 0) {
  11. __disable_irq();
  12. // NVIC_DisableIRQ();
  13. }
  14. g_port_exit_critical_count++;
  15. }
  16. void chip_critical_exit(void) {
  17. g_port_exit_critical_count--;
  18. if (g_port_exit_critical_count == 0) {
  19. // NVIC_EnableIRQ();
  20. __enable_irq();
  21. }
  22. }