-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathvcmailbox.7
More file actions
2238 lines (2238 loc) · 26.2 KB
/
vcmailbox.7
File metadata and controls
2238 lines (2238 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'\" t
.TH VCMAILBOX 7
.
.SH NAME
vcmailbox \- the VideoCore mailbox property interface
.
.
.SH DESCRIPTION
.
The mailbox can be used by the ARM on the Raspberry Pi to communicate with the
VideoCore processor.
From the command line, the
.BR vcmailbox (1)
can be used for this purpose.
The mailbox operates a simple request / response protocol:
.
.IP \(bu 3
The response overwrites the request.
.RS
.IP \(bu 3
The callee is not allowed to return a different buffer address, this allows the
caller to make independent asynchronous requests.
.RE
.
.IP \(bu
The buffer itself is 16-byte aligned as only the upper 28 bits of the address
can be passed via the mailbox.
.
.IP \(bu
All u64/u32/u16 values are in host CPU endian order.
.
.IP \(bu
Unknown tags are ignored (the response bit will not be set).
.
.IP \(bu
Response may include unsolicited tags.
.
.IP \(bu
Response tag lengths may be longer than expected if additional information is
provided in a future format.
.RS
.IP \(bu 3
The response is truncated to the provided buffer length.
.IP \(bu
Incompatible changes require a new tag so that where the buffer is the size
required by a previous version the truncated part should be readable as per the
previous version.
.IP \(bu
Response length indicates the desired length even when it is longer than the
buffer size filled.
.IP \(bu
Tag value length can be used to infer the version of the request/response.
.RE
.
.IP \(bu
Tags should be processed in order except where an interface requires multiple
tags for a single operation (like the frame buffer).
.
.
.SS Mailbox messages
.
.IP \(bu 3
The mailbox interface has 28 bits (MSB) available for the value and 4 bits
(LSB) for the channel.
.RS
.IP \(bu 3
Request message: 28 bits (MSB) buffer address
.IP \(bu
Response message: 28 bits (MSB) buffer address
.RE
.
.IP \(bu
Channels 8 and 9 are used.
.RS
.IP \(bu 3
Channel 8: Request from ARM for response by VC
.IP \(bu
Channel 9: Request from VC for response by ARM (none currently defined)
.RE
.
.
.SS Buffer contents
.
.
.TP
.B u32
buffer size in bytes (including the header values, the end tag and
padding)
.
.TP
.B u32
buffer request/response code
.RS
.PP
Request codes:
.PD 0
.TP 12
.B 0x00000000
process request
.TP
.B \&
All other values reserved
.PD
.PP
Response codes:
.PD 0
.TP 12
.B 0x80000000
request successful
.TP
.B 0x80000001
error parsing request buffer (partial response)
.TP
.B \&
All other values reserved
.PD
.RE
.
.TP
.B u8\|.\|.\|.
sequence of concatenated tags
.
.TP
.B u32
0x0 (end tag)
.
.TP
.B u8\|.\|.\|.
padding
.
.
.SS Tag format
.
.TP
.B u32
tag identifier
.
.TP
.B u32
value buffer size in bytes
.
.TP
.B u32
Request codes:
.PD 0
.RS
.TP 12
.B b31 clear
request
.TP
.B b30-b0
reserved
.RE
.PD
.IP
Response codes:
.PD 0
.RS
.TP 12
.B b31 set
response
.TP
.B b30-b0
value length in bytes
.RE
.PD
.
.TP
.B u8\|.\|.\|.
value buffer
.
.TP
.B u8\|.\|.\|.
padding to align the tag to 32 bits.
.
.
.SH VIDEOCORE TAGS
.
.
.SS Get firmware revision
.PD 0
.TP 12
.B Tag:
0x00000001
.TP
.B Request:
0 bytes
.TP
.B Response:
4 bytes
.RS
.TP
.B u32
firmware revision
.RE
.PD
.
.
.SH HARDWARE TAGS
.
.SS Get board model
.PD 0
.TP 12
.B Tag:
0x00010001
.TP
.B Request:
0 bytes
.TP
.B Response:
4 bytes
.RS
.TP
.B u32
board model
.RE
.PD
.
.SS Get board revision
.PD 0
.TP 12
.B Tag:
0x00010002
.TP
.B Request:
0 bytes
.TP
.B Response:
4 bytes
.RS
.TP
.B u32
board revision
.RE
.PD
.
.SS Get board MAC address
.PD 0
.TP 12
.B Tag:
0x00010003
.TP
.B Request:
0 bytes
.TP
.B Response:
6 bytes
.RS
.TP
.B u8...
MAC address in network byte order
.RE
.PD
.
.SS Get board serial
.PD 0
.TP 12
.B Tag:
0x00010004
.TP
.B Request:
0 bytes
.TP
.B Response:
8 bytes
.RS
.TP
.B u64
board serial
.RE
.PD
.
.SS Get ARM memory
.PD 0
.TP 12
.B Tag:
0x00010005
.TP
.B Request:
0 bytes
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
base address in bytes
.TP
.B u32
size in bytes
.RE
.PD
.
.PP
Future formats may specify multiple base+size combinations.
.
.SS Get VC memory
.PD 0
.TP 12
.B Tag:
0x00010006
.TP
.B Request:
0 bytes
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
base address in bytes
.TP
.B u32
size in bytes
.RE
.PD
.
.PP
Future formats may specify multiple base+size combinations.
.
.SS Get clocks
.PD 0
.TP 12
.B Tag:
0x00010007
.TP
.B Request:
0 bytes
.TP
.B Response:
variable bytes (multiple of 8)
.RS
.TP
.B u32
parent clock id (0 for a root clock)
.TP
.B u32
clock id
.TP
.B (repeated)
.RE
.PD
.
.PP
Returns all clocks that exist
.IR "in top-down, breadth-first order" .
Clocks that depend on another clock should be defined as children of that clock. Clocks that depend on no other clocks should have no parent. Clock IDs are as in the
.B CLOCK TAGS
section below.
.
.
.SH CONFIG TAGS
.
.SS Get command line
.PD 0
.TP 12
.B Tag:
0x00050001
.TP
.B Request:
0 bytes
.TP
.B Response:
variable bytes
.RS
.TP
.B u8...
ASCII command line string
.RE
.PD
.
.PP
Caller should not assume the string is null terminated.
.
.
.SH SHARED RESOURCE MANAGEMENT TAGS
.
.SS Get DMA channels
.PD 0
.TP 12
.B Tag:
0x00060001
.TP
.B Request:
0 bytes
.TP
.B Response:
4 bytes
.RS
.TP
.B u32
mask
.RS
.TP 12
.B Bits 0-15
DMA channels 0-15 (0=do not use, 1=usable)
.TP
.B Bits 16-31
reserved for future use
.RE
.RE
.PD
.
.PP
Caller assumes that the VC has enabled all the usable DMA channels.
.
.
.SH POWER TAGS
.
.SS Unique device IDs
.PD 0
.TP 12
.B 0x00000000
SD Card
.TP
.B 0x00000001
UART0
.TP
.B 0x00000002
UART1
.TP
.B 0x00000003
USB HCD
.TP
.B 0x00000004
I2C0
.TP
.B 0x00000005
I2C1
.TP
.B 0x00000006
I2C2
.TP
.B 0x00000007
SPI
.TP
.B 0x00000008
CCP2TX
.TP
.B 0x00000009
Unknown (RPi4)
.TP
.B 0x0000000a
Unknown (RPi4)
.PD
.
.SS Get power state
.PD 0
.TP 12
.B Tag:
0x00020001
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
device id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
device id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=device exists, 1=device does not exist
.TP
.B Bits 2-31
reserved for future use
.RE
.RE
.PD
.
.PP
Response indicates current state.
.
.SS Get timing
.PD 0
.TP 12
.B Tag:
0x00020002
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
device id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
device id
.TP
.B u32
enable wait time in microseconds
.RE
.PD
.
.PP
Response indicates wait time required after turning a device on before power is stable. Returns 0 wait time if the device does not exist.
.
.SS Set power state
.PD 0
.TP 12
.B Tag:
0x00028001
.TP
.B Request:
8 bytes
.RS
.TP
.B u32
device id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=do not wait, 1=wait
.TP
.B Bits 2-31
reserved for future use (set to 0)
.RE
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
device id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=device exists, 1=device does not exist
.TP
.B Bits 2-31
reserved for future use
.RE
.RE
.PD
.
.PP
Response indicates new state, with/without waiting for the power to become stable.
.
.
.SH CLOCK TAGS
.
.SS Unique clock IDs
.PD 0
.TP 12
.B 0x00000000
reserved
.TP
.B 0x00000001
EMMC
.TP
.B 0x00000002
UART
.TP
.B 0x00000003
ARM
.TP
.B 0x00000004
CORE
.TP
.B 0x00000005
V3D
.TP
.B 0x00000006
H264
.TP
.B 0x00000007
ISP
.TP
.B 0x00000008
SDRAM
.TP
.B 0x00000009
PIXEL
.TP
.B 0x0000000a
PWM
.TP
.B 0x0000000b
HEVC
.TP
.B 0x0000000c
EMMC2
.TP
.B 0x0000000d
M2MC
.TP
.B 0x0000000e
PIXEL_BVB
.PD
.
.PP
All clocks are the
.I base clocks
for those peripherals, e.g. 3MHz for UART, 50/100MHz for EMMC, not the dividers applied using the peripheral.
.
.SS Get clock state
.PD 0
.TP 12
.B Tag:
0x00030001
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
clock id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=clock exists, 1=clock does not exist
.TP
.B Bits 2-31
reserved for future use
.RE
.RE
.PD
.
.SS Set clock state
.PD 0
.TP 12
.B Tag:
0x00038001
.TP
.B Request:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=clock exists, 1=clock does not exist
.TP
.B Bits 2-31
reserved for future use (set to 0)
.RE
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
state
.RS
.TP 12
.B Bit 0
0=off, 1=on
.TP
.B Bit 1
0=clock exists, 1=clock does not exist
.TP
.B Bits 2-31
reserved for future use
.RE
.RE
.PD
.
.SS Get clock rate
.PD 0
.TP 12
.B Tag:
0x00030002
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
clock id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
rate (in Hz)
.RE
.PD
.
.PP
Next enable rate should be returned even if the clock is not running. A rate of 0 is returned if the clock does not exist.
.
.SS Set clock rate
.PD 0
.TP 12
.B Tag:
0x00038002
.TP
.B Request:
12 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
rate (in Hz)
.TP
.B u32
skip setting turbo
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
rate (in Hz)
.RE
.PD
.
.PP
Next supported enable rate should be returned even if the clock is not running. A rate of 0 is returned if the clock does not exist. The clock rate may be clamped to the supported range.
.
.PP
By default when setting arm freq above default, other turbo settings will be enabled (e.g. voltage, sdram and gpu frequencies). You can disable this effect by setting "skip setting turbo" to 1.
.
.SS Get max clock rate
.PD 0
.TP 12
.B Tag:
0x00030004
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
clock id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
rate (in Hz)
.RE
.PD
.
.PP
Return the maximum supported clock rate for the given clock. Clocks should not be set higher than this.
.
.SS Get min clock rate
.PD 0
.TP 12
.B Tag:
0x00030007
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
clock id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
clock id
.TP
.B u32
rate (in Hz)
.RE
.PD
.
.PP
Return the minimum supported clock rate for the given clock. This may be used when idle.
.
.SS Get turbo
.PD 0
.TP 12
.B Tag:
0x00030009
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
id
.TP
.B u32
level
.RE
.PD
.
.PP
Get the turbo state for index id. id should be 0. level will be zero for non-turbo and one for turbo.
.
.SS Set turbo
.PD 0
.TP 12
.B Tag:
0x00038009
.TP
.B Request:
8 bytes
.RS
.TP
.B u32
id
.TP
.B u32
level
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
id
.TP
.B u32
level
.RE
.PD
.
.PP
Set the turbo state for index id. id should be zero. level will be zero for non-turbo and one for turbo.
This will cause GPU clocks to be set to maximum when enabled and minimum when disabled.
.
.
.SH VOLTAGE TAGS
.
.SS Unique voltage IDs
.PD 0
.TP 12
.B 0x00000000
reserved
.TP
.B 0x00000001
Core
.TP
.B 0x00000002
SDRAM_C
.TP
.B 0x00000003
SDRAM_P
.TP
.B 0x00000004
SDRAM_I
.PD
.
.SS Get voltage
.PD 0
.TP 12
.B Tag:
0x00030003
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
voltage id
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
voltage id
.TP
.B u32
value (offset from 1.2V in units of 0.025V)
.RE
.PD
.
.PP
The voltage value may be clamped to the supported range.
A value of 0x80000000 means the id was not valid.
.
.SS Set voltage
.PD 0
.TP 12
.B Tag:
0x00038003
.TP
.B Request:
8 bytes
.RS
.TP
.B u32
voltage id
.TP
.B u32
value (offset from 1.2V in units of 0.025V)
.RE
.TP
.B Response:
8 bytes
.RS
.TP
.B u32
voltage id
.TP
.B u32
value (offset from 1.2V in units of 0.025V)
.RE
.PD
.
.PP
The voltage value may be clamped to the supported range.
A value of 0x80000000 means the id was not valid.
.
.SS Get max voltage
.PD 0
.TP 12
.B Tag:
0x00030005
.TP
.B Request:
4 bytes
.RS
.TP
.B u32
voltage id
.RE
.TP