cfgffs.c

来自「是一个手机功能的模拟程序」· C语言 代码 · 共 76 行

C
76
字号
/******************************************************************************
 * Flash File System (ffs)
 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
 *
 * FFS configuration
 *
 * $Id: cfgffs.c,v 1.1.1.1 2004/06/19 06:00:30 root Exp $
 *
 ******************************************************************************/

#ifndef TARGET
#include "ffs.cfg"
#endif

#include "ffs.h"

#include <string.h>

/******************************************************************************
 * Flash Device Configuration
 ******************************************************************************/

#if (TARGET == 1)

// The absolutely easiest way to disable FFS altogether is to set
// ffs_flash_manufact = 0x99 and ffs_flash_device = 0x9999. Because this is
// (as of today at least) an undefined device, FFS will NOT initialize and
// every FFS function call will fail (with no side-effects).

// FFS will automatically detect the flash device if both ffs_flash_manufact
// and ffs_flash_device are zero. Note that this works *only* if the flash
// device is mapped at address zero. Otherwise you *have* to supply
// manufacturer and device IDs.

//uint16 ffs_flash_manufact = 0x00; // autodetect device
uint16 ffs_flash_manufact = 0x04; // Fujitsu
//uint16 ffs_flash_manufact = 0xBF; // SST

//uint16 ffs_flash_device   = 0x0000; // autodetect device
uint16 ffs_flash_device   = 0x227E; // autodetect device
//uint16 ffs_flash_device   = 0xB496; // Fujitsu stacked device
//uint16 ffs_flash_device   = 0x2250; // BSample device; 15x64kB blocks
//uint16 ffs_flash_device   = 0x2761; // SST device 1601
//uint16 ffs_flash_device   = 0xF250; // EVA4 device; 15x64kB blocks
//uint16 ffs_flash_device   = 0x2259; // 8x8kB blocks

#else

uint16 ffs_flash_manufact = 'T';
//uint16 ffs_flash_device   = 0x0F12; // Test device: 128x64kB blocks
uint16 ffs_flash_device   = 0x0F10; // Test device: 16x64kB blocks
//uint16 ffs_flash_device   = 0x080D; // Test device: 8x8kB blocks
//uint16 ffs_flash_device   = 0x0404; // Test device: 4x4kB blocks

#endif


/******************************************************************************
 * ffs_is_modify_valid()
 ******************************************************************************/

// This is function to be implemented by the application programmer. It is
// called by ffs when a read-only object is about to be modified or
// removed. It should return zero if the operation should be
// disallowed. Returning non-zero means go ahead.
effs_t ffs_is_modifiable(const char *name)
{
    // default is to allow any modification of read-only objects.

    // example of how to disallow modifying a specific object...
    if (strcmp("IMEI", &name[strlen(name) - 4]) == 0)
        return 0;

    return 1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?