Magic Lantern Firmware Wiki
Advertisement

General Notes[]

Findings by: Coutts

There are 2 functions of interest, dm_set_store_level and dm_set_print_level. Stubs can be found here (from 500d):

0xFF066DE4 - dm_set_store_level

0xFF066D7C - dm_set_print_level

Different debug messages in the firmware are posted with different classes. The class is arg0 to the debug message. This class determines what shows up for a name in the log, i.e.: [GUI], [STARTUP], [MAGIC], etc. The second argument to a debug message is the print level. Refer to the section below for understanding the level system implemented by canon.


dm_set_store_level[]

Usage (after finding stub):

dm_set_store_level( [class_id], [store_level] );

dm_set_print_level[]

This function behaves identical to dm_set_store_level, so all of the classes above will apply. I do not yet understand just what the print level affects, but I do know that setting a lower store_level seems to produce larger debug log files. To use this, just refer to dm_set_store_level above.


Debug Classes[]

class_id can be any number between 1 and 255. I have mapped out all of the known values below. Any missing ones didn't print in my test for some reason, it could just be the 500d - would be nice if someone can confirm these classes on another camera.

Class Name
ID # (decimal)
[PRP]
1
[PROPAD]
2
[INTCOM]
3
[WINSYS]
4
[CTRLSRV]
5
[LVCAF]
6
[LVAF]
7
[LVCAE]
8
[LVAE]
9
[LVFD]
10
[LVMD]
11
[LVCLR]
12
[LVWB]
13
[DP]
14
[MAC]
15
[CRP]
16
[UPDC]
17
[SYS]
18
[RD]
19
[AUDIO]
20
[ENG]
21
[ENGP]
22
[FAC]
23
[IMP]
24
[IMPD]
25
[IMPP]
26
[REDEV]
27
[COL]
28
[WB]
29
[CSMGR]
30
[FSYS]
31
[FIO]
32
[FSU]
33
[CF]
34
[SD]
35
[FM]
36
[MRK]
37
[MPTP]
38
[FC]
39
[WAV]
40
[FJOB]
41
[FR]
42
[FW]
43
[MP]
44
[MP_MOV]
45
[MP_AVI]
46
[MR]
47
[MR_MOV]
48
[USB]
49
[PTPCOM]

[MAGIC]
50
[PTP]
51
[MTP]
52
[RTOM]
53
[CERES]
54
[SDCOM]
55
[SDIODRV]
56
[SDIOTSK]
57
[TOM]
58
[TOM_C]
59
[TOM_F]
60
[LVCDEV]
61
[IPC]
62
[IPCT]
63
[RPC]
64
[RSC]
128
[PROPST]
129
[DISP]
130
[GUI]
131
[GUI_M]
132
[GUI_E]
133
[UPD]
134
[DEVICE]
135
[HDMI]
136
[BIND]
137
[HPD]
138
[STARTUP]
139
[TERM]
140
[EM]
141
[FCACHE]
142
[JOB]
143
[FA]
144
[CAPD]
145
[CAPE]
146
[SHTC]
147
[SHTB]
148
[SHTP]
149
[SHTFD]
150
[SHTRD]
151
[LV]
152
[LVP]
153
[LVA]
154
[LVCFG]
155
[MC]
156
[FCS]
157
[FSS]
158
[RMT]
159
[MS]
160
[SS]
161
[CF]
162
[SD]
163
[FM]
164
[MRK]
165
[MPTP]
166
[FC]
167
[WAV]
168
[FJOB]
169
[FR]
170
[FW]
171
[MP]
172
[MP_MOV]
173
[MP_AVI]
174
[MR]
175
[MR_MOV]
176
[USB]
177
[PTPCOM]
178
[PTP]
179
[MTP]
180
[RTOM]
181
[CERES]
182
[SDCOM]
183
[SDIODRV]
184
[SDIOTSK]
185
[TOM]
186
[TOM_C]
187
[TOM_F]
188
[LVCDEV]
189
[IPC]
190
[IPCT]
191
[RPC]
192

Store Levels[]

