Modbus RTU/ASCII/TCP with lwip TCP working partial, but with errors (retransmitions)
Dependencies: EthernetNetIf mbed
ModBus/port.h@0:f54e9507171b, 2011-12-05 (annotated)
- Committer:
- tmav123
- Date:
- Mon Dec 05 22:49:02 2011 +0000
- Revision:
- 0:f54e9507171b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tmav123 | 0:f54e9507171b | 1 | /* |
tmav123 | 0:f54e9507171b | 2 | * FreeModbus Libary: BARE Port |
tmav123 | 0:f54e9507171b | 3 | * Copyright (C) 2006 Christian Walter <wolti@sil.at> |
tmav123 | 0:f54e9507171b | 4 | * |
tmav123 | 0:f54e9507171b | 5 | * This library is free software; you can redistribute it and/or |
tmav123 | 0:f54e9507171b | 6 | * modify it under the terms of the GNU Lesser General Public |
tmav123 | 0:f54e9507171b | 7 | * License as published by the Free Software Foundation; either |
tmav123 | 0:f54e9507171b | 8 | * version 2.1 of the License, or (at your option) any later version. |
tmav123 | 0:f54e9507171b | 9 | * |
tmav123 | 0:f54e9507171b | 10 | * This library is distributed in the hope that it will be useful, |
tmav123 | 0:f54e9507171b | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
tmav123 | 0:f54e9507171b | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
tmav123 | 0:f54e9507171b | 13 | * Lesser General Public License for more details. |
tmav123 | 0:f54e9507171b | 14 | * |
tmav123 | 0:f54e9507171b | 15 | * You should have received a copy of the GNU Lesser General Public |
tmav123 | 0:f54e9507171b | 16 | * License along with this library; if not, write to the Free Software |
tmav123 | 0:f54e9507171b | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
tmav123 | 0:f54e9507171b | 18 | * |
tmav123 | 0:f54e9507171b | 19 | * File: $Id: port.h,v 1.1 2006/08/22 21:35:13 wolti Exp $ |
tmav123 | 0:f54e9507171b | 20 | */ |
tmav123 | 0:f54e9507171b | 21 | |
tmav123 | 0:f54e9507171b | 22 | #ifndef _PORT_H |
tmav123 | 0:f54e9507171b | 23 | #define _PORT_H |
tmav123 | 0:f54e9507171b | 24 | |
tmav123 | 0:f54e9507171b | 25 | #include <assert.h> |
tmav123 | 0:f54e9507171b | 26 | #include <inttypes.h> |
tmav123 | 0:f54e9507171b | 27 | |
tmav123 | 0:f54e9507171b | 28 | #define INLINE //inline |
tmav123 | 0:f54e9507171b | 29 | #define PR_BEGIN_EXTERN_C //extern "C" { |
tmav123 | 0:f54e9507171b | 30 | #define PR_END_EXTERN_C //} |
tmav123 | 0:f54e9507171b | 31 | |
tmav123 | 0:f54e9507171b | 32 | #define ENTER_CRITICAL_SECTION( ) |
tmav123 | 0:f54e9507171b | 33 | #define EXIT_CRITICAL_SECTION( ) |
tmav123 | 0:f54e9507171b | 34 | |
tmav123 | 0:f54e9507171b | 35 | typedef uint8_t BOOL; |
tmav123 | 0:f54e9507171b | 36 | |
tmav123 | 0:f54e9507171b | 37 | typedef unsigned char UCHAR; |
tmav123 | 0:f54e9507171b | 38 | typedef char CHAR; |
tmav123 | 0:f54e9507171b | 39 | |
tmav123 | 0:f54e9507171b | 40 | typedef uint16_t USHORT; |
tmav123 | 0:f54e9507171b | 41 | typedef int16_t SHORT; |
tmav123 | 0:f54e9507171b | 42 | |
tmav123 | 0:f54e9507171b | 43 | typedef uint32_t ULONG; |
tmav123 | 0:f54e9507171b | 44 | typedef int32_t LONG; |
tmav123 | 0:f54e9507171b | 45 | |
tmav123 | 0:f54e9507171b | 46 | #ifndef TRUE |
tmav123 | 0:f54e9507171b | 47 | #define TRUE 1 |
tmav123 | 0:f54e9507171b | 48 | #endif |
tmav123 | 0:f54e9507171b | 49 | |
tmav123 | 0:f54e9507171b | 50 | #ifndef FALSE |
tmav123 | 0:f54e9507171b | 51 | #define FALSE 0 |
tmav123 | 0:f54e9507171b | 52 | #endif |
tmav123 | 0:f54e9507171b | 53 | |
tmav123 | 0:f54e9507171b | 54 | #define MB_TCP_DEBUG 1 /* Debug output in TCP module. */ |
tmav123 | 0:f54e9507171b | 55 | |
tmav123 | 0:f54e9507171b | 56 | |
tmav123 | 0:f54e9507171b | 57 | typedef enum |
tmav123 | 0:f54e9507171b | 58 | { |
tmav123 | 0:f54e9507171b | 59 | MB_LOG_ERROR = 0, |
tmav123 | 0:f54e9507171b | 60 | MB_LOG_WARN = 1, |
tmav123 | 0:f54e9507171b | 61 | MB_LOG_INFO = 2, |
tmav123 | 0:f54e9507171b | 62 | MB_LOG_DEBUG = 3 |
tmav123 | 0:f54e9507171b | 63 | } eMBPortLogLevel; |
tmav123 | 0:f54e9507171b | 64 | |
tmav123 | 0:f54e9507171b | 65 | #ifdef MB_TCP_DEBUG |
tmav123 | 0:f54e9507171b | 66 | void vMBPortLog( eMBPortLogLevel eLevel, const CHAR * szModule, |
tmav123 | 0:f54e9507171b | 67 | const CHAR * szFmt, ... ); |
tmav123 | 0:f54e9507171b | 68 | |
tmav123 | 0:f54e9507171b | 69 | void prvvMBTCPLogFrame( const CHAR * pucMsg, UCHAR * pucFrame, USHORT usFrameLen ); |
tmav123 | 0:f54e9507171b | 70 | #endif |
tmav123 | 0:f54e9507171b | 71 | |
tmav123 | 0:f54e9507171b | 72 | #endif |