]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - k3conf/k3conf.git/blob - common/help.c
treewide: Replace http links with https
[k3conf/k3conf.git] / common / help.c
1 /*
2  * Help Library for K3CONF
3  *
4  * Copyright (C) 2019 Texas Instruments Incorporated - https://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 [--host <id>] [--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--host <id>\n");
72                 printf("\t    Use this host id for communicating with sysfw\n\n");
74                 printf("\t--help\n");
75                 printf("\t    Print k3conf help.\n");
77                 printf("\n\t--version\n");
78                 printf("\t    Print k3conf version.\n");
80                 printf("\n\t--cpuinfo\n");
81                 printf("\t    Print the host processor information.\n");
82         }
84         if (cat != HELP_USAGE)
85                 printf("\nCOMMANDS\n");
87         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
88             (cat == HELP_SHOW_HOST)) {
89                 printf("\n\tk3conf show hosts\n");
90                 printf("\t      Prints all the available TISCI hosts\n");
91         }
92         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
93             (cat == HELP_SHOW_SEC_PROXY)) {
94                 printf("\n\tk3conf show threads\n");
95                 printf("\t      Prints all the available TISCI secure proxy threads\n");
96         }
97         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
98             (cat == HELP_SHOW_DEVICE)) {
99                 printf("\n\tk3conf show device\n");
100                 printf("\t      Prints all the available TISCI devices\n");
101                 printf("\n\tk3conf show device <dev_id>\n");
102                 printf("\t      Prints the corresponding device id information\n");
103         }
104         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
105             (cat == HELP_SHOW_CLOCK)) {
106                 printf("\n\tk3conf show clock\n");
107                 printf("\t      Prints all the available TISCI clocks\n");
108                 printf("\n\tk3conf show clock <dev_id>\n");
109                 printf("\t      Prints the clocks for corresponding device id\n");
110         }
111         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
112             (cat == HELP_SHOW_PROCESSOR)) {
113                 printf("\n\tk3conf show processor\n");
114                 printf("\t      Prints all the available TISCI processors\n");
115         }
116         if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
117             (cat == HELP_SHOW_RM)) {
118                 printf("\n\tk3conf show rm\n");
119                 printf("\t      Prints resources managed by System firmware\n");
120                 printf("\n\tk3conf show rm <dev_id>\n");
121                 printf("\t      Prints resources managed by System firmware for corresponding device\n");
122         }
123         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
124             (cat == HELP_DUMP_DEVICE)) {
125                 printf("\n\tk3conf dump device\n");
126                 printf("\t      Prints device status of all the TISCI devices\n");
127                 printf("\n\tk3conf dump device <dev_id>\n");
128                 printf("\t      Prints the corresponding device id status\n");
129         }
130         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
131             (cat == HELP_DUMP_CLOCK)) {
132                 printf("\n\tk3conf dump clock\n");
133                 printf("\t      Prints clock status all the available TISCI clocks\n");
134                 printf("\n\tk3conf dump clock <dev_id>\n");
135                 printf("\t      Prints the available clock status for corresponding device id\n");
136         }
137         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
138             (cat == HELP_DUMP_PROCESSOR)) {
139                 printf("\n\tk3conf dump processor\n");
140                 printf("\t      Prints status of all the available TISCI processors\n");
141                 printf("\n\tk3conf dump processor <proc_id>\n");
142                 printf("\t      Prints status of the given TISCI processors\n");
143         }
144         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
145             (cat == HELP_DUMP_RM)) {
146                 printf("\n\tk3conf dump rm [OPTIONS]\n");
147                 printf("\t      Prints resource allocation for all utypes / hosts\n");
148                 printf("\n\tk3conf dump rm [OPTIONS] <type>\n");
149                 printf("\t      Prints resource allocation for corresponding type\n");
150                 printf("\n\tk3conf dump rm [OPTIONS] <type> <subtype>\n");
151                 printf("\t      Prints resource allocation for corresponding device/type\n");
152                 printf("\t      \n");
153                 printf("\t      [OPTIONS]\n");
154                 printf("\t      -h <host_id>\n");
155                 printf("\t              Filter only for corresponding host_id\n");
156         }
157         if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
158             (cat == HELP_ENABLE_DEVICE)) {
159                 printf("\n\tk3conf enable device <dev_id>\n");
160                 printf("\t      Enables the TISCI device and prints the status\n");
161         }
162         if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
163             (cat == HELP_ENABLE_CLOCK)) {
164                 printf("\n\tk3conf enable clock <dev_id> <clk_id>\n");
165                 printf("\t      Enables the TISCI clock and prints the status\n");
166         }
167         if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
168             (cat == HELP_DISABLE_DEVICE)) {
169                 printf("\n\tk3conf disable device <dev_id>\n");
170                 printf("\t      Disables the TISCI device and prints the status\n");
171         }
172         if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
173             (cat == HELP_DISABLE_CLOCK)) {
174                 printf("\n\tk3conf disable clock <dev_id> <clk_id>\n");
175                 printf("\t      Disables the TISCI clock and prints the status\n");
176         }
177         if ((cat == HELP_ALL) || (cat == HELP_SET) ||
178             (cat == HELP_SET_CLOCK)) {
179                 printf("\n\tk3conf set clock <dev_id> <clk_id> <freq>\n");
180                 printf("\t      Sets the clock frequency and prints the status\n");
181         }
182         if ((cat == HELP_ALL) || (cat == HELP_READ)) {
183                 printf("\n\tk3conf read <addr>\n");
184                 printf("\t      Prints the value at the specified io memory\n");
185         }
186         if ((cat == HELP_ALL) || (cat == HELP_WRITE)) {
187                 printf("\n\tk3conf write <addr> <val>\n");
188                 printf("\t      Writes the value at the specified io memory\n");
189         }