diff --git a/include/disk/disk_access.h b/include/disk/disk_access.h index b65106151b0..628d9412758 100644 --- a/include/disk/disk_access.h +++ b/include/disk/disk_access.h @@ -4,92 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * @file - * @brief Disk Access layer API - * - * This file contains APIs for disk access. +/* + * The header was moved to include/storage/disk_access.h + * This header is deprecated and there for compatibility. */ #ifndef ZEPHYR_INCLUDE_DISK_DISK_ACCESS_H_ #define ZEPHYR_INCLUDE_DISK_DISK_ACCESS_H_ -/** - * @brief Disk Access APIs - * @defgroup disk_access_interface Disk Access Interface - * @{ - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * @brief perform any initialization - * - * This call is made by the consumer before doing any IO calls so that the - * disk or the backing device can do any initialization. - * - * @return 0 on success, negative errno code on fail - */ -int disk_access_init(const char *pdrv); - -/* - * @brief Get the status of disk - * - * This call is used to get the status of the disk - * - * @return DISK_STATUS_OK or other DISK_STATUS_*s - */ -int disk_access_status(const char *pdrv); - -/* - * @brief read data from disk - * - * Function to read data from disk to a memory buffer. - * - * @param[in] data_buf Pointer to the memory buffer to put data. - * @param[in] start_sector Start disk sector to read from - * @param[in] num_sector Number of disk sectors to read - * - * @return 0 on success, negative errno code on fail - */ -int disk_access_read(const char *pdrv, uint8_t *data_buf, - uint32_t start_sector, uint32_t num_sector); - -/* - * @brief write data to disk - * - * Function write data from memory buffer to disk. - * - * @param[in] data_buf Pointer to the memory buffer - * @param[in] start_sector Start disk sector to write to - * @param[in] num_sector Number of disk sectors to write - * - * @return 0 on success, negative errno code on fail - */ -int disk_access_write(const char *pdrv, const uint8_t *data_buf, - uint32_t start_sector, uint32_t num_sector); - -/* - * @brief Get/Configure disk parameters - * - * Function to get disk parameters and make any special device requests. - * - * @param[in] cmd DISK_IOCTL_* code describing the request - * - * @return 0 on success, negative errno code on fail - */ -int disk_access_ioctl(const char *pdrv, uint8_t cmd, void *buff); - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ +#include #endif /* ZEPHYR_INCLUDE_DISK_DISK_ACCESS_H_ */ diff --git a/include/storage/disk_access.h b/include/storage/disk_access.h new file mode 100644 index 00000000000..8d4e68b1a2c --- /dev/null +++ b/include/storage/disk_access.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Disk Access layer API + * + * This file contains APIs for disk access. + */ + +#ifndef ZEPHYR_INCLUDE_STORAGE_DISK_ACCESS_H_ +#define ZEPHYR_INCLUDE_STORAGE_DISK_ACCESS_H_ + +/** + * @brief Disk Access APIs + * @defgroup disk_access_interface Disk Access Interface + * @{ + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * @brief perform any initialization + * + * This call is made by the consumer before doing any IO calls so that the + * disk or the backing device can do any initialization. + * + * @return 0 on success, negative errno code on fail + */ +int disk_access_init(const char *pdrv); + +/* + * @brief Get the status of disk + * + * This call is used to get the status of the disk + * + * @return DISK_STATUS_OK or other DISK_STATUS_*s + */ +int disk_access_status(const char *pdrv); + +/* + * @brief read data from disk + * + * Function to read data from disk to a memory buffer. + * + * @param[in] data_buf Pointer to the memory buffer to put data. + * @param[in] start_sector Start disk sector to read from + * @param[in] num_sector Number of disk sectors to read + * + * @return 0 on success, negative errno code on fail + */ +int disk_access_read(const char *pdrv, uint8_t *data_buf, + uint32_t start_sector, uint32_t num_sector); + +/* + * @brief write data to disk + * + * Function write data from memory buffer to disk. + * + * @param[in] data_buf Pointer to the memory buffer + * @param[in] start_sector Start disk sector to write to + * @param[in] num_sector Number of disk sectors to write + * + * @return 0 on success, negative errno code on fail + */ +int disk_access_write(const char *pdrv, const uint8_t *data_buf, + uint32_t start_sector, uint32_t num_sector); + +/* + * @brief Get/Configure disk parameters + * + * Function to get disk parameters and make any special device requests. + * + * @param[in] cmd DISK_IOCTL_* code describing the request + * + * @return 0 on success, negative errno code on fail + */ +int disk_access_ioctl(const char *pdrv, uint8_t cmd, void *buff); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_STORAGE_DISK_ACCESS_H_ */ diff --git a/samples/subsys/fs/fat_fs/src/main.c b/samples/subsys/fs/fat_fs/src/main.c index 2c3ce4f4b44..0aaf90e06a6 100644 --- a/samples/subsys/fs/fat_fs/src/main.c +++ b/samples/subsys/fs/fat_fs/src/main.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/subsys/disk/disk_access.c b/subsys/disk/disk_access.c index 37cdfac55ba..02b708aa82a 100644 --- a/subsys/disk/disk_access.c +++ b/subsys/disk/disk_access.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/subsys/usb/class/msc.c b/subsys/usb/class/msc.c index 581cb8bf0ba..62cf15d9542 100644 --- a/subsys/usb/class/msc.c +++ b/subsys/usb/class/msc.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c b/tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c index ed7d69e2163..e91db75cb9c 100644 --- a/tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c +++ b/tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include