Debian Codegraph @

utils/v4l2-dbg/v4l2-dbg.cpp

raw
1 /*
2 Copyright (C) 2007 Hans Verkuil <[email protected]>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17 */
18
19 #include <cctype>
20 #include <cerrno>
21 #include <cstring>
22 #include <string>
23 #include <vector>
24
25 #include <fcntl.h>
26 #include <getopt.h>
27 #include <sys/ioctl.h>
28 #include <unistd.h>
29
30 #ifdef HAVE_SYS_KLOG_H
31 #include <sys/klog.h>
32 #endif
33
34 #include <linux/videodev2.h>
35 #include <v4l-getsubopt.h>
36
37 #include <v4l2-info.h>
38
39 #include "v4l2-dbg-bttv.h"
40 #include "v4l2-dbg-saa7134.h"
41 #include "v4l2-dbg-em28xx.h"
42 #include "v4l2-dbg-ac97.h"
43 #include "v4l2-dbg-tvp5150.h"
44 #include "v4l2-dbg-micron.h"
45
46 struct board_list {
47 const char *name;
48 int prefix; /* Register prefix size */
49 const std::vector<board_regs> &regs;
50 const std::vector<board_regs> &alt_regs;
51 };
52
53 static const std::vector<board_regs> empty{};
54
55 static const std::vector<board_list> boards{
56 #define AC97_BOARD 0
57 {
58 /* From v4l2-dbg-ac97.h */
59 AC97_IDENT,
60 sizeof(AC97_PREFIX) - 1,
61 ac97_regs,
62 empty,
63 },
64 {
65 /* From v4l2-dbg-bttv.h */
66 BTTV_IDENT,
67 sizeof(BTTV_PREFIX) - 1,
68 bt8xx_regs,
69 bt8xx_regs_other,
70 },
71 {
72 /* From v4l2-dbg-saa7134.h */
73 SAA7134_IDENT,
74 sizeof(SAA7134_PREFIX) - 1,
75 saa7134_regs,
76 empty,
77 },
78 {
79 /* From v4l2-dbg-em28xx.h */
80 EM28XX_IDENT,
81 sizeof(EM28XX_PREFIX) - 1,
82 em28xx_regs,
83 em28xx_alt_regs,
84 },
85 {
86 /* From v4l2-dbg-tvp5150.h */
87 TVP5150_IDENT,
88 sizeof(TVP5150_PREFIX) - 1,
89 tvp5150_regs,
90 empty,
91 },
92 {
93 /* From v4l2-dbg-micron.h */
94 MT9V011_IDENT,
95 sizeof(MT9V011_PREFIX) - 1,
96 mt9v011_regs,
97 empty,
98 },
99 };
100
101 /* Short option list
102
103 Please keep in alphabetical order.
104 That makes it easier to see which short options are still free.
105
106 In general the lower case is used to set something and the upper
107 case is used to retrieve a setting. */
108 enum Option {
109 OptListRegisters = 'l',
110 OptGetRegister = 'g',
111 OptSetRegister = 's',
112 OptSetDevice = 'd',
113 OptGetDriverInfo = 'D',
114 OptChip = 'c',
115 OptScanChips = 'n',
116 OptSetStride = 'w',
117 OptHelp = 'h',
118
119 OptLogStatus = 128,
120 OptVerbose,
121 OptListSymbols,
122 OptLast = 256
123 };
124
125 static char options[OptLast];
126
127 static unsigned capabilities;
128
129 static struct option long_options[] = {
130 {"device", required_argument, nullptr, OptSetDevice},
131 {"help", no_argument, nullptr, OptHelp},
132 {"list-registers", optional_argument, nullptr, OptListRegisters},
133 {"get-register", required_argument, nullptr, OptGetRegister},
134 {"set-register", required_argument, nullptr, OptSetRegister},
135 {"chip", required_argument, nullptr, OptChip},
136 {"scan-chips", no_argument, nullptr, OptScanChips},
137 {"info", no_argument, nullptr, OptGetDriverInfo},
138 {"verbose", no_argument, nullptr, OptVerbose},
139 {"log-status", no_argument, nullptr, OptLogStatus},
140 {"list-symbols", no_argument, nullptr, OptListSymbols},
141 {"wide", required_argument, nullptr, OptSetStride},
142 {nullptr, 0, nullptr, 0}
143 };
144
145 static void usage()
146 {
147 printf("Usage: v4l2-dbg [options] [values]\n"
148 " -D, --info Show driver info [VIDIOC_QUERYCAP]\n"
149 " -d, --device <dev> Use device <dev> instead of /dev/video0\n"
150 " If <dev> starts with a digit, then /dev/video<dev> is used\n"
151 " -h, --help Display this help message\n"
152 " --verbose Turn on verbose ioctl error reporting\n"
153 " -c, --chip <chip> The chip identifier to use with other commands\n"
154 " It can be one of:\n"
155 " bridge<num>: bridge chip number <num>\n"
156 " bridge (default): same as bridge0\n"
157 " subdev<num>: sub-device number <num>\n"
158 " -l, --list-registers[=min=<addr>[,max=<addr>]]\n"
159 " Dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER]\n"
160 " -g, --get-register <addr>\n"
161 " Get the specified register [VIDIOC_DBG_G_REGISTER]\n"
162 " -s, --set-register <addr>\n"
163 " Set the register with the commandline arguments\n"
164 " The register will autoincrement [VIDIOC_DBG_S_REGISTER]\n"
165 " -n, --scan-chips Scan the available bridge and subdev chips [VIDIOC_DBG_G_CHIP_INFO]\n"
166 " -w, --wide <reg length>\n"
167 " Sets step between two registers\n"
168 " --list-symbols List the symbolic register names you can use, if any\n"
169 " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n");
170 }
171
172 static void print_regs(int fd, struct v4l2_dbg_register *reg, unsigned long min, unsigned long max, int stride)
173 {
174 unsigned long mask;
175 unsigned long i;
176 int line = 0;
177
178 /* Query size of the first register */
179 reg->reg = min;
180 if (ioctl(fd, VIDIOC_DBG_G_REGISTER, reg) == 0) {
181 /* If size is set, then use this as the stride */
182 if (reg->size)
183 stride = reg->size;
184 }
185
186 mask = stride > 2 ? 0x1f : 0x0f;
187
188 for (i = min & ~mask; i <= max; i += stride) {
189 if ((i & mask) == 0 && line % 32 == 0) {
190 if (stride == 4)
191 printf("\n 00 04 08 0C 10 14 18 1C");
192 else if (stride == 2)
193 printf("\n 00 02 04 06 08 0A 0C 0E");
194 else
195 printf("\n 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
196 }
197
198 if ((i & mask) == 0) {
199 printf("\n%08lx: ", i);
200 line++;
201 }
202 if (i < min) {
203 printf("%*s ", 2 * stride, "");
204 continue;
205 }
206 reg->reg = i;
207 if (ioctl(fd, VIDIOC_DBG_G_REGISTER, reg) < 0) {
208 perror("ioctl: VIDIOC_DBG_G_REGISTER failed\n");
209 break;
210 }
211 printf("%0*llx ", 2 * stride, reg->val);
212 usleep(1);
213 }
214 printf("\n");
215 }
216
217 static void print_name(struct v4l2_dbg_chip_info *chip)
218 {
219 printf("%-10s (%c%c)\n", chip->name,
220 (chip->flags & V4L2_CHIP_FL_READABLE) ? 'r' : '-',
221 (chip->flags & V4L2_CHIP_FL_WRITABLE) ? 'w' : '-');
222 }
223
224 static unsigned long long parse_reg(const struct board_list *curr_bd, const std::string &reg)
225 {
226 if (curr_bd) {
227 for (const auto &curr : curr_bd->regs) {
228 if (!strcasecmp(reg.c_str(), curr.name) ||
229 !strcasecmp(reg.c_str(), curr.name + curr_bd->prefix)) {
230 return curr.reg;
231 }
232 }
233 for (const auto &curr : curr_bd->alt_regs) {
234 if (!strcasecmp(reg.c_str(), curr.name) ||
235 !strcasecmp(reg.c_str(), curr.name + curr_bd->prefix)) {
236 return curr.reg;
237 }
238 }
239 }
240 return strtoull(reg.c_str(), nullptr, 0);
241 }
242
243 static const char *reg_name(const struct board_list *curr_bd, unsigned long long reg)
244 {
245 if (curr_bd) {
246 for (const auto &curr : curr_bd->regs) {
247 if (reg == curr.reg)
248 return curr.name;
249 }
250 for (const auto &curr : curr_bd->regs) {
251 if (reg == curr.reg)
252 return curr.name;
253 }
254 }
255 return nullptr;
256 }
257
258 static const char *binary(unsigned long long val)
259 {
260 static char bin[80];
261 char *p = bin;
262 int i, j;
263 int bits = 64;
264
265 if ((val & 0xffffffff00000000LL) == 0) {
266 if ((val & 0xffff0000) == 0) {
267 if ((val & 0xff00) == 0)
268 bits = 8;
269 else
270 bits= 16;
271 }
272 else
273 bits = 32;
274 }
275
276 for (i = bits - 1; i >= 0; i -= 8) {
277 for (j = i; j >= i - 7; j--) {
278 if (val & (1LL << j))
279 *p++ = '1';
280 else
281 *p++ = '0';
282 }
283 *p++ = ' ';
284 }
285 p[-1] = 0;
286 return bin;
287 }
288
289 static int doioctl(int fd, unsigned long int request, void *parm, const char *name)
290 {
291 int retVal = ioctl(fd, request, parm);
292
293 if (options[OptVerbose]) {
294 if (retVal < 0)
295 printf("%s: failed: %s\n", name, strerror(errno));
296 else
297 printf("%s: ok\n", name);
298 }
299
300 return retVal;
301 }
302
303 static int parse_subopt(char **subs, const char * const *subopts, char **value)
304 {
305 int opt = v4l_getsubopt(subs, const_cast<char * const *>(subopts), value);
306
307 if (opt == -1) {
308 fprintf(stderr, "Invalid suboptions specified\n");
309 usage();
310 std::exit(EXIT_FAILURE);
311 }
312 if (*value == nullptr) {
313 fprintf(stderr, "No value given to suboption <%s>\n",
314 subopts[opt]);
315 usage();
316 std::exit(EXIT_FAILURE);
317 }
318 return opt;
319 }
320
321 int main(int argc, char **argv)
322 {
323 char *value, *subs;
324 int i, forcedstride = 0;
325
326 int fd = -1;
327
328 /* command args */
329 int ch;
330 const char *device = "/dev/video0"; /* -d device */
331 struct v4l2_capability vcap; /* list_cap */
332 struct v4l2_dbg_register set_reg;
333 struct v4l2_dbg_register get_reg;
334 struct v4l2_dbg_chip_info chip_info;
335 const struct board_list *curr_bd = nullptr;
336 char short_options[26 * 2 * 3 + 1];
337 int idx = 0;
338 std::string reg_min_arg, reg_max_arg;
339 std::string reg_set_arg;
340 unsigned long long reg_min = 0, reg_max = 0;
341 std::vector<std::string> get_regs;
342 struct v4l2_dbg_match match;
343 char *p;
344
345 match.type = V4L2_CHIP_MATCH_BRIDGE;
346 match.addr = 0;
347 memset(&set_reg, 0, sizeof(set_reg));
348 memset(&get_reg, 0, sizeof(get_reg));
349
350 if (argc == 1) {
351 usage();
352 std::exit(EXIT_SUCCESS);
353 }
354 for (i = 0; long_options[i].name; i++) {
355 if (!isalpha(long_options[i].val))
356 continue;
357 short_options[idx++] = long_options[i].val;
358 if (long_options[i].has_arg == required_argument) {
359 short_options[idx++] = ':';
360 } else if (long_options[i].has_arg == optional_argument) {
361 short_options[idx++] = ':';
362 short_options[idx++] = ':';
363 }
364 }
365 while (true) {
366 int option_index = 0;
367
368 short_options[idx] = 0;
369 ch = getopt_long(argc, argv, short_options,
370 long_options, &option_index);
371 if (ch == -1)
372 break;
373
374 options[ch] = 1;
375 if (!option_index) {
376 for (i = 0; long_options[i].val; i++) {
377 if (long_options[i].val == ch) {
378 option_index = i;
379 break;
380 }
381 }
382 }
383 if (long_options[option_index].has_arg == optional_argument &&
384 !optarg && argv[optind] && argv[optind][0] != '-')
385 optarg = argv[optind++];
386
387 switch (ch) {
388 case OptHelp:
389 usage();
390 std::exit(EXIT_SUCCESS);
391
392 case OptSetDevice:
393 device = optarg;
394 if (device[0] >= '0' && device[0] <= '9' && strlen(device) <= 3) {
395 static char newdev[20];
396
397 sprintf(newdev, "/dev/video%s", device);
398 device = newdev;
399 }
400 break;
401
402 case OptChip:
403 if (!memcmp(optarg, "subdev", 6) && isdigit(optarg[6])) {
404 match.type = V4L2_CHIP_MATCH_SUBDEV;
405 match.addr = strtoul(optarg + 6, nullptr, 0);
406 break;
407 }
408 if (!memcmp(optarg, "bridge", 6)) {
409 match.type = V4L2_CHIP_MATCH_BRIDGE;
410 match.addr = strtoul(optarg + 6, nullptr, 0);
411 break;
412 }
413 match.type = V4L2_CHIP_MATCH_BRIDGE;
414 match.addr = 0;
415 break;
416
417 case OptSetRegister:
418 reg_set_arg = optarg;
419 break;
420
421 case OptGetRegister:
422 get_regs.emplace_back(optarg);
423 break;
424
425 case OptSetStride:
426 forcedstride = strtoull(optarg, nullptr, 0);
427 break;
428
429 case OptListRegisters:
430 subs = optarg;
431 if (subs == nullptr)
432 break;
433
434 while (*subs != '\0') {
435 static constexpr const char *subopts[] = {
436 "min",
437 "max",
438 nullptr
439 };
440
441 switch (parse_subopt(&subs, subopts, &value)) {
442 case 0:
443 reg_min_arg = value;
444 //if (reg_max == 0)
445 // reg_max = reg_min + 0xff;
446 break;
447 case 1:
448 reg_max_arg = value;
449 break;
450 }
451 }
452 break;
453
454 case OptListSymbols:
455 break;
456
457 case ':':
458 fprintf(stderr, "Option `%s' requires a value\n",
459 argv[optind]);
460 usage();
461 return 1;
462
463 case '?':
464 fprintf(stderr, "Unknown argument `%s'\n",
465 argv[optind]);
466 usage();
467 return 1;
468 }
469 }
470
471 if ((fd = open(device, O_RDWR)) < 0) {
472 fprintf(stderr, "Failed to open %s: %s\n", device,
473 strerror(errno));
474 std::exit(EXIT_FAILURE);
475 }
476
477 doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP");
478 capabilities = vcap.capabilities;
479
480 /* Information Opts */
481
482 if (options[OptGetDriverInfo]) {
483 printf("Driver Info:\n");
484 v4l2_info_capability(vcap);
485 }
486
487 chip_info.name[0] = '\0';
488 if (options[OptChip]) {
489 /* try to figure out which chip it is */
490 chip_info.match = match;
491 if (doioctl(fd, VIDIOC_DBG_G_CHIP_INFO, &chip_info, "VIDIOC_DBG_G_CHIP_INFO") != 0)
492 chip_info.name[0] = '\0';
493
494 if (!strncasecmp(match.name, "ac97", 4)) {
495 curr_bd = &boards[AC97_BOARD];
496 } else {
497 for (size_t board = boards.size(); board; board--) {
498 if (!strcasecmp(chip_info.name, boards[board - 1].name)) {
499 curr_bd = &boards[board - 1];
500 break;
501 }
502 }
503 }
504 }
505
506 /* Set options */
507
508 if (options[OptSetRegister]) {
509 set_reg.match = match;
510 if (optind >= argc) {
511 usage();
512 exit(1);
513 }
514 set_reg.reg = parse_reg(curr_bd, reg_set_arg);
515 while (optind < argc) {
516 unsigned size = 0;
517
518 if (doioctl(fd, VIDIOC_DBG_G_REGISTER, &set_reg,
519 "VIDIOC_DBG_G_REGISTER") >= 0)
520 size = set_reg.size;
521
522 set_reg.val = strtoull(argv[optind++], nullptr, 0);
523 if (doioctl(fd, VIDIOC_DBG_S_REGISTER, &set_reg,
524 "VIDIOC_DBG_S_REGISTER") >= 0) {
525 const char *name = reg_name(curr_bd, set_reg.reg);
526
527 printf("Register ");
528
529 if (name)
530 printf("%s (0x%08llx)", name, set_reg.reg);
531 else
532 printf("0x%08llx", set_reg.reg);
533
534 printf(" set to 0x%llx\n", set_reg.val);
535 } else {
536 printf("Failed to set register 0x%08llx value 0x%llx: %s\n",
537 set_reg.reg, set_reg.val, strerror(errno));
538 }
539 set_reg.reg += size ? : (forcedstride ? : 1);
540 }
541 }
542
543 if (options[OptScanChips]) {
544 chip_info.match.type = V4L2_CHIP_MATCH_BRIDGE;
545 chip_info.match.addr = 0;
546
547 while (doioctl(fd, VIDIOC_DBG_G_CHIP_INFO, &chip_info, "VIDIOC_DBG_G_CHIP_INFO") == 0 && chip_info.name[0]) {
548 printf("bridge%d: ", chip_info.match.addr);
549 print_name(&chip_info);
550 chip_info.match.addr++;
551 }
552
553 chip_info.match.type = V4L2_CHIP_MATCH_SUBDEV;
554 chip_info.match.addr = 0;
555 while (doioctl(fd, VIDIOC_DBG_G_CHIP_INFO, &chip_info, "VIDIOC_DBG_G_CHIP_INFO") == 0 && chip_info.name[0]) {
556 printf("subdev%d: ", chip_info.match.addr++);
557 print_name(&chip_info);
558 }
559 }
560
561 if (options[OptGetRegister]) {
562 get_reg.match = match;
563 printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
564
565 for (const auto &reg : get_regs) {
566 get_reg.reg = parse_reg(curr_bd, reg);
567 if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0)
568 fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER "
569 "failed for 0x%llx\n", get_reg.reg);
570 else {
571 const char *name = reg_name(curr_bd, get_reg.reg);
572
573 printf("Register ");
574
575 if (name)
576 printf("%s (0x%08llx)", name, get_reg.reg);
577 else
578 printf("0x%08llx", get_reg.reg);
579
580 printf(" = %llxh (%lldd %sb)\n",
581 get_reg.val, get_reg.val, binary(get_reg.val));
582 }
583 }
584 }
585
586 if (options[OptListRegisters]) {
587 std::string name;
588 int stride = 1;
589
590 get_reg.match = match;
591 if (forcedstride) {
592 stride = forcedstride;
593 } else if (get_reg.match.type == V4L2_CHIP_MATCH_BRIDGE) {
594 stride = 4;
595 }
596 printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
597
598 if (curr_bd) {
599 if (reg_min_arg.empty())
600 reg_min = 0;
601 else
602 reg_min = parse_reg(curr_bd, reg_min_arg);
603
604
605 if (reg_max_arg.empty())
606 reg_max = (1ll << 32) - 1;
607 else
608 reg_max = parse_reg(curr_bd, reg_max_arg);
609
610 for (const auto &curr : curr_bd->regs) {
611 if (reg_min_arg.empty() || ((curr.reg >= reg_min) && curr.reg <= reg_max)) {
612 get_reg.reg = curr.reg;
613
614 if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0)
615 fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER "
616 "failed for 0x%llx\n", get_reg.reg);
617 else {
618 const char *name = reg_name(curr_bd, get_reg.reg);
619
620 printf("Register ");
621
622 if (name)
623 printf("%s (0x%08llx)", name, get_reg.reg);
624 else
625 printf("0x%08llx", get_reg.reg);
626
627 printf(" = %llxh (%lldd %sb)\n",
628 get_reg.val, get_reg.val, binary(get_reg.val));
629 }
630 }
631 }
632 goto list_done;
633 }
634
635 if (!reg_min_arg.empty()) {
636 reg_min = parse_reg(curr_bd, reg_min_arg);
637 if (reg_max_arg.empty())
638 reg_max = reg_min + 0xff;
639 else
640 reg_max = parse_reg(curr_bd, reg_max_arg);
641 /* Explicit memory range: just do it */
642 print_regs(fd, &get_reg, reg_min, reg_max, stride);
643 goto list_done;
644 }
645
646 p = std::strchr(chip_info.name, ' ');
647 if (p)
648 *p = '\0';
649 name = chip_info.name;
650
651 if (name == "saa7115") {
652 print_regs(fd, &get_reg, 0, 0xff, stride);
653 } else if (name == "saa717x") {
654 // FIXME: use correct reg regions
655 print_regs(fd, &get_reg, 0, 0xff, stride);
656 } else if (name == "saa7127") {
657 print_regs(fd, &get_reg, 0, 0x7f, stride);
658 } else if (name == "ov7670") {
659 print_regs(fd, &get_reg, 0, 0x89, stride);
660 } else if (name == "cx25840") {
661 print_regs(fd, &get_reg, 0, 2, stride);
662 print_regs(fd, &get_reg, 0x100, 0x15f, stride);
663 print_regs(fd, &get_reg, 0x200, 0x23f, stride);
664 print_regs(fd, &get_reg, 0x400, 0x4bf, stride);
665 print_regs(fd, &get_reg, 0x800, 0x9af, stride);
666 } else if (name == "cs5345") {
667 print_regs(fd, &get_reg, 1, 0x10, stride);
668 } else if (name == "cx23416") {
669 print_regs(fd, &get_reg, 0x02000000, 0x020000ff, stride);
670 } else if (name == "cx23418") {
671 print_regs(fd, &get_reg, 0x02c40000, 0x02c409c7, stride);
672 } else if (name == "cafe") {
673 print_regs(fd, &get_reg, 0, 0x43, stride);
674 print_regs(fd, &get_reg, 0x88, 0x8f, stride);
675 print_regs(fd, &get_reg, 0xb4, 0xbb, stride);
676 print_regs(fd, &get_reg, 0x3000, 0x300c, stride);
677 } else {
678 /* unknown chip, dump 0-0xff by default */
679 print_regs(fd, &get_reg, 0, 0xff, stride);
680 }
681 }
682 list_done:
683
684 if (options[OptLogStatus]) {
685 static char buf[40960];
686 int len = -1;
687
688 if (doioctl(fd, VIDIOC_LOG_STATUS, nullptr, "VIDIOC_LOG_STATUS") == 0) {
689 printf("\nStatus Log:\n\n");
690 #ifdef HAVE_KLOGCTL
691 len = klogctl(3, buf, sizeof(buf) - 1);
692 #endif
693 if (len >= 0) {
694 bool found_status = false;
695 char *p = buf;
696 char *q;
697
698 buf[len] = 0;
699 while ((q = strstr(p, "START STATUS"))) {
700 found_status = true;
701 p = q + 1;
702 }
703 if (found_status) {
704 while (p > buf && *p != '<') p--;
705 q = p;
706 while ((q = strstr(q, "<6>"))) {
707 memcpy(q, " ", 3);
708 }
709 printf("%s", p);
710 }
711 }
712 }
713 }
714
715 if (options[OptListSymbols]) {
716 if (curr_bd == nullptr) {
717 printf("No symbols found for driver %s\n", vcap.driver);
718 }
719 else {
720 printf("Symbols for driver %s:\n", curr_bd->name);
721 for (const auto &curr : curr_bd->regs)
722 printf("0x%08x: %s\n", curr.reg, curr.name);
723 for (const auto &curr : curr_bd->alt_regs)
724 printf("0x%08x: %s\n", curr.reg, curr.name);
725 }
726 }
727
728 close(fd);
729 std::exit(EXIT_SUCCESS);
730 }