zoukankan      html  css  js  c++  java
  • NorFlash linux分区分析

    一般情况下,与板卡相关的内容都在bsp中(即arch/arm/mach-xxx/board-xxx.c)中,但norflash的分区直接放在norflash驱动中。由于norflash应用基于mtd,所以驱动位于drivers/mtd/目录下,chips目录是norflash相关公用驱动,maps是不同板卡应用的的驱动,如at91sam9261.c。分区信息便在板卡norflash驱动文件中。

    #define WINDOW_ADDR 0x10000000      /* physical properties of flash */

    #define WINDOW_SIZE 0x800000

    #define BUSWIDTH    2

    #define MSG_PREFIX "SAM9261-NOR:"   /* prefix for our printk()'s */

    #define MTDID      "sam9261-nor"    /* for mtdparts= partitioning */

    static struct mtd_info *mymtd;

    struct map_info sam9261nor_map = {

        .name = "NOR flash on sam9261",

        .size = WINDOW_SIZE,

        .bankwidth = BUSWIDTH,

        .phys = WINDOW_ADDR,

    };

    #ifdef CONFIG_MTD_PARTITIONS

    /*

     * MTD partitioning stuff

     */

    static struct mtd_partition sam9261_partitions[] =

    {

    #if 1           /* New fs */

        {   /* rootfs 2M */

            .name = "rootfs",

            .size = MTDPART_SIZ_FULL,

            .offset = 0x380000,

        },

    #endif

    };

    驱动定义两个函数,用于加载卸载驱动:

    static int __init init_sam9261nor(void);

    static void __exit cleanup_sam9261nor(void);

    module_init(init_sam9261nor);

    module_exit(cleanup_sam9261nor);

  • 相关阅读:
    从零开始搭建VUE项目
    推送类型
    spring整合消息队列rabbitmq
    Terracotta
    MYSQL INNODB 存储引擎
    Java 各种读取文件方法以及文件合并
    spring-security用户权限认证框架
    Spring Bean初始化过程
    使用PLSQL客户端登录ORACLE时报ORA-12502和ORA-12545错误的解决方案
    计算机语言基础概况
  • 原文地址:https://www.cnblogs.com/embedded-linux/p/5943699.html
Copyright © 2011-2022 走看看