There are 15 levels, 1-15. Basic rule of thumb: higher number will hide debug messages and a lower one will show them. Think of the store level as a value-floor (limiter) for what messages will be printed. Any debug message with a level lower than what's currently set by dm_set_store_level for a specific class, won't be printed in the log. Let's take this for an example:

DryosDebugMsg( 0x83, 0x3, "This is a [GUI] debug message");

The default store level seems to be 3, so this message will print. Say I want to hide this message (or any [GUI] messages with a store level of 3 for that matter). Simple, just call dm_set_store_level:

dm_set_store_level( 0x83, 0x4);

Since the store level for this class (0x83 - [GUI]) is now higher than what's being passed in the debug messages, no debug message will be stored in the log for this class. The reason that everybody thought a store level of 7 was a magic number for turning off debug messages is because 7 is a higher level than almost all debug messages in the dump, so it works well for turning off messages.


DbgMgr Struct in memory[]

I have found some kind of structure in memory for each debug class which contains the actual values for dm_store_level and dm_print_level. Each class has it's own spot in this (array of structures?) area of memory. The store levels are stored as bytes, so don't forget to take this into account when looking at ram dumps ;)

  • off_0x14 holds the dm_store_level
  • off_0x15 holds the dm_print_level
CLASS id # BASE ADDR dm_store level - off_0x14 dm_print level - off_0x15
[PRP] 1 301E57 301E6B 301E6C
[PROPAD] 2 301E5A 301E6E 301E6F
[INTCOM] 3 301E5D 301E71 301E72
[WINSYS] 4 301E60 301E74 301E75
[CTRLSRV] 5 301E63 301E77 301E78
[LVCAF] 6 301E66 301E7A 301E7B
[LVAF] 7 301E69 301E7D 301E7E
[LVCAE] 8 301E6C 301E80 301E81
[LVAE] 9 301E6F 301E83 301E84
[LVFD] 10 301E72 301E86 301E87
[LVMD] 11 301E75 301E89 301E8A
[LVCLR] 12 301E78 301E8C 301E8D
[LVWB] 13 301E7B 301E8F 301E90
[DP] 14 301E7E 301E92 301E93
[MAC] 15 301E81 301E95 301E96
[CRP] 16 301E84 301E98 301E99
[UPDC] 17 301E87 301E9B 301E9C
[SYS] 18 301E8A 301E9E 301E9F
[RD] 19 301E8D 301EA1 301EA2
[AUDIO] 20 301E90 301EA4 301EA5
[ENG] 21 301E93 301EA7 301EA8
[ENGP] 22 301E96 301EAA 301EAB
[FAC] 23 301E99 301EAD 301EAE
[IMP] 24 301E9C 301EB0 301EB1
[IMPD] 25 301E9F 301EB3 301EB4
[IMPP] 26 301EA2 301EB6 301EB7
[REDEV] 27 301EA5 301EB9 301EBA
[COL] 28 301EA8 301EBC 301EBD
[WB] 29 301EAB 301EBF 301EC0
[CSMGR] 30 301EAE 301EC2 301EC3
[FSYS] 31 301EB1 301EC5 301EC6
[FIO] 32 301EB4 301EC8 301EC9
[FSU] 33 301EB7 301ECB 301ECC
[CF] 34 301EBA 301ECE 301ECF
[SD] 35 301EBD 301ED1 301ED2
[FM] 36 301EC0 301ED4 301ED5
[MRK] 37 301EC3 301ED7 301ED8
[MPTP] 38 301EC6 301EDA 301EDB
[FC] 39 301EC9 301EDD 301EDE
[WAV] 40 301ECC 301EE0 301EE1
[FJOB] 41 301ECF 301EE3 301EE4
[FR] 42 301ED2 301EE6 301EE7
[FW] 43 301ED5 301EE9 301EEA
[MP] 44 301ED8 301EEC 301EED
[MP_MOV] 45 301EDB 301EEF 301EF0
[MP_AVI] 46 301EDE 301EF2 301EF3
[MR] 47 301EE1 301EF5 301EF6
[MR_MOV] 48 301EE4 301EF8 301EF9
[USB] 49 301EE7 301EFB 301EFC
[PTPCOM] 50 301EEA 301EFE 301EFF
[PTP] 51 301EED 301F01 301F02
[MTP] 52 301EF0 301F04 301F05
[RTOM] 53 301EF3 301F07 301F08
[CERES] 54 301EF6 301F0A 301F0B
[SDCOM] 55 301EF9 301F0D 301F0E
[SDIODRV] 56 301EFC 301F10 301F11
[SDIOTSK] 57 301EFF 301F13 301F14
[TOM] 58 301F02 301F16 301F17
[TOM_C] 59 301F05 301F19 301F1A
[TOM_F] 60 301F08 301F1C 301F1D
[LVCDEV] 61 301F0B 301F1F 301F20
[IPC] 62 301F0E 301F22 301F23
[IPCT] 63 301F11 301F25 301F26
[RPC] 64 301F14 301F28 301F29
[RSC] 128 301FD4 301FE8 301FE9
[PROPST] 129 301FD7 301FEB 301FEC
[DISP] 130 301FDA 301FEE 301FEF
[GUI] 131 301FDD 301FF1 301FF2
[GUI_M] 132 301FE0 301FF4 301FF5
[GUI_E] 133 301FE3 301FF7 301FF8
[UPD] 134 301FE6 301FFA 301FFB
[DEVICE] 135 301FE9 301FFD 301FFE
[HDMI] 136 301FEC 302000 302001
[BIND] 137 301FEF 302003 302004
[HPD] 138 301FF2 302006 302007
[STARTUP] 139 301FF5 302009 30200A
[TERM] 140 301FF8 30200C 30200D
[EM] 141 301FFB 30200F 302010
[FCACHE] 142 301FFE 302012 302013
[JOB] 143 302001 302015 302016
[FA] 144 302004 302018 302019
[CAPD] 145 302007 30201B 30201C
[CAPE] 146 30200A 30201E 30201F
[SHTC] 147 30200D 302021 302022
[SHTB] 148 302010 302024 302025
[SHTP] 149 302013 302027 302028
[SHTFD] 150 302016 30202A 30202B
[SHTRD] 151 302019 30202D 30202E
[LV] 152 30201C 302030 302031
[LVP] 153 30201F 302033 302034
[LVA] 154 302022 302036 302037
[LVCFG] 155 302025 302039 30203A
[MC] 156 302028 30203C 30203D
[FCS] 157 30202B 30203F 302040
[FSS] 158 30202E 302042 302043
[RMT] 159 302031 302045 302046
[MS] 160 302034 302048 302049
[SS] 161 302037 30204B 30204C
[CF] 162 30203A 30204E 30204F
[SD] 163 30203D 302051 302052
[FM] 164 302040 302054 302055
[MRK] 165 302043 302057 302058
[MPTP] 166 302046 30205A 30205B
[FC] 167 302049 30205D 30205E
[WAV] 168 30204C 302060 302061
[FJOB] 169 30204F 302063 302064
[FR] 170 302052 302066 302067
[FW] 171 302055 302069 30206A
[MP] 172 302058 30206C 30206D
[MP_MOV] 173 30205B 30206F 302070
[MP_AVI] 174 30205E 302072 302073
[MR] 175 302061 302075 302076
[MR_MOV] 176 302064 302078 302079
[USB] 177 302067 30207B 30207C
[PTPCOM] 178 30206A 30207E 30207F
[PTP] 179 30206D 302081 302082
[MTP] 180 302070 302084 302085
[RTOM] 181 302073 302087 302088
[CERES] 182 302076 30208A 30208B
[SDCOM] 183 302079 30208D 30208E
[SDIODRV] 184 30207C 302090 302091
[SDIOTSK] 185 30207F 302093 302094
[TOM] 186 302082 302096 302097
[TOM_C] 187 302085 302099 30209A
[TOM_F] 188 302088 30209C 30209D
[LVCDEV] 189 30208B 30209F 3020A0
[IPC] 190 30208E 3020A2 3020A3
[IPCT] 191 302091 3020A5 3020A6
[RPC] 192 302094 3020A8 3020A9

