Improved checks.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15151 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
8119b966d0
commit
271f5841ce
|
@ -90,6 +90,29 @@
|
|||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name FatFS driver settings
|
||||
* @{
|
||||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of directory nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_DIR_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_DIR_NODES_NUM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Number of file nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_FILE_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_FILE_NODES_NUM 2
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* VFSCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -90,6 +90,29 @@
|
|||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name FatFS driver settings
|
||||
* @{
|
||||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of directory nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_DIR_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_DIR_NODES_NUM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Number of file nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_FILE_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_FILE_NODES_NUM 2
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* VFSCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -108,6 +108,7 @@ include $(CHIBIOS)/os/rt/rt.mk
|
|||
include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
|
||||
# VFS files (optional).
|
||||
include $(CHIBIOS)/os/vfs/vfs.mk
|
||||
include $(CHIBIOS)/os/vfs/drivers/overlay/drvoverlay.mk
|
||||
include $(CHIBIOS)/os/vfs/drivers/streams/drvstreams.mk
|
||||
include $(CHIBIOS)/os/vfs/drivers/fatfs/drvfatfs.mk
|
||||
# Auto-build files in ./source recursively.
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
#include "vfs.h"
|
||||
#include "drvfatfs.h"
|
||||
|
||||
#include "ff.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
@ -96,60 +94,6 @@
|
|||
/* Module local types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_driver_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_driver_vmt {
|
||||
__vfs_fatfs_driver_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a VFS FatFS driver.
|
||||
*/
|
||||
typedef struct vfs_drv_streams {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_driver_vmt *vmt;
|
||||
__vfs_fatfs_driver_data
|
||||
} vfs_fatfs_driver_t;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_dir_node_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_dir_node_vmt {
|
||||
__vfs_fatfs_dir_node_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a FatFS directory VFS node.
|
||||
*/
|
||||
typedef struct vfs_fatfs_dir_node {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_dir_node_vmt *vmt;
|
||||
__vfs_fatfs_dir_node_data
|
||||
} vfs_fatfs_dir_node_t;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_file_node_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_file_node_vmt {
|
||||
__vfs_fatfs_file_node_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a FatFS file VFS node.
|
||||
*/
|
||||
typedef struct vfs_fatfs_file_node {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_file_node_vmt *vmt;
|
||||
__vfs_fatfs_file_node_data
|
||||
} vfs_fatfs_file_node_t;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module local variables. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#ifndef DRVFATFS_H
|
||||
#define DRVFATFS_H
|
||||
|
||||
#include "vfs.h"
|
||||
#include "ff.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module constants. */
|
||||
|
@ -42,10 +42,123 @@
|
|||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* Configuration options checks.*/
|
||||
#if !defined(DRV_CFG_FATFS_DIR_NODES_NUM)
|
||||
#error "DRV_CFG_FATFS_DIR_NODES_NUM not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if !defined(DRV_CFG_FATFS_FILE_NODES_NUM)
|
||||
#error "DRV_CFG_FATFS_FILE_NODES_NUM not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if DRV_CFG_FATFS_DIR_NODES_NUM < 1
|
||||
#error "invalid value for DRV_CFG_FATFS_DIR_NODES_NUM"
|
||||
#endif
|
||||
|
||||
#if DRV_CFG_FATFS_FILE_NODES_NUM < 1
|
||||
#error "invalid value for DRV_CFG_FATFS_FILE_NODES_NUM"
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_dir_node_t specific methods.
|
||||
*/
|
||||
#define __vfs_fatfs_dir_node_methods \
|
||||
__vfs_directory_node_methods
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_dir_node_t specific data.
|
||||
*/
|
||||
#define __vfs_fatfs_dir_node_data \
|
||||
__vfs_directory_node_data \
|
||||
DIR dir;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_dir_node_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_dir_node_vmt {
|
||||
__vfs_fatfs_dir_node_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a FatFS directory VFS node.
|
||||
*/
|
||||
typedef struct vfs_fatfs_dir_node {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_dir_node_vmt *vmt;
|
||||
__vfs_fatfs_dir_node_data
|
||||
} vfs_fatfs_dir_node_t;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_file_node_t specific methods.
|
||||
*/
|
||||
#define __vfs_fatfs_file_node_methods \
|
||||
__vfs_file_node_methods
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_file_node_t specific data.
|
||||
*/
|
||||
#define __vfs_fatfs_file_node_data \
|
||||
__vfs_file_node_data \
|
||||
FIL file; \
|
||||
BaseSequentialStream *stream;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_file_node_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_file_node_vmt {
|
||||
__vfs_fatfs_file_node_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a FatFS file VFS node.
|
||||
*/
|
||||
typedef struct vfs_fatfs_file_node {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_file_node_vmt *vmt;
|
||||
__vfs_fatfs_file_node_data
|
||||
} vfs_fatfs_file_node_t;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_driver_t specific methods.
|
||||
*/
|
||||
#define __vfs_fatfs_driver_methods \
|
||||
__vfs_driver_methods
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_driver_t specific data.
|
||||
*/
|
||||
#define __vfs_fatfs_driver_data \
|
||||
__vfs_driver_data \
|
||||
memory_pool_t file_nodes_pool; \
|
||||
memory_pool_t dir_nodes_pool; \
|
||||
memory_pool_t info_nodes_pool;
|
||||
|
||||
/**
|
||||
* @brief @p vfs_fatfs_driver_t virtual methods table.
|
||||
*/
|
||||
struct vfs_fatfs_driver_vmt {
|
||||
__vfs_fatfs_driver_methods
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type of a structure representing a VFS FatFS driver.
|
||||
*/
|
||||
typedef struct vfs_drv_streams {
|
||||
/**
|
||||
* @brief Virtual Methods Table.
|
||||
*/
|
||||
const struct vfs_fatfs_driver_vmt *vmt;
|
||||
__vfs_fatfs_driver_data
|
||||
} vfs_fatfs_driver_t;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module macros. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#ifndef DRVOVERLAY_H
|
||||
#define DRVOVERLAY_H
|
||||
|
||||
#include "vfs.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module constants. */
|
||||
/*===========================================================================*/
|
||||
|
@ -43,6 +41,14 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/* Configuration options checks.*/
|
||||
#if !defined(DRV_CFG_OVERLAY_DIR_NODES_NUM)
|
||||
#error "DRV_CFG_OVERLAY_DIR_NODES_NUM not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if !defined(DRV_CFG_OVERLAY_DRV_MAX)
|
||||
#error "DRV_CFG_OVERLAY_DRV_MAX not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if DRV_CFG_OVERLAY_DIR_NODES_NUM < 1
|
||||
#error "invalid value for DRV_CFG_OVERLAY_DIR_NODES_NUM"
|
||||
#endif
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#ifndef DRVSTREAMS_H
|
||||
#define DRVSTREAMS_H
|
||||
|
||||
#include "vfs.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module constants. */
|
||||
/*===========================================================================*/
|
||||
|
@ -43,6 +41,14 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
/* Configuration options checks.*/
|
||||
#if !defined(DRV_CFG_STREAMS_DIR_NODES_NUM)
|
||||
#error "DRV_CFG_STREAMS_DIR_NODES_NUM not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if !defined(DRV_CFG_STREAMS_FILE_NODES_NUM)
|
||||
#error "DRV_CFG_STREAMS_FILE_NODES_NUM not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if DRV_CFG_STREAMS_DIR_NODES_NUM < 1
|
||||
#error "invalid value for DRV_CFG_STREAMS_DIR_NODES_NUM"
|
||||
#endif
|
||||
|
|
|
@ -48,6 +48,15 @@
|
|||
#error "obsolete or unknown configuration file"
|
||||
#endif
|
||||
|
||||
/* Configuration options checks.*/
|
||||
#if !defined(VFS_CFG_MAX_NAMELEN)
|
||||
#error "VFS_CFG_MAX_NAMELEN not defined in vfsconf.h"
|
||||
#endif
|
||||
|
||||
#if VFS_CFG_MAX_NAMELEN < 12
|
||||
#error "invalid value for VFS_CFG_MAX_NAMELEN"
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -90,6 +90,29 @@
|
|||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name FatFS driver settings
|
||||
* @{
|
||||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Number of directory nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_DIR_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_DIR_NODES_NUM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Number of file nodes pre-allocated in the pool.
|
||||
*/
|
||||
#if !defined(DRV_CFG_FATFS_FILE_NODES_NUM) || defined(__DOXYGEN__)
|
||||
#define DRV_CFG_FATFS_FILE_NODES_NUM 2
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* VFSCONF_H */
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Reference in New Issue