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 
12 typedef enum {
13  /* Generic */
19 
20  /* Codec */
25 
26  /* App */
41 
43 
44  LOG_EMPTY = 0x00
45 } LogEntryEnum;
46 
47 typedef enum {
48  LOG_MODE_OFF,
49  LOG_MODE_MEMORY,
50  LOG_MODE_LIVE
51 } LogModeEnum;
52 
53 typedef void (*LogFuncType) (LogEntryEnum Entry, const void* Data, uint8_t Length);
54 
55 extern LogFuncType CurrentLogFunc;
56 
57 void LogInit(void);
58 void LogTick(void);
59 void LogTask(void);
60 
61 void LogMemClear(void);
62 uint16_t LogMemFree(void);
63 /* XModem callback */
64 bool LogMemLoadBlock(void* Buffer, uint32_t BlockAddress, uint16_t ByteCount);
65 
66 void LogSetModeById(LogModeEnum Mode);
67 bool LogSetModeByName(const char* Mode);
68 void LogGetModeByName(char* Mode, uint16_t BufferSize);
69 void LogGetModeList(char* List, uint16_t BufferSize);
70 void LogSRAMToFRAM(void);
71 
72 /* Wrapper function to call current logging function */
73 INLINE void LogEntry(LogEntryEnum Entry, const void* Data, uint8_t Length) { CurrentLogFunc(Entry, Data, Length); }
74 
75 #endif /* LOG_H_ */
Application processed authentication command.
Definition: Log.h:33
Chameleon boots.
Definition: Log.h:42
Application authentication failed.
Definition: Log.h:38
Application is in auth state.
Definition: Log.h:37
Application processed increment command.
Definition: Log.h:29
Currently active codec sent data.
Definition: Log.h:22
UID change.
Definition: Log.h:17
Empty Log Entry. This is not followed by a length byte nor the two systick bytes nor any data...
Definition: Log.h:44
LogEntryEnum
Definition: Log.h:12
Currently active codec received data.
Definition: Log.h:21
Application processed write command.
Definition: Log.h:28
Application processed halt command.
Definition: Log.h:34
Application processed an unknown command.
Definition: Log.h:35
Application reset.
Definition: Log.h:18
Unspecific log entry.
Definition: Log.h:14
Application processed restore command.
Definition: Log.h:32
Application processed read command.
Definition: Log.h:27
Application had a checksum fail.
Definition: Log.h:39
Application processed transfer command.
Definition: Log.h:31
Setting change.
Definition: Log.h:16
Currently active codec received data.
Definition: Log.h:23
Application is not authenticated.
Definition: Log.h:40
Application processed decrement command.
Definition: Log.h:30
Configuration change.
Definition: Log.h:15
Currently active codec sent data.
Definition: Log.h:24
Application is in authing state.
Definition: Log.h:36