Find VRAM addresses[]

by Coutts in 500D[]

Keep in mind that the known HD buffers in the 500d are at 0x46000080 
and 0x48000080
 
 8026: 26858.706 [LVCFG] [LVREC] Free Yuv 46000064
 8027: 26858.763 [RSC] SRM_FreeMemoryResourceForLiveViewYuv 0x46000064
 8028: 26858.827 [LVCFG] [LVREC] Free Yuv 48000064
 8029: 26858.869 [RSC] SRM_FreeMemoryResourceForLiveViewYuv 0x48000064
 8033: 26859.363 [RSC] this->dwLVYUV 1
 8035: 26860.124 [RSC] this->dwLVYUV 0
 8345: 29739.697 [LVCFG] [LVREC] AllocMemYuv1 Addr:48000064-48000080
 8354: 29770.936 [LVCFG] YuvAddress = 0x48000064 -> 0x48000080
 8357: 29771.190 [LVCFG] [LVREC] AllocMemYuv2 Addr:48000064-48000080
 8359: 29771.584 [LVCFG] YuvAddress = 0x46000064 -> 0x46000080
 8833: 31321.728 [LVCFG] [LVREC] Free Yuv 48000064
 8834: 31321.789 [RSC] SRM_FreeMemoryResourceForLiveViewYuv 0x48000064
 8835: 31321.856 [LVCFG] [LVREC] Free Yuv 46000064
 8836: 31321.895 [RSC] SRM_FreeMemoryResourceForLiveViewYuv 0x46000064
 8840: 31322.412 [RSC] this->dwLVYUV 1
 8842: 31323.147 [RSC] this->dwLVYUV 0



