summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/jffs2.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/include/rtems/jffs2.h')
-rw-r--r--cpukit/include/rtems/jffs2.h182
1 files changed, 171 insertions, 11 deletions
diff --git a/cpukit/include/rtems/jffs2.h b/cpukit/include/rtems/jffs2.h
index a856c46c41..12f4f8e073 100644
--- a/cpukit/include/rtems/jffs2.h
+++ b/cpukit/include/rtems/jffs2.h
@@ -1,15 +1,28 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/*
- * Copyright (c) 2013, 2016 embedded brains GmbH. All rights reserved.
- *
- * embedded brains GmbH
- * Dornierstr. 4
- * 82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * Copyright (C) 2013, 2016 embedded brains GmbH & Co. KG
+ *
+ * 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.
+ *
+ * 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.
*/
#ifndef RTEMS_JFFS2_H
@@ -217,6 +230,99 @@ typedef int (*rtems_jffs2_flash_erase)(
);
/**
+ * @brief Flash bad block check operation.
+ *
+ * This operation checks whether a block is bad.
+ *
+ * @param[in, out] self The flash control.
+ * @param[in] offset The offset in bytes of the block to check.
+ * @param[out] The result of the bad block check.
+ *
+ * @retval 0 Successful operation.
+ * @retval -EIO An error occurred. Please note that the value is negative.
+ * @retval other All other values are reserved and must not be used.
+ */
+typedef int (*rtems_jffs2_flash_block_is_bad)(
+ rtems_jffs2_flash_control *self,
+ uint32_t offset,
+ bool *bad
+);
+
+/**
+ * @brief Flash bad block mark operation.
+ *
+ * This operation marks a block bad.
+ *
+ * @param[in, out] self The flash control.
+ * @param[in] offset The offset in bytes of the block to mark bad.
+ *
+ * @retval 0 Successful operation.
+ * @retval -EIO An error occurred. Please note that the value is negative.
+ * @retval other All other values are reserved and must not be used.
+ */
+typedef int (*rtems_jffs2_flash_block_mark_bad)(
+ rtems_jffs2_flash_control *self,
+ uint32_t offset
+);
+
+/**
+ * @brief Flash oob write.
+ *
+ * This operation writes the out-of-band/spare bytes for the block matching
+ * the given offset in bytes.
+ *
+ * @param[in, out] self The flash control.
+ * @param[in] offset The offset to erase from the flash begin in bytes.
+ * @param[in] pointer to the buffer which will be written to the oob/spare bytes.
+ * @param[in] length of the buffer which will be written to the oob/spare bytes.
+ *
+ * @retval 0 Successful operation.
+ * @retval -EIO An error occurred. Please note that the value is negative.
+ * @retval other All other values are reserved and must not be used.
+ */
+typedef int (*rtems_jffs2_flash_oob_write)(
+ rtems_jffs2_flash_control *self,
+ uint32_t offset,
+ uint8_t *oobbuf,
+ uint32_t obblen
+);
+
+/**
+ * @brief Flash oob read.
+ *
+ * This operation reads the out-of-band/spare bytes for the block matching
+ * the given offset in bytes.
+ *
+ * @param[in, out] self The flash control.
+ * @param[in] offset The offset to erase from the flash begin in bytes.
+ * @param[out] pointer to the buffer which will have the oob/spare bytes data written to it.
+ * @param[in] length of the buffer which will hold the oob/spare bytes.
+ *
+ * @retval 0 Successful operation.
+ * @retval -EIO An error occurred. Please note that the value is negative.
+ * @retval other All other values are reserved and must not be used.
+ */
+typedef int (*rtems_jffs2_flash_oob_read)(
+ rtems_jffs2_flash_control *self,
+ uint32_t offset,
+ uint8_t *oobbuf,
+ uint32_t obblen
+);
+
+/**
+ * @brief Flash get oob size.
+ *
+ * This operation gets the size of the out-of-band/spare bytes for each page.
+ *
+ * @param[in, out] self The flash control.
+ *
+ * @retval The size of the OOB/spare area available to each page
+ */
+typedef uint32_t (*rtems_jffs2_flash_get_oob_size)(
+ rtems_jffs2_flash_control *self
+);
+
+/**
* @brief Flash destroy operation.
*
* The flash destroy operation is called during unmount of the file system
@@ -261,6 +367,14 @@ struct rtems_jffs2_flash_control {
uint32_t flash_size;
/**
+ * @brief The size in bytes of the minimum write size for the flash device.
+ *
+ * It must be an integral divisor into the block size. This is only applicable
+ * for NAND devices.
+ */
+ uint32_t write_size;
+
+ /**
* @brief Read from flash operation.
*/
rtems_jffs2_flash_read read;
@@ -276,6 +390,31 @@ struct rtems_jffs2_flash_control {
rtems_jffs2_flash_erase erase;
/**
+ * @brief Flash bad block check operation.
+ */
+ rtems_jffs2_flash_block_is_bad block_is_bad;
+
+ /**
+ * @brief Flash bad block mark operation.
+ */
+ rtems_jffs2_flash_block_mark_bad block_mark_bad;
+
+ /**
+ * @brief Flash oob bytes write operation.
+ */
+ rtems_jffs2_flash_oob_write oob_write;
+
+ /**
+ * @brief Flash oob bytes read operation.
+ */
+ rtems_jffs2_flash_oob_read oob_read;
+
+ /**
+ * @brief Flash get oob bytes per page operation.
+ */
+ rtems_jffs2_flash_get_oob_size get_oob_size;
+
+ /**
* @brief Flash destroy operation.
*
* This operation is optional and the pointer may be @c NULL.
@@ -595,6 +734,27 @@ typedef struct {
*/
#define RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION _IO('F', 3)
+/**
+ * Default delayed-write servicing task priority.
+ */
+#define RTEMS_JFFS2_DELAYED_WRITE_TASK_PRIORITY_DEFAULT 15
+
+/**
+ * JFFS2 configuration definition. See confdefs.h for support on using this
+ * structure.
+ */
+typedef struct rtems_jffs2_config {
+ rtems_task_priority delayed_write_priority; /**< Priority of the delayed write
+ * task. */
+} rtems_jffs2_config;
+
+/**
+ * External reference to the configuration.
+ *
+ * The configuration is provided by the application.
+ */
+extern const rtems_jffs2_config jffs2_config;
+
/** @} */
#ifdef __cplusplus