Chameleon-Mini
Log.h
Go to the documentation of this file.
1 #ifndef LOG_H_
2 #define LOG_H_
3 
4 #include "Common.h"
5 
6 #define LOG_SIZE 2048
7 #define FRAM_LOG_ADDR_ADDR 0x4000 // start of the second half of FRAM
8 #define FRAM_LOG_START_ADDR 0x4002 // directly after the address
9 #define FRAM_LOG_SIZE 0x3FFE // the whole second half (minus the 2 Bytes of Address)
10 
11 extern uint8_t LogMem[LOG_SIZE];
12 extern uint8_t *LogMemPtr;
13 extern uint16_t LogMemLeft;
14 
16 typedef enum {
17  /* Generic */
23 
24  /* Codec */
29  LOG_INFO_CODEC_SNI_READER_DATA = 0x44, //< Sniffing codec receive data from reader
30  LOG_INFO_CODEC_SNI_READER_DATA_W_PARITY = 0x45, //< Sniffing codec receive data from reader
31  LOG_INFO_CODEC_SNI_CARD_DATA = 0x46, //< Sniffing codec receive data from card
32  LOG_INFO_CODEC_SNI_CARD_DATA_W_PARITY = 0x47, //< Sniffing codec receive data from card
34 
35  /* App */
50 
51  /* DESFire emulation and development related logging messages (0xEx): */
52 #ifdef CONFIG_MF_DESFIRE_SUPPORT
53 #include "Application/DESFire/DESFireLoggingCodesInclude.c"
54 #endif
55 
57  LOG_EMPTY = 0x00
58 } LogEntryEnum;
60 
61 typedef enum {
62  LOG_MODE_OFF,
63  LOG_MODE_MEMORY,
64  LOG_MODE_LIVE
65 } LogModeEnum;
66 
67 typedef void (*LogFuncType)(LogEntryEnum Entry, const void *Data, uint8_t Length);
68 
69 extern LogFuncType CurrentLogFunc;
70 
71 void LogInit(void);
72 void LogTick(void);
73 void LogTask(void);
74 
75 void LogMemClear(void);
76 uint16_t LogMemFree(void);
77 /* XModem callback */
78 bool LogMemLoadBlock(void *Buffer, uint32_t BlockAddress, uint16_t ByteCount);
79 
80 void LogSetModeById(LogModeEnum Mode);
81 bool LogSetModeByName(const char *Mode);
82 void LogGetModeByName(char *Mode, uint16_t BufferSize);
83 void LogGetModeList(char *List, uint16_t BufferSize);
84 void LogSRAMToFRAM(void);
85 
86 /* Wrapper function to call current logging function */
87 INLINE void LogEntry(LogEntryEnum Entry, const void *Data, uint8_t Length) { CurrentLogFunc(Entry, Data, Length); }
88 
89 #endif /* LOG_H_ */
Application processed authentication command.
Definition: Log.h:42
Chameleon boots.
Definition: Log.h:56
Application authentication failed.
Definition: Log.h:47
Application is in auth state.
Definition: Log.h:46
Application processed increment command.
Definition: Log.h:38
Currently active codec sent data.
Definition: Log.h:26
UID change.
Definition: Log.h:21
nor the two systick bytes nor any data.
Definition: Log.h:57
LogEntryEnum
Definition: Log.h:16
Currently active codec received data.
Definition: Log.h:25
Application processed write command.
Definition: Log.h:37
Application processed halt command.
Definition: Log.h:43
Application processed an unknown command.
Definition: Log.h:44
Application reset.
Definition: Log.h:22
Unspecific log entry.
Definition: Log.h:18
Application processed restore command.
Definition: Log.h:41
Application processed read command.
Definition: Log.h:36
Application had a checksum fail.
Definition: Log.h:48
Application processed transfer command.
Definition: Log.h:40
Setting change.
Definition: Log.h:20
Currently active codec received data.
Definition: Log.h:27
Application is not authenticated.
Definition: Log.h:49
Application processed decrement command.
Definition: Log.h:39
Configuration change.
Definition: Log.h:19
Currently active codec sent data.
Definition: Log.h:28
Application is in authing state.
Definition: Log.h:45
Add logging of the LEDHook case for FIELD_DETECTED.
Definition: Log.h:33