2 * Copyright (C) 2012 Samsung Electronics
3 * Rajeshwari Shinde <rajeshwari.s@samsung.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 DECLARE_GLOBAL_DATA_PTR;
31 /* Initilaise sound subsystem */
32 static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
36 ret = sound_init(gd->fdt_blob);
38 printf("Initialise Audio driver failed\n");
39 return CMD_RET_FAILURE;
45 /* play sound from buffer */
46 static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
53 msec = simple_strtoul(argv[1], NULL, 10);
55 freq = simple_strtoul(argv[2], NULL, 10);
57 ret = sound_play(msec, freq);
59 printf("play failed");
60 return CMD_RET_FAILURE;
66 static cmd_tbl_t cmd_sound_sub[] = {
67 U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
68 U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
71 /* process sound command */
72 static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
79 /* Strip off leading 'sound' command argument */
83 c = find_cmd_tbl(argv[0], &cmd_sound_sub[0], ARRAY_SIZE(cmd_sound_sub));
86 return c->cmd(cmdtp, flag, argc, argv);
92 sound, 4, 1, do_sound,
94 "init - initialise the sound driver\n"
95 "sound play [len] [freq] - play a sound for len ms at freq hz\n"