fs: expose generic ramdisk/flash disk access functions
This patch removes "FAT" from files names, config names and symbol names so as to avoid confusion, when other modules use them in a more generic way. Also flash_disk_access.c and ram_disk_access.c now exports generic disk_access symbols as defined in include/disk_access.h rather than FAT specific ones in fs/fat_diskio.h. Thus modules like USB which need to use disk_access interface is not dependent on symbols from ELMChan FAT module. Also fat_diskio.h is removed. Further the shim between ELM chan and Zephyr is modified as per these changes. Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982 Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
This commit is contained in:
parent
383d9b757a
commit
2fe288b4aa
9 changed files with 546 additions and 159 deletions
|
@ -26,7 +26,8 @@
|
||||||
/----------------------------------------------------------------------------*/
|
/----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <diskio.h> /* FatFs lower layer API */
|
#include <diskio.h> /* FatFs lower layer API */
|
||||||
#include <fs/fat_diskio.h>
|
#include <ffconf.h>
|
||||||
|
#include <disk_access.h>
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Get Drive Status */
|
/* Get Drive Status */
|
||||||
|
@ -34,7 +35,11 @@
|
||||||
|
|
||||||
DSTATUS disk_status(BYTE pdrv)
|
DSTATUS disk_status(BYTE pdrv)
|
||||||
{
|
{
|
||||||
return fat_disk_status();
|
if (disk_access_status() != 0) {
|
||||||
|
return STA_NOINIT;
|
||||||
|
} else {
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
@ -43,7 +48,11 @@ DSTATUS disk_status(BYTE pdrv)
|
||||||
|
|
||||||
DSTATUS disk_initialize(BYTE pdrv)
|
DSTATUS disk_initialize(BYTE pdrv)
|
||||||
{
|
{
|
||||||
return fat_disk_initialize();
|
if (disk_access_init() != 0) {
|
||||||
|
return STA_NOINIT;
|
||||||
|
} else {
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
@ -52,7 +61,12 @@ DSTATUS disk_initialize(BYTE pdrv)
|
||||||
|
|
||||||
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
||||||
{
|
{
|
||||||
return fat_disk_read(buff, sector, count);
|
if (disk_access_read(buff, sector, count) != 0) {
|
||||||
|
return RES_ERROR;
|
||||||
|
} else {
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
@ -60,7 +74,11 @@ DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
||||||
{
|
{
|
||||||
return fat_disk_write(buff, sector, count);
|
if(disk_access_write(buff, sector, count) != 0) {
|
||||||
|
return RES_ERROR;
|
||||||
|
} else {
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
@ -69,5 +87,33 @@ DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
|
||||||
|
|
||||||
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
|
||||||
{
|
{
|
||||||
return fat_disk_ioctl(cmd, buff);
|
int ret = RES_OK;
|
||||||
|
uint32_t tmp = 0;
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case CTRL_SYNC:
|
||||||
|
if(disk_access_ioctl(DISK_IOCTL_CTRL_SYNC, buff) != 0) {
|
||||||
|
ret = RES_ERROR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GET_SECTOR_COUNT:
|
||||||
|
if (disk_access_ioctl(DISK_IOCTL_GET_DISK_SIZE, &tmp) != 0) {
|
||||||
|
ret = RES_ERROR;
|
||||||
|
} else {
|
||||||
|
*(uint32_t *) buff = (tmp / _MIN_SS) ;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GET_BLOCK_SIZE:
|
||||||
|
if (disk_access_ioctl(DISK_IOCTL_GET_ERASE_BLOCK_SZ, buff) != 0) {
|
||||||
|
ret = RES_ERROR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ret = RES_PARERR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _FAT_DISKIO_H_
|
|
||||||
#define _FAT_DISKIO_H_
|
|
||||||
|
|
||||||
#include <diskio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
DSTATUS fat_disk_status(void);
|
|
||||||
DSTATUS fat_disk_initialize(void);
|
|
||||||
DRESULT fat_disk_read(uint8_t *buff, unsigned long sector, uint32_t count);
|
|
||||||
DRESULT fat_disk_write(const uint8_t *buff, unsigned long sector,
|
|
||||||
uint32_t count);
|
|
||||||
DRESULT fat_disk_ioctl(uint8_t cmd, void *buff);
|
|
||||||
|
|
||||||
#endif /* _FAT_DISKIO_H_ */
|
|
|
@ -40,14 +40,14 @@ config FILE_SYSTEM_FAT
|
||||||
choice
|
choice
|
||||||
prompt "Storage backend selection"
|
prompt "Storage backend selection"
|
||||||
|
|
||||||
config FS_FAT_RAM_DISK
|
config DISK_ACCESS_RAM
|
||||||
bool "RAM Disk"
|
bool "RAM Disk"
|
||||||
help
|
help
|
||||||
RAM buffer used to emulate storage disk.
|
RAM buffer used to emulate storage disk.
|
||||||
This option can used to test the file
|
This option can used to test the file
|
||||||
system.
|
system.
|
||||||
|
|
||||||
config FS_FAT_FLASH_DISK
|
config DISK_ACCESS_FLASH
|
||||||
bool "Flash"
|
bool "Flash"
|
||||||
help
|
help
|
||||||
Flash device is used for the file system.
|
Flash device is used for the file system.
|
||||||
|
@ -56,20 +56,20 @@ endchoice
|
||||||
|
|
||||||
config FS_VOLUME_SIZE
|
config FS_VOLUME_SIZE
|
||||||
hex
|
hex
|
||||||
default 0x18000 if FS_FAT_RAM_DISK
|
default 0x18000 if DISK_ACCESS_RAM
|
||||||
default 0x200000 if FS_FAT_FLASH_DISK_W25QXXDV
|
default 0x200000 if FS_FAT_FLASH_DISK_W25QXXDV
|
||||||
help
|
help
|
||||||
This is the file system volume size in bytes.
|
This is the file system volume size in bytes.
|
||||||
|
|
||||||
config FS_BLOCK_SIZE
|
config FS_BLOCK_SIZE
|
||||||
hex
|
hex
|
||||||
default 0x1000 if FS_FAT_RAM_DISK
|
default 0x1000 if DISK_ACCESS_RAM
|
||||||
default 0x1000 if FS_FAT_FLASH_DISK_W25QXXDV
|
default 0x1000 if FS_FAT_FLASH_DISK_W25QXXDV
|
||||||
help
|
help
|
||||||
This is typically the minimum block size that
|
This is typically the minimum block size that
|
||||||
is erased at one time in flash storage.
|
is erased at one time in flash storage.
|
||||||
|
|
||||||
if FS_FAT_FLASH_DISK
|
if DISK_ACCESS_FLASH
|
||||||
|
|
||||||
config FS_FAT_FLASH_DISK_W25QXXDV
|
config FS_FAT_FLASH_DISK_W25QXXDV
|
||||||
bool "W25QXXDV flash component"
|
bool "W25QXXDV flash component"
|
||||||
|
@ -108,7 +108,7 @@ config FS_FLASH_ERASE_ALIGNMENT
|
||||||
the flash component.
|
the flash component.
|
||||||
|
|
||||||
endif # FS_FAT_FLASH_DISK_W25QXXDV
|
endif # FS_FAT_FLASH_DISK_W25QXXDV
|
||||||
endif # FS_FAT_FLASH_DISK
|
endif # DISK_ACCESS_FLASH
|
||||||
endif # FILE_SYSTEM
|
endif # FILE_SYSTEM
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
obj-$(CONFIG_FS_FAT_RAM_DISK) += fat_ram_diskio.o
|
|
||||||
obj-$(CONFIG_FS_FAT_FLASH_DISK) += fat_flash_diskio.o
|
|
||||||
obj-$(CONFIG_FILE_SYSTEM_FAT) += fat_fs.o
|
|
||||||
obj-$(CONFIG_FILE_SYSTEM_SHELL) += shell.o
|
obj-$(CONFIG_FILE_SYSTEM_SHELL) += shell.o
|
||||||
|
obj-$(CONFIG_FILE_SYSTEM_FAT) += fat_fs.o
|
||||||
|
obj-$(CONFIG_DISK_ACCESS_RAM) += disk_access_ram.o
|
||||||
|
obj-$(CONFIG_DISK_ACCESS_FLASH) += disk_access_flash.o
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <misc/__assert.h>
|
#include <misc/__assert.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
#include <diskio.h>
|
#include <disk_access.h>
|
||||||
#include <ff.h>
|
#include <errno.h>
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
#include <flash.h>
|
#include <flash.h>
|
||||||
|
|
||||||
|
#define SECTOR_SIZE 512
|
||||||
|
|
||||||
static struct device *flash_dev;
|
static struct device *flash_dev;
|
||||||
|
|
||||||
/* flash read-copy-erase-write operation */
|
/* flash read-copy-erase-write operation */
|
||||||
|
@ -40,36 +42,36 @@ static off_t lba_to_address(uint32_t sector_num)
|
||||||
{
|
{
|
||||||
off_t flash_addr;
|
off_t flash_addr;
|
||||||
|
|
||||||
flash_addr = CONFIG_FS_FLASH_START + sector_num * _MIN_SS;
|
flash_addr = CONFIG_FS_FLASH_START + sector_num * SECTOR_SIZE;
|
||||||
__ASSERT(flash_addr < (CONFIG_FS_FLASH_START + CONFIG_FS_VOLUME_SIZE),
|
__ASSERT(flash_addr < (CONFIG_FS_FLASH_START + CONFIG_FS_VOLUME_SIZE),
|
||||||
"FS bound error");
|
"FS bound error");
|
||||||
return flash_addr;
|
return flash_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSTATUS fat_disk_status(void)
|
int disk_access_status(void)
|
||||||
{
|
{
|
||||||
if (!flash_dev) {
|
if (!flash_dev) {
|
||||||
return STA_NOINIT;
|
return DISK_STATUS_NOMEDIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_OK;
|
return DISK_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSTATUS fat_disk_initialize(void)
|
int disk_access_init(void)
|
||||||
{
|
{
|
||||||
if (flash_dev) {
|
if (flash_dev) {
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
flash_dev = device_get_binding(CONFIG_FS_FLASH_DEV_NAME);
|
flash_dev = device_get_binding(CONFIG_FS_FLASH_DEV_NAME);
|
||||||
if (!flash_dev) {
|
if (!flash_dev) {
|
||||||
return STA_NOINIT;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRESULT fat_disk_read(void *buff, uint32_t start_sector,
|
int disk_access_read(uint8_t *buff, uint32_t start_sector,
|
||||||
uint32_t sector_count)
|
uint32_t sector_count)
|
||||||
{
|
{
|
||||||
off_t fl_addr;
|
off_t fl_addr;
|
||||||
|
@ -78,7 +80,7 @@ DRESULT fat_disk_read(void *buff, uint32_t start_sector,
|
||||||
uint32_t num_read;
|
uint32_t num_read;
|
||||||
|
|
||||||
fl_addr = lba_to_address(start_sector);
|
fl_addr = lba_to_address(start_sector);
|
||||||
remaining = (sector_count * _MIN_SS);
|
remaining = (sector_count * SECTOR_SIZE);
|
||||||
len = CONFIG_FS_FLASH_MAX_RW_SIZE;
|
len = CONFIG_FS_FLASH_MAX_RW_SIZE;
|
||||||
|
|
||||||
num_read = GET_NUM_BLOCK(remaining, CONFIG_FS_FLASH_MAX_RW_SIZE);
|
num_read = GET_NUM_BLOCK(remaining, CONFIG_FS_FLASH_MAX_RW_SIZE);
|
||||||
|
@ -89,7 +91,7 @@ DRESULT fat_disk_read(void *buff, uint32_t start_sector,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flash_read(flash_dev, fl_addr, buff, len) != 0) {
|
if (flash_read(flash_dev, fl_addr, buff, len) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_addr += len;
|
fl_addr += len;
|
||||||
|
@ -97,11 +99,11 @@ DRESULT fat_disk_read(void *buff, uint32_t start_sector,
|
||||||
remaining -= len;
|
remaining -= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This performs read-copy into an output buffer */
|
/* This performs read-copy into an output buffer */
|
||||||
static DRESULT read_copy_flash_block(off_t start_addr, uint32_t size,
|
static int read_copy_flash_block(off_t start_addr, uint32_t size,
|
||||||
const void *src_buff,
|
const void *src_buff,
|
||||||
uint8_t *dest_buff)
|
uint8_t *dest_buff)
|
||||||
{
|
{
|
||||||
|
@ -126,18 +128,18 @@ static DRESULT read_copy_flash_block(off_t start_addr, uint32_t size,
|
||||||
fl_addr + (CONFIG_FS_FLASH_MAX_RW_SIZE * i),
|
fl_addr + (CONFIG_FS_FLASH_MAX_RW_SIZE * i),
|
||||||
dest_buff + (CONFIG_FS_FLASH_MAX_RW_SIZE * i),
|
dest_buff + (CONFIG_FS_FLASH_MAX_RW_SIZE * i),
|
||||||
CONFIG_FS_FLASH_MAX_RW_SIZE) != 0) {
|
CONFIG_FS_FLASH_MAX_RW_SIZE) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* overwrite with user data */
|
/* overwrite with user data */
|
||||||
memcpy(dest_buff + offset, src_buff, size);
|
memcpy(dest_buff + offset, src_buff, size);
|
||||||
|
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* input size is either less or equal to a block size, CONFIG_FS_BLOCK_SIZE. */
|
/* input size is either less or equal to a block size, CONFIG_FS_BLOCK_SIZE. */
|
||||||
static DRESULT update_flash_block(off_t start_addr, uint32_t size,
|
static int update_flash_block(off_t start_addr, uint32_t size,
|
||||||
const void *buff)
|
const void *buff)
|
||||||
{
|
{
|
||||||
off_t fl_addr;
|
off_t fl_addr;
|
||||||
|
@ -147,8 +149,8 @@ static DRESULT update_flash_block(off_t start_addr, uint32_t size,
|
||||||
/* if size is a partial block, perform read-copy with user data */
|
/* if size is a partial block, perform read-copy with user data */
|
||||||
if (size < CONFIG_FS_BLOCK_SIZE) {
|
if (size < CONFIG_FS_BLOCK_SIZE) {
|
||||||
if (read_copy_flash_block(start_addr, size, buff, fs_buff) !=
|
if (read_copy_flash_block(start_addr, size, buff, fs_buff) !=
|
||||||
RES_OK) {
|
0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now use the local buffer as the source */
|
/* now use the local buffer as the source */
|
||||||
|
@ -161,7 +163,7 @@ static DRESULT update_flash_block(off_t start_addr, uint32_t size,
|
||||||
/* disable write-protection first before erase */
|
/* disable write-protection first before erase */
|
||||||
flash_write_protection_set(flash_dev, false);
|
flash_write_protection_set(flash_dev, false);
|
||||||
if (flash_erase(flash_dev, fl_addr, CONFIG_FS_BLOCK_SIZE) != 0) {
|
if (flash_erase(flash_dev, fl_addr, CONFIG_FS_BLOCK_SIZE) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write data to flash */
|
/* write data to flash */
|
||||||
|
@ -174,17 +176,17 @@ static DRESULT update_flash_block(off_t start_addr, uint32_t size,
|
||||||
|
|
||||||
if (flash_write(flash_dev, fl_addr, src,
|
if (flash_write(flash_dev, fl_addr, src,
|
||||||
CONFIG_FS_FLASH_MAX_RW_SIZE) != 0) {
|
CONFIG_FS_FLASH_MAX_RW_SIZE) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_addr += CONFIG_FS_FLASH_MAX_RW_SIZE;
|
fl_addr += CONFIG_FS_FLASH_MAX_RW_SIZE;
|
||||||
src += CONFIG_FS_FLASH_MAX_RW_SIZE;
|
src += CONFIG_FS_FLASH_MAX_RW_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
int disk_access_write(const uint8_t *buff, uint32_t start_sector,
|
||||||
uint32_t sector_count)
|
uint32_t sector_count)
|
||||||
{
|
{
|
||||||
off_t fl_addr;
|
off_t fl_addr;
|
||||||
|
@ -192,7 +194,7 @@ DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
fl_addr = lba_to_address(start_sector);
|
fl_addr = lba_to_address(start_sector);
|
||||||
remaining = (sector_count * _MIN_SS);
|
remaining = (sector_count * SECTOR_SIZE);
|
||||||
|
|
||||||
/* check if start address is erased-aligned address */
|
/* check if start address is erased-aligned address */
|
||||||
if (fl_addr & (CONFIG_FS_FLASH_ERASE_ALIGNMENT - 1)) {
|
if (fl_addr & (CONFIG_FS_FLASH_ERASE_ALIGNMENT - 1)) {
|
||||||
|
@ -204,9 +206,9 @@ DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
||||||
~(CONFIG_FS_BLOCK_SIZE - 1))) {
|
~(CONFIG_FS_BLOCK_SIZE - 1))) {
|
||||||
/* not over block boundary (a partial block also) */
|
/* not over block boundary (a partial block also) */
|
||||||
if (update_flash_block(fl_addr, remaining, buff) != 0) {
|
if (update_flash_block(fl_addr, remaining, buff) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write goes over block boundary */
|
/* write goes over block boundary */
|
||||||
|
@ -214,7 +216,7 @@ DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
||||||
|
|
||||||
/* write first partial block */
|
/* write first partial block */
|
||||||
if (update_flash_block(fl_addr, size, buff) != 0) {
|
if (update_flash_block(fl_addr, size, buff) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_addr += size;
|
fl_addr += size;
|
||||||
|
@ -230,7 +232,7 @@ DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
||||||
|
|
||||||
if (update_flash_block(fl_addr, CONFIG_FS_BLOCK_SIZE,
|
if (update_flash_block(fl_addr, CONFIG_FS_BLOCK_SIZE,
|
||||||
buff) != 0) {
|
buff) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_addr += CONFIG_FS_BLOCK_SIZE;
|
fl_addr += CONFIG_FS_BLOCK_SIZE;
|
||||||
|
@ -241,27 +243,33 @@ DRESULT fat_disk_write(const void *buff, uint32_t start_sector,
|
||||||
/* remaining partial block */
|
/* remaining partial block */
|
||||||
if (remaining) {
|
if (remaining) {
|
||||||
if (update_flash_block(fl_addr, remaining, buff) != 0) {
|
if (update_flash_block(fl_addr, remaining, buff) != 0) {
|
||||||
return RES_ERROR;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRESULT fat_disk_ioctl(uint8_t cmd, void *buff)
|
int disk_access_ioctl(uint8_t cmd, void *buff)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CTRL_SYNC:
|
case DISK_IOCTL_CTRL_SYNC:
|
||||||
return RES_OK;
|
return 0;
|
||||||
case GET_SECTOR_COUNT:
|
case DISK_IOCTL_GET_SECTOR_COUNT:
|
||||||
*(uint32_t *)buff = CONFIG_FS_VOLUME_SIZE / _MIN_SS;
|
*(uint32_t *)buff = CONFIG_FS_VOLUME_SIZE / SECTOR_SIZE;
|
||||||
return RES_OK;
|
return 0;
|
||||||
case GET_BLOCK_SIZE: /* in sectors */
|
case DISK_IOCTL_GET_SECTOR_SIZE:
|
||||||
*(uint32_t *)buff = CONFIG_FS_BLOCK_SIZE / _MIN_SS;
|
*(uint32_t *) buff = SECTOR_SIZE;
|
||||||
return RES_OK;
|
return 0;
|
||||||
case CTRL_TRIM:
|
case DISK_IOCTL_GET_ERASE_BLOCK_SZ: /* in sectors */
|
||||||
|
*(uint32_t *)buff = CONFIG_FS_BLOCK_SIZE / SECTOR_SIZE;
|
||||||
|
return 0;
|
||||||
|
case DISK_IOCTL_GET_DISK_SIZE:
|
||||||
|
*(uint32_t *)buff = CONFIG_FS_VOLUME_SIZE;
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_PARERR;
|
return -EINVAL;
|
||||||
}
|
}
|
91
subsys/fs/disk_access_ram.c
Normal file
91
subsys/fs/disk_access_ram.c
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel Corporation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <misc/__assert.h>
|
||||||
|
#include <disk_access.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#define RAMDISK_SECTOR_SIZE 512
|
||||||
|
|
||||||
|
#if defined(CONFIG_USB_MASS_STORAGE)
|
||||||
|
/* A 16KB initialized RAMdisk which will fit on most target's RAM. It
|
||||||
|
* is initialized with a valid file system for validating USB mass storage.
|
||||||
|
*/
|
||||||
|
#include "fat12_ramdisk.h"
|
||||||
|
#else
|
||||||
|
/* A 96KB RAM Disk, which meets ELM FAT fs's minimum block requirement. Fit for
|
||||||
|
* qemu testing (as it may exceed target's RAM limits).
|
||||||
|
*/
|
||||||
|
#define RAMDISK_VOLUME_SIZE (192 * RAMDISK_SECTOR_SIZE)
|
||||||
|
static uint8_t ramdisk_buf[RAMDISK_VOLUME_SIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void *lba_to_address(uint32_t lba)
|
||||||
|
{
|
||||||
|
__ASSERT(((lba * RAMDISK_SECTOR_SIZE) < RAMDISK_VOLUME_SIZE),
|
||||||
|
"FS bound error");
|
||||||
|
return &ramdisk_buf[(lba * RAMDISK_SECTOR_SIZE)];
|
||||||
|
}
|
||||||
|
|
||||||
|
int disk_access_status(void)
|
||||||
|
{
|
||||||
|
return DISK_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int disk_access_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int disk_access_read(uint8_t *buff, uint32_t sector, uint32_t count)
|
||||||
|
{
|
||||||
|
memcpy(buff, lba_to_address(sector), count * RAMDISK_SECTOR_SIZE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int disk_access_write(const uint8_t *buff, uint32_t sector, uint32_t count)
|
||||||
|
{
|
||||||
|
memcpy(lba_to_address(sector), buff, count * RAMDISK_SECTOR_SIZE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int disk_access_ioctl(uint8_t cmd, void *buff)
|
||||||
|
{
|
||||||
|
switch (cmd) {
|
||||||
|
case DISK_IOCTL_CTRL_SYNC:
|
||||||
|
break;
|
||||||
|
case DISK_IOCTL_GET_SECTOR_COUNT:
|
||||||
|
*(uint32_t *) buff = RAMDISK_VOLUME_SIZE / RAMDISK_SECTOR_SIZE;
|
||||||
|
break;
|
||||||
|
case DISK_IOCTL_GET_SECTOR_SIZE:
|
||||||
|
*(uint32_t *) buff = RAMDISK_SECTOR_SIZE;
|
||||||
|
break;
|
||||||
|
case DISK_IOCTL_GET_ERASE_BLOCK_SZ:
|
||||||
|
*(uint32_t *) buff = 1;
|
||||||
|
break;
|
||||||
|
case DISK_IOCTL_GET_DISK_SIZE:
|
||||||
|
*(uint32_t *) buff = RAMDISK_VOLUME_SIZE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
340
subsys/fs/fat12_ramdisk.h
Normal file
340
subsys/fs/fat12_ramdisk.h
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
#ifndef __FAT12_RAMDISK_SAMPLE_H__
|
||||||
|
#define __FAT12_RAMDISK_SAMPLE_H__
|
||||||
|
|
||||||
|
#define RAMDISK_VOLUME_SIZE (32 * 512)
|
||||||
|
|
||||||
|
/* A tiny RAMdisk buffer which will fit on most target's RAM. The
|
||||||
|
* following array encodes a FAT12 partition which contains a single readme
|
||||||
|
* file within the root directory. The array initializes only 5 out of the
|
||||||
|
* 32 sectors, which need to have valid contents (though 32 x 512 = 16384
|
||||||
|
* is the total size). The 5 initialized sectors being boot sector (0),
|
||||||
|
* fat table (1, 2), directory table (3) and file(readme) contents (4).
|
||||||
|
*/
|
||||||
|
|
||||||
|
static uint8_t ramdisk_buf[RAMDISK_VOLUME_SIZE] = {
|
||||||
|
0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53,
|
||||||
|
0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x01, 0x00,
|
||||||
|
0x01, 0x10, 0x00, 0x20, 0x00, 0xF8, 0x02, 0x00,
|
||||||
|
0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x74,
|
||||||
|
0x19, 0x02, 0x27, 0x5A, 0x45, 0x50, 0x48, 0x59,
|
||||||
|
0x52, 0x20, 0x20, 0x55, 0x53, 0x42, 0x46, 0x41,
|
||||||
|
0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x33, 0xC9,
|
||||||
|
0x8E, 0xD1, 0xBC, 0xF0, 0x7B, 0x8E, 0xD9, 0xB8,
|
||||||
|
0x00, 0x20, 0x8E, 0xC0, 0xFC, 0xBD, 0x00, 0x7C,
|
||||||
|
0x38, 0x4E, 0x24, 0x7D, 0x24, 0x8B, 0xC1, 0x99,
|
||||||
|
0xE8, 0x3C, 0x01, 0x72, 0x1C, 0x83, 0xEB, 0x3A,
|
||||||
|
0x66, 0xA1, 0x1C, 0x7C, 0x26, 0x66, 0x3B, 0x07,
|
||||||
|
0x26, 0x8A, 0x57, 0xFC, 0x75, 0x06, 0x80, 0xCA,
|
||||||
|
0x02, 0x88, 0x56, 0x02, 0x80, 0xC3, 0x10, 0x73,
|
||||||
|
0xEB, 0x33, 0xC9, 0x8A, 0x46, 0x10, 0x98, 0xF7,
|
||||||
|
0x66, 0x16, 0x03, 0x46, 0x1C, 0x13, 0x56, 0x1E,
|
||||||
|
0x03, 0x46, 0x0E, 0x13, 0xD1, 0x8B, 0x76, 0x11,
|
||||||
|
0x60, 0x89, 0x46, 0xFC, 0x89, 0x56, 0xFE, 0xB8,
|
||||||
|
0x20, 0x00, 0xF7, 0xE6, 0x8B, 0x5E, 0x0B, 0x03,
|
||||||
|
0xC3, 0x48, 0xF7, 0xF3, 0x01, 0x46, 0xFC, 0x11,
|
||||||
|
0x4E, 0xFE, 0x61, 0xBF, 0x00, 0x00, 0xE8, 0xE6,
|
||||||
|
0x00, 0x72, 0x39, 0x26, 0x38, 0x2D, 0x74, 0x17,
|
||||||
|
0x60, 0xB1, 0x0B, 0xBE, 0xA1, 0x7D, 0xF3, 0xA6,
|
||||||
|
0x61, 0x74, 0x32, 0x4E, 0x74, 0x09, 0x83, 0xC7,
|
||||||
|
0x20, 0x3B, 0xFB, 0x72, 0xE6, 0xEB, 0xDC, 0xA0,
|
||||||
|
0xFB, 0x7D, 0xB4, 0x7D, 0x8B, 0xF0, 0xAC, 0x98,
|
||||||
|
0x40, 0x74, 0x0C, 0x48, 0x74, 0x13, 0xB4, 0x0E,
|
||||||
|
0xBB, 0x07, 0x00, 0xCD, 0x10, 0xEB, 0xEF, 0xA0,
|
||||||
|
0xFD, 0x7D, 0xEB, 0xE6, 0xA0, 0xFC, 0x7D, 0xEB,
|
||||||
|
0xE1, 0xCD, 0x16, 0xCD, 0x19, 0x26, 0x8B, 0x55,
|
||||||
|
0x1A, 0x52, 0xB0, 0x01, 0xBB, 0x00, 0x00, 0xE8,
|
||||||
|
0x3B, 0x00, 0x72, 0xE8, 0x5B, 0x8A, 0x56, 0x24,
|
||||||
|
0xBE, 0x0B, 0x7C, 0x8B, 0xFC, 0xC7, 0x46, 0xF0,
|
||||||
|
0x3D, 0x7D, 0xC7, 0x46, 0xF4, 0x29, 0x7D, 0x8C,
|
||||||
|
0xD9, 0x89, 0x4E, 0xF2, 0x89, 0x4E, 0xF6, 0xC6,
|
||||||
|
0x06, 0x96, 0x7D, 0xCB, 0xEA, 0x03, 0x00, 0x00,
|
||||||
|
0x20, 0x0F, 0xB6, 0xC8, 0x66, 0x8B, 0x46, 0xF8,
|
||||||
|
0x66, 0x03, 0x46, 0x1C, 0x66, 0x8B, 0xD0, 0x66,
|
||||||
|
0xC1, 0xEA, 0x10, 0xEB, 0x5E, 0x0F, 0xB6, 0xC8,
|
||||||
|
0x4A, 0x4A, 0x8A, 0x46, 0x0D, 0x32, 0xE4, 0xF7,
|
||||||
|
0xE2, 0x03, 0x46, 0xFC, 0x13, 0x56, 0xFE, 0xEB,
|
||||||
|
0x4A, 0x52, 0x50, 0x06, 0x53, 0x6A, 0x01, 0x6A,
|
||||||
|
0x10, 0x91, 0x8B, 0x46, 0x18, 0x96, 0x92, 0x33,
|
||||||
|
0xD2, 0xF7, 0xF6, 0x91, 0xF7, 0xF6, 0x42, 0x87,
|
||||||
|
0xCA, 0xF7, 0x76, 0x1A, 0x8A, 0xF2, 0x8A, 0xE8,
|
||||||
|
0xC0, 0xCC, 0x02, 0x0A, 0xCC, 0xB8, 0x01, 0x02,
|
||||||
|
0x80, 0x7E, 0x02, 0x0E, 0x75, 0x04, 0xB4, 0x42,
|
||||||
|
0x8B, 0xF4, 0x8A, 0x56, 0x24, 0xCD, 0x13, 0x61,
|
||||||
|
0x61, 0x72, 0x0B, 0x40, 0x75, 0x01, 0x42, 0x03,
|
||||||
|
0x5E, 0x0B, 0x49, 0x75, 0x06, 0xF8, 0xC3, 0x41,
|
||||||
|
0xBB, 0x00, 0x00, 0x60, 0x66, 0x6A, 0x00, 0xEB,
|
||||||
|
0xB0, 0x4E, 0x54, 0x4C, 0x44, 0x52, 0x20, 0x20,
|
||||||
|
0x20, 0x20, 0x20, 0x20, 0x0D, 0x0A, 0x52, 0x65,
|
||||||
|
0x6D, 0x6F, 0x76, 0x65, 0x20, 0x64, 0x69, 0x73,
|
||||||
|
0x6B, 0x73, 0x20, 0x6F, 0x72, 0x20, 0x6F, 0x74,
|
||||||
|
0x68, 0x65, 0x72, 0x20, 0x6D, 0x65, 0x64, 0x69,
|
||||||
|
0x61, 0x2E, 0xFF, 0x0D, 0x0A, 0x44, 0x69, 0x73,
|
||||||
|
0x6B, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0xFF,
|
||||||
|
0x0D, 0x0A, 0x50, 0x72, 0x65, 0x73, 0x73, 0x20,
|
||||||
|
0x61, 0x6E, 0x79, 0x20, 0x6B, 0x65, 0x79, 0x20,
|
||||||
|
0x74, 0x6F, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61,
|
||||||
|
0x72, 0x74, 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0xAC, 0xCB, 0xD8, 0x55, 0xAA,
|
||||||
|
/* Sector 1 FAT follows */
|
||||||
|
0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* Sector 3 directory table - 2 entries (16 bytes) roor dir and readme file */
|
||||||
|
0x5A, 0x45, 0x50, 0x48, 0x59, 0x52, 0x20, 0x20,
|
||||||
|
0x55, 0x53, 0x42, 0x28, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x52, 0x45, 0x41, 0x44, 0x4D, 0x45, 0x20, 0x20,
|
||||||
|
0x54, 0x58, 0x54, 0x20, 0x00, 0x00, 0x36, 0x8F,
|
||||||
|
0x4A, 0x49, 0x4A, 0x49, 0x00, 0x00, 0xDC, 0x83,
|
||||||
|
0xBB, 0x32, 0x02, 0x00, 0x3E, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
/* Sector 4 Contents of README file follows */
|
||||||
|
0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
|
||||||
|
0x61, 0x20, 0x20, 0x52, 0x41, 0x4D, 0x20, 0x44,
|
||||||
|
0x69, 0x73, 0x6B, 0x20, 0x62, 0x61, 0x73, 0x65,
|
||||||
|
0x64, 0x20, 0x20, 0x55, 0x53, 0x42, 0x20, 0x4D,
|
||||||
|
0x61, 0x73, 0x73, 0x20, 0x53, 0x74, 0x6F, 0x72,
|
||||||
|
0x61, 0x67, 0x65, 0x20, 0x64, 0x65, 0x6D, 0x6F,
|
||||||
|
0x20, 0x66, 0x6F, 0x72, 0x20, 0x5A, 0x65, 0x70,
|
||||||
|
0x68, 0x79, 0x72, 0x2E, 0x0D, 0x0A, 0x0D, 0x0A,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __FAT12_RAMDISK_SAMPLE_H__ */
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2016 Intel Corporation.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <misc/__assert.h>
|
|
||||||
#include <diskio.h>
|
|
||||||
#include <ff.h>
|
|
||||||
|
|
||||||
static uint8_t file_buff[CONFIG_FS_VOLUME_SIZE];
|
|
||||||
|
|
||||||
static void *lba_to_address(uint32_t lba)
|
|
||||||
{
|
|
||||||
__ASSERT(((lba * _MIN_SS) < CONFIG_FS_VOLUME_SIZE), "FS bound error");
|
|
||||||
return &file_buff[(lba * _MIN_SS)];
|
|
||||||
}
|
|
||||||
|
|
||||||
DSTATUS fat_disk_status(void)
|
|
||||||
{
|
|
||||||
return RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DSTATUS fat_disk_initialize(void)
|
|
||||||
{
|
|
||||||
return RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DRESULT fat_disk_read(void *buff, uint32_t sector, uint32_t count)
|
|
||||||
{
|
|
||||||
memcpy(buff, lba_to_address(sector), count * _MIN_SS);
|
|
||||||
|
|
||||||
return RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DRESULT fat_disk_write(void *buff, uint32_t sector, uint32_t count)
|
|
||||||
{
|
|
||||||
memcpy(lba_to_address(sector), buff, count * _MIN_SS);
|
|
||||||
|
|
||||||
return RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DRESULT fat_disk_ioctl(uint8_t cmd, void *buff)
|
|
||||||
{
|
|
||||||
switch (cmd) {
|
|
||||||
case CTRL_SYNC:
|
|
||||||
return RES_OK;
|
|
||||||
case GET_SECTOR_COUNT:
|
|
||||||
*(uint32_t *) buff = CONFIG_FS_VOLUME_SIZE / _MIN_SS;
|
|
||||||
return RES_OK;
|
|
||||||
case GET_BLOCK_SIZE:
|
|
||||||
*(uint32_t *) buff = CONFIG_FS_BLOCK_SIZE / _MIN_SS;
|
|
||||||
return RES_OK;
|
|
||||||
case CTRL_TRIM:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RES_PARERR;
|
|
||||||
}
|
|
|
@ -1,7 +1,9 @@
|
||||||
CONFIG_FILE_SYSTEM=y
|
CONFIG_FILE_SYSTEM=y
|
||||||
CONFIG_FILE_SYSTEM_FAT=y
|
CONFIG_FILE_SYSTEM_FAT=y
|
||||||
CONFIG_FS_FAT_FLASH_DISK=y
|
CONFIG_DISK_ACCESS_FLASH=y
|
||||||
CONFIG_FS_FAT_FLASH_DISK_W25QXXDV=y
|
CONFIG_FS_FAT_FLASH_DISK_W25QXXDV=y
|
||||||
CONFIG_FLASH=y
|
CONFIG_FLASH=y
|
||||||
CONFIG_SPI=y
|
CONFIG_SPI=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
|
#CONFIG_DISK_ACCESS_RAM=y
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue