00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef SFBPRINT_H
00030 #define SFBPRINT_H
00031
00032 #include "SFBConstants.h"
00033 #include "SFBAlarm.h"
00034 #include "SFBReactor.h"
00035 #include "SFBFrame.h"
00036
00037
00038
00039 extern void print(const char * str);
00040
00041 extern void print(const u8 * str, u32 len);
00042
00043 extern void print(int decimal);
00044
00045 extern void print(unsigned int decimal);
00046
00047 extern void print(long decimal);
00048
00049 extern void print(unsigned long decimal);
00050
00051 extern void print(long decimal, int code);
00052
00053 extern void print(double val);
00054
00055 extern void printFace();
00056
00057
00058 extern void printPacket(u8 * packet);
00059
00060
00061 extern void println();
00062
00063 extern void println(const char * str);
00064
00065 extern void println(const u8 * str, u32 len);
00066
00067 extern void println(int decimal);
00068
00069 extern void println(unsigned int decimal);
00070
00071 extern void println(long decimal);
00072
00073 extern void println(unsigned long decimal);
00074
00075 extern void println(long decimal, int code);
00076
00077 extern void println(double val);
00078
00079 extern void printlnCheckByte();
00080
00081
00082 extern void facePrint(u8 face, const char * str);
00083 extern void facePrint(u8 face, const u8 * str, u32 len);
00084 extern void facePrint(u8 face, int decimal);
00085 extern void facePrint(u8 face, unsigned int decimal);
00086 extern void facePrint(u8 face, long decimal);
00087 extern void facePrint(u8 face, unsigned long decimal);
00088 extern void facePrintBinary(u8 face, u64 value);
00089
00090 extern void facePrint(u8 face, unsigned long decimal, int code);
00091 extern void facePrint(u8 face, unsigned long decimal, int code, bool printneg, int width, bool zerofill);
00092 extern void facePrint(u8 face, double val);
00093 extern void facePrint(u8 face, double val);
00094 extern void facePrintFace(u8 face);
00095 extern void facePrintPacket(u8 face, const u8 * packet);
00096 extern void facePrintPacketHeader(u8 face, u32 packetLen, u8 sourceFace = NORTH, u8 cursor = 0, u8 flags = 0);
00097
00098 extern void facePrintln(u8 face);
00099 extern void facePrintln(u8 face, const char * str);
00100
00101 extern void facePrintln(u8 face, const u8 * str, u32 len);
00102
00103 extern void facePrintln(u8 face, int decimal);
00104
00105 extern void facePrintln(u8 face, unsigned int decimal);
00106
00107 extern void facePrintln(u8 face, long decimal);
00108
00109 extern void facePrintln(u8 face, unsigned long decimal);
00110
00111 extern void facePrintln(u8 face, unsigned long decimal, int code);
00114 extern void facePrintln(u8 face, double val);
00115
00116 extern void facePrintlnCheckByte(u8 face);
00117
00130 struct FacePrinter {
00131 void (*print)(u8 face, u8 byte);
00132 void (*println)(u8 face);
00133 void (*printFaceCode)(u8 face);
00134
00135 const char * (*getFaceName)(u8 face);
00136
00137 };
00138
00139 extern bool faceHasPrinter(u8 face);
00140
00141
00148 extern const FacePrinter * faceGetPrinter(u8 face);
00149
00160 extern bool faceFindFreeFace(u8 & foundFace);
00161
00176 extern void faceSetPrinter(u8 face, const FacePrinter * handler) ;
00177
00186 extern void faceUnsetPrinter(u8 face) ;
00187
00192 struct PacketPrinterHeader {
00193 FacePrinter fp;
00194 u8 maxLen;
00195 u8 usedLen;
00196 u8 sourceFace;
00197
00198 };
00199
00209 extern void packetPrinterStoreDataByte(PacketPrinterHeader *pph, u8 byte) ;
00210
00220 extern void packetPrinterTerminatePacket(PacketPrinterHeader *pph) ;
00221
00228 extern u8 * packetPrinterPrintedPacket(PacketPrinterHeader *pph) ;
00229
00237 #define PACKET_PRINTER_BUFFER_OVERHEAD_BYTES \
00238 (sizeof(PacketPrinterHeader)+sizeof(PacketHeader)+3+1) // (up to) 3 for alignment + 1 null terminator
00239
00243 #define PACKET_PRINTER_PACKET_BUFFER_SIZE \
00244 (PACKET_PRINTER_BUFFER_OVERHEAD_BYTES+MAX_PACKET_LENGTH) // room for a full packet
00245
00290 extern u8 * makePacketPrinter(u8 & assignedFace, u8 * buffer, u32 bufferLength, u8 sourceFace) ;
00291
00292 extern PacketPrinterHeader * initializePacketPrinterBuffer(const FacePrinter * fp, u8 onFace, u8 * buffer, u32 bufferLength, u8 sourceFace) ;
00293
00294
00295 extern void print_startup_initialization() ;
00296
00297 #endif
00298