Chinaunix首页 | 论坛 | 博客
  • 博客访问: 952275
  • 博文数量: 214
  • 博客积分: 10173
  • 博客等级: 上将
  • 技术积分: 1867
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-18 13:48
文章分类

全部博文(214)

文章存档

2012年(1)

2010年(13)

2009年(5)

2008年(98)

2007年(97)

分类: LINUX

2007-08-22 16:40:04

WinBond w90p710 uClinux移植问题
1、Makefile中没有romfs  target,如何生成romfs是一个问题
2、MTD
      相对原始版本uClinux, 修改了如下一些东西
      include/linux/mtd/map.h
      struct map_info {
          char *name;
          unsigned long size;

          ......
          int bankwidth; /* in octets. This isn't necessarily the width             由buswidth修改成bankwidth
               of actual bus cycles -- it's the repeat interval
              in bytes, before you are talking to the first chip again.
              */

         #ifdef CONFIG_MTD_COMPLEX_MAPPINGS        必须选择Support for non-linear mappings of flash chips才行
             //2004-11-2 12:03   
             u8 (*read8)(struct map_info *, unsigned long);
            u16 (*read16)(struct map_info *, unsigned long);
            u32 (*read32)(struct map_info *, unsigned long); 
            u64 (*read64)(struct map_info *, unsigned long); 
             //2004-11-2 12:03
             map_word (*read)(struct map_info *, unsigned long);
              void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t);
   
             //2004-11-2 12:03   
             void (*write8)(struct map_info *, u8, unsigned long);
             void (*write16)(struct map_info *, u16, unsigned long);
            void (*write32)(struct map_info *, u32, unsigned long);
             void (*write64)(struct map_info *, u64, unsigned long);
            //2004-11-2 12:03   

           void (*write)(struct map_info *, const map_word, unsigned long);
           void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);

          /* We can perhaps put in 'point' and 'unpoint' methods, if we really
            want to enable XIP for non-linear mappings. Not yet though. */
      #endif
      ......
     };

     include/linux/mtd/mtd.h
     struct mtd_info {
    u_char type;
    u_int32_t flags;
    u_int32_t size;     // Total size of the MTD

    /* "Major" erase size for the device. Na飗e users may take this
     * to be the only erase size available, or may use the more detailed
     * information below if they desire
     */
    u_int32_t erasesize;

    u_int32_t oobblock;  // Size of OOB blocks (e.g. 512)
    u_int32_t oobsize;   // Amount of OOB data per block (e.g. 16)
    u_int32_t oobavail;  // Number of bytes in OOB area available for fs
    u_int32_t ecctype;
    u_int32_t eccsize;
   

    // Kernel-only stuff starts here.
    char *name;
    int index;

    // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO)
    struct nand_oobinfo oobinfo;

    /* Data for variable erase regions. If numeraseregions is zero,
     * it means that the whole device has erasesize as given above.
     */
    int numeraseregions;
    struct mtd_erase_region_info *eraseregions;

    /* This really shouldn't be here. It can go away in 2.5 */
    u_int32_t bank_size;

    int (*erase) (struct mtd_info *mtd, struct erase_info *instr);

    /* This stuff for eXecute-In-Place */
    int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf);

    /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
    void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len);


    int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
    int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);

    int (*read_ecc) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
    int (*write_ecc) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);

    int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
    int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);

    /*
     * Methods to access the protection register area, present in some
     * flash devices. The user data is one time programmable but the
     * factory data is read only.
     */
    int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);

    int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);

    /* This function is not yet implemented */
    int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);

    /* kvec-based read/write methods. We need these especially for NAND flash,
       with its limited number of write cycles per erase.
       NB: The 'count' parameter is the number of _vectors_, each of
       which contains an (ofs, len) tuple.
    */
    int (*readv) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from, size_t *retlen);
    int (*readv_ecc) (struct mtd_info *mtd, struct kvec *vecs, unsigned long count, loff_t from,
        size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel);
    int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
    int (*writev_ecc) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to,
        size_t *retlen, u_char *eccbuf, struct nand_oobinfo *oobsel);

    /* Sync */
    void (*sync) (struct mtd_info *mtd);

    /* Chip-supported device locking */
    int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len);
    int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len);

    /* Power Management functions */
    int (*suspend) (struct mtd_info *mtd);
    void (*resume) (struct mtd_info *mtd);

    /* Bad block management functions */
    int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
    int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);

    void *priv;

    struct module *owner;     由module修改为owner
    int usecount;
};
阅读(1679) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~