internal.c 632 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "stdio.h"
  2. #include "internal.h"
  3. static enter_crit st_enter_critical = NULL;
  4. static exit_crit st_exit_critical = NULL;
  5. int st_register_crit_func(enter_crit ent, exit_crit exit)
  6. {
  7. if(ent == NULL || ent == NULL)
  8. {
  9. printf("parameter error\n");
  10. return -1;
  11. }
  12. st_enter_critical = ent;
  13. st_exit_critical = exit;
  14. return 0;
  15. }
  16. uint32_t st_enter_crit_func()
  17. {
  18. if(st_enter_critical)
  19. {
  20. return st_enter_critical();
  21. }
  22. else
  23. {
  24. return -1;
  25. }
  26. }
  27. void st_exit_crit_func(uint32_t flags)
  28. {
  29. if(st_exit_critical)
  30. {
  31. st_exit_critical(flags);
  32. }
  33. }