/* * (c) 2002 Mario de Sousa * * Offered to the public under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * This code is made available on the understanding that it will not be * used in safety-critical situations without a full and competent review. */ #ifndef MODBUS_ASCII_PRIVATE_H #define MODBUS_ASCII_PRIVATE_H #include /* get the plc data types */ #include "mb_util.h" /* serial port default configuration... */ #define DEF_DATA_BITS 7 #define DEF_STOP_BITS_PAR 1 /* default stop bits if parity is used */ #define DEF_STOP_BITS_NOP 2 /* default stop bits if parity is not used */ #define DEF_BAUD_RATE 9600 /* Send retries of ascii frames... */ #define ASC_FRAME_SEND_RETRY 0 /* NOTES: * - the above are the retries at the layer1 level, * higher layers may decide to retry for themselves! * - For ascii frames, it doesn't make much sense to retry * if the first try failed... */ /* Buffer sizes... */ #define SEND_BUFFER_SIZE_SMALL (MAX_ASC_FRAME_LENGTH / 2) #define SEND_BUFFER_SIZE_LARGE (MAX_ASC_FRAME_LENGTH) #define RECV_BUFFER_SIZE_SMALL (MAX_ASC_FRAME_LENGTH / 2) #define RECV_BUFFER_SIZE_LARGE (MAX_ASC_FRAME_LENGTH) /* Frame lengths... */ /* The smallest element in an ascii frame. * This is used later to define the smallest value of certain buffers... */ #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_HEADER_LENGTH #if ASC_FRAME_MIN_ELE_LENGTH < ASC_FRAME_TAIL_LENGTH #undef ASC_FRAME_MIN_ELE_LENGTH #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_TAIL_LENGTH #endif #if ASC_FRAME_MIN_ELE_LENGTH < ASC_FRAME_LRC_LENGTH #undef ASC_FRAME_MIN_ELE_LENGTH #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_LRC_LENGTH #endif #if ASC_FRAME_MIN_ELE_LENGTH < L2_TO_ASC_CODING #undef ASC_FRAME_MIN_ELE_LENGTH #define ASC_FRAME_MIN_ELE_LENGTH L2_TO_ASC_CODING #endif #endif /* MODBUS_ASCII_PRIVATE_H */