1 /* 2 * Copyright (c) 2022 HPMicro 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef HPM_LITTLEFS_DRV_H 16 #define HPM_LITTLEFS_DRV_H 17 18 #include <stdint.h> 19 #include <hpm_soc.h> 20 #include <hpm_romapi.h> 21 #include <los_fs.h> 22 23 struct HpmLittleCtx { 24 xpi_nor_config_t xpiNorConfig; 25 int isInited; 26 uint32_t startOffset; /* The partion address in chip; unit in byte */ 27 uint32_t len; /* The partion length, unit in byte */ 28 uint32_t base; /* XPI register base */ 29 char *mountPoint; 30 }; 31 32 struct HpmLittlefsCfg { 33 struct PartitionCfg cfg; 34 struct HpmLittleCtx ctx; 35 }; 36 37 int HpmLittlefsRead(int partition, UINT32 *offset, void *buf, UINT32 size); 38 int HpmLittlefsProg(int partition, UINT32 *offset, const void *buf, UINT32 size); 39 int HpmLittlefsErase(int partition, UINT32 offset, UINT32 size); 40 int HpmLittlefsDriverInit(struct HpmLittlefsCfg *cfg); 41 42 #endif 43