1 /*
2 * Help Library for K3CONF
3 *
4 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
5 * Lokesh Vutla <lokeshvutla@ti.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the
17 * distribution.
18 *
19 * Neither the name of Texas Instruments Incorporated nor the names of
20 * its contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
36 #include <help.h>
37 #include <stdio.h>
39 void help(help_category cat)
40 {
41 if (cat >= HELP_CATEGORY_MAX) {
42 fprintf(stderr, "help called with incorrect category!!! (%d)\n",
43 cat);
44 return;
45 }
47 if ((cat == HELP_ALL) || (cat == HELP_USAGE)) {
48 printf("\nNAME\n");
49 printf("\tk3conf - TI K3 Configuration Diagnostic Tool\n");
51 printf("\nSYNOPSIS\n");
52 printf("\tk3conf [--version] [--help] [--cpuinfo] <command> [<args>]\n");
53 if (cat == HELP_USAGE)
54 printf("\n\tSee 'k3conf --help' for more information.\n\n");
55 }
57 if (cat == HELP_ALL) {
58 printf("\nDESCRIPTION\n");
59 printf("\tk3conf is standalone application designed to provide"
60 " a quick'n easy way to \n\tdiagnose/debug/audit"
61 " TI K3 architecture based processors configuration"
62 " at\n\truntime, with no particular kernel dependency.\n");
63 printf("\tk3conf is designed to be as much platform-agnostic"
64 " as possible, being able to \n\trun on any Linux platform"
65 " and easily ported to other OS.\n");
66 printf("\tEven if k3conf today focuses mainly on TISCI"
67 " related functionality, it is \n\tintended to be extended"
68 " to any other area.\n");
70 printf("\nOPTIONS\n");
71 printf("\t--help\n");
72 printf("\t Print k3conf help.\n");
74 printf("\n\t--version\n");
75 printf("\t Print k3conf version.\n");
77 printf("\n\t--cpuinfo\n");
78 printf("\t Print the host processor information.\n");
79 }
81 if (cat != HELP_USAGE)
82 printf("\nCOMMANDS\n");
84 if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
85 (cat == HELP_SHOW_HOST)) {
86 printf("\n\tk3conf show hosts\n");
87 printf("\t Prints all the available TISCI hosts\n");
88 }
89 if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
90 (cat == HELP_SHOW_SEC_PROXY)) {
91 printf("\n\tk3conf show threads\n");
92 printf("\t Prints all the available TISCI secure proxy threads\n");
93 }
94 if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
95 (cat == HELP_SHOW_DEVICE)) {
96 printf("\n\tk3conf show device\n");
97 printf("\t Prints all the available TISCI devices\n");
98 printf("\n\tk3conf show device <dev_id>\n");
99 printf("\t Prints the corresponding device id information\n");
100 }
101 if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
102 (cat == HELP_SHOW_CLOCK)) {
103 printf("\n\tk3conf show clock\n");
104 printf("\t Prints all the available TISCI clocks\n");
105 printf("\n\tk3conf show clock <dev_id>\n");
106 printf("\t Prints the clocks for corresponding device id\n");
107 }
108 if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
109 (cat == HELP_SHOW_PROCESSOR)) {
110 printf("\n\tk3conf show processor\n");
111 printf("\t Prints all the available TISCI processors\n");
112 }
113 if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
114 (cat == HELP_DUMP_DEVICE)) {
115 printf("\n\tk3conf dump device\n");
116 printf("\t Prints device status of all the TISCI devices\n");
117 printf("\n\tk3conf dump device <dev_id>\n");
118 printf("\t Prints the corresponding device id status\n");
119 }
120 if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
121 (cat == HELP_DUMP_CLOCK)) {
122 printf("\n\tk3conf dump clock\n");
123 printf("\t Prints clock status all the available TISCI clocks\n");
124 printf("\n\tk3conf dump clock <dev_id>\n");
125 printf("\t Prints the available clock status for corresponding device id\n");
126 }
127 if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
128 (cat == HELP_DUMP_PROCESSOR)) {
129 printf("\n\tk3conf dump processor\n");
130 printf("\t Prints status of all the available TISCI processors\n");
131 printf("\n\tk3conf dump processor <proc_id>\n");
132 printf("\t Prints status of the given TISCI processors\n");
133 }
134 if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
135 (cat == HELP_ENABLE_DEVICE)) {
136 printf("\n\tk3conf enable device <dev_id>\n");
137 printf("\t Enables the TISCI device and prints the status\n");
138 }
139 if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
140 (cat == HELP_ENABLE_CLOCK)) {
141 printf("\n\tk3conf enable clock <dev_id> <clk_id>\n");
142 printf("\t Enables the TISCI clock and prints the status\n");
143 }
144 if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
145 (cat == HELP_DISABLE_DEVICE)) {
146 printf("\n\tk3conf disable device <dev_id>\n");
147 printf("\t Disables the TISCI device and prints the status\n");
148 }
149 if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
150 (cat == HELP_DISABLE_CLOCK)) {
151 printf("\n\tk3conf disable clock <dev_id> <clk_id>\n");
152 printf("\t Disables the TISCI clock and prints the status\n");
153 }
154 if ((cat == HELP_ALL) || (cat == HELP_SET) ||
155 (cat == HELP_SET_CLOCK)) {
156 printf("\n\tk3conf set clock <dev_id> <clk_id> <freq>\n");
157 printf("\t Sets the clock frequency and prints the status\n");
158 }
159 }