Example #1
0
int do_sar(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
	const char *cmd;

	/* need at least two arguments */
	if (argc < 2)
		goto usage;

	cmd = argv[1];

	if (strcmp(cmd, "list") == 0)
		return do_sar_list(argc - 2, argv + 2);
	else if (strcmp(cmd, "write") == 0) {

		if (do_sar_write(argc - 2, argv + 2) == 0)
			do_sar_read(argc - 2, argv + 2);
		return 0;

	} else if (strcmp(cmd, "read") == 0)
		return do_sar_read(argc - 2, argv + 2);

usage:
	cmd_usage(cmdtp);
	return 1;
}
int do_sar(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
	const char *cmd, *cmd2 = NULL;

	/* need at least two arguments */
	if (argc < 2)
		goto usage;

	cmd = argv[1];

	if (argc > 2)
		cmd2 = argv[2];

	if (strcmp(cmd, "list") == 0)
		return do_sar_list(argc - 2, argv + 2);
	else if ((strcmp(cmd, "write") == 0) && (strcmp(cmd2, "default") == 0)) {
		if (do_sar_default() == 0) {
			do_sar_read(argc - 3, argv + 3);
			printf("\nChanges will be applied after reset.\n\n");
			return 0;
		}
		else
			return 1;
	}
	else if (strcmp(cmd, "write") == 0) {
		if (do_sar_write(argc - 2, argv + 2) == 0) {
			do_sar_read(argc - 2, argv + 2);
			if (strcmp(cmd2, "freq") == 0 && !mvCtrlIsValidSatR())
				printf("\n*** Selected Unsupported DDR/CPU/L2 Clock configuration ***\n\n");
			printf("\nChanges will be applied after reset.\n");
			return 0;
		}
		else
			return 1;
	} else if (strcmp(cmd, "read") == 0)
		return do_sar_read(argc - 2, argv + 2);


usage:
	cmd_usage(cmdtp);
	return 1;
}