Files
luban-lite-t3e-pro/packages/third-party/dfs/filesystems/elmfat/spinand_disk/spinand_disk.h

100 lines
2.2 KiB
C
Raw Normal View History

2023-11-09 20:19:51 +08:00
/*
* Copyright (c) 2023, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: xuan.wen <xuan.wen@artinchip.com>
*/
#ifndef _SPINAND_DISKIO_H_
#define _SPINAND_DISKIO_H_
#include <stdint.h>
#include <ff.h>
#include "diskio.h"
#include "mtd.h"
2024-01-27 08:47:24 +08:00
#ifdef AIC_NFTL_SUPPORT
#include "nftl_api.h"
#endif
2023-11-09 20:19:51 +08:00
#if defined(__cplusplus)
extern "C" {
#endif
struct spinand_blk_device {
struct mtd_dev *mtd_device;
2024-01-27 08:47:24 +08:00
struct rt_device_blk_geometry info;
#ifdef AIC_NFTL_SUPPORT
struct nftl_api_handler_t *nftl_handler;
#endif
2023-11-09 20:19:51 +08:00
u8 *pagebuf;
2024-01-27 08:47:24 +08:00
enum part_attr attr;
2023-11-09 20:19:51 +08:00
};
/*!
* @name SPINAND Disk Function
* @{
*/
/*!
* @brief Initializes SPINAND disk.
*
* @param device_name the name of device which includes a file system.
2024-01-27 08:47:24 +08:00
* @retval the handle of disk.
2023-11-09 20:19:51 +08:00
*/
2024-01-27 08:47:24 +08:00
void *spinand_disk_initialize(const char *device_name);
2023-11-09 20:19:51 +08:00
/*!
* Gets SPINAND disk status
*
2024-01-27 08:47:24 +08:00
* @param hdisk the handle of device which includes a file system.
2023-11-09 20:19:51 +08:00
* @retval STA_NOINIT Failed.
* @retval RES_OK Success.
*/
2024-01-27 08:47:24 +08:00
DSTATUS spinand_disk_status(void *hdisk);
2023-11-09 20:19:51 +08:00
/*!
* @brief Reads SPINAND disk.
*
2024-01-27 08:47:24 +08:00
* @param hdisk the handle of device which includes a file system.
2023-11-09 20:19:51 +08:00
* @param buf The data buffer pointer to store read content.
* @param sector The start sector number to be read.
* @param cnt The sector count to be read.
* @retval RES_PARERR Failed.
* @retval RES_OK Success.
*/
2024-01-27 08:47:24 +08:00
DRESULT spinand_disk_read(void *hdisk, uint8_t *buf, uint32_t sector, uint8_t cnt);
2023-11-09 20:19:51 +08:00
/*!
* @brief Writes SPINAND disk.
*
2024-01-27 08:47:24 +08:00
* @param hdisk the handle of device which includes a file system.
2023-11-09 20:19:51 +08:00
* @param buf The data buffer pointer to store write content.
* @param sector The start sector number to be written.
* @param cnt The sector count to be written.
* @retval RES_PARERR Failed.
* @retval RES_OK Success.
*/
2024-01-27 08:47:24 +08:00
DRESULT spinand_disk_write(void *hdisk, const uint8_t *buf, uint32_t sector, uint8_t cnt);
2023-11-09 20:19:51 +08:00
/*!
* @brief SPINAND disk IO operation.
*
2024-01-27 08:47:24 +08:00
* @param hdisk the handle of device which includes a file system.
2023-11-09 20:19:51 +08:00
* @param command The command to be set.
* @param buf The buffer to store command result.
* @retval RES_PARERR Failed.
* @retval RES_OK Success.
*/
2024-01-27 08:47:24 +08:00
DRESULT spinand_disk_ioctl(void *hdisk, uint8_t command, void *buf);
2023-11-09 20:19:51 +08:00
/* @} */
#if defined(__cplusplus)
}
#endif
#endif /* _SPINAND_DISKIO_H_ */