diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/jffs2.h | 149 |
1 files changed, 148 insertions, 1 deletions
diff --git a/cpukit/include/rtems/jffs2.h b/cpukit/include/rtems/jffs2.h index 1cf9a01c6e..12f4f8e073 100644 --- a/cpukit/include/rtems/jffs2.h +++ b/cpukit/include/rtems/jffs2.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2013, 2016 embedded brains GmbH. All rights reserved. + * 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 @@ -230,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 @@ -274,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; @@ -289,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. @@ -608,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 |