27 #ifndef __DESFIRE_LOGGING_UTILS_H__ 28 #define __DESFIRE_LOGGING_UTILS_H__ 30 #include "../../Log.h" 31 #include "../../Common.h" 32 #include "DESFireFirmwareSettings.h" 33 #include "DESFireMemoryOperations.h" 35 #ifndef DESFIRE_MIN_INCOMING_LOGSIZE 36 #define DESFIRE_MIN_INCOMING_LOGSIZE (1) 38 #ifndef DESFIRE_MIN_OUTGOING_LOGSIZE 39 #define DESFIRE_MIN_OUTGOING_LOGSIZE (1) 42 INLINE
void DesfireLogEntry(
LogEntryEnum LogCode,
void *LogDataBuffer, uint16_t BufSize) {
43 if (DESFIRE_MIN_OUTGOING_LOGSIZE <= BufSize) {
44 LogEntry(LogCode, (
void *) LogDataBuffer, BufSize);
48 typedef enum DESFIRE_FIRMWARE_ENUM_PACKING {
55 extern DESFireLoggingMode LocalLoggingMode;
64 extern BYTE LocalTestingMode;
66 void DESFireLogErrorMessage(
char *fmtMsg, ...);
67 void DESFireLogStatus(BYTE *bufMsg, SIZET bufSize);
68 void DESFireLogDebuggingMessage(
char *fmtMsg, ...);
69 void DESFireLogSourceCodeTODO(
char *implNoteMsg,
char *srcFileLoggingData);
70 void DESFireLogIncomingData(BYTE *byteBuf, SIZET bufLength);
71 void DESFireLogOutgoingData(BYTE *byteBuf, SIZET bufLength);
72 void DESFireLogNativeCommand(BYTE *Buffer, SIZET ByteCount);
73 void DESFireLogISO1443Command(BYTE *Buffer, SIZET ByteCount);
74 void DESFireLogISO7816Command(BYTE *Buffer, SIZET ByteCount);
75 void DESFireLogSetProtectedData(BYTE *pdataBuf, SIZET byteBufSize);
76 void DESFireLogPICCHardReset(BYTE *strBuf, SIZET strLength);
77 void DESFireLogPICCSoftReset(BYTE *strBuf, SIZET strLength);
79 void DebugPrintP(
const char *fmt, ...);
80 #define DEBUG_PRINT(fmt, ...) DebugPrintP(PSTR(fmt), ##__VA_ARGS__) 82 #define DEBUG_PRINT_P(fmtStr, ...) ({ \ 83 uint8_t logLength = 0; \ 85 snprintf_P((char *) __InternalStringBuffer, STRING_BUFFER_SIZE, \ 86 fmtStr, ##__VA_ARGS__); \ 87 logLength = StringLength((char *) __InternalStringBuffer, \ 88 STRING_BUFFER_SIZE); \ 89 DesfireLogEntry(LOG_ERR_DESFIRE_GENERIC_ERROR, \ 90 (char *) __InternalStringBuffer, logLength); \ 94 #define GetSourceFileLoggingData() ({ \ 97 snprintf_P(__InternalStringBuffer, STRING_BUFFER_SIZE, \ 98 PSTR("@@ LINE #%d in *%s @@"), \ 99 __LINE__, __FILE__); \ 100 __InternalStringBuffer[STRING_BUFFER_SIZE - 1] = '\0'; \ 102 strBuffer = __InternalStringBuffer; \ 106 #define GetSymbolNameString(symbolName) ({ \ 109 strncpy_P(__InternalStringBuffer2, PSTR(#symbolName), \ 110 DATA_BUFFER_SIZE_SMALL); \ 112 strBuffer = __InternalStringBuffer2; \ 116 #define GetHexBytesString(byteArray, arrSize) ({ \ 119 BufferToHexString(__InternalStringBuffer, \ 120 STRING_BUFFER_SIZE, \ 121 byteArray, arrSize); \ 122 __InternalStringBuffer[STRING_BUFFER_SIZE - 1] = '\0'; \ 124 strBuffer = __InternalStringBuffer; \ 128 #if defined(DESFIRE_DEFAULT_LOGGING_MODE) && DESFIRE_DEFAULT_LOGGING_MODE != 0 129 #define LogDebuggingMsg(msg) ({ \ 131 strncpy_P((char *) __InternalStringBuffer, msg, STRING_BUFFER_SIZE); \ 132 uint8_t sbufLength = StringLength((char *) __InternalStringBuffer, STRING_BUFFER_SIZE); \ 133 LogEntry(LOG_INFO_DESFIRE_OUTGOING_DATA, (void *) __InternalStringBuffer, \ 138 #define LogDebuggingMsg(msg) ({}) 166 #define DesfireLogISOStateChange(state, logCode) ({}) LogEntryEnum
Definition: Log.h:16