port.c 962 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * File : porttimer.c
  3. * This file is part of freemodbus in RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-04-04 yi.qiu first version
  13. */
  14. /* ----------------------- System includes --------------------------------*/
  15. #include <rtthread.h>
  16. #include <rthw.h>
  17. /* ----------------------- Modbus includes ----------------------------------*/
  18. /* ----------------------- Variables ----------------------------------------*/
  19. static int level;
  20. /* ----------------------- Start implementation -----------------------------*/
  21. void EnterCriticalSection(void)
  22. {
  23. level = rt_hw_interrupt_disable();
  24. }
  25. void ExitCriticalSection(void)
  26. {
  27. rt_hw_interrupt_enable(level);
  28. }