]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - k3conf/k3conf.git/blob - common/help.c
common: socinfo: Use JTAD_ID register for device identification
[k3conf/k3conf.git] / common / help.c
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 [--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_DUMP) ||
117             (cat == HELP_DUMP_DEVICE)) {
118                 printf("\n\tk3conf dump device\n");
119                 printf("\t      Prints device status of all the TISCI devices\n");
120                 printf("\n\tk3conf dump device <dev_id>\n");
121                 printf("\t      Prints the corresponding device id status\n");
122         }
123         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
124             (cat == HELP_DUMP_CLOCK)) {
125                 printf("\n\tk3conf dump clock\n");
126                 printf("\t      Prints clock status all the available TISCI clocks\n");
127                 printf("\n\tk3conf dump clock <dev_id>\n");
128                 printf("\t      Prints the available clock status for corresponding device id\n");
129         }
130         if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
131             (cat == HELP_DUMP_PROCESSOR)) {
132                 printf("\n\tk3conf dump processor\n");
133                 printf("\t      Prints status of all the available TISCI processors\n");
134                 printf("\n\tk3conf dump processor <proc_id>\n");
135                 printf("\t      Prints status of the given TISCI processors\n");
136         }
137         if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
138             (cat == HELP_ENABLE_DEVICE)) {
139                 printf("\n\tk3conf enable device <dev_id>\n");
140                 printf("\t      Enables the TISCI device and prints the status\n");
141         }
142         if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
143             (cat == HELP_ENABLE_CLOCK)) {
144                 printf("\n\tk3conf enable clock <dev_id> <clk_id>\n");
145                 printf("\t      Enables the TISCI clock and prints the status\n");
146         }
147         if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
148             (cat == HELP_DISABLE_DEVICE)) {
149                 printf("\n\tk3conf disable device <dev_id>\n");
150                 printf("\t      Disables the TISCI device and prints the status\n");
151         }
152         if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
153             (cat == HELP_DISABLE_CLOCK)) {
154                 printf("\n\tk3conf disable clock <dev_id> <clk_id>\n");
155                 printf("\t      Disables the TISCI clock and prints the status\n");
156         }
157         if ((cat == HELP_ALL) || (cat == HELP_SET) ||
158             (cat == HELP_SET_CLOCK)) {
159                 printf("\n\tk3conf set clock <dev_id> <clk_id> <freq>\n");
160                 printf("\t      Sets the clock frequency and prints the status\n");
161         }
162         if ((cat == HELP_ALL) || (cat == HELP_READ)) {
163                 printf("\n\tk3conf read <addr>\n");
164                 printf("\t      Prints the value at the specified io memory\n");
165         }
166         if ((cat == HELP_ALL) || (cat == HELP_WRITE)) {
167                 printf("\n\tk3conf write <addr> <val>\n");
168                 printf("\t      Writes the value at the specified io memory\n");
169         }