aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-16 14:23:28 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-16 14:23:28 +0000
commitd7ce59dc3cb5f1ea14807320ca7031f1e17e8f37 (patch)
treed867972d5ed03e7fb29c47a94b9e67c97c5b0835 /os
parent7037d2fa6cb8326a05852bf22062257dba0c5a48 (diff)
downloadChibiOS-d7ce59dc3cb5f1ea14807320ca7031f1e17e8f37.tar.gz
ChibiOS-d7ce59dc3cb5f1ea14807320ca7031f1e17e8f37.tar.bz2
ChibiOS-d7ce59dc3cb5f1ea14807320ca7031f1e17e8f37.zip
First MFS test sequence complete, starting debug.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11017 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/lib/complex/mfs/mfs.c15
-rw-r--r--os/hal/lib/complex/mfs/mfs.h11
2 files changed, 17 insertions, 9 deletions
diff --git a/os/hal/lib/complex/mfs/mfs.c b/os/hal/lib/complex/mfs/mfs.c
index 77ae33128..76178cc06 100644
--- a/os/hal/lib/complex/mfs/mfs.c
+++ b/os/hal/lib/complex/mfs/mfs.c
@@ -921,11 +921,12 @@ mfs_error_t mfsErase(MFSDriver *mfsp) {
*
* @api
*/
-mfs_error_t mfsReadRecord(MFSDriver *mfsp, uint32_t id,
+mfs_error_t mfsReadRecord(MFSDriver *mfsp, mfs_id_t id,
size_t *np, uint8_t *buffer) {
uint16_t crc;
- osalDbgCheck((mfsp != NULL) && (id >= 1) && (id <= MFS_CFG_MAX_RECORDS) &&
+ osalDbgCheck((mfsp != NULL) &&
+ (id >= 1) && (id <= (mfs_id_t)MFS_CFG_MAX_RECORDS) &&
(np != NULL) && (buffer != NULL));
if (mfsp->state != MFS_READY) {
@@ -978,12 +979,13 @@ mfs_error_t mfsReadRecord(MFSDriver *mfsp, uint32_t id,
*
* @api
*/
-mfs_error_t mfsWriteRecord(MFSDriver *mfsp, uint32_t id,
+mfs_error_t mfsWriteRecord(MFSDriver *mfsp, mfs_id_t id,
size_t n, const uint8_t *buffer) {
flash_offset_t free, required;
bool warning = false;
- osalDbgCheck((mfsp != NULL) && (id >= 1) && (id <= MFS_CFG_MAX_RECORDS) &&
+ osalDbgCheck((mfsp != NULL) &&
+ (id >= 1) && (id <= (mfs_id_t)MFS_CFG_MAX_RECORDS) &&
(n > 0U) && (buffer != NULL));
if (mfsp->state != MFS_READY) {
@@ -1064,11 +1066,12 @@ mfs_error_t mfsWriteRecord(MFSDriver *mfsp, uint32_t id,
*
* @api
*/
-mfs_error_t mfsEraseRecord(MFSDriver *mfsp, uint32_t id) {
+mfs_error_t mfsEraseRecord(MFSDriver *mfsp, mfs_id_t id) {
flash_offset_t free, required;
bool warning = false;
- osalDbgCheck((mfsp != NULL) && (id >= 1) && (id <= MFS_CFG_MAX_RECORDS));
+ osalDbgCheck((mfsp != NULL) &&
+ (id >= 1U) && (id <= (mfs_id_t)MFS_CFG_MAX_RECORDS));
if (mfsp->state != MFS_READY) {
return MFS_ERR_INV_STATE;
diff --git a/os/hal/lib/complex/mfs/mfs.h b/os/hal/lib/complex/mfs/mfs.h
index 66c5f57d4..0cae31f90 100644
--- a/os/hal/lib/complex/mfs/mfs.h
+++ b/os/hal/lib/complex/mfs/mfs.h
@@ -174,6 +174,11 @@ typedef enum {
} mfs_record_state_t;
/**
+ * @brief Type of a record identifier.
+ */
+typedef uint32_t mfs_id_t;
+
+/**
* @brief Type of a bank header.
* @note The header resides in the first 16 bytes of a bank.
*/
@@ -352,11 +357,11 @@ extern "C" {
mfs_error_t mfsStart(MFSDriver *devp, const MFSConfig *config);
void mfsStop(MFSDriver *devp);
mfs_error_t mfsErase(MFSDriver *mfsp);
- mfs_error_t mfsReadRecord(MFSDriver *devp, uint32_t id,
+ mfs_error_t mfsReadRecord(MFSDriver *devp, mfs_id_t id,
size_t *np, uint8_t *buffer);
- mfs_error_t mfsWriteRecord(MFSDriver *devp, uint32_t id,
+ mfs_error_t mfsWriteRecord(MFSDriver *devp, mfs_id_t id,
size_t n, const uint8_t *buffer);
- mfs_error_t mfsEraseRecord(MFSDriver *devp, uint32_t id);
+ mfs_error_t mfsEraseRecord(MFSDriver *devp, mfs_id_t id);
mfs_error_t mfsPerformGarbageCollection(MFSDriver *mfsp);
#ifdef __cplusplus
}