in another log, after doing some video recording. 
These messages are in play mode watching a clip.

 9469: 33747.617 [MP] StartResizeMotionJpeg(0, 0x43738800)
 9478: 33754.900 [MP] DeleteVram[0](0x43738800)
 9551: 34761.695 [MP] MVP_GetRecWorkBuffSize(0x91920c70)
 9554: 34762.679 [MP] MVP_GetPlayWorkBuffSize(0x91920c70)
 9555: 34762.717 [MP] MVP_GetPlayWorkBuffSize : Decode Size(1884160 x 2)
 9559: 34763.407 [MP] MVP_GetStreamBuffSize(0x91920c70)
 9562: 34799.175 [MP] MVP_OpenMoviePlay(0x91920c70)
 9563: 34799.231 [MP] MVP_OpenMoviePlay : Decode Size[1884160](1280,720)
 9564: 34799.270 [MP] MVP_OpenMoviePlay : DecBuff[0x48000064,0x481cc064]
 9565: 34799.296 [MP] VramAddress[0]=0x41b07800
 9566: 34799.318 [MP] VramAddress[1]=0x43738800
 9567: 34799.341 [MP] VramAddress[2]=0x43b48800
 9568: 34799.364 [MP_MOV] OpenMovReadFile(B:/DCIM/100CANON/MVI_8391.MOV)
 9569: 34799.454 [MP_MOV] ReadMovHeader
 9570: 34801.619 [MP_MOV] ReadMovHeader : AtomType(ftyp)
 9571: 34802.810 [MP] mvpGetVramNum : ImageAddress[0x43738800]
 9572: 34802.835 [MP] mvpGetVramNum : VramNum=1
 9669: 35372.854 [MP] mvpGetVramNum : ImageAddress[0x43738800]
 9670: 35372.873 [MP] mvpGetVramNum : VramNum=1
 9671: 35372.922 [MP] CreateVram[2](0x43b48800,720,720,480)
 9673: 35376.228 [MP] CreateVram[0](0x41b07800,720,720,480)
 9888: 36088.830 [MP] -- STATE_PLAYING_PLAY --
 9895: 36095.442 [MP] mvpResizeCompleteCallback
 9896: 36095.516 [MP] mvpResizeCompleteCallback
 9904: 36102.261 [MP] mvpDecodeCompleteCallback
 9912: 36118.581 [MP] PlayMovie :rd(3),dec(2),res(1),resC(1),dspC(0)
 9913: 36118.609 [MP] PlayMovie : (0,1,0,0)
 9914: 36118.664 [MP] PlayMovie : SetRectColorParameter(0x43738800,720,720,480)
 9917: 36121.852 [MP] ChangeVramCallBack
 9918: 36121.869 [MP] ChangeVramCallBackExec
 9920: 36122.328 [MP] ChangeNextUpdateVram[0](0x41b07800)
 9921: 36122.386 [MP] StartResizeMotionJpeg(1, 0x43738800)
