port.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * FreeModbus Libary: BARE Port
  3. * Copyright (C) 2006 Christian Walter <wolti@sil.at>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. *
  19. * File: $Id: port.h ,v 1.60 2013/08/13 15:07:05 Armink add Master Functions $
  20. */
  21. #ifndef _PORT_H
  22. #define _PORT_H
  23. #include <stm32f10x_conf.h>
  24. #include "mbconfig.h"
  25. #include <rthw.h>
  26. #include <rtthread.h>
  27. #include <assert.h>
  28. #include <inttypes.h>
  29. #define INLINE
  30. #define PR_BEGIN_EXTERN_C extern "C" {
  31. #define PR_END_EXTERN_C }
  32. //TODO 暂时先写B13引脚,等组网测试时再确认
  33. #define SLAVE_RS485_SEND_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
  34. #define SLAVE_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
  35. #define MASTER_RS485_SEND_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
  36. #define MASTER_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
  37. #define ENTER_CRITICAL_SECTION() EnterCriticalSection()
  38. #define EXIT_CRITICAL_SECTION() ExitCriticalSection()
  39. void EnterCriticalSection(void);
  40. void ExitCriticalSection(void);
  41. typedef uint8_t BOOL;
  42. typedef unsigned char UCHAR;
  43. typedef char CHAR;
  44. typedef uint16_t USHORT;
  45. typedef int16_t SHORT;
  46. typedef uint32_t ULONG;
  47. typedef int32_t LONG;
  48. #ifndef TRUE
  49. #define TRUE 1
  50. #endif
  51. #ifndef FALSE
  52. #define FALSE 0
  53. #endif
  54. #endif