add support uffs interface

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1243 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
iamyhw@gmail.com committed 2011-01-16 13:30:54 +00:00
1 parent dede5414de
commit 0030a2d396
47 files changed
+12411 -12884

No files matched your search

File diff suppressed because it is too large. Load diff
+22 -12
View File
@@ -1,20 +1,30 @@
/*
* File : dfs_uffs.h
* This file is part of Device File System in RT-Thread RTOS
* COPYRIGHT (C) 2004-2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE.
*
* Change Logs:
* Date Author Notes
* 2010-09-02 Bernard The first version.
*/
+------------------------------------------------------------------------------
| Project : Device Filesystem
+------------------------------------------------------------------------------
| Copyright 2010
| All rights reserved.
|------------------------------------------------------------------------------
| File : dfs_uffs.h
|------------------------------------------------------------------------------
| Chang Logs:
| Date Author Notes
| 2010-12-24 amsl Add dfs_uffs_init function declaration
+------------------------------------------------------------------------------
*/
#ifndef __DFS_UFFS_H__
#define __DFS_UFFS_H__
#ifdef __cplusplus
extern "C" {
#endif
int dfs_uffs_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -57,7 +57,7 @@ struct cli_commandset {
const char * cli_getparam(const char *tail, const char **next);
void cli_add_commandset(struct cli_commandset *cmds);
void cliInterpret(const char *line);
void cliMain();
void cliMain(void);
#endif
@@ -37,7 +37,7 @@
*/
#include "uffs/uffs_os.h"
#include "uffs/uffs_public.h"
#include <memory.h>
//#include <memory.h>
#include <stdlib.h>
#include <time.h>
@@ -98,7 +98,7 @@ unsigned int uffs_GetCurDateTime(void)
// or just return 0 if you don't care about file time.
time_t tvalue;
tvalue = time(NULL);
tvalue = 0;//time(NULL);
return (unsigned int)tvalue;
}
@@ -1,12 +1,12 @@
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc)
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/emu)
LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/emu)
LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/uffs)
SET(static_mem_SRCS static-mem-allocate.c)
SET(flash_if_SRCS flash-interface-example.c)
ADD_EXECUTABLE(static-mem-example ${static_mem_SRCS})
ADD_EXECUTABLE(flash-if-example ${flash_if_SRCS})
TARGET_LINK_LIBRARIES(static-mem-example emu uffs emu)
TARGET_LINK_LIBRARIES(flash-if-example emu uffs emu)
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc)
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/emu)
LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/emu)
LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/uffs)
SET(static_mem_SRCS static-mem-allocate.c)
SET(flash_if_SRCS flash-interface-example.c)
ADD_EXECUTABLE(static-mem-example ${static_mem_SRCS})
ADD_EXECUTABLE(flash-if-example ${flash_if_SRCS})
TARGET_LINK_LIBRARIES(static-mem-example emu uffs emu)
TARGET_LINK_LIBRARIES(flash-if-example emu uffs emu)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,70 +1,70 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_badblock.h
* \brief bad block management
* \author Ricky Zheng
*/
#ifndef _UFFS_BADBLOCK_H_
#define _UFFS_BADBLOCK_H_
#include "uffs/uffs_public.h"
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
#define HAVE_BADBLOCK(dev) (dev->bad.block != UFFS_INVALID_BLOCK)
/** initialize bad block management data structures for uffs device */
void uffs_BadBlockInit(uffs_Device *dev);
/** processing bad block: erase bad block, mark it as 'bad' and put it to bad block list */
void uffs_BadBlockProcess(uffs_Device *dev, TreeNode *node);
/** try to recover data from a new discovered bad block */
void uffs_BadBlockRecover(uffs_Device *dev);
/** put a new block to the bad block waiting list */
void uffs_BadBlockAdd(uffs_Device *dev, int block);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_badblock.h
* \brief bad block management
* \author Ricky Zheng
*/
#ifndef _UFFS_BADBLOCK_H_
#define _UFFS_BADBLOCK_H_
#include "uffs/uffs_public.h"
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
#define HAVE_BADBLOCK(dev) (dev->bad.block != UFFS_INVALID_BLOCK)
/** initialize bad block management data structures for uffs device */
void uffs_BadBlockInit(uffs_Device *dev);
/** processing bad block: erase bad block, mark it as 'bad' and put it to bad block list */
void uffs_BadBlockProcess(uffs_Device *dev, TreeNode *node);
/** try to recover data from a new discovered bad block */
void uffs_BadBlockRecover(uffs_Device *dev);
/** put a new block to the bad block waiting list */
void uffs_BadBlockAdd(uffs_Device *dev, int block);
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,59 +1,59 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef _UFFS_CORE_H_
#define _UFFS_CORE_H_
#ifdef __cplusplus
extern "C"{
#endif
/** \typedef uffs_Device */
typedef struct uffs_DeviceSt uffs_Device;
/** \typedef uffs_FlashOps */
typedef struct uffs_FlashOpsSt uffs_FlashOps;
typedef struct uffs_BlockInfoSt uffs_BlockInfo;
typedef struct uffs_PageSpareSt uffs_PageSpare;
typedef struct uffs_TagsSt uffs_Tags; //!< UFFS page tags
typedef struct uffs_TagStoreSt uffs_TagStore; //!< UFFS page tags physical store structure
typedef struct uffs_BufSt uffs_Buf;
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef _UFFS_CORE_H_
#define _UFFS_CORE_H_
#ifdef __cplusplus
extern "C"{
#endif
/** \typedef uffs_Device */
typedef struct uffs_DeviceSt uffs_Device;
/** \typedef uffs_FlashOps */
typedef struct uffs_FlashOpsSt uffs_FlashOps;
typedef struct uffs_BlockInfoSt uffs_BlockInfo;
typedef struct uffs_PageSpareSt uffs_PageSpare;
typedef struct uffs_TagsSt uffs_Tags; //!< UFFS page tags
typedef struct uffs_TagStoreSt uffs_TagStore; //!< UFFS page tags physical store structure
typedef struct uffs_BufSt uffs_Buf;
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
@@ -1,90 +1,90 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_ecc.h
* \brief file handle operations
* \author Ricky Zheng, created 8th Jun, 2005
*/
#ifndef _UFFS_ECC_H_
#define _UFFS_ECC_H_
#include <string.h>
#include "uffs/uffs_fs.h"
#include "uffs/uffs_config.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
#define MAX_ECC_LENGTH 24 //!< 2K page ecc length is 24 bytes.
/**
* calculate ECC
* \return length of generated ECC. (3 bytes ECC per 256 data)
*/
int uffs_EccMake(void *data, int data_len, void *ecc);
/**
* correct data by ECC.
*
* return: 0 -- no error
* -1 -- can not be corrected
* >0 -- how many bits are corrected
*/
int uffs_EccCorrect(void *data, int data_len, void *read_ecc, const void *test_ecc);
/**
* generate 12 bit ecc for maximum 8 bytes data
*/
u16 uffs_EccMake8(void *data, int data_len);
/**
* correct maximum 8 bytes data from 12 bits ECC
*
* return: 0 -- no error
* -1 -- can not be corrected
* >0 -- how many bits are corrected
*/
int uffs_EccCorrect8(void *data, u16 read_ecc, u16 test_ecc, int errtop);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_ecc.h
* \brief file handle operations
* \author Ricky Zheng, created 8th Jun, 2005
*/
#ifndef _UFFS_ECC_H_
#define _UFFS_ECC_H_
#include <string.h>
#include "uffs/uffs_fs.h"
#include "uffs/uffs_config.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
#define MAX_ECC_LENGTH 24 //!< 2K page ecc length is 24 bytes.
/**
* calculate ECC
* \return length of generated ECC. (3 bytes ECC per 256 data)
*/
int uffs_EccMake(void *data, int data_len, void *ecc);
/**
* correct data by ECC.
*
* return: 0 -- no error
* -1 -- can not be corrected
* >0 -- how many bits are corrected
*/
int uffs_EccCorrect(void *data, int data_len, void *read_ecc, const void *test_ecc);
/**
* generate 12 bit ecc for maximum 8 bytes data
*/
u16 uffs_EccMake8(void *data, int data_len);
/**
* correct maximum 8 bytes data from 12 bits ECC
*
* return: 0 -- no error
* -1 -- can not be corrected
* >0 -- how many bits are corrected
*/
int uffs_EccCorrect8(void *data, u16 read_ecc, u16 test_ecc, int errtop);
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
@@ -1,74 +1,74 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_find.h
* \brief find objects under dir
* \author Ricky Zheng
*/
#ifndef _UFFS_FIND_H_
#define _UFFS_FIND_H_
#include "uffs/uffs_fs.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct uffs_FindInfoSt {
uffs_Device *dev; //!< the device to be searched
u16 serial; //!< the dir serial number
int step; //!< step: 0 - working on dir entries, 1 - working on file entries, 2 - stoped.
int hash; //!< hash entry, internal used
TreeNode *work; //!< working node, internal used.
int pos; //!< current position
} uffs_FindInfo;
URET uffs_GetObjectInfo(uffs_Object *obj, uffs_ObjectInfo *info, int *err);
URET uffs_FindObjectOpen(uffs_FindInfo *find_handle, uffs_Object *dir);
URET uffs_FindObjectOpenEx(uffs_FindInfo *f, uffs_Device *dev, int dir);
URET uffs_FindObjectFirst(uffs_ObjectInfo *info, uffs_FindInfo *find_handle);
URET uffs_FindObjectNext(uffs_ObjectInfo *info, uffs_FindInfo *find_handle);
URET uffs_FindObjectRewind(uffs_FindInfo *find_handle);
URET uffs_FindObjectClose(uffs_FindInfo * find_handle);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_find.h
* \brief find objects under dir
* \author Ricky Zheng
*/
#ifndef _UFFS_FIND_H_
#define _UFFS_FIND_H_
#include "uffs/uffs_fs.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct uffs_FindInfoSt {
uffs_Device *dev; //!< the device to be searched
u16 serial; //!< the dir serial number
int step; //!< step: 0 - working on dir entries, 1 - working on file entries, 2 - stoped.
int hash; //!< hash entry, internal used
TreeNode *work; //!< working node, internal used.
int pos; //!< current position
} uffs_FindInfo;
URET uffs_GetObjectInfo(uffs_Object *obj, uffs_ObjectInfo *info, int *err);
URET uffs_FindObjectOpen(uffs_FindInfo *find_handle, uffs_Object *dir);
URET uffs_FindObjectOpenEx(uffs_FindInfo *f, uffs_Device *dev, int dir);
URET uffs_FindObjectFirst(uffs_ObjectInfo *info, uffs_FindInfo *find_handle);
URET uffs_FindObjectNext(uffs_ObjectInfo *info, uffs_FindInfo *find_handle);
URET uffs_FindObjectRewind(uffs_FindInfo *find_handle);
URET uffs_FindObjectClose(uffs_FindInfo * find_handle);
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,90 +1,90 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_mtb.h
* \brief mount table related stuff
* \author Ricky Zheng
*/
#ifndef UFFS_MTB_H
#define UFFS_MTB_H
#include "uffs/uffs_types.h"
#include "uffs/uffs_config.h"
#include "uffs/uffs_core.h"
#include "uffs/uffs.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct uffs_MountTableEntrySt {
uffs_Device *dev;
int start_block;
int end_block;
const char *mount;
struct uffs_MountTableEntrySt *next;
} uffs_MountTable;
/** initialize registered mount table */
URET uffs_InitMountTable(void);
/** release registered mount table */
URET uffs_ReleaseMountTable(void);
/** get registered mount table */
uffs_MountTable * uffs_GetMountTable(void);
/** register mount table */
int uffs_RegisterMountTable(uffs_MountTable *mtab);
/** get matched mount point from absolute path */
int uffs_GetMatchedMountPointSize(const char *path);
/** get uffs device from mount point */
uffs_Device * uffs_GetDeviceFromMountPoint(const char *mount);
/** get uffs device from mount point */
uffs_Device * uffs_GetDeviceFromMountPointEx(const char *mount, int len);
/** get mount point name from uffs device */
const char * uffs_GetDeviceMountPoint(uffs_Device *dev);
/** down crease uffs device references by uffs_GetDeviceXXX() */
void uffs_PutDevice(uffs_Device *dev);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_mtb.h
* \brief mount table related stuff
* \author Ricky Zheng
*/
#ifndef UFFS_MTB_H
#define UFFS_MTB_H
#include "uffs/uffs_types.h"
#include "uffs/uffs_config.h"
#include "uffs/uffs_core.h"
#include "uffs/uffs.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef struct uffs_MountTableEntrySt {
uffs_Device *dev;
int start_block;
int end_block;
const char *mount;
struct uffs_MountTableEntrySt *next;
} uffs_MountTable;
/** initialize registered mount table */
URET uffs_InitMountTable(void);
/** release registered mount table */
URET uffs_ReleaseMountTable(void);
/** get registered mount table */
uffs_MountTable * uffs_GetMountTable(void);
/** register mount table */
int uffs_RegisterMountTable(uffs_MountTable *mtab);
/** get matched mount point from absolute path */
int uffs_GetMatchedMountPointSize(const char *path);
/** get uffs device from mount point */
uffs_Device * uffs_GetDeviceFromMountPoint(const char *mount);
/** get uffs device from mount point */
uffs_Device * uffs_GetDeviceFromMountPointEx(const char *mount, int len);
/** get mount point name from uffs device */
const char * uffs_GetDeviceMountPoint(uffs_Device *dev);
/** down crease uffs device references by uffs_GetDeviceXXX() */
void uffs_PutDevice(uffs_Device *dev);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,65 +1,65 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_OS_H
#define UFFS_OS_H
#ifdef __cplusplus
extern "C"{
#endif
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#define UFFS_TASK_ID_NOT_EXIST -1
typedef int OSSEM;
/* OS specific functions */
int uffs_SemCreate(int n);
int uffs_SemWait(int sem);
int uffs_SemSignal(int sem);
int uffs_SemDelete(int sem);
void uffs_CriticalEnter(void);
void uffs_CriticalExit(void);
int uffs_OSGetTaskId(void); //get current task id
unsigned int uffs_GetCurDateTime(void);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_OS_H
#define UFFS_OS_H
#ifdef __cplusplus
extern "C"{
#endif
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#define UFFS_TASK_ID_NOT_EXIST -1
typedef int OSSEM;
/* OS specific functions */
int uffs_SemCreate(int n);
int uffs_SemWait(int sem);
int uffs_SemSignal(int sem);
int uffs_SemDelete(int sem);
void uffs_CriticalEnter(void);
void uffs_CriticalExit(void);
int uffs_OSGetTaskId(void); //get current task id
unsigned int uffs_GetCurDateTime(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,92 +1,92 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_pool.h
* \brief Fast fixed size memory pool management.
* \author Ricky Zheng, Simon Kallweit
*/
#ifndef _UFFS_POOL_H_
#define _UFFS_POOL_H_
#include "uffs/uffs_types.h"
#ifdef __cplusplus
extern "C"{
#endif
/**
* \struct uffs_PoolEntrySt
* \brief Helper type for free buffer entries.
*/
typedef struct uffs_PoolEntrySt {
struct uffs_PoolEntrySt *next;
} uffs_PoolEntry;
/**
* \struct uffs_PoolSt
* \brief Memory pool.
*/
typedef struct uffs_PoolSt {
u8 *mem; //!< memory pool
u32 buf_size; //!< size of a buffer
u32 num_bufs; //!< number of buffers in the pool
uffs_PoolEntry *free_list; //!< linked list of free buffers
int sem; //!< buffer lock
} uffs_Pool;
URET uffs_PoolInit(uffs_Pool *pool, void *mem, u32 mem_size, u32 buf_size, u32 num_bufs);
URET uffs_PoolRelease(uffs_Pool *pool);
UBOOL uffs_PoolVerify(uffs_Pool *pool, void *p);
void *uffs_PoolGet(uffs_Pool *pool);
void *uffs_PoolGetLocked(uffs_Pool *pool);
int uffs_PoolPut(uffs_Pool *pool, void *p);
int uffs_PoolPutLocked(uffs_Pool *pool, void *p);
void *uffs_PoolGetBufByIndex(uffs_Pool *pool, u32 index);
u32 uffs_PoolGetIndex(uffs_Pool *pool, void *p);
UBOOL uffs_PoolCheckFreeList(uffs_Pool *pool, void *p);
void * uffs_PoolFindNextAllocated(uffs_Pool *pool, void *from);
int uffs_PoolGetFreeCount(uffs_Pool *pool);
#ifdef __cplusplus
}
#endif
#endif // _UFFS_POOL_H_
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_pool.h
* \brief Fast fixed size memory pool management.
* \author Ricky Zheng, Simon Kallweit
*/
#ifndef _UFFS_POOL_H_
#define _UFFS_POOL_H_
#include "uffs/uffs_types.h"
#ifdef __cplusplus
extern "C"{
#endif
/**
* \struct uffs_PoolEntrySt
* \brief Helper type for free buffer entries.
*/
typedef struct uffs_PoolEntrySt {
struct uffs_PoolEntrySt *next;
} uffs_PoolEntry;
/**
* \struct uffs_PoolSt
* \brief Memory pool.
*/
typedef struct uffs_PoolSt {
u8 *mem; //!< memory pool
u32 buf_size; //!< size of a buffer
u32 num_bufs; //!< number of buffers in the pool
uffs_PoolEntry *free_list; //!< linked list of free buffers
int sem; //!< buffer lock
} uffs_Pool;
URET uffs_PoolInit(uffs_Pool *pool, void *mem, u32 mem_size, u32 buf_size, u32 num_bufs);
URET uffs_PoolRelease(uffs_Pool *pool);
UBOOL uffs_PoolVerify(uffs_Pool *pool, void *p);
void *uffs_PoolGet(uffs_Pool *pool);
void *uffs_PoolGetLocked(uffs_Pool *pool);
int uffs_PoolPut(uffs_Pool *pool, void *p);
int uffs_PoolPutLocked(uffs_Pool *pool, void *p);
void *uffs_PoolGetBufByIndex(uffs_Pool *pool, u32 index);
u32 uffs_PoolGetIndex(uffs_Pool *pool, void *p);
UBOOL uffs_PoolCheckFreeList(uffs_Pool *pool, void *p);
void * uffs_PoolFindNextAllocated(uffs_Pool *pool, void *from);
int uffs_PoolGetFreeCount(uffs_Pool *pool);
#ifdef __cplusplus
}
#endif
#endif // _UFFS_POOL_H_
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,85 +1,85 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_UTILS_H
#define UFFS_UTILS_H
#include "uffs/uffs_types.h"
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
//begin method
#define PARTITION_FOLLOW_PRIVATE 0
#define PARTITION_BEGIN_ABSOLUTE 1
//alloc method
#define ALLOC_BY_SIZE 0
#define ALLOC_BY_ABSOLUTE 1
#define ALLOC_USE_FREE 2
//struct uffs_PartitionMakeInfoSt {
// u32 begin_method;
// u32 alloc_method;
// union{
// u32 begin_block;
// u32 begin_offset;
// };
// union{
// u32 end_block;
// u32 size;
// u32 remain_size;
// };
// u32 access;
//};
//
//
//URET uffs_MakePartition(struct uffs_DeviceSt *dev, struct uffs_PartitionMakeInfoSt *pi, int nums);
//
//void uffs_ListPartition(struct uffs_DeviceSt *dev);
//get UFFS disk version, if fail, return 0
int uffs_GetUFFSVersion(struct uffs_DeviceSt *dev);
URET uffs_FormatDevice(uffs_Device *dev);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_UTILS_H
#define UFFS_UTILS_H
#include "uffs/uffs_types.h"
#include "uffs/uffs_device.h"
#include "uffs/uffs_core.h"
#ifdef __cplusplus
extern "C"{
#endif
//begin method
#define PARTITION_FOLLOW_PRIVATE 0
#define PARTITION_BEGIN_ABSOLUTE 1
//alloc method
#define ALLOC_BY_SIZE 0
#define ALLOC_BY_ABSOLUTE 1
#define ALLOC_USE_FREE 2
//struct uffs_PartitionMakeInfoSt {
// u32 begin_method;
// u32 alloc_method;
// union{
// u32 begin_block;
// u32 begin_offset;
// };
// union{
// u32 end_block;
// u32 size;
// u32 remain_size;
// };
// u32 access;
//};
//
//
//URET uffs_MakePartition(struct uffs_DeviceSt *dev, struct uffs_PartitionMakeInfoSt *pi, int nums);
//
//void uffs_ListPartition(struct uffs_DeviceSt *dev);
//get UFFS disk version, if fail, return 0
int uffs_GetUFFSVersion(struct uffs_DeviceSt *dev);
URET uffs_FormatDevice(uffs_Device *dev);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,54 +1,54 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_VERSION_H
#define UFFS_VERSION_H
#ifdef __cplusplus
extern "C"{
#endif
#define UFFS_VERSION 0x01030000 //"01.03.0000"
const char * uffs_Version2Str(int ver);
int uffs_GetVersion(void);
int uffs_GetMainVersion(int ver);
int uffs_GetMinorVersion(int ver);
#ifdef __cplusplus
}
#endif
#endif
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
#ifndef UFFS_VERSION_H
#define UFFS_VERSION_H
#ifdef __cplusplus
extern "C"{
#endif
#define UFFS_VERSION 0x01030000 //"01.03.0000"
const char * uffs_Version2Str(int ver);
int uffs_GetVersion(void);
int uffs_GetMainVersion(int ver);
int uffs_GetMinorVersion(int ver);
#ifdef __cplusplus
}
#endif
#endif
@@ -1,49 +1,49 @@
SET (libuffs_SRCS
uffs_badblock.c
uffs_blockinfo.c
uffs_buf.c
uffs_debug.c
uffs_device.c
uffs_ecc.c
uffs_fd.c
uffs_fs.c
uffs_init.c
uffs_mem.c
uffs_pool.c
uffs_public.c
uffs_tree.c
uffs_utils.c
uffs_mtb.c
uffs_find.c
uffs_flash.c
uffs_version.c
)
SET (HDR ${uffs_SOURCE_DIR}/src/inc/uffs)
SET (libuffs_HEADS
${HDR}/uffs.h
${HDR}/uffs_badblock.h
${HDR}/uffs_blockinfo.h
${HDR}/uffs_buf.h
${HDR}/uffs_config.h
${HDR}/uffs_core.h
${HDR}/uffs_device.h
${HDR}/uffs_ecc.h
${HDR}/uffs_fd.h
${HDR}/uffs_fs.h
${HDR}/uffs_mem.h
${HDR}/uffs_os.h
${HDR}/uffs_pool.h
${HDR}/uffs_public.h
${HDR}/uffs_tree.h
${HDR}/uffs_types.h
${HDR}/uffs_utils.h
${HDR}/uffs_mtb.h
${HDR}/uffs_find.h
${HDR}/uffs_flash.h
${HDR}/uffs_version.h
)
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc)
ADD_LIBRARY( uffs STATIC ${libuffs_SRCS} ${libuffs_HEADS} )
SET (libuffs_SRCS
uffs_badblock.c
uffs_blockinfo.c
uffs_buf.c
uffs_debug.c
uffs_device.c
uffs_ecc.c
uffs_fd.c
uffs_fs.c
uffs_init.c
uffs_mem.c
uffs_pool.c
uffs_public.c
uffs_tree.c
uffs_utils.c
uffs_mtb.c
uffs_find.c
uffs_flash.c
uffs_version.c
)
SET (HDR ${uffs_SOURCE_DIR}/src/inc/uffs)
SET (libuffs_HEADS
${HDR}/uffs.h
${HDR}/uffs_badblock.h
${HDR}/uffs_blockinfo.h
${HDR}/uffs_buf.h
${HDR}/uffs_config.h
${HDR}/uffs_core.h
${HDR}/uffs_device.h
${HDR}/uffs_ecc.h
${HDR}/uffs_fd.h
${HDR}/uffs_fs.h
${HDR}/uffs_mem.h
${HDR}/uffs_os.h
${HDR}/uffs_pool.h
${HDR}/uffs_public.h
${HDR}/uffs_tree.h
${HDR}/uffs_types.h
${HDR}/uffs_utils.h
${HDR}/uffs_mtb.h
${HDR}/uffs_find.h
${HDR}/uffs_flash.h
${HDR}/uffs_version.h
)
INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc)
ADD_LIBRARY( uffs STATIC ${libuffs_SRCS} ${libuffs_HEADS} )
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,94 +1,94 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_device.c
* \brief uffs device operation
* \author Ricky Zheng, created 10th May, 2005
*/
#include "uffs/uffs_device.h"
#include "uffs/uffs_os.h"
#include "uffs/uffs_public.h"
#include "uffs/uffs_mtb.h"
#include <string.h>
#define PFX "dev: "
URET uffs_DeviceInitLock(uffs_Device *dev)
{
dev->lock.sem = uffs_SemCreate(1);
dev->lock.task_id = UFFS_TASK_ID_NOT_EXIST;
dev->lock.counter = 0;
return U_SUCC;
}
URET uffs_DeviceReleaseLock(uffs_Device *dev)
{
if (dev->lock.sem) {
uffs_SemDelete(dev->lock.sem);
dev->lock.sem = 0;
}
return U_SUCC;
}
URET uffs_DeviceLock(uffs_Device *dev)
{
uffs_SemWait(dev->lock.sem);
if (dev->lock.counter != 0) {
uffs_Perror(UFFS_ERR_NORMAL, "Lock device, counter %d NOT zero?!", dev->lock.counter);
}
dev->lock.counter++;
return U_SUCC;
}
URET uffs_DeviceUnLock(uffs_Device *dev)
{
dev->lock.counter--;
if (dev->lock.counter != 0) {
uffs_Perror(UFFS_ERR_NORMAL, "Unlock device, counter %d NOT zero?!", dev->lock.counter);
}
uffs_SemSignal(dev->lock.sem);
return U_SUCC;
}
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_device.c
* \brief uffs device operation
* \author Ricky Zheng, created 10th May, 2005
*/
#include "uffs/uffs_device.h"
#include "uffs/uffs_os.h"
#include "uffs/uffs_public.h"
#include "uffs/uffs_mtb.h"
#include <string.h>
#define PFX "dev: "
URET uffs_DeviceInitLock(uffs_Device *dev)
{
dev->lock.sem = uffs_SemCreate(1);
dev->lock.task_id = UFFS_TASK_ID_NOT_EXIST;
dev->lock.counter = 0;
return U_SUCC;
}
URET uffs_DeviceReleaseLock(uffs_Device *dev)
{
if (dev->lock.sem) {
uffs_SemDelete(dev->lock.sem);
dev->lock.sem = 0;
}
return U_SUCC;
}
URET uffs_DeviceLock(uffs_Device *dev)
{
uffs_SemWait(dev->lock.sem);
if (dev->lock.counter != 0) {
uffs_Perror(UFFS_ERR_NORMAL, "Lock device, counter %d NOT zero?!", dev->lock.counter);
}
dev->lock.counter++;
return U_SUCC;
}
URET uffs_DeviceUnLock(uffs_Device *dev)
{
dev->lock.counter--;
if (dev->lock.counter != 0) {
uffs_Perror(UFFS_ERR_NORMAL, "Unlock device, counter %d NOT zero?!", dev->lock.counter);
}
uffs_SemSignal(dev->lock.sem);
return U_SUCC;
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,67 +1,67 @@
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_version.c
* \brief uffs version information
* \author Ricky Zheng, created 8th May, 2005
*/
#include "uffs/uffs_version.h"
#include "uffs/uffs_config.h"
#include <stdio.h>
#define PFX "ver: "
static char version_buf[8];
const char * uffs_Version2Str(int ver)
{
sprintf(version_buf, "%1d.%02d.%04d", (ver&0xff000000) >> 24, (ver&0xff0000) >> 16, (ver&0xffff));
return version_buf;
}
int uffs_GetVersion(void)
{
return UFFS_VERSION;
}
int uffs_GetMainVersion(int ver)
{
return (ver&0xff000000) >> 24;
}
int uffs_GetMinorVersion(int ver)
{
return (ver&0xff0000) >> 16;
}
/*
This file is part of UFFS, the Ultra-low-cost Flash File System.
Copyright (C) 2005-2009 Ricky Zheng <ricky_gz_zheng@yahoo.co.nz>
UFFS is free software; you can redistribute it and/or modify it under
the GNU Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
UFFS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
or GNU Library General Public License, as applicable, for more details.
You should have received a copy of the GNU General Public License
and GNU Library General Public License along with UFFS; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this file
and link it with other works to produce a work based on this file,
this file does not by itself cause the resulting work to be covered
by the GNU General Public License. However the source code for this
file must still be made available in accordance with section (3) of
the GNU General Public License v2.
This exception does not invalidate any other reasons why a work based
on this file might be covered by the GNU General Public License.
*/
/**
* \file uffs_version.c
* \brief uffs version information
* \author Ricky Zheng, created 8th May, 2005
*/
#include "uffs/uffs_version.h"
#include "uffs/uffs_config.h"
#include <stdio.h>
#define PFX "ver: "
static char version_buf[8];
const char * uffs_Version2Str(int ver)
{
sprintf(version_buf, "%1d.%02d.%04d", (ver&0xff000000) >> 24, (ver&0xff0000) >> 16, (ver&0xffff));
return version_buf;
}
int uffs_GetVersion(void)
{
return UFFS_VERSION;
}
int uffs_GetMainVersion(int ver)
{
return (ver&0xff000000) >> 24;
}
int uffs_GetMinorVersion(int ver)
{
return (ver&0xff0000) >> 16;
}