File: help.c

package info (click to toggle)
k3conf 0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,328 kB
  • sloc: ansic: 23,686; makefile: 2
file content (247 lines) | stat: -rw-r--r-- 9,537 bytes parent folder | download
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
/*
 * Help Library for K3CONF
 *
 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com/
 *	Lokesh Vutla <lokeshvutla@ti.com>
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *    Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the
 *    distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <help.h>
#include <stdio.h>

#define HELP_CLK_SET_PARENT_URL1 "http://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/pm/clocks.html#power-management-clock-frequency-configuration-example-with-mux-programming"
#define HELP_CLK_SET_PARENT_URL2 "http://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/pm/clocks.html#tisci-msg-set-clock-parent"

void help(help_category cat)
{
	if (cat >= HELP_CATEGORY_MAX) {
		fprintf(stderr, "help called with incorrect category!!! (%d)\n",
			cat);
		return;
	}

	if ((cat == HELP_ALL) || (cat == HELP_USAGE)) {
		printf("\n");
		printf("NAME\n");
		printf("	k3conf - TI K3 Configuration Diagnostic Tool\n");
		printf("\n");
		printf("SYNOPSIS\n");
		printf("	k3conf [--host <id>] [--version] [--help] [--cpuinfo] <command> [<args>]\n");
		if (cat == HELP_USAGE) {
			printf("\n");
			printf("	See 'k3conf --help' for more information.\n");
			printf("\n");
		}
	}

	if (cat == HELP_ALL) {
		printf("\n");
		printf("DESCRIPTION\n");
		printf("	k3conf is standalone application designed to provide a quick'n easy way to \n"
			"	diagnose/debug/audit TI K3 architecture based processors configuration at\n"
			"	runtime, with no particular kernel dependency.\n");
		printf("	k3conf is designed to be as much platform-agnostic as possible, being able to \n"
			"	run on any Linux platform and easily ported to other OS.\n");
		printf("	Even if k3conf today focuses mainly on TISCI related functionality, it is \n"
			"	intended to be extended to any other area.\n");

		printf("\n");
		printf("OPTIONS\n");
		printf("	--host <id>\n");
		printf("	    Use this host id for communicating with sysfw\n");
		printf("\n");
		printf("	--help\n");
		printf("	    Print k3conf help.\n");
		printf("\n");
		printf("	--version\n");
		printf("	    Print k3conf version.\n");
		printf("\n");
		printf("	--cpuinfo\n");
		printf("	    Print the host processor information.\n");
	}

	if (cat != HELP_USAGE) {
		printf("\n");
		printf("COMMANDS\n");
	}

	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_HOST)) {
		printf("\n");
		printf("	k3conf show hosts\n");
		printf("		Prints all the available TISCI hosts\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_SEC_PROXY)) {
		printf("\n");
		printf("	k3conf show threads\n");
		printf("		Prints all the available TISCI secure proxy threads\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_DEVICE)) {
		printf("\n");
		printf("	k3conf show device\n");
		printf("		Prints all the available TISCI devices\n");
		printf("\n");
		printf("	k3conf show device <dev_id>\n");
		printf("		Prints the corresponding device id information\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_CLOCK)) {
		printf("\n	k3conf show clock\n");
		printf("		Prints all the available TISCI clocks\n");
		printf("\n	k3conf show clock <dev_id>\n");
		printf("		Prints the clocks for corresponding device id\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_PROCESSOR)) {
		printf("\n");
		printf("	k3conf show processor\n");
		printf("		Prints all the available TISCI processors\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SHOW) ||
	    (cat == HELP_SHOW_RM)) {
		printf("\n");
		printf("	k3conf show rm\n");
		printf("		Prints resources managed by System firmware\n");
		printf("\n");
		printf("	k3conf show rm <dev_id>\n");
		printf("		Prints resources managed by System firmware for corresponding device\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
	    (cat == HELP_DUMP_DEVICE)) {
		printf("\n");
		printf("	k3conf dump device\n");
		printf("		Prints device status of all the TISCI devices\n");
		printf("\n");
		printf("	k3conf dump device <dev_id>\n");
		printf("		Prints the corresponding device id status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
	    (cat == HELP_DUMP_CLOCK)) {
		printf("\n");
		printf("	k3conf dump clock\n");
		printf("		Prints clock status all the available TISCI clocks\n");
		printf("\n");
		printf("	k3conf dump clock <dev_id>\n");
		printf("		Prints the available clock status for corresponding device id\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
	    (cat == HELP_DUMP_CLOCK_PARENT)) {
		printf("\n");
		printf("	k3conf dump parent_clock <dev_id> <clk_id>\n");
		printf("		Prints the clock parent of provided clock\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
	    (cat == HELP_DUMP_PROCESSOR)) {
		printf("\n");
		printf("	k3conf dump processor\n");
		printf("		Prints status of all the available TISCI processors\n");
		printf("\n");
		printf("	k3conf dump processor <proc_id>\n");
		printf("		Prints status of the given TISCI processors\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP) ||
	    (cat == HELP_DUMP_RM)) {
		printf("\n");
		printf("	k3conf dump rm [OPTIONS]\n");
		printf("		Prints resource allocation for all utypes / hosts\n");
		printf("\n");
		printf("	k3conf dump rm [OPTIONS] <type>\n");
		printf("		Prints resource allocation for corresponding type\n");
		printf("\n");
		printf("	k3conf dump rm [OPTIONS] <type> <subtype>\n");
		printf("		Prints resource allocation for corresponding device/type\n");
		printf("\n");
		printf("		[OPTIONS]\n");
		printf("		-h <host_id>\n");
		printf("			Filter only for corresponding host_id\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
	    (cat == HELP_ENABLE_DEVICE)) {
		printf("\n");
		printf("	k3conf enable device <dev_id>\n");
		printf("		Enables the TISCI device and prints the status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_ENABLE) ||
	    (cat == HELP_ENABLE_CLOCK)) {
		printf("\n");
		printf("	k3conf enable clock <dev_id> <clk_id>\n");
		printf("		Enables the TISCI clock and prints the status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
	    (cat == HELP_DISABLE_DEVICE)) {
		printf("\n");
		printf("	k3conf disable device <dev_id>\n");
		printf("		Disables the TISCI device and prints the status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DISABLE) ||
	    (cat == HELP_DISABLE_CLOCK)) {
		printf("\n");
		printf("	k3conf disable clock <dev_id> <clk_id>\n");
		printf("		Disables the TISCI clock and prints the status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SET) ||
	    (cat == HELP_SET_CLOCK)) {
		printf("\n");
		printf("	k3conf set clock <dev_id> <clk_id> <freq>\n");
		printf("		Sets the clock frequency and prints the status\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_SET) ||
	    (cat == HELP_SET_CLOCK_PARENT)) {
		printf("\n");
		printf("	k3conf set parent_clock <dev_id> <clk_id> <parent_clk_id>\n");
		printf("		Sets the parent clock for a clock mux and prints the mux status\n");
		printf("		Refer to the following documentation for preconditions:\n");
		printf("		%s\n", HELP_CLK_SET_PARENT_URL1);
		printf("		%s\n", HELP_CLK_SET_PARENT_URL2);
	}
	if ((cat == HELP_ALL) || (cat == HELP_READ)) {
		printf("\n");
		printf("	k3conf read <addr> [<size>]\n");
		printf("		No.of bits to be read is given in the size argument\n");
		printf("		Expected input size is 8,16,32,64\n");
		printf("		Prints the value at the specified io memory\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_WRITE)) {
		printf("\n");
		printf("	k3conf write <addr> <val> [<size>]\n");
		printf("		No.of bits to be written is given in the size argument\n");
		printf("		Expected input size is 8,16,32,64\n");
		printf("		Writes the value at the specified io memory\n");
	}
	if ((cat == HELP_ALL) || (cat == HELP_DUMP_DDRBW)) {
		printf("\n");
		printf("	k3conf ddrbw <sample_duration> <count>\n");
		printf("		Prints DDR bandwidth utilization on all DDR instances\n");
		printf("		sample_duration is delay between samples in seconds (default: 1 second)\n");
		printf("		count is number of samples to capture before stopping (default: -1 infinite)\n");
	}
}