all 3 of the 500d's identified LV vram buffers are there, again this could be useful for new cameras. :)

See VRAM/500D

On 550D/1.0.9[]

    dm_set_store_level( DM_DISP, 7 );

gives:

 20741:  3027.786 [DISP] SetImageVramParameter pAddress=40d07800 pFlipCBR=0
20742:  3027.840 [DISP] SetImageOverrideParameter ClassID=152, Override=-1
20743:  3027.983 [DISP] EnableImagePhysicalScreenParameter pCBR=ff0350f8
20744:  3028.117 [LVCDEV] ->lvcdevStartDev
20745:  3029.292 [ENG] LockEng   [0xac41c0][LVC_DEV]
20746:  3029.857 [ENG] LockEng   [0x8bd1d8][LVC_FACE]
20747:  3033.701 [DISP] VdInterruptHandler bmp=0 img=ff0350f8
20748:  3035.308 [ENG] UnLockEng [0xac41c0][LVC_DEV]
20749:  3053.523 [ENG] UnLockEng [0x8bd1d8][LVC_FACE]
20752:  3060.867 [LVP] GetJpegEncodePass Zoom:0 R:0 V:1 M:0
20753:  3061.300 [DISP] SetImageVramParameter pAddress=4c233800 pFlipCBR=0
20754:  3061.356 [DISP] SetImageOverrideParameter ClassID=152, Override=-1
20755:  3061.489 [DISP] EnableImagePhysicalScreenParameter pCBR=ff0350f8
20756:  3061.631 [LVCDEV] ->lvcdevStartDev
20757:  3062.833 [ENG] LockEng   [0xac41c0][LVC_DEV]
20758:  3067.071 [DISP] VdInterruptHandler bmp=0 img=ff0350f8
20759:  3068.845 [ENG] UnLockEng [0xac41c0][LVC_DEV]
20760:  3094.476 [LVP] GetJpegEncodePass Zoom:0 R:0 V:1 M:0
20761:  3094.921 [DISP] SetImageVramParameter pAddress=4f11d800 pFlipCBR=0
20762:  3094.976 [DISP] SetImageOverrideParameter ClassID=152, Override=-1
20763:  3095.099 [DISP] EnableImagePhysicalScreenParameter pCBR=ff0350f8

This code:

    int (*GetVramInformation)(uint8_t *v1, uint8_t *v2, uint8_t *v3, uint8_t *v4, uint8_t *v5, uint8_t *v6, uint8_t *v7 ) = (void*)0xFF28E894;
    GetVramInformation(&v1, &v2, &v3, &v4, &v5, &v6, &v7);
    bmp_printf( FONT_SMALL, x, y+20, "GetVramInformation v1=%x v2=%x v3=%x v4=%x v5=%x v6=%x v7=%x", v1, v2, v3, v4, v5, v6, v7 );
    DebugMsg( DM_MAGIC, 3, "GetVramInformation v1=%x v2=%x v3=%x v4=%x v5=%x v6=%x v7=%x", v1, v2, v3, v4, v5, v6, v7 );

gives:

v1=0x40d078000, v2=2, v3=0x4c233800, v4=0, v5=720, v6=720, v7=480


which Class_ID to use ?[]

To know which class_id to use, look R0, the first arg of DebugMsg

ROM:FF012248                 ADR     R2, aStartupentry ; "startupEntry"
ROM:FF01224C                 MOV     R1, #5
ROM:FF012250                 MOV     R0, #0x8B     ;139
ROM:FF012254                 BL      DebugMsg

the related log entry is

     7:    13.020 [STARTUP] startupEntry

so use

dm_set_store_level( 139, level);

in your code to debug STARTUP things...

Advertisement