Modified version of ModbusTCP

Dependencies:   EthernetNetIf mbed

Committer:
paleskyjp
Date:
Thu Mar 15 15:28:14 2012 +0000
Revision:
3:d7d7c67f21fa
Parent:
0:62be54b8975d
eMBRegCoilsCB was corrected.
(Implementation of writing single coil was wrong.)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
paleskyjp 0:62be54b8975d 1 /*
paleskyjp 0:62be54b8975d 2 * FreeModbus Libary: BARE Port
paleskyjp 0:62be54b8975d 3 * Copyright (C) 2006 Christian Walter <wolti@sil.at>
paleskyjp 0:62be54b8975d 4 *
paleskyjp 0:62be54b8975d 5 * This library is free software; you can redistribute it and/or
paleskyjp 0:62be54b8975d 6 * modify it under the terms of the GNU Lesser General Public
paleskyjp 0:62be54b8975d 7 * License as published by the Free Software Foundation; either
paleskyjp 0:62be54b8975d 8 * version 2.1 of the License, or (at your option) any later version.
paleskyjp 0:62be54b8975d 9 *
paleskyjp 0:62be54b8975d 10 * This library is distributed in the hope that it will be useful,
paleskyjp 0:62be54b8975d 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paleskyjp 0:62be54b8975d 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
paleskyjp 0:62be54b8975d 13 * Lesser General Public License for more details.
paleskyjp 0:62be54b8975d 14 *
paleskyjp 0:62be54b8975d 15 * You should have received a copy of the GNU Lesser General Public
paleskyjp 0:62be54b8975d 16 * License along with this library; if not, write to the Free Software
paleskyjp 0:62be54b8975d 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
paleskyjp 0:62be54b8975d 18 *
paleskyjp 0:62be54b8975d 19 * File: $Id: portevent.c,v 1.1 2006/08/22 21:35:13 wolti Exp $
paleskyjp 0:62be54b8975d 20 */
paleskyjp 0:62be54b8975d 21
paleskyjp 0:62be54b8975d 22 /* ----------------------- Modbus includes ----------------------------------*/
paleskyjp 0:62be54b8975d 23 #include "mb.h"
paleskyjp 0:62be54b8975d 24 #include "mbport.h"
paleskyjp 0:62be54b8975d 25
paleskyjp 0:62be54b8975d 26 /* ----------------------- Variables ----------------------------------------*/
paleskyjp 0:62be54b8975d 27 static eMBEventType eQueuedEvent;
paleskyjp 0:62be54b8975d 28 static BOOL xEventInQueue;
paleskyjp 0:62be54b8975d 29
paleskyjp 0:62be54b8975d 30 /* ----------------------- Start implementation -----------------------------*/
paleskyjp 0:62be54b8975d 31 BOOL
paleskyjp 0:62be54b8975d 32 xMBPortEventInit( void )
paleskyjp 0:62be54b8975d 33 {
paleskyjp 0:62be54b8975d 34 xEventInQueue = FALSE;
paleskyjp 0:62be54b8975d 35 return TRUE;
paleskyjp 0:62be54b8975d 36 }
paleskyjp 0:62be54b8975d 37
paleskyjp 0:62be54b8975d 38 BOOL
paleskyjp 0:62be54b8975d 39 xMBPortEventPost( eMBEventType eEvent )
paleskyjp 0:62be54b8975d 40 {
paleskyjp 0:62be54b8975d 41 xEventInQueue = TRUE;
paleskyjp 0:62be54b8975d 42 eQueuedEvent = eEvent;
paleskyjp 0:62be54b8975d 43 return TRUE;
paleskyjp 0:62be54b8975d 44 }
paleskyjp 0:62be54b8975d 45
paleskyjp 0:62be54b8975d 46 BOOL
paleskyjp 0:62be54b8975d 47 xMBPortEventGet( eMBEventType * eEvent )
paleskyjp 0:62be54b8975d 48 {
paleskyjp 0:62be54b8975d 49 BOOL xEventHappened = FALSE;
paleskyjp 0:62be54b8975d 50
paleskyjp 0:62be54b8975d 51 if( xEventInQueue )
paleskyjp 0:62be54b8975d 52 {
paleskyjp 0:62be54b8975d 53 *eEvent = eQueuedEvent;
paleskyjp 0:62be54b8975d 54 xEventInQueue = FALSE;
paleskyjp 0:62be54b8975d 55 xEventHappened = TRUE;
paleskyjp 0:62be54b8975d 56 }
paleskyjp 0:62be54b8975d 57 return xEventHappened;
paleskyjp 0:62be54b8975d 58 }