1/* 2 * MTD utility functions 3 * 4 * Copyright (C) 2014, Broadcom Corporation. All Rights Reserved. 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $Id: mtd.h 271787 2011-07-13 20:53:53Z $ 19 */ 20 21#ifndef _mtd_h_ 22#define _mtd_h_ 23 24/* 25 * Open an MTD device 26 * @param mtd path to or partition name of MTD device 27 * @param flags open() flags 28 * @return return value of open() 29 */ 30extern int mtd_open(const char *mtd, int flags); 31 32/* 33 * Erase an MTD device 34 * @param mtd path to or partition name of MTD device 35 * @return 0 on success and errno on failure 36 */ 37extern int mtd_erase(const char *mtd); 38 39/* 40 * Write a file or a URL to an MTD device 41 * @param path file to write or a URL 42 * @param mtd path to or partition name of MTD device 43 * @return 0 on success and errno on failure 44 */ 45extern int mtd_write(const char *path, const char *mtd); 46 47/* 48 * Write a CFE image to a MTD device 49 * @param path file to write or a URL 50 * @param mtd path to or partition name of MTD device 51 * @return 0 on success and errno on failure 52 */ 53extern int mtd_write_cfe(const char *path, const char *mtd); 54 55#endif /* _mtd_h_ */ 56