enable blk cache for spinand fatfs read

This commit is contained in:
刘可亮
2024-12-03 11:13:01 +08:00
parent 08c1394167
commit 791ea5b94b
4 changed files with 266 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, ArtInChip Technology Co., Ltd
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -13,6 +13,23 @@
#include <rtdevice.h>
#include "spinand_parts.h"
#ifndef AIC_SPINAND_BLOCK_CACHE_SIZE
#define BLOCK_CACHE_SIZE 512
#else
#define BLOCK_CACHE_SIZE AIC_SPINAND_BLOCK_CACHE_SIZE
#endif
#ifndef AIC_SPINAND_BLOCK_CACHE_NUM
#define BLOCK_CACHE_NUM 4
#else
#define BLOCK_CACHE_NUM AIC_SPINAND_BLOCK_CACHE_NUM
#endif
struct blk_cache {
u32 pos;
char buf[BLOCK_CACHE_SIZE];
};
struct spinand_blk_device {
struct rt_device parent;
struct rt_device_blk_geometry geometry;
@@ -23,6 +40,7 @@ struct spinand_blk_device {
char name[32];
enum part_attr attr;
u8 *pagebuf;
struct blk_cache blk_cache[BLOCK_CACHE_NUM];
};
int rt_blk_nand_register_device(const char *name, struct rt_mtd_nand_device *mtd_device);