00001 /* FreeEMS - the open source engine management system 00002 00003 Copyright 2008 Fred Cooke 00004 00005 This file is part of the FreeEMS project. 00006 00007 FreeEMS software is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 FreeEMS software is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with any FreeEMS software. If not, see http://www.gnu.org/licenses/ 00019 00020 We ask that if you make any changes to this file you email them upstream to 00021 us at admin(at)diyefi(dot)org or, even better, fork the code on github.com! 00022 00023 Thank you for choosing FreeEMS to run your engine! */ 00024 00025 00031 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00032 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00033 #ifndef FILE_COMMS_ISRS_H_SEEN 00034 #define FILE_COMMS_ISRS_H_SEEN 00035 00036 00037 #ifdef EXTERN 00038 #warning "EXTERN already defined by another header, please sort it out!" 00039 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */ 00040 #endif 00041 00042 00043 #ifdef COMMSISRS_C 00044 #define EXTERN 00045 #else 00046 #define EXTERN extern 00047 #endif 00048 00049 00050 /* SCISR1 register fields 00051 * 00052 * From left most/most significant to right most/least significant. 00053 * 00054 * Abrev Description Actions/Meaning 00055 * TRDE - Transmit Data Register Empty - Load with more data if there is any - Main Flag 00056 * TC - Transmit Complete - Nothing being sent and nothing loaded ready - unused 00057 * RDRF - Receive Data Register Full - Store data in buffer until packet complete - Main Flag 00058 * IDLE - Idle Line - Receive line is quiet - unused 00059 * OR - Overrun - Discard partial data received and increment counter 00060 * NF - Noise Flag - Discard partial data received and increment counter 00061 * FE - Framing Error - Discard partial data received and increment counter 00062 * PF - Parity Error - Discard partial data received and increment counter 00063 * 00064 * SCISR1 flag masks */ 00065 #define SCISR1_TX_REGISTER_EMPTY BIT7 00066 #define SCISR1_TX_COMPLETE BIT6 00067 #define SCISR1_RX_REGISTER_FULL BIT5 00068 #define SCISR1_RX_IDLE_LINE BIT4 00069 #define SCISR1_RX_OVERRUN BIT3 00070 #define SCISR1_RX_NOISE BIT2 00071 #define SCISR1_RX_FRAMING BIT1 00072 #define SCISR1_RX_PARITY BIT0 00073 00074 00075 /* TX/RX state variables */ 00076 EXTERN unsigned char TXByteEscaped; 00077 EXTERN unsigned char RXCalculatedChecksum; 00078 00079 00080 #undef EXTERN 00081 00082 #else 00083 /* let us know if we are being untidy with headers */ 00084 #warning "Header file COMMS_ISRS_H seen before, sort it out!" 00085 /* end of the wrapper ifdef from the very top */ 00086 #endif