00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00032
00033
00034 #ifndef FILE_COMMS_CORE_H_SEEN
00035 #define FILE_COMMS_CORE_H_SEEN
00036
00037
00038 #ifdef EXTERN
00039 #warning "EXTERN already defined by another header, please sort it out!"
00040 #undef EXTERN
00041 #endif
00042
00043
00044 #ifdef COMMSCORE_C
00045 #define EXTERN
00046
00047 void sendErrorInternal(unsigned short) FPAGE_FE;
00048 void sendDebugInternal(unsigned char*) FPAGE_FE;
00049 #else
00050 #define EXTERN extern
00051 #endif
00052
00053
00054
00055
00056 EXTERN void decodePacketAndRespond(void) TEXT;
00057
00058 EXTERN void sendErrorIfClear(unsigned short) FPAGE_FE;
00059 EXTERN void sendDebugIfClear(unsigned char*) FPAGE_FE;
00060
00061
00062
00063 EXTERN void resetReceiveState(unsigned char) FPAGE_FE;
00064
00065 EXTERN void checksumAndSend(void) FPAGE_FE;
00066
00067 EXTERN void populateBasicDatalog(void) FPAGE_FE;
00068
00069
00070
00071 EXTERN unsigned short TXPacketLengthToSendCAN0;
00072 EXTERN unsigned short TXPacketLengthToSendSCI0;
00073 EXTERN unsigned char* TXBufferCurrentPositionHandler;
00074 EXTERN unsigned char* TXBufferCurrentPositionCAN0;
00075 EXTERN unsigned char* TXBufferCurrentPositionSCI0;
00076
00077
00078
00079 EXTERN unsigned char TXBufferInUseFlags;
00080 EXTERN unsigned char RXBufferContentSourceID;
00081
00082 #define COM_SET_SCI0_INTERFACE_ID BIT0
00083 #define COM_SET_CAN0_INTERFACE_ID BIT1
00084 #define COM_SET_SPARE2_INTERFACE_ID BIT2
00085 #define COM_SET_SPARE3_INTERFACE_ID BIT3
00086 #define COM_SET_SPARE4_INTERFACE_ID BIT4
00087 #define COM_SET_SPARE5_INTERFACE_ID BIT5
00088 #define COM_SET_SPARE6_INTERFACE_ID BIT6
00089 #define COM_SET_SPARE7_INTERFACE_ID BIT7
00090 #define COM_CLEAR_SCI0_INTERFACE_ID NBIT0
00091 #define COM_CLEAR_CAN0_INTERFACE_ID NBIT1
00092 #define COM_CLEAR_SPARE2_INTERFACE_ID NBIT2
00093 #define COM_CLEAR_SPARE3_INTERFACE_ID NBIT3
00094 #define COM_CLEAR_SPARE4_INTERFACE_ID NBIT4
00095 #define COM_CLEAR_SPARE5_INTERFACE_ID NBIT5
00096 #define COM_CLEAR_SPARE6_INTERFACE_ID NBIT6
00097 #define COM_CLEAR_SPARE7_INTERFACE_ID NBIT7
00098 #define CLEAR_ALL_SOURCE_ID_FLAGS ZEROS
00099
00100
00101
00102 EXTERN unsigned char RXStateFlags;
00103 EXTERN unsigned char* RXBufferCurrentPosition;
00104 EXTERN unsigned short RXPacketLengthReceived;
00105 EXTERN unsigned short RXCalculatedPayloadLength;
00106
00107
00108 #define RX_READY_TO_PROCESS BIT1
00109 #define RX_SCI_ESCAPED_NEXT BIT2
00110
00111
00112 #define RX_CLEAR_READY_TO_PROCESS NBIT1
00113 #define RX_SCI_NOT_ESCAPED_NEXT NBIT2
00114
00115
00116
00117
00118
00119
00120
00121
00122 #define SCICR2_RX_ENABLE BIT2
00123 #define SCICR2_TX_ENABLE BIT3
00124 #define SCICR2_RX_ISR_ENABLE BIT5
00125 #define SCICR2_TX_ISR_ENABLE BIT7
00126 #define SCICR2_RX_DISABLE NBIT2
00127 #define SCICR2_TX_DISABLE NBIT3
00128 #define SCICR2_RX_ISR_DISABLE NBIT5
00129 #define SCICR2_TX_ISR_DISABLE NBIT7
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 EXTERN unsigned char RXHeaderFlags;
00144 EXTERN unsigned short RXHeaderPayloadID;
00145 EXTERN unsigned char RXHeaderSourceAddress;
00146 EXTERN unsigned short RXHeaderPayloadLength;
00147
00148
00149
00150
00151
00152
00153 #define HEADER_HAS_ACK BIT0
00154 #define HEADER_IS_NACK BIT1
00155 #define HEADER_HAS_ADDRS BIT2
00156 #define HEADER_HAS_LENGTH BIT3
00157 #define HEADER_RESERVED_A BIT4
00158 #define HEADER_RESERVED_B BIT5
00159 #define HEADER_RESERVED_C BIT6
00160 #define HEADER_RESERVED_D BIT7
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175 #define requestInterfaceVersion 0
00176 #define requestFirmwareVersion 2
00177 #define requestMaxPacketSize 4
00178 #define requestEchoPacketReturn 6
00179 #define requestSoftSystemReset 8
00180
00181 #define requestHardSystemReset 10
00182
00183
00184
00185
00186 #define asyncErrorCodePacket 13
00187
00188 #define asyncDebugInfoPacket 15
00189
00190
00191
00192
00193
00194 #define replaceBlockInRAM 256
00195 #define replaceBlockInFlash 258
00196 #define retrieveBlockFromRAM 260
00197 #define retrieveBlockFromFlash 262
00198 #define burnBlockFromRamToFlash 264
00199 #define eraseAllBlocksFromFlash 266
00200 #define burnAllBlocksOfFlash 268
00201
00202
00203 #define adjustMainTableCell 300
00204 #define adjustMainTableRPMAxis 302
00205 #define adjustMainTableLoadAxis 304
00206
00207
00208 #define adjust2dTableAxis 306
00209 #define adjust2dTableCell 308
00210
00211
00212 #define requestBasicDatalog 400
00213 #define responseBasicDatalog 401
00214 #define requestConfigurableDatalog 402
00215 #define responseConfigurableDatalog 403
00216 #define setAsyncDatalogType 404
00217
00218
00219 #define forwardPacketOverCAN 500
00220 #define forwardPacketOverOtherUART 502
00221
00222
00223 #define retrieveArbitraryMemory 600
00224
00225
00226 #define testPayloadIDPacketType0 65520
00227 #define testPayloadIDPacketType1 65522
00228 #define testPayloadIDPacketType2 65524
00229 #define testPayloadIDPacketType3 65526
00230 #define testPayloadIDPacketType4 65528
00231 #define testPayloadIDPacketType5 65530
00232 #define testPayloadIDPacketType6 65532
00233 #define testPayloadIDPacketType7 65534
00234
00235
00236 #undef EXTERN
00237
00238
00239 #else
00240
00241 #warning "Header file COMMS_CORE_H seen before, sort it out!"
00242
00243 #endif