diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-05-01 07:45:34 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-05-01 07:45:34 -0600 |
commit | fa71d6461e5b8cc8b3cada0e594c9641e5e21da7 (patch) | |
tree | f7307a9c8d87eed8fa94cb69a0e8b7242a916a30 /apps/system/flash_eraseall/flash_eraseall.c | |
parent | 2fd7dfe98ac64e201c22e8cb07bab75433dd6b60 (diff) | |
download | nuttx-fa71d6461e5b8cc8b3cada0e594c9641e5e21da7.tar.gz nuttx-fa71d6461e5b8cc8b3cada0e594c9641e5e21da7.tar.bz2 nuttx-fa71d6461e5b8cc8b3cada0e594c9641e5e21da7.zip |
Add system/flash_eraseall NSH command
Diffstat (limited to 'apps/system/flash_eraseall/flash_eraseall.c')
-rw-r--r-- | apps/system/flash_eraseall/flash_eraseall.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/apps/system/flash_eraseall/flash_eraseall.c b/apps/system/flash_eraseall/flash_eraseall.c new file mode 100644 index 000000000..e6eebad0c --- /dev/null +++ b/apps/system/flash_eraseall/flash_eraseall.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * apps/system/flash_eraseall/flash_eraseall.c + * + * Copyright (C) 2013 Ken Pettit. All rights reserved. + * Author: Ken Pettit <pettitkd@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name NuttX 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/progmem.h> +#include <sys/stat.h> + +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <nuttx/mtd.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int flash_eraseall_main(int argc, char *argv[]) +{ + /* Argument given? */ + + if (argc < 2) + { + fprintf(stderr, "usage: flash_eraseall flash_block_device\n"); + return -1; + } + + /* Do the job */ + + flash_eraseall(argv[1]); + + return 0; +} |