serial.h
1 | /*
| 2 | FreeRTOS.org V4.7.0 - Copyright (C) 2003-2007 Richard Barry.
| 3 |
| 4 | This file is part of the FreeRTOS.org distribution.
| 5 |
| 6 | FreeRTOS.org is free software; you can redistribute it and/or modify
| 7 | it under the terms of the GNU General Public License as published by
| 8 | the Free Software Foundation; either version 2 of the License, or
| 9 | (at your option) any later version.
| 10 |
| 11 | FreeRTOS.org is distributed in the hope that it will be useful,
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| 14 | GNU General Public License for more details.
| 15 |
| 16 | You should have received a copy of the GNU General Public License
| 17 | along with FreeRTOS.org; if not, write to the Free Software
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
| 19 |
| 20 | A special exception to the GPL can be applied should you wish to distribute
| 21 | a combined work that includes FreeRTOS.org, without being obliged to provide
| 22 | the source code for any proprietary components. See the licensing section
| 23 | of http://www.FreeRTOS.org for full details of how and when the exception
| 24 | can be applied.
| 25 |
| 26 | ***************************************************************************
| 27 | See http://www.FreeRTOS.org for documentation, latest information, license
| 28 | and contact details. Please ensure to read the configuration and relevant
| 29 | port sections of the online documentation.
| 30 |
| 31 | Also see http://www.SafeRTOS.com a version that has been certified for use
| 32 | in safety critical systems, plus commercial licensing, development and
| 33 | support options.
| 34 | ***************************************************************************
| 35 | */
| 36 |
| 37 | #ifndef SERIAL_COMMS_H
| 38 | #define SERIAL_COMMS_H
| 39 |
| 40 | #include "queue.h"
| 41 |
| 42 | typedef void * xComPortHandle;
| 43 |
| 44 | typedef enum
| 45 | {
| 46 | serCOM1,
| 47 | serCOM2,
| 48 | serCOM3,
| 49 | serCOM4,
| 50 | serCOM5,
| 51 | serCOM6,
| 52 | serCOM7,
| 53 | serCOM8
| 54 | } eCOMPort;
| 55 |
| 56 | typedef enum
| 57 | {
| 58 | serNO_PARITY,
| 59 | serODD_PARITY,
| 60 | serEVEN_PARITY,
| 61 | serMARK_PARITY,
| 62 | serSPACE_PARITY
| 63 | } eParity;
| 64 |
| 65 | typedef enum
| 66 | {
| 67 | serSTOP_1,
| 68 | serSTOP_2
| 69 | } eStopBits;
| 70 |
| 71 | typedef enum
| 72 | {
| 73 | serBITS_5,
| 74 | serBITS_6,
| 75 | serBITS_7,
| 76 | serBITS_8
| 77 | } eDataBits;
| 78 |
| 79 | typedef enum
| 80 | {
| 81 | ser50,
| 82 | ser75,
| 83 | ser110,
| 84 | ser134,
| 85 | ser150,
| 86 | ser200,
| 87 | ser300,
| 88 | ser600,
| 89 | ser1200,
| 90 | ser1800,
| 91 | ser2400,
| 92 | ser4800,
| 93 | ser9600,
| 94 | ser19200,
| 95 | ser38400,
| 96 | ser57600,
| 97 | ser115200
| 98 | } eBaud;
| 99 |
| 100 | typedef struct xCOM_PORT
| 101 | {
| 102 | eCOMPort sPort; /* comm port address (0 or 1) */
| 103 |
| 104 | /* Read/Write buffers. */
| 105 | xQueueHandle xRxedChars;
| 106 | xQueueHandle xCharsForTx;
| 107 | } xComPort;
| 108 |
| 109 |
| 110 | xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength );
| 111 | xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );
| 112 | //void vSerialPutString( xComPortHandle pxPort,const signed portCHAR * const pcString, unsigned portSHORT usStringLength );
| 113 | void vSerialPutString( xComPortHandle pxPort, signed portCHAR * pcString, portSHORT usStringLength );
| 114 | signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime );
| 115 | signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime );
| 116 | portBASE_TYPE xSerialWaitForSemaphore( xComPortHandle xPort );
| 117 | void vSerialClose( xComPortHandle xPort );
| 118 |
| 119 | #endif
|
|