你好,游客 登录 注册 搜索
背景:
阅读新闻

ARMBoot-1.1.0 在 mini2440 开发板上的移植

[日期:2011-05-26] 来源:Linux社区  作者:jocks [字体:大 中 小]
board/mini2440/memsetup.S 的修改

     1    /*
     2     * Memory Setup stuff - taken from blob memsetup.S
     3     *
     4     * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
     5     *                     Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
     6     *
     7     * Modified for the Samsung SMDK2410 by
     8     * (C) Copyright 2002
     9     * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
    10     *
    11     * See file CREDITS for list of people who contributed to this
    12     * project.
    13     *
    14     * This program is free software; you can redistribute it and/or
    15     * modify it under the terms of the GNU General Public License as
    16     * published by the Free Software Foundation; either version 2 of
    17     * the License, or (at your option) any later version.
    18     *
    19     * This program is distributed in the hope that it will be useful,
    20     * but WITHOUT ANY WARRANTY; without even the implied warranty of
    21     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22     * GNU General Public License for more details.
    23     *
    24     * You should have received a copy of the GNU General Public License
    25     * along with this program; if not, write to the Free Software
    26     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    27     * MA 02111-1307 USA
    28     */
    29   
    30   
    31   
    32    #include "config.h"
    33    #include "version.h"
    34   
    35   
    36    /* some parameters for the board */
    37   
    38    /*
    39     *
    40     * Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
    41     *
    42     * Copyright (C) 2002 Samsung Electronics SW.LEE  <hitchcar@sec.samsung.com>
    43     *
    44     */
    45   
    46    #define BWSCON    0x48000000
    47   
    48    /* BWSCON */
    49    #define DW8             (0x0)
    50    #define DW16             (0x1)
    51    #define DW32             (0x2)
    52    #define WAIT             (0x1<<2)
    53    #define UBLB             (0x1<<3)
    54   
    55    #define B1_BWSCON          (DW32)
    56    #define B2_BWSCON          (DW16)
    57    #define B3_BWSCON          (DW16 + WAIT + UBLB)
    58    #define B4_BWSCON          (DW16)
    59    #define B5_BWSCON          (DW16)
    60    #define B6_BWSCON          (DW32)
    61    #define B7_BWSCON          (DW32)
    62   
    63    /* BANK0CON */
    64    #define B0_Tacs             0x0    /*  0clk */
    65    #define B0_Tcos             0x0    /*  0clk */
    66    #define B0_Tacc             0x7    /* 14clk */
    67    #define B0_Tcoh             0x0    /*  0clk */
    68    #define B0_Tah             0x0    /*  0clk */
    69    #define B0_Tacp             0x0
    70    #define B0_PMC             0x0    /* normal */
    71   
    72    /* BANK1CON */
    73    #define B1_Tacs             0x0    /*  0clk */
    74    #define B1_Tcos             0x0    /*  0clk */
    75    #define B1_Tacc             0x7    /* 14clk */
    76    #define B1_Tcoh             0x0    /*  0clk */
    77    #define B1_Tah             0x0    /*  0clk */
    78    #define B1_Tacp             0x0
    79    #define B1_PMC             0x0
    80   
    81    #define B2_Tacs             0x0
    82    #define B2_Tcos             0x0
    83    #define B2_Tacc             0x7
    84    #define B2_Tcoh             0x0
    85    #define B2_Tah             0x0
    86    #define B2_Tacp             0x0
    87    #define B2_PMC             0x0
    88   
    89    #define B3_Tacs             0x0    /*  0clk */
    90    #define B3_Tcos             0x3    /*  4clk */
    91    #define B3_Tacc             0x7    /* 14clk */
    92    #define B3_Tcoh             0x1    /*  1clk */
    93    #define B3_Tah             0x0    /*  0clk */
    94    #define B3_Tacp             0x3     /*  6clk */
    95    #define B3_PMC             0x0    /* normal */
    96   
    97    #define B4_Tacs             0x0    /*  0clk */
    98    #define B4_Tcos             0x0    /*  0clk */
    99    #define B4_Tacc             0x7    /* 14clk */
   100    #define B4_Tcoh             0x0    /*  0clk */
   101    #define B4_Tah             0x0    /*  0clk */
   102    #define B4_Tacp             0x0
   103    #define B4_PMC             0x0    /* normal */
   104   
   105    #define B5_Tacs             0x0    /*  0clk */
   106    #define B5_Tcos             0x0    /*  0clk */
   107    #define B5_Tacc             0x7    /* 14clk */
   108    #define B5_Tcoh             0x0    /*  0clk */
   109    #define B5_Tah             0x0    /*  0clk */
   110    #define B5_Tacp             0x0
   111    #define B5_PMC             0x0    /* normal */
   112   
   113    #define B6_MT             0x3    /* SDRAM */
   114    #define B6_Trcd              0x1
   115    #define B6_SCAN             0x1    /* 9bit */
   116   
   117    #define B7_MT             0x3    /* SDRAM */
   118    #define B7_Trcd             0x1    /* 3clk */
   119    #define B7_SCAN             0x1    /* 9bit */
   120   
   121    /* REFRESH parameter */
   122    #define REFEN             0x1    /* Refresh enable */
   123    #define TREFMD             0x0    /* CBR(CAS before RAS)/Auto refresh */
   124    #define Trp             0x0    /* 2clk */
   125    #define Trc             0x3    /* 7clk */
   126    #define Tchr             0x2    /* 3clk */
   127    #define REFCNT             1113    /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */
   128    /**************************************/
   129   
   130    _TEXT_BASE:
   131        .word    TEXT_BASE
   132   
   133    .globl memsetup
   134    memsetup:
   135        /* memory control configuration */
   136        /* make r0 relative the current location so that it */
   137        /* reads SMRDATA out of FLASH rather than memory ! */
   138        ldr     r0, =SMRDATA
   139        ldr    r1, _TEXT_BASE
   140        sub    r0, r0, r1
   141        ldr    r1, =BWSCON    /* Bus Width Status Controller */
   142        add     r2, r0, #13*4
   143    0:
   144        ldr     r3, [r0], #4
   145        str     r3, [r1], #4
   146        cmp     r2, r0
   147        bne     0b
   148   
   149        /* everything is fine now */
   150        mov    pc, lr
   151   
   152        .ltorg
   153    /* the literal pools origin */
   154    #if defined(CONFIG_SMDK2410) // snallie
   155    SMRDATA:
   156        .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28))
   157        .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC))
   158        .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC))
   159        .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC))
   160        .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC))
   161        .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC))
   162        .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC))
   163        .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN))
   164        .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN))
   165        .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)
   166        .word 0x32
   167        .word 0x30
   168        .word 0x30
   169    #endif // snallie
    /*  将 155~169行的内容通过条件编译取消掉 ,直接使用 172~203 行的部分,以适应MINI2440开发板 */  
   
   170       
   171    // start of snallie   
   172    #if defined(CONFIG_MINI2440)
   173    SMRDATA:
   174        .word    0x2211d110
   175        .word    0x00000700
   176        .word    0x00000700
   177        .word    0x00000700
   178        .word    0x0001c740
   179        .word    0x00000700
   180        .word    0x0001c740
   181        .word    0x00018005
   182        .word    0x00018005
   183        .word    0x008e0459
   184        .word    0x000000b2
   185        .word    0x00000030
   186        .word    0x00000030
   187   
   188    // snallie, Sun Feb  6 10:09:44 HKT 2011
   189    //        .word 0x22111112
   190    //        .word 0x00000700
   191    //        .word 0x00000700
   192    //        .word 0x00000700
   193    //        .word 0x00000700
   194    //        .word 0x00000700
   195    //        .word 0x00000700
   196    //        .word 0x00018009
   197    //        .word 0x00018009
   198    //        .word 0x008e04eb
   199    //        .word 0x000000b2
   200    //        .word 0x00000030
   201    //        .word 0x00000030       
   202   
   203    #endif
   204    // end of snallie   
    /* 170~204行为MINI2440开发板关于存储器控制的配置数据 */

       
//////////////////
board/mini2440/armboot.lds 的修改
     1    /*
     2     * (C) Copyright 2002
     3     * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
     4     *
     5     * See file CREDITS for list of people who contributed to this
     6     * project.
     7     *
     8     * This program is free software; you can redistribute it and/or
     9     * modify it under the terms of the GNU General Public License as
    10     * published by the Free Software Foundation; either version 2 of
    11     * the License, or (at your option) any later version.
    12     *
    13     * This program is distributed in the hope that it will be useful,
    14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16     * GNU General Public License for more details.
    17     *
    18     * You should have received a copy of the GNU General Public License
    19     * along with this program; if not, write to the Free Software
    20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    21     * MA 02111-1307 USA
    22     */
    23   
    24    OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
    25    /*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
    26    OUTPUT_ARCH(arm)
    27    ENTRY(_start)
    28    SECTIONS
    29    {
    30            . = 0x00000000;
    31   
    32            . = ALIGN(4);
    33        .text      :
    34        {
    35          cpu/arm920t/start.o    (.text)
    36          board/mini2440/memsetup.o    (.text)    /* snallie */
    37          board/mini2440/boot_init.o    (.text)    /* snallie */
        /*
         *   36~37行控制将start.o,memsetup.o,boot_init.o 放在程序映像的前4K的部分,
         *   不放在这里则程序的初始化部分将得不到运行,boot_init.o有boot_init.c编译而来,是新引入的文件,后面有说明
         */
   
    38          *(.text)
    39        }
    40   
    41            . = ALIGN(4);
    42            .rodata : { *(.rodata) }
    43   
    44            . = ALIGN(4);
    45            .data : { *(.data) }
    46   
    47            . = ALIGN(4);
    48            .got : { *(.got) }
    49   
    50            . = ALIGN(4);
    51            __bss_start = .; /* snallie */
        /* 51行定义了一个新的符号地址,供cpu/arm920t/start.S 中的第95行使用,以便记录BSS段的起始地址 */
   
    52            .bss : { *(.bss) }
    53   
    54        armboot_end = .;
    55    }

   
/////////////
新引入一个boot_init.c,在MINI2440的配套盘上的u-boot-1.1.6中可找到,
放到 board/mini2440 目录下,(随之还引入几个相关文件随后进行说明)并作少许改动如下:
     1    //#include <common.h>  // snallie
     2    //#include <s3c2410.h> // snallie
     3    #include <s3c2410a.h>  // snallie
    /*
     * 第1行的common.h用不到,去掉,ARMboot-1.1.0中已经有了一个s3c2410.h,但是不适合boot_init.c 使用,
     * 去掉,引入一个新的s3c2410a.h 供boot_init.c使用,该文件只改这些。主要是cpu/arm920t/start.S中调用了
     * 这个文件中的int CopyCode2Ram(unsigned long start_addr, unsigned char *buf, int size)
     */
    
     4   
     5    #define GSTATUS1        (*(volatile unsigned int *)0x560000B0)
     6    #define BUSY            1
     7   
     8    /* 供外部调用的函数 */
     9    void nand_init_ll(void);
    10    void nand_read_ll(unsigned char *buf, unsigned long start_addr, int size);
    11   
    12    /* NAND Flash操作的总入口, 它们将调用S3C2410或S3C2440的相应函数 */
    13    static void nand_reset(void);
    14    static void wait_idle(void);
    15    static void nand_select_chip(void);
    16    static void nand_deselect_chip(void);
    17    static void write_cmd(int cmd);
    18    static void write_addr(unsigned int addr);
    19    static unsigned char read_data(void);
    20   
    21    /* S3C2410的NAND Flash处理函数 */
    22    static void s3c2410_nand_reset(void);
    23    static void s3c2410_wait_idle(void);
    24    static void s3c2410_nand_select_chip(void);
    25    static void s3c2410_nand_deselect_chip(void);
    26    static void s3c2410_write_cmd(int cmd);
    27    static void s3c2410_write_addr(unsigned int addr);
    28    static unsigned char s3c2410_read_data(void);
    29   
    30    /* S3C2440的NAND Flash处理函数 */
    31    static void s3c2440_nand_reset(void);
    32    static void s3c2440_wait_idle(void);
    33    static void s3c2440_nand_select_chip(void);
    34    static void s3c2440_nand_deselect_chip(void);
    35    static void s3c2440_write_cmd(int cmd);
    36    static void s3c2440_write_addr(unsigned int addr);
    37    static unsigned char s3c2440_read_data(void);
    38   
    39    /* S3C2410的NAND Flash操作函数 */
    40   
    41    /* 复位 */
    42    static void s3c2410_nand_reset(void)
    43    {
    44        s3c2410_nand_select_chip();
    45        s3c2410_write_cmd(0xff);  // 复位命令
    46        s3c2410_wait_idle();
    47        s3c2410_nand_deselect_chip();
    48    }
    49   
    50    /* 等待NAND Flash就绪 */
    51    static void s3c2410_wait_idle(void)
    52    {
    53        int i;
    54        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
    55       
    56        volatile unsigned char *p = (volatile unsigned char *)&s3c2410nand->NFSTAT;
    57        while(!(*p & BUSY))
    58            for(i=0; i<10; i++);
    59    }
    60   
    61    /* 发出片选信号 */
    62    static void s3c2410_nand_select_chip(void)
    63    {
    64        int i;
    65        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
    66   
    67        s3c2410nand->NFCONF &= ~(1<<11);
    68        for(i=0; i<10; i++);   
    69    }
    70   
    71    /* 取消片选信号 */
    72    static void s3c2410_nand_deselect_chip(void)
    73    {
    74        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
    75   
    76        s3c2410nand->NFCONF |= (1<<11);
    77    }
    78   
    79    /* 发出命令 */
    80    static void s3c2410_write_cmd(int cmd)
    81    {
    82        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
    83   
    84        volatile unsigned char *p = (volatile unsigned char *)&s3c2410nand->NFCMD;
    85        *p = cmd;
    86    }
    87   
    88    /* 发出地址 */
    89    static void s3c2410_write_addr(unsigned int addr)
    90    {
    91        int i;
    92        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
    93        volatile unsigned char *p = (volatile unsigned char *)&s3c2410nand->NFADDR;
    94       
    95        *p = addr & 0xff;
    96        for(i=0; i<10; i++);
    97        *p = (addr >> 9) & 0xff;
    98        for(i=0; i<10; i++);
    99        *p = (addr >> 17) & 0xff;
   100        for(i=0; i<10; i++);
   101        *p = (addr >> 25) & 0xff;
   102        for(i=0; i<10; i++);
   103    }
   104   
   105    /* 读取数据 */
   106    static unsigned char s3c2410_read_data(void)
   107    {
   108        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
   109   
   110        volatile unsigned char *p = (volatile unsigned char *)&s3c2410nand->NFDATA;
   111        return *p;
   112    }
   113   
   114    /* S3C2440的NAND Flash操作函数 */
   115   
   116    /* 复位 */
   117    static void s3c2440_nand_reset(void)
   118    {
   119        s3c2440_nand_select_chip();
   120        s3c2440_write_cmd(0xff);  // 复位命令
   121        s3c2440_wait_idle();
   122        s3c2440_nand_deselect_chip();
   123    }
   124   
   125    /* 等待NAND Flash就绪 */
   126    static void s3c2440_wait_idle(void)
   127    {
   128        int i;
   129        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   130        volatile unsigned char *p = (volatile unsigned char *)&s3c2440nand->NFSTAT;
   131   
   132        while(!(*p & BUSY))
   133            for(i=0; i<10; i++);
   134    }
   135   
   136    /* 发出片选信号 */
   137    static void s3c2440_nand_select_chip(void)
   138    {
   139        int i;
   140        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   141   
   142        s3c2440nand->NFCONT &= ~(1<<1);
   143        for(i=0; i<10; i++);   
   144    }
   145   
   146    /* 取消片选信号 */
   147    static void s3c2440_nand_deselect_chip(void)
   148    {
   149        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   150   
   151        s3c2440nand->NFCONT |= (1<<1);
   152    }
   153   
   154    /* 发出命令 */
   155    static void s3c2440_write_cmd(int cmd)
   156    {
   157        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   158   
   159        volatile unsigned char *p = (volatile unsigned char *)&s3c2440nand->NFCMD;
   160        *p = cmd;
   161    }
   162   
   163    /* 发出地址 */
   164    static void s3c2440_write_addr(unsigned int addr)
   165    {
   166        int i;
   167        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   168        volatile unsigned char *p = (volatile unsigned char *)&s3c2440nand->NFADDR;
   169       
   170        *p = addr & 0xff;
   171        for(i=0; i<10; i++);
   172        *p = (addr >> 9) & 0xff;
   173        for(i=0; i<10; i++);
   174        *p = (addr >> 17) & 0xff;
   175        for(i=0; i<10; i++);
   176        *p = (addr >> 25) & 0xff;
   177        for(i=0; i<10; i++);
   178    }
   179   
   180    /* 读取数据 */
   181    static unsigned char s3c2440_read_data(void)
   182    {
   183        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   184        volatile unsigned char *p = (volatile unsigned char *)&s3c2440nand->NFDATA;
   185        return *p;
   186    }
   187   
   188   
   189    /* 在第一次使用NAND Flash前,复位一下NAND Flash */
   190    static void nand_reset(void)
   191    {
   192        /* 判断是S3C2410还是S3C2440 */
   193        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   194        {
   195            s3c2410_nand_reset();
   196        }
   197        else
   198        {
   199            s3c2440_nand_reset();
   200        }
   201    }
   202   
   203    static void wait_idle(void)
   204    {
   205        /* 判断是S3C2410还是S3C2440 */
   206        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   207        {
   208            s3c2410_wait_idle();
   209        }
   210        else
   211        {
   212            s3c2440_wait_idle();
   213        }
   214    }
   215   
   216    static void nand_select_chip(void)
   217    {
   218        int i;
   219       
   220        /* 判断是S3C2410还是S3C2440 */
   221        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   222        {
   223            s3c2410_nand_select_chip();
   224        }
   225        else
   226        {
   227            s3c2440_nand_select_chip();
   228        }
   229       
   230        for(i=0; i<10; i++);
   231    }
   232   
   233    static void nand_deselect_chip(void)
   234    {
   235        /* 判断是S3C2410还是S3C2440 */
   236        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   237        {
   238            s3c2410_nand_deselect_chip();
   239        }
   240        else
   241        {
   242            s3c2440_nand_deselect_chip();
   243        }   
   244    }
   245   
   246    static void write_cmd(int cmd)
   247    {
   248        /* 判断是S3C2410还是S3C2440 */
   249        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   250        {
   251            s3c2410_write_cmd(cmd);
   252        }
   253        else
   254        {
   255            s3c2440_write_cmd(cmd);
   256        }   
   257    }
   258    static void write_addr(unsigned int addr)
   259    {
   260        /* 判断是S3C2410还是S3C2440 */
   261        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   262        {
   263            s3c2410_write_addr(addr);
   264        }
   265        else
   266        {
   267            s3c2440_write_addr(addr);
   268        }   
   269    }
   270   
   271    static unsigned char read_data(void)
   272    {
   273        /* 判断是S3C2410还是S3C2440 */
   274        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   275        {
   276            return s3c2410_read_data();
   277        }
   278        else
   279        {
   280            return s3c2440_read_data();
   281        }   
   282    }
   283   
   284    /* 初始化NAND Flash */
   285    void nand_init_ll(void)
   286    {
   287        S3C2410_NAND * s3c2410nand = (S3C2410_NAND *)0x4e000000;
   288        S3C2440_NAND * s3c2440nand = (S3C2440_NAND *)0x4e000000;
   289   
   290    #define TACLS   0
   291    #define TWRPH0  3
   292    #define TWRPH1  0
   293   
   294        /* 判断是S3C2410还是S3C2440 */
   295        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   296        {
   297            /* 使能NAND Flash控制器, 初始化ECC, 禁止片选, 设置时序 */
   298            s3c2410nand->NFCONF = (1<<15)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0);
   299        }
   300        else
   301        {
   302            /* 设置时序 */
   303            s3c2440nand->NFCONF = (TACLS<<12)|(TWRPH0<<8)|(TWRPH1<<4);
   304            /* 使能NAND Flash控制器, 初始化ECC, 禁止片选 */
   305            s3c2440nand->NFCONT = (1<<4)|(1<<1)|(1<<0);
   306        }
   307   
   308        /* 复位NAND Flash */
   309        nand_reset();
   310    }
   311   
   312   
   313    #define NAND_SECTOR_SIZE    512
   314    #define NAND_BLOCK_MASK     (NAND_SECTOR_SIZE - 1)
   315   
   316    /* 读函数 */
   317    void nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
   318    {
   319        int i, j;
   320       
   321        if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
   322            return ;    /* 地址或长度不对齐 */
   323        }
   324   
   325        /* 选中芯片 */
   326        nand_select_chip();
   327   
   328        for(i=start_addr; i < (start_addr + size);) {
   329          /* 发出READ0命令 */
   330          write_cmd(0);
   331   
   332          /* Write Address */
   333          write_addr(i);
   334          wait_idle();
   335   
   336          for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
   337              *buf = read_data();
   338              buf++;
   339          }
   340        }
   341   
   342        /* 取消片选信号 */
   343        nand_deselect_chip();
   344       
   345        return ;
   346    }
   347   
   348    int bBootFrmNORFlash(void)
   349    {
   350        volatile unsigned int *pdw = (volatile unsigned int *)0;
   351        unsigned int dwVal;
   352       
   353        /*
   354         * 无论是从NOR Flash还是从NAND Flash启动,
   355         * 地址0处为指令"b    Reset", 机器码为0xEA00000B,
   356         * 对于从NAND Flash启动的情况,其开始4KB的代码会复制到CPU内部4K内存中,
   357         * 对于从NOR Flash启动的情况,NOR Flash的开始地址即为0。
   358         * 对于NOR Flash,必须通过一定的命令序列才能写数据,
   359         * 所以可以根据这点差别来分辨是从NAND Flash还是NOR Flash启动:
   360         * 向地址0写入一个数据,然后读出来,如果没有改变的话就是NOR Flash
   361         */
   362   
   363        dwVal = *pdw;      
   364        *pdw = 0x12345678;
   365        if (*pdw != 0x12345678)
   366        {
   367            return 1;
   368        }
   369        else
   370        {
   371            *pdw = dwVal;
   372            return 0;
   373        }
   374    }
   375   
   376    int CopyCode2Ram(unsigned long start_addr, unsigned char *buf, int size)
   377    {
   378        unsigned int *pdwDest;
   379        unsigned int *pdwSrc;
   380        int i;
   381   
   382        if (bBootFrmNORFlash())
   383        {
   384            pdwDest = (unsigned int *)buf;
   385            pdwSrc  = (unsigned int *)start_addr;
   386            /* 从 NOR Flash启动 */
   387            for (i = 0; i < size / 4; i++)
   388            {
   389                pdwDest[i] = pdwSrc[i];
   390            }
   391            return 0;
   392        }
   393        else
   394        {
   395            /* 初始化NAND Flash */
   396            nand_init_ll();
   397            /* 从 NAND Flash启动 */
   398            nand_read_ll(buf, start_addr, (size + NAND_BLOCK_MASK)&~(NAND_BLOCK_MASK));
   399            return 0;
   400        }
   401    }
   402   
   403    static inline void delay (unsigned long loops)
   404    {
   405        __asm__ volatile ("1:\n"
   406          "subs %0, %1, #1\n"
   407          "bne 1b":"=r" (loops):"0" (loops));
   408    }
   409   
   410    /* S3C2440: Mpll = (2*m * Fin) / (p * 2^s), UPLL = (m * Fin) / (p * 2^s)
   411     * m = M (the value for divider M)+ 8, p = P (the value for divider P) + 2
   412     */
   413    #define S3C2440_MPLL_400MHZ     ((0x5c<<12)|(0x01<<4)|(0x01))
   414    #define S3C2440_MPLL_200MHZ     ((0x5c<<12)|(0x01<<4)|(0x02))
   415    #define S3C2440_MPLL_100MHZ     ((0x5c<<12)|(0x01<<4)|(0x03))
   416    #define S3C2440_UPLL_96MHZ      ((0x38<<12)|(0x02<<4)|(0x01))
   417    #define S3C2440_UPLL_48MHZ      ((0x38<<12)|(0x02<<4)|(0x02))
   418    #define S3C2440_CLKDIV          (0x05) // | (1<<3))    /* FCLK:HCLK:PCLK = 1:4:8, UCLK = UPLL/2 */
   419    #define S3C2440_CLKDIV188       0x04    /* FCLK:HCLK:PCLK = 1:8:8 */
   420    #define S3C2440_CAMDIVN188      ((0<<8)|(1<<9)) /* FCLK:HCLK:PCLK = 1:8:8 */
   421   
   422    /* S3C2410: Mpll,Upll = (m * Fin) / (p * 2^s)
   423     * m = M (the value for divider M)+ 8, p = P (the value for divider P) + 2
   424     */
   425    #define S3C2410_MPLL_200MHZ     ((0x5c<<12)|(0x04<<4)|(0x00))
   426    #define S3C2410_UPLL_48MHZ      ((0x28<<12)|(0x01<<4)|(0x02))
   427    #define S3C2410_CLKDIV          0x03    /* FCLK:HCLK:PCLK = 1:2:4 */
   428    void clock_init(void)
   429    {
   430        S3C24X0_CLOCK_POWER *clk_power = (S3C24X0_CLOCK_POWER *)0x4C000000;
   431   
   432        /* support both of S3C2410 and S3C2440, by www.arm9.net */
   433        if ((GSTATUS1 == 0x32410000) || (GSTATUS1 == 0x32410002))
   434        {
   435            /* FCLK:HCLK:PCLK = 1:2:4 */
   436            clk_power->CLKDIVN = S3C2410_CLKDIV;
   437   
   438            /* change to asynchronous bus mod */
   439            __asm__(    "mrc    p15, 0, r1, c1, c0, 0\n"    /* read ctrl register   */ 
   440                        "orr    r1, r1, #0xc0000000\n"      /* Asynchronous         */ 
   441                        "mcr    p15, 0, r1, c1, c0, 0\n"    /* write ctrl register  */ 
   442                        :::"r1"
   443                        );
   444           
   445            /* to reduce PLL lock time, adjust the LOCKTIME register */
   446            clk_power->LOCKTIME = 0xFFFFFFFF;
   447   
   448            /* configure UPLL */
   449            clk_power->UPLLCON = S3C2410_UPLL_48MHZ;
   450   
   451            /* some delay between MPLL and UPLL */
   452            delay (4000);
   453   
   454            /* configure MPLL */
   455            clk_power->MPLLCON = S3C2410_MPLL_200MHZ;
   456   
   457            /* some delay between MPLL and UPLL */
   458            delay (8000);
   459        }
   460        else
   461        {
   462            /* FCLK:HCLK:PCLK = 1:4:8 */
   463            clk_power->CLKDIVN = S3C2440_CLKDIV;
   464   
   465            /* change to asynchronous bus mod */
   466            __asm__(    "mrc    p15, 0, r1, c1, c0, 0\n"    /* read ctrl register   */ 
   467                        "orr    r1, r1, #0xc0000000\n"      /* Asynchronous         */ 
   468                        "mcr    p15, 0, r1, c1, c0, 0\n"    /* write ctrl register  */ 
   469                        :::"r1"
   470                        );
   471   
   472            /* to reduce PLL lock time, adjust the LOCKTIME register */
   473            clk_power->LOCKTIME = 0xFFFFFFFF;
   474   
   475            /* configure UPLL */
   476            clk_power->UPLLCON = S3C2440_UPLL_48MHZ;
   477   
   478            /* some delay between MPLL and UPLL */
   479            delay (4000);
   480   
   481            /* configure MPLL */
   482            clk_power->MPLLCON = S3C2440_MPLL_400MHZ;
   483   
   484            /* some delay between MPLL and UPLL */
   485            delay (8000);
   486        }
   487    }
   488   

////////////
新引入s3c2410a.h 放到include下, 内容如下,不需任何修改
include/s3c2410a.h
     1    /*
     2     * (C) Copyright 2003
     3     * David M黮ler ELSOFT AG Switzerland. d.mueller@elsoft.ch
     4     *
     5     * See file CREDITS for list of people who contributed to this
     6     * project.
     7     *
     8     * This program is free software; you can redistribute it and/or
     9     * modify it under the terms of the GNU General Public License as
    10     * published by the Free Software Foundation; either version 2 of
    11     * the License, or (at your option) any later version.
    12     *
    13     * This program is distributed in the hope that it will be useful,
    14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16     * GNU General Public License for more details.
    17     *
    18     * You should have received a copy of the GNU General Public License
    19     * along with this program; if not, write to the Free Software
    20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    21     * MA 02111-1307 USA
    22     */
    23   
    24    /************************************************
    25     * NAME     : s3c2410.h
    26     * Version  : 31.3.2003
    27     *
    28     * Based on S3C2410X User's manual Rev 1.1
    29     ************************************************/
    30   
    31    #ifndef __S3C2410_H__
    32    #define __S3C2410_H__
    33   
    34    #define S3C24X0_UART_CHANNELS   3
    35    #define S3C24X0_SPI_CHANNELS    2
    36   
    37    /* S3C2410 only supports 512 Byte HW ECC */
    38    #define S3C2410_ECCSIZE     512
    39    #define S3C2410_ECCBYTES    3
    40   
    41    typedef enum {
    42        S3C24X0_UART0,
    43        S3C24X0_UART1,
    44        S3C24X0_UART2
    45    } S3C24X0_UARTS_NR;
    46   
    47    /* S3C2410 device base addresses */
    48    #define S3C24X0_MEMCTL_BASE     0x48000000
    49    #define S3C24X0_USB_HOST_BASE       0x49000000
    50    #define S3C24X0_INTERRUPT_BASE      0x4A000000
    51    #define S3C24X0_DMA_BASE        0x4B000000
    52    #define S3C24X0_CLOCK_POWER_BASE    0x4C000000
    53    #define S3C24X0_LCD_BASE        0x4D000000
    54    #define S3C2410_NAND_BASE       0x4E000000
    55    #define S3C24X0_UART_BASE       0x50000000
    56    #define S3C24X0_TIMER_BASE      0x51000000
    57    #define S3C24X0_USB_DEVICE_BASE     0x52000140
    58    #define S3C24X0_WATCHDOG_BASE       0x53000000
    59    #define S3C24X0_I2C_BASE        0x54000000
    60    #define S3C24X0_I2S_BASE        0x55000000
    61    #define S3C24X0_GPIO_BASE       0x56000000
    62    #define S3C24X0_RTC_BASE        0x57000000
    63    #define S3C2410_ADC_BASE        0x58000000
    64    #define S3C24X0_SPI_BASE        0x59000000
    65    #define S3C2410_SDI_BASE        0x5A000000
    66   
    67   
    68    /* include common stuff */
    69    #include <s3c24x0.h>
    70   
    71   
    72    static inline S3C24X0_MEMCTL * const S3C24X0_GetBase_MEMCTL(void)
    73    {
    74        return (S3C24X0_MEMCTL * const)S3C24X0_MEMCTL_BASE;
    75    }
    76    static inline S3C24X0_USB_HOST * const S3C24X0_GetBase_USB_HOST(void)
    77    {
    78        return (S3C24X0_USB_HOST * const)S3C24X0_USB_HOST_BASE;
    79    }
    80    static inline S3C24X0_INTERRUPT * const S3C24X0_GetBase_INTERRUPT(void)
    81    {
    82        return (S3C24X0_INTERRUPT * const)S3C24X0_INTERRUPT_BASE;
    83    }
    84    static inline S3C24X0_DMAS * const S3C24X0_GetBase_DMAS(void)
    85    {
    86        return (S3C24X0_DMAS * const)S3C24X0_DMA_BASE;
    87    }
    88    static inline S3C24X0_CLOCK_POWER * const S3C24X0_GetBase_CLOCK_POWER(void)
    89    {
    90        return (S3C24X0_CLOCK_POWER * const)S3C24X0_CLOCK_POWER_BASE;
    91    }
    92    static inline S3C24X0_LCD * const S3C24X0_GetBase_LCD(void)
    93    {
    94        return (S3C24X0_LCD * const)S3C24X0_LCD_BASE;
    95    }
    96    static inline S3C2410_NAND * const S3C2410_GetBase_NAND(void)
    97    {
    98        return (S3C2410_NAND * const)S3C2410_NAND_BASE;
    99    }
   100   
   101    /* for s3c2440, www.arm9.net */
   102    static inline S3C2440_NAND * const S3C2440_GetBase_NAND(void)
   103    {
   104        return (S3C2440_NAND * const)S3C2410_NAND_BASE;
   105    }
   106    static inline S3C24X0_UART * const S3C24X0_GetBase_UART(S3C24X0_UARTS_NR nr)
   107    {
   108        return (S3C24X0_UART * const)(S3C24X0_UART_BASE + (nr * 0x4000));
   109    }
   110    static inline S3C24X0_TIMERS * const S3C24X0_GetBase_TIMERS(void)
   111    {
   112        return (S3C24X0_TIMERS * const)S3C24X0_TIMER_BASE;
   113    }
   114    static inline S3C24X0_USB_DEVICE * const S3C24X0_GetBase_USB_DEVICE(void)
   115    {
   116        return (S3C24X0_USB_DEVICE * const)S3C24X0_USB_DEVICE_BASE;
   117    }
   118    static inline S3C24X0_WATCHDOG * const S3C24X0_GetBase_WATCHDOG(void)
   119    {
   120        return (S3C24X0_WATCHDOG * const)S3C24X0_WATCHDOG_BASE;
   121    }
   122    static inline S3C24X0_I2C * const S3C24X0_GetBase_I2C(void)
   123    {
   124        return (S3C24X0_I2C * const)S3C24X0_I2C_BASE;
   125    }
   126    static inline S3C24X0_I2S * const S3C24X0_GetBase_I2S(void)
   127    {
   128        return (S3C24X0_I2S * const)S3C24X0_I2S_BASE;
   129    }
   130    static inline S3C24X0_GPIO * const S3C24X0_GetBase_GPIO(void)
   131    {
   132        return (S3C24X0_GPIO * const)S3C24X0_GPIO_BASE;
   133    }
   134    static inline S3C24X0_RTC * const S3C24X0_GetBase_RTC(void)
   135    {
   136        return (S3C24X0_RTC * const)S3C24X0_RTC_BASE;
   137    }
   138    static inline S3C2410_ADC * const S3C2410_GetBase_ADC(void)
   139    {
   140        return (S3C2410_ADC * const)S3C2410_ADC_BASE;
   141    }
   142    static inline S3C24X0_SPI * const S3C24X0_GetBase_SPI(void)
   143    {
   144        return (S3C24X0_SPI * const)S3C24X0_SPI_BASE;
   145    }
   146    static inline S3C2410_SDI * const S3C2410_GetBase_SDI(void)
   147    {
   148        return (S3C2410_SDI * const)S3C2410_SDI_BASE;
   149    }
   150   
   151    /* add by mike.arm9 */            
   152    #define _ISR_STARTADDRESS   ((unsigned)isr_handle_array)
   153   
   154    #define ISR_EINT0_OFT     0
   155    #define ISR_EINT1_OFT     1
   156    #define ISR_EINT2_OFT     2
   157    #define ISR_EINT3_OFT     3
   158    #define ISR_EINT4_7_OFT   4
   159    #define ISR_EINT8_23_OFT  5
   160    #define ISR_NOTUSED6_OFT  6
   161    #define ISR_BAT_FLT_OFT   7
   162    #define ISR_TICK_OFT      8
   163    #define ISR_WDT_OFT       9
   164    #define ISR_TIMER0_OFT    10
   165    #define ISR_TIMER1_OFT    11
   166    #define ISR_TIMER2_OFT    12
   167    #define ISR_TIMER3_OFT    13
   168    #define ISR_TIMER4_OFT    14
   169    #define ISR_UART2_OFT     15
   170    #define ISR_LCD_OFT       16
   171    #define ISR_DMA0_OFT      17
   172    #define ISR_DMA1_OFT      18
   173    #define ISR_DMA2_OFT      19
   174    #define ISR_DMA3_OFT      20
   175    #define ISR_SDI_OFT       21
   176    #define ISR_SPI0_OFT      22
   177    #define ISR_UART1_OFT     23
   178    #define ISR_NOTUSED24_OFT 24
   179    #define ISR_USBD_OFT      25
   180    #define ISR_USBH_OFT      26
   181    #define ISR_IIC_OFT       27
   182    #define ISR_UART0_OFT     28
   183    #define ISR_SPI1_OFT      29
   184    #define ISR_RTC_OFT       30
   185    #define ISR_ADC_OFT       31
   186   
   187    /* ISR */
   188    #define pISR_RESET      (*(unsigned *)(_ISR_STARTADDRESS+0x0))
   189    #define pISR_UNDEF      (*(unsigned *)(_ISR_STARTADDRESS+0x4))
   190    #define pISR_SWI        (*(unsigned *)(_ISR_STARTADDRESS+0x8))
   191    #define pISR_PABORT     (*(unsigned *)(_ISR_STARTADDRESS+0xC))
   192    #define pISR_DABORT     (*(unsigned *)(_ISR_STARTADDRESS+0x10))
   193    #define pISR_RESERVED       (*(unsigned *)(_ISR_STARTADDRESS+0x14))
   194    #define pISR_IRQ        (*(unsigned *)(_ISR_STARTADDRESS+0x18))
   195    #define pISR_FIQ        (*(unsigned *)(_ISR_STARTADDRESS+0x1C))
   196   
   197    #define pISR_EINT0      (*(unsigned *)(_ISR_STARTADDRESS+0x20))
   198    #define pISR_EINT1      (*(unsigned *)(_ISR_STARTADDRESS+0x24))
   199    #define pISR_EINT2      (*(unsigned *)(_ISR_STARTADDRESS+0x28))
   200    #define pISR_EINT3      (*(unsigned *)(_ISR_STARTADDRESS+0x2C))
   201    #define pISR_EINT4_7        (*(unsigned *)(_ISR_STARTADDRESS+0x30))
   202    #define pISR_EINT8_23       (*(unsigned *)(_ISR_STARTADDRESS+0x34))
   203    #define pISR_BAT_FLT        (*(unsigned *)(_ISR_STARTADDRESS+0x3C))
   204    #define pISR_TICK       (*(unsigned *)(_ISR_STARTADDRESS+0x40))
   205    #define pISR_WDT        (*(unsigned *)(_ISR_STARTADDRESS+0x44))
   206    #define pISR_TIMER0     (*(unsigned *)(_ISR_STARTADDRESS+0x48))
   207    #define pISR_TIMER1     (*(unsigned *)(_ISR_STARTADDRESS+0x4C))
   208    #define pISR_TIMER2     (*(unsigned *)(_ISR_STARTADDRESS+0x50))
   209    #define pISR_TIMER3     (*(unsigned *)(_ISR_STARTADDRESS+0x54))
   210    #define pISR_TIMER4     (*(unsigned *)(_ISR_STARTADDRESS+0x58))
   211    #define pISR_UART2      (*(unsigned *)(_ISR_STARTADDRESS+0x5C))
   212    #define pISR_NOTUSED        (*(unsigned *)(_ISR_STARTADDRESS+0x60))
   213    #define pISR_DMA0       (*(unsigned *)(_ISR_STARTADDRESS+0x64))
   214    #define pISR_DMA1       (*(unsigned *)(_ISR_STARTADDRESS+0x68))
   215    #define pISR_DMA2       (*(unsigned *)(_ISR_STARTADDRESS+0x6C))
   216    #define pISR_DMA3       (*(unsigned *)(_ISR_STARTADDRESS+0x70))
   217    #define pISR_SDI        (*(unsigned *)(_ISR_STARTADDRESS+0x74))
   218    #define pISR_SPI0       (*(unsigned *)(_ISR_STARTADDRESS+0x78))
   219    #define pISR_UART1      (*(unsigned *)(_ISR_STARTADDRESS+0x7C))
   220    #define pISR_USBD       (*(unsigned *)(_ISR_STARTADDRESS+0x84))
   221    #define pISR_USBH       (*(unsigned *)(_ISR_STARTADDRESS+0x88))
   222    #define pISR_IIC        (*(unsigned *)(_ISR_STARTADDRESS+0x8C))
   223    #define pISR_UART0      (*(unsigned *)(_ISR_STARTADDRESS+0x90))
   224    #define pISR_SPI1       (*(unsigned *)(_ISR_STARTADDRESS+0x94))
   225    #define pISR_RTC        (*(unsigned *)(_ISR_STARTADDRESS+0x98))
   226    #define pISR_ADC        (*(unsigned *)(_ISR_STARTADDRESS+0xA0))
   227   
   228   
   229    // PENDING BIT
   230    #define BIT_EINT0        (0x1)
   231    #define BIT_EINT1        (0x1<<1)
   232    #define BIT_EINT2        (0x1<<2)
   233    #define BIT_EINT3        (0x1<<3)
   234    #define BIT_EINT4_7        (0x1<<4)
   235    #define BIT_EINT8_23    (0x1<<5)
   236    #define BIT_CAM            (0x1<<6)        // Added for 2440.
   237    #define BIT_BAT_FLT        (0x1<<7)
   238    #define BIT_TICK            (0x1<<8)
   239    #define BIT_WDT_AC97    (0x1<<9)
   240    #define BIT_TIMER0        (0x1<<10)
   241    #define BIT_TIMER1        (0x1<<11)
   242    #define BIT_TIMER2        (0x1<<12)
   243    #define BIT_TIMER3        (0x1<<13)
   244    #define BIT_TIMER4        (0x1<<14)
   245    #define BIT_UART2        (0x1<<15)
   246    #define BIT_LCD            (0x1<<16)
   247    #define BIT_DMA0        (0x1<<17)
   248    #define BIT_DMA1        (0x1<<18)
   249    #define BIT_DMA2        (0x1<<19)
   250    #define BIT_DMA3        (0x1<<20)
   251    #define BIT_SDI            (0x1<<21)
   252    #define BIT_SPI0            (0x1<<22)
   253    #define BIT_UART1        (0x1<<23)
   254    #define BIT_NFCON        (0x1<<24)        // Added for 2440.
   255    #define BIT_USBD        (0x1<<25)
   256    #define BIT_USBH        (0x1<<26)
   257    #define BIT_IIC            (0x1<<27)
   258    #define BIT_UART0        (0x1<<28)
   259    #define BIT_SPI1            (0x1<<29)
   260    #define BIT_RTC            (0x1<<30)
   261    #define BIT_ADC            (0x1<<31)
   262    #define BIT_ALLMSK        (0xffffffff)
   263   
   264    #define BIT_SUB_ALLMSK    (0x7fff)
   265    #define BIT_SUB_AC97     (0x1<<14)
   266    #define BIT_SUB_WDT     (0x1<<13)
   267    #define BIT_SUB_CAM_S    (0x1<<12)        // Added for 2440.
   268    #define BIT_SUB_CAM_C    (0x1<<11)        // Added for 2440.
   269    #define BIT_SUB_ADC        (0x1<<10)
   270    #define BIT_SUB_TC        (0x1<<9)
   271    #define BIT_SUB_ERR2    (0x1<<8)
   272    #define BIT_SUB_TXD2    (0x1<<7)
   273    #define BIT_SUB_RXD2    (0x1<<6)
   274    #define BIT_SUB_ERR1    (0x1<<5)
   275    #define BIT_SUB_TXD1    (0x1<<4)
   276    #define BIT_SUB_RXD1    (0x1<<3)
   277    #define BIT_SUB_ERR0    (0x1<<2)
   278    #define BIT_SUB_TXD0    (0x1<<1)
   279    #define BIT_SUB_RXD0    (0x1<<0)
   280   
   281    #endif /*__S3C2410_H__*/

//////////////

include/s3c24x0.h 为新的引入的文件,内容如下:并做少许修改
     1    /*
     2     * (C) Copyright 2003
     3     * David M黮ler ELSOFT AG Switzerland. d.mueller@elsoft.ch
     4     *
     5     * See file CREDITS for list of people who contributed to this
     6     * project.
     7     *
     8     * This program is free software; you can redistribute it and/or
     9     * modify it under the terms of the GNU General Public License as
    10     * published by the Free Software Foundation; either version 2 of
    11     * the License, or (at your option) any later version.
    12     *
    13     * This program is distributed in the hope that it will be useful,
    14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16     * GNU General Public License for more details.
    17     *
    18     * You should have received a copy of the GNU General Public License
    19     * along with this program; if not, write to the Free Software
    20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    21     * MA 02111-1307 USA
    22     */
    23   
    24    /************************************************
    25     * NAME     : s3c24x0.h
    26     * Version  : 31.3.2003
    27     *
    28     * common stuff for SAMSUNG S3C24X0 SoC
    29     ************************************************/
    30   
    31    #ifndef __S3C24X0_H__
    32    #define __S3C24X0_H__
    33    #include "types.h" // snallie
    /* 33行为新加入的,包含types.h ,types.h无需新引入,ARMboot的源码目录中含有该文件 */   
   
    34   
    35    typedef volatile u8 S3C24X0_REG8;
    36    typedef volatile u16    S3C24X0_REG16;
    37    typedef volatile u32    S3C24X0_REG32;
    38   
    39    /* Memory controller (see manual chapter 5) */
    40    typedef struct {
    41        S3C24X0_REG32   BWSCON;
    42        S3C24X0_REG32   BANKCON[8];
    43        S3C24X0_REG32   REFRESH;
    44        S3C24X0_REG32   BANKSIZE;
    45        S3C24X0_REG32   MRSRB6;
    46        S3C24X0_REG32   MRSRB7;
    47    } /*__attribute__((__packed__))*/ S3C24X0_MEMCTL;
    48   
    49   
    50    /* USB HOST (see manual chapter 12) */
    51    typedef struct {
    52        S3C24X0_REG32   HcRevision;
    53        S3C24X0_REG32   HcControl;
    54        S3C24X0_REG32   HcCommonStatus;
    55        S3C24X0_REG32   HcInterruptStatus;
    56        S3C24X0_REG32   HcInterruptEnable;
    57        S3C24X0_REG32   HcInterruptDisable;
    58        S3C24X0_REG32   HcHCCA;
    59        S3C24X0_REG32   HcPeriodCuttendED;
    60        S3C24X0_REG32   HcControlHeadED;
    61        S3C24X0_REG32   HcControlCurrentED;
    62        S3C24X0_REG32   HcBulkHeadED;
    63        S3C24X0_REG32   HcBuldCurrentED;
    64        S3C24X0_REG32   HcDoneHead;
    65        S3C24X0_REG32   HcRmInterval;
    66        S3C24X0_REG32   HcFmRemaining;
    67        S3C24X0_REG32   HcFmNumber;
    68        S3C24X0_REG32   HcPeriodicStart;
    69        S3C24X0_REG32   HcLSThreshold;
    70        S3C24X0_REG32   HcRhDescriptorA;
    71        S3C24X0_REG32   HcRhDescriptorB;
    72        S3C24X0_REG32   HcRhStatus;
    73        S3C24X0_REG32   HcRhPortStatus1;
    74        S3C24X0_REG32   HcRhPortStatus2;
    75    } /*__attribute__((__packed__))*/ S3C24X0_USB_HOST;
    76   
    77   
    78    /* INTERRUPT (see manual chapter 14) */
    79    typedef struct {
    80        S3C24X0_REG32   SRCPND;
    81        S3C24X0_REG32   INTMOD;
    82        S3C24X0_REG32   INTMSK;
    83        S3C24X0_REG32   PRIORITY;
    84        S3C24X0_REG32   INTPND;
    85        S3C24X0_REG32   INTOFFSET;
    86    #ifdef CONFIG_S3C2410
    87        S3C24X0_REG32   SUBSRCPND;
    88        S3C24X0_REG32   INTSUBMSK;
    89    #endif
    90    } /*__attribute__((__packed__))*/ S3C24X0_INTERRUPT;
    91   
    92   
    93    /* DMAS (see manual chapter 8) */
    94    typedef struct {
    95        S3C24X0_REG32   DISRC;
    96    #ifdef CONFIG_S3C2410
    97        S3C24X0_REG32   DISRCC;
    98    #endif
    99        S3C24X0_REG32   DIDST;
   100    #ifdef CONFIG_S3C2410
   101        S3C24X0_REG32   DIDSTC;
   102    #endif
   103        S3C24X0_REG32   DCON;
   104        S3C24X0_REG32   DSTAT;
   105        S3C24X0_REG32   DCSRC;
   106        S3C24X0_REG32   DCDST;
   107        S3C24X0_REG32   DMASKTRIG;
   108    #ifdef CONFIG_S3C2400
   109        S3C24X0_REG32   res[1];
   110    #endif
   111    #ifdef CONFIG_S3C2410
   112        S3C24X0_REG32   res[7];
   113    #endif
   114    } /*__attribute__((__packed__))*/ S3C24X0_DMA;
   115   
   116    typedef struct {
   117        S3C24X0_DMA dma[4];
   118    } /*__attribute__((__packed__))*/ S3C24X0_DMAS;
   119   
   120   
   121    /* CLOCK & POWER MANAGEMENT (see S3C2400 manual chapter 6) */
   122    /*                          (see S3C2410 manual chapter 7) */
   123    typedef struct {
   124        S3C24X0_REG32   LOCKTIME;
   125        S3C24X0_REG32   MPLLCON;
   126        S3C24X0_REG32   UPLLCON;
   127        S3C24X0_REG32   CLKCON;
   128        S3C24X0_REG32   CLKSLOW;
   129        S3C24X0_REG32   CLKDIVN;
   130        S3C24X0_REG32   CAMDIVN;    /* for s3c2440, by www.arm9.net */
   131    } /*__attribute__((__packed__))*/ S3C24X0_CLOCK_POWER;
   132   
   133   
   134    /* LCD CONTROLLER (see manual chapter 15) */
   135    typedef struct {
   136        S3C24X0_REG32   LCDCON1;
   137        S3C24X0_REG32   LCDCON2;
   138        S3C24X0_REG32   LCDCON3;
   139        S3C24X0_REG32   LCDCON4;
   140        S3C24X0_REG32   LCDCON5;
   141        S3C24X0_REG32   LCDSADDR1;
   142        S3C24X0_REG32   LCDSADDR2;
   143        S3C24X0_REG32   LCDSADDR3;
   144        S3C24X0_REG32   REDLUT;
   145        S3C24X0_REG32   GREENLUT;
   146        S3C24X0_REG32   BLUELUT;
   147        S3C24X0_REG32   res[8];
   148        S3C24X0_REG32   DITHMODE;
   149        S3C24X0_REG32   TPAL;
   150    #ifdef CONFIG_S3C2410
   151        S3C24X0_REG32   LCDINTPND;
   152        S3C24X0_REG32   LCDSRCPND;
   153        S3C24X0_REG32   LCDINTMSK;
   154        S3C24X0_REG32   LPCSEL;
   155    #endif
   156    } /*__attribute__((__packed__))*/ S3C24X0_LCD;
   157   
   158   
   159    /* NAND FLASH (see S3C2410 manual chapter 6) */
   160    typedef struct {
   161        S3C24X0_REG32   NFCONF;
   162        S3C24X0_REG32   NFCMD;
   163        S3C24X0_REG32   NFADDR;
   164        S3C24X0_REG32   NFDATA;
   165        S3C24X0_REG32   NFSTAT;
   166        S3C24X0_REG32   NFECC;
   167    } /*__attribute__((__packed__))*/ S3C2410_NAND;
   168   
   169    /* NAND FLASH (see S3C2440 manual chapter 6, www.arm9.net) */
   170    typedef struct {
   171        S3C24X0_REG32   NFCONF;
   172        S3C24X0_REG32   NFCONT;
   173        S3C24X0_REG32   NFCMD;
   174        S3C24X0_REG32   NFADDR;
   175        S3C24X0_REG32   NFDATA;
   176        S3C24X0_REG32   NFMECCD0;
   177        S3C24X0_REG32   NFMECCD1;
   178        S3C24X0_REG32   NFSECCD;
   179        S3C24X0_REG32   NFSTAT;
   180        S3C24X0_REG32   NFESTAT0;
   181        S3C24X0_REG32   NFESTAT1;
   182        S3C24X0_REG32   NFMECC0;
   183        S3C24X0_REG32   NFMECC1;
   184        S3C24X0_REG32   NFSECC;
   185        S3C24X0_REG32   NFSBLK;
   186        S3C24X0_REG32   NFEBLK;
   187    } /*__attribute__((__packed__))*/ S3C2440_NAND;
   188   
   189    /* UART (see manual chapter 11) */
   190    typedef struct {
   191        S3C24X0_REG32   ULCON;
   192        S3C24X0_REG32   UCON;
   193        S3C24X0_REG32   UFCON;
   194        S3C24X0_REG32   UMCON;
   195        S3C24X0_REG32   UTRSTAT;
   196        S3C24X0_REG32   UERSTAT;
   197        S3C24X0_REG32   UFSTAT;
   198        S3C24X0_REG32   UMSTAT;
   199    #ifdef __BIG_ENDIAN
   200        S3C24X0_REG8    res1[3];
   201        S3C24X0_REG8    UTXH;
   202        S3C24X0_REG8    res2[3];
   203        S3C24X0_REG8    URXH;
   204    #else /* Little Endian */
   205        S3C24X0_REG8    UTXH;
   206        S3C24X0_REG8    res1[3];
   207        S3C24X0_REG8    URXH;
   208        S3C24X0_REG8    res2[3];
   209    #endif
   210        S3C24X0_REG32   UBRDIV;
   211    } /*__attribute__((__packed__))*/ S3C24X0_UART;
   212   
   213   
   214    /* PWM TIMER (see manual chapter 10) */
   215    typedef struct {
   216        S3C24X0_REG32   TCNTB;
   217        S3C24X0_REG32   TCMPB;
   218        S3C24X0_REG32   TCNTO;
   219    } /*__attribute__((__packed__))*/ S3C24X0_TIMER;
   220   
   221    typedef struct {
   222        S3C24X0_REG32   TCFG0;
   223        S3C24X0_REG32   TCFG1;
   224        S3C24X0_REG32   TCON;
   225        S3C24X0_TIMER   ch[4];
   226        S3C24X0_REG32   TCNTB4;
   227        S3C24X0_REG32   TCNTO4;
   228    } /*__attribute__((__packed__))*/ S3C24X0_TIMERS;
   229   
   230   
   231    /* USB DEVICE (see manual chapter 13) */
   232    typedef struct {
   233    #ifdef __BIG_ENDIAN
   234        S3C24X0_REG8    res[3];
   235        S3C24X0_REG8    EP_FIFO_REG;
   236    #else /*  little endian */
   237        S3C24X0_REG8    EP_FIFO_REG;
   238        S3C24X0_REG8    res[3];
   239    #endif
   240    } /*__attribute__((__packed__))*/ S3C24X0_USB_DEV_FIFOS;
   241   
   242    typedef struct {
   243    #ifdef __BIG_ENDIAN
   244        S3C24X0_REG8    res1[3];
   245        S3C24X0_REG8    EP_DMA_CON;
   246        S3C24X0_REG8    res2[3];
   247        S3C24X0_REG8    EP_DMA_UNIT;
   248        S3C24X0_REG8    res3[3];
   249        S3C24X0_REG8    EP_DMA_FIFO;
   250        S3C24X0_REG8    res4[3];
   251        S3C24X0_REG8    EP_DMA_TTC_L;
   252        S3C24X0_REG8    res5[3];
   253        S3C24X0_REG8    EP_DMA_TTC_M;
   254        S3C24X0_REG8    res6[3];
   255        S3C24X0_REG8    EP_DMA_TTC_H;
   256    #else /*  little endian */
   257        S3C24X0_REG8    EP_DMA_CON;
   258        S3C24X0_REG8    res1[3];
   259        S3C24X0_REG8    EP_DMA_UNIT;
   260        S3C24X0_REG8    res2[3];
   261        S3C24X0_REG8    EP_DMA_FIFO;
   262        S3C24X0_REG8    res3[3];
   263        S3C24X0_REG8    EP_DMA_TTC_L;
   264        S3C24X0_REG8    res4[3];
   265        S3C24X0_REG8    EP_DMA_TTC_M;
   266        S3C24X0_REG8    res5[3];
   267        S3C24X0_REG8    EP_DMA_TTC_H;
   268        S3C24X0_REG8    res6[3];
   269    #endif
   270    } /*__attribute__((__packed__))*/ S3C24X0_USB_DEV_DMAS;
   271   
   272    typedef struct {
   273    #ifdef __BIG_ENDIAN
   274        S3C24X0_REG8    res1[3];
   275        S3C24X0_REG8    FUNC_ADDR_REG;
   276        S3C24X0_REG8    res2[3];
   277        S3C24X0_REG8    PWR_REG;
   278        S3C24X0_REG8    res3[3];
   279        S3C24X0_REG8    EP_INT_REG;
   280        S3C24X0_REG8    res4[15];
   281        S3C24X0_REG8    USB_INT_REG;
   282        S3C24X0_REG8    res5[3];
   283        S3C24X0_REG8    EP_INT_EN_REG;
   284        S3C24X0_REG8    res6[15];
   285        S3C24X0_REG8    USB_INT_EN_REG;
   286        S3C24X0_REG8    res7[3];
   287        S3C24X0_REG8    FRAME_NUM1_REG;
   288        S3C24X0_REG8    res8[3];
   289        S3C24X0_REG8    FRAME_NUM2_REG;
   290        S3C24X0_REG8    res9[3];
   291        S3C24X0_REG8    INDEX_REG;
   292        S3C24X0_REG8    res10[7];
   293        S3C24X0_REG8    MAXP_REG;
   294        S3C24X0_REG8    res11[3];
   295        S3C24X0_REG8    EP0_CSR_IN_CSR1_REG;
   296        S3C24X0_REG8    res12[3];
   297        S3C24X0_REG8    IN_CSR2_REG;
   298        S3C24X0_REG8    res13[7];
   299        S3C24X0_REG8    OUT_CSR1_REG;
   300        S3C24X0_REG8    res14[3];
   301        S3C24X0_REG8    OUT_CSR2_REG;
   302        S3C24X0_REG8    res15[3];
   303        S3C24X0_REG8    OUT_FIFO_CNT1_REG;
   304        S3C24X0_REG8    res16[3];
   305        S3C24X0_REG8    OUT_FIFO_CNT2_REG;
   306    #else /*  little endian */
   307        S3C24X0_REG8    FUNC_ADDR_REG;
   308        S3C24X0_REG8    res1[3];
   309        S3C24X0_REG8    PWR_REG;
   310        S3C24X0_REG8    res2[3];
   311        S3C24X0_REG8    EP_INT_REG;
   312        S3C24X0_REG8    res3[15];
   313        S3C24X0_REG8    USB_INT_REG;
   314        S3C24X0_REG8    res4[3];
   315        S3C24X0_REG8    EP_INT_EN_REG;
   316        S3C24X0_REG8    res5[15];
   317        S3C24X0_REG8    USB_INT_EN_REG;
   318        S3C24X0_REG8    res6[3];
   319        S3C24X0_REG8    FRAME_NUM1_REG;
   320        S3C24X0_REG8    res7[3];
   321        S3C24X0_REG8    FRAME_NUM2_REG;
   322        S3C24X0_REG8    res8[3];
   323        S3C24X0_REG8    INDEX_REG;
   324        S3C24X0_REG8    res9[7];
   325        S3C24X0_REG8    MAXP_REG;
   326        S3C24X0_REG8    res10[3];
   327        S3C24X0_REG8    EP0_CSR_IN_CSR1_REG;
   328        S3C24X0_REG8    res11[3];
   329        S3C24X0_REG8    IN_CSR2_REG;
   330        S3C24X0_REG8    res12[7];
   331        S3C24X0_REG8    OUT_CSR1_REG;
   332        S3C24X0_REG8    res13[3];
   333        S3C24X0_REG8    OUT_CSR2_REG;
   334        S3C24X0_REG8    res14[3];
   335        S3C24X0_REG8    OUT_FIFO_CNT1_REG;
   336        S3C24X0_REG8    res15[3];
   337        S3C24X0_REG8    OUT_FIFO_CNT2_REG;
   338        S3C24X0_REG8    res16[3];
   339    #endif /*  __BIG_ENDIAN */
   340        S3C24X0_REG32   res17[8];
   341        S3C24X0_USB_DEV_FIFOS   fifo[5];
   342        S3C24X0_REG32   res18[11];
   343        S3C24X0_USB_DEV_DMAS    ep1;
   344        S3C24X0_USB_DEV_DMAS    ep2;
   345        S3C24X0_REG8    res19[16];
   346        S3C24X0_USB_DEV_DMAS    ep3;
   347        S3C24X0_USB_DEV_DMAS    ep4;
   348    } /*__attribute__((__packed__))*/ S3C24X0_USB_DEVICE;
   349   
   350   
   351    /* WATCH DOG TIMER (see manual chapter 18) */
   352    typedef struct {
   353        S3C24X0_REG32   WTCON;
   354        S3C24X0_REG32   WTDAT;
   355        S3C24X0_REG32   WTCNT;
   356    } /*__attribute__((__packed__))*/ S3C24X0_WATCHDOG;
   357   
   358   
   359    /* IIC (see manual chapter 20) */
   360    typedef struct {
   361        S3C24X0_REG32   IICCON;
   362        S3C24X0_REG32   IICSTAT;
   363        S3C24X0_REG32   IICADD;
   364        S3C24X0_REG32   IICDS;
   365    } /*__attribute__((__packed__))*/ S3C24X0_I2C;
   366   
   367   
   368    /* IIS (see manual chapter 21) */
   369    typedef struct {
   370    #ifdef __BIG_ENDIAN
   371        S3C24X0_REG16   res1;
   372        S3C24X0_REG16   IISCON;
   373        S3C24X0_REG16   res2;
   374        S3C24X0_REG16   IISMOD;
   375        S3C24X0_REG16   res3;
   376        S3C24X0_REG16   IISPSR;
   377        S3C24X0_REG16   res4;
   378        S3C24X0_REG16   IISFCON;
   379        S3C24X0_REG16   res5;
   380        S3C24X0_REG16   IISFIFO;
   381    #else /*  little endian */
   382        S3C24X0_REG16   IISCON;
   383        S3C24X0_REG16   res1;
   384        S3C24X0_REG16   IISMOD;
   385        S3C24X0_REG16   res2;
   386        S3C24X0_REG16   IISPSR;
   387        S3C24X0_REG16   res3;
   388        S3C24X0_REG16   IISFCON;
   389        S3C24X0_REG16   res4;
   390        S3C24X0_REG16   IISFIFO;
   391        S3C24X0_REG16   res5;
   392    #endif
   393    } /*__attribute__((__packed__))*/ S3C24X0_I2S;
   394   
   395   
   396    /* I/O PORT (see manual chapter 9) */
   397    typedef struct {
   398    #ifdef CONFIG_S3C2400
   399        S3C24X0_REG32   PACON;
   400        S3C24X0_REG32   PADAT;
   401   
   402        S3C24X0_REG32   PBCON;
   403        S3C24X0_REG32   PBDAT;
   404        S3C24X0_REG32   PBUP;
   405   
   406        S3C24X0_REG32   PCCON;
   407        S3C24X0_REG32   PCDAT;
   408        S3C24X0_REG32   PCUP;
   409   
   410        S3C24X0_REG32   PDCON;
   411        S3C24X0_REG32   PDDAT;
   412        S3C24X0_REG32   PDUP;
   413   
   414        S3C24X0_REG32   PECON;
   415        S3C24X0_REG32   PEDAT;
   416        S3C24X0_REG32   PEUP;
   417   
   418        S3C24X0_REG32   PFCON;
   419        S3C24X0_REG32   PFDAT;
   420        S3C24X0_REG32   PFUP;
   421   
   422        S3C24X0_REG32   PGCON;
   423        S3C24X0_REG32   PGDAT;
   424        S3C24X0_REG32   PGUP;
   425   
   426        S3C24X0_REG32   OPENCR;
   427   
   428        S3C24X0_REG32   MISCCR;
   429        S3C24X0_REG32   EXTINT;
   430    #endif
   431    #ifdef CONFIG_S3C2410
   432        S3C24X0_REG32   GPACON;
   433        S3C24X0_REG32   GPADAT;
   434        S3C24X0_REG32   res1[2];
   435        S3C24X0_REG32   GPBCON;
   436        S3C24X0_REG32   GPBDAT;
   437        S3C24X0_REG32   GPBUP;
   438        S3C24X0_REG32   res2;
   439        S3C24X0_REG32   GPCCON;
   440        S3C24X0_REG32   GPCDAT;
   441        S3C24X0_REG32   GPCUP;
   442        S3C24X0_REG32   res3;
   443        S3C24X0_REG32   GPDCON;
   444        S3C24X0_REG32   GPDDAT;
   445        S3C24X0_REG32   GPDUP;
   446        S3C24X0_REG32   res4;
   447        S3C24X0_REG32   GPECON;
   448        S3C24X0_REG32   GPEDAT;
   449        S3C24X0_REG32   GPEUP;
   450        S3C24X0_REG32   res5;
   451        S3C24X0_REG32   GPFCON;
   452        S3C24X0_REG32   GPFDAT;
   453        S3C24X0_REG32   GPFUP;
   454        S3C24X0_REG32   res6;
   455        S3C24X0_REG32   GPGCON;
   456        S3C24X0_REG32   GPGDAT;
   457        S3C24X0_REG32   GPGUP;
   458        S3C24X0_REG32   res7;
   459        S3C24X0_REG32   GPHCON;
   460        S3C24X0_REG32   GPHDAT;
   461        S3C24X0_REG32   GPHUP;
   462        S3C24X0_REG32   res8;
   463   
   464        S3C24X0_REG32   MISCCR;
   465        S3C24X0_REG32   DCLKCON;
   466        S3C24X0_REG32   EXTINT0;
   467        S3C24X0_REG32   EXTINT1;
   468        S3C24X0_REG32   EXTINT2;
   469        S3C24X0_REG32   EINTFLT0;
   470        S3C24X0_REG32   EINTFLT1;
   471        S3C24X0_REG32   EINTFLT2;
   472        S3C24X0_REG32   EINTFLT3;
   473        S3C24X0_REG32   EINTMASK;
   474        S3C24X0_REG32   EINTPEND;
   475        S3C24X0_REG32   GSTATUS0;
   476        S3C24X0_REG32   GSTATUS1;
   477        S3C24X0_REG32   GSTATUS2;
   478        S3C24X0_REG32   GSTATUS3;
   479        S3C24X0_REG32   GSTATUS4;
   480   
   481        /* s3c2440 */
   482        S3C24X0_REG32   res9[4];
   483        S3C24X0_REG32   GPJCON;
   484        S3C24X0_REG32   GPJDAT;
   485        S3C24X0_REG32   GPJUP;
   486    #endif
   487    } /*__attribute__((__packed__))*/ S3C24X0_GPIO;
   488   
   489   
   490    /* RTC (see manual chapter 17) */
   491    typedef struct {
   492    #ifdef __BIG_ENDIAN
   493        S3C24X0_REG8    res1[67];
   494        S3C24X0_REG8    RTCCON;
   495        S3C24X0_REG8    res2[3];
   496        S3C24X0_REG8    TICNT;
   497        S3C24X0_REG8    res3[11];
   498        S3C24X0_REG8    RTCALM;
   499        S3C24X0_REG8    res4[3];
   500        S3C24X0_REG8    ALMSEC;
   501        S3C24X0_REG8    res5[3];
   502        S3C24X0_REG8    ALMMIN;
   503        S3C24X0_REG8    res6[3];
   504        S3C24X0_REG8    ALMHOUR;
   505        S3C24X0_REG8    res7[3];
   506        S3C24X0_REG8    ALMDATE;
   507        S3C24X0_REG8    res8[3];
   508        S3C24X0_REG8    ALMMON;
   509        S3C24X0_REG8    res9[3];
   510        S3C24X0_REG8    ALMYEAR;
   511        S3C24X0_REG8    res10[3];
   512        S3C24X0_REG8    RTCRST;
   513        S3C24X0_REG8    res11[3];
   514        S3C24X0_REG8    BCDSEC;
   515        S3C24X0_REG8    res12[3];
   516        S3C24X0_REG8    BCDMIN;
   517        S3C24X0_REG8    res13[3];
   518        S3C24X0_REG8    BCDHOUR;
   519        S3C24X0_REG8    res14[3];
   520        S3C24X0_REG8    BCDDATE;
   521        S3C24X0_REG8    res15[3];
   522        S3C24X0_REG8    BCDDAY;
   523        S3C24X0_REG8    res16[3];
   524        S3C24X0_REG8    BCDMON;
   525        S3C24X0_REG8    res17[3];
   526        S3C24X0_REG8    BCDYEAR;
   527    #else /*  little endian */
   528        S3C24X0_REG8    res0[64];
   529        S3C24X0_REG8    RTCCON;
   530        S3C24X0_REG8    res1[3];
   531        S3C24X0_REG8    TICNT;
   532        S3C24X0_REG8    res2[11];
   533        S3C24X0_REG8    RTCALM;
   534        S3C24X0_REG8    res3[3];
   535        S3C24X0_REG8    ALMSEC;
   536        S3C24X0_REG8    res4[3];
   537        S3C24X0_REG8    ALMMIN;
   538        S3C24X0_REG8    res5[3];
   539        S3C24X0_REG8    ALMHOUR;
   540        S3C24X0_REG8    res6[3];
   541        S3C24X0_REG8    ALMDATE;
   542        S3C24X0_REG8    res7[3];
   543        S3C24X0_REG8    ALMMON;
   544        S3C24X0_REG8    res8[3];
   545        S3C24X0_REG8    ALMYEAR;
   546        S3C24X0_REG8    res9[3];
   547        S3C24X0_REG8    RTCRST;
   548        S3C24X0_REG8    res10[3];
   549        S3C24X0_REG8    BCDSEC;
   550        S3C24X0_REG8    res11[3];
   551        S3C24X0_REG8    BCDMIN;
   552        S3C24X0_REG8    res12[3];
   553        S3C24X0_REG8    BCDHOUR;
   554        S3C24X0_REG8    res13[3];
   555        S3C24X0_REG8    BCDDATE;
   556        S3C24X0_REG8    res14[3];
   557        S3C24X0_REG8    BCDDAY;
   558        S3C24X0_REG8    res15[3];
   559        S3C24X0_REG8    BCDMON;
   560        S3C24X0_REG8    res16[3];
   561        S3C24X0_REG8    BCDYEAR;
   562        S3C24X0_REG8    res17[3];
   563    #endif
   564    } /*__attribute__((__packed__))*/ S3C24X0_RTC;
   565   
   566   
   567    /* ADC (see manual chapter 16) */
   568    typedef struct {
   569        S3C24X0_REG32   ADCCON;
   570        S3C24X0_REG32   ADCDAT;
   571    } /*__attribute__((__packed__))*/ S3C2400_ADC;
   572   
   573   
   574    /* ADC (see manual chapter 16) */
   575    typedef struct {
   576        S3C24X0_REG32   ADCCON;
   577        S3C24X0_REG32   ADCTSC;
   578        S3C24X0_REG32   ADCDLY;
   579        S3C24X0_REG32   ADCDAT0;
   580        S3C24X0_REG32   ADCDAT1;
   581    } /*__attribute__((__packed__))*/ S3C2410_ADC;
   582   
   583   
   584    /* SPI (see manual chapter 22) */
   585    typedef struct {
   586        S3C24X0_REG32   SPCON;
   587        S3C24X0_REG32   SPSTA;
   588        S3C24X0_REG32   SPPIN;
   589        S3C24X0_REG32   SPPRE;
   590        S3C24X0_REG32   SPTDAT;
   591        S3C24X0_REG32   SPRDAT;
   592        S3C24X0_REG32   res[2];
   593    } __attribute__((__packed__)) S3C24X0_SPI_CHANNEL;
   594   
   595    typedef struct {
   596        S3C24X0_SPI_CHANNEL ch[S3C24X0_SPI_CHANNELS];
   597    } /*__attribute__((__packed__))*/ S3C24X0_SPI;
   598   
   599   
   600    /* MMC INTERFACE (see S3C2400 manual chapter 19) */
   601    typedef struct {
   602    #ifdef __BIG_ENDIAN
   603        S3C24X0_REG8    res1[3];
   604        S3C24X0_REG8    MMCON;
   605        S3C24X0_REG8    res2[3];
   606        S3C24X0_REG8    MMCRR;
   607        S3C24X0_REG8    res3[3];
   608        S3C24X0_REG8    MMFCON;
   609        S3C24X0_REG8    res4[3];
   610        S3C24X0_REG8    MMSTA;
   611        S3C24X0_REG16   res5;
   612        S3C24X0_REG16   MMFSTA;
   613        S3C24X0_REG8    res6[3];
   614        S3C24X0_REG8    MMPRE;
   615        S3C24X0_REG16   res7;
   616        S3C24X0_REG16   MMLEN;
   617        S3C24X0_REG8    res8[3];
   618        S3C24X0_REG8    MMCR7;
   619        S3C24X0_REG32   MMRSP[4];
   620        S3C24X0_REG8    res9[3];
   621        S3C24X0_REG8    MMCMD0;
   622        S3C24X0_REG32   MMCMD1;
   623        S3C24X0_REG16   res10;
   624        S3C24X0_REG16   MMCR16;
   625        S3C24X0_REG8    res11[3];
   626        S3C24X0_REG8    MMDAT;
   627    #else
   628        S3C24X0_REG8    MMCON;
   629        S3C24X0_REG8    res1[3];
   630        S3C24X0_REG8    MMCRR;
   631        S3C24X0_REG8    res2[3];
   632        S3C24X0_REG8    MMFCON;
   633        S3C24X0_REG8    res3[3];
   634        S3C24X0_REG8    MMSTA;
   635        S3C24X0_REG8    res4[3];
   636        S3C24X0_REG16   MMFSTA;
   637        S3C24X0_REG16   res5;
   638        S3C24X0_REG8    MMPRE;
   639        S3C24X0_REG8    res6[3];
   640        S3C24X0_REG16   MMLEN;
   641        S3C24X0_REG16   res7;
   642        S3C24X0_REG8    MMCR7;
   643        S3C24X0_REG8    res8[3];
   644        S3C24X0_REG32   MMRSP[4];
   645        S3C24X0_REG8    MMCMD0;
   646        S3C24X0_REG8    res9[3];
   647        S3C24X0_REG32   MMCMD1;
   648        S3C24X0_REG16   MMCR16;
   649        S3C24X0_REG16   res10;
   650        S3C24X0_REG8    MMDAT;
   651        S3C24X0_REG8    res11[3];
   652    #endif
   653    } /*__attribute__((__packed__))*/ S3C2400_MMC;
   654   
   655   
   656    /* SD INTERFACE (see S3C2410 manual chapter 19) */
   657    typedef struct {
   658        S3C24X0_REG32   SDICON;
   659        S3C24X0_REG32   SDIPRE;
   660        S3C24X0_REG32   SDICARG;
   661        S3C24X0_REG32   SDICCON;
   662        S3C24X0_REG32   SDICSTA;
   663        S3C24X0_REG32   SDIRSP0;
   664        S3C24X0_REG32   SDIRSP1;
   665        S3C24X0_REG32   SDIRSP2;
   666        S3C24X0_REG32   SDIRSP3;
   667        S3C24X0_REG32   SDIDTIMER;
   668        S3C24X0_REG32   SDIBSIZE;
   669        S3C24X0_REG32   SDIDCON;
   670        S3C24X0_REG32   SDIDCNT;
   671        S3C24X0_REG32   SDIDSTA;
   672        S3C24X0_REG32   SDIFSTA;
   673    #ifdef __BIG_ENDIAN
   674        S3C24X0_REG8    res[3];
   675        S3C24X0_REG8    SDIDAT;
   676    #else
   677        S3C24X0_REG8    SDIDAT;
   678        S3C24X0_REG8    res[3];
   679    #endif
   680        S3C24X0_REG32   SDIIMSK;
   681    } /*__attribute__((__packed__))*/ S3C2410_SDI;
   682   
   683   
   684    #if 0
   685    /* Memory control */
   686    #define rBWSCON         (*(volatile unsigned *)0x48000000)
   687    #define rBANKCON0       (*(volatile unsigned *)0x48000004)
   688    #define rBANKCON1       (*(volatile unsigned *)0x48000008)
   689    #define rBANKCON2       (*(volatile unsigned *)0x4800000C)
   690    #define rBANKCON3       (*(volatile unsigned *)0x48000010)
   691    #define rBANKCON4       (*(volatile unsigned *)0x48000014)
   692    #define rBANKCON5       (*(volatile unsigned *)0x48000018)
   693    #define rBANKCON6       (*(volatile unsigned *)0x4800001C)
   694    #define rBANKCON7       (*(volatile unsigned *)0x48000020)
   695    #define rREFRESH        (*(volatile unsigned *)0x48000024)
   696    #define rBANKSIZE       (*(volatile unsigned *)0x48000028)
   697    #define rMRSRB6         (*(volatile unsigned *)0x4800002C)
   698    #define rMRSRB7         (*(volatile unsigned *)0x48000030)
   699   
   700   
   701    /* USB HOST */
   702    #define rHcRevision     (*(volatile unsigned *)0x49000000)
   703    #define rHcControl      (*(volatile unsigned *)0x49000004)
   704    #define rHcCommonStatus     (*(volatile unsigned *)0x49000008)
   705    #define rHcInterruptStatus  (*(volatile unsigned *)0x4900000C)
   706    #define rHcInterruptEnable  (*(volatile unsigned *)0x49000010)
   707    #define rHcInterruptDisable (*(volatile unsigned *)0x49000014)
   708    #define rHcHCCA         (*(volatile unsigned *)0x49000018)
   709    #define rHcPeriodCuttendED  (*(volatile unsigned *)0x4900001C)
   710    #define rHcControlHeadED    (*(volatile unsigned *)0x49000020)
   711    #define rHcControlCurrentED (*(volatile unsigned *)0x49000024)
   712    #define rHcBulkHeadED       (*(volatile unsigned *)0x49000028)
   713    #define rHcBuldCurrentED    (*(volatile unsigned *)0x4900002C)
   714    #define rHcDoneHead     (*(volatile unsigned *)0x49000030)
   715    #define rHcRmInterval       (*(volatile unsigned *)0x49000034)
   716    #define rHcFmRemaining      (*(volatile unsigned *)0x49000038)
   717    #define rHcFmNumber     (*(volatile unsigned *)0x4900003C)
   718    #define rHcPeriodicStart    (*(volatile unsigned *)0x49000040)
   719    #define rHcLSThreshold      (*(volatile unsigned *)0x49000044)
   720    #define rHcRhDescriptorA    (*(volatile unsigned *)0x49000048)
   721    #define rHcRhDescriptorB    (*(volatile unsigned *)0x4900004C)
   722    #define rHcRhStatus     (*(volatile unsigned *)0x49000050)
   723    #define rHcRhPortStatus1    (*(volatile unsigned *)0x49000054)
   724    #define rHcRhPortStatus2    (*(volatile unsigned *)0x49000058)
   725   
   726   
   727    /* INTERRUPT */
   728    #define rSRCPND         (*(volatile unsigned *)0x4A000000)
   729    #define rINTMOD         (*(volatile unsigned *)0x4A000004)
   730    #define rINTMSK         (*(volatile unsigned *)0x4A000008)
   731    #define rPRIORITY       (*(volatile unsigned *)0x4A00000C)
   732    #define rINTPND         (*(volatile unsigned *)0x4A000010)
   733    #define rINTOFFSET      (*(volatile unsigned *)0x4A000014)
   734    #define rSUBSRCPND      (*(volatile unsigned *)0x4A000018)
   735    #define rINTSUBMSK      (*(volatile unsigned *)0x4A00001C)
   736   
   737   
   738    /* DMA */
   739    #define rDISRC0         (*(volatile unsigned *)0x4B000000)
   740    #define rDISRCC0        (*(volatile unsigned *)0x4B000004)
   741    #define rDIDST0         (*(volatile unsigned *)0x4B000008)
   742    #define rDIDSTC0        (*(volatile unsigned *)0x4B00000C)
   743    #define rDCON0          (*(volatile unsigned *)0x4B000010)
   744    #define rDSTAT0         (*(volatile unsigned *)0x4B000014)
   745    #define rDCSRC0         (*(volatile unsigned *)0x4B000018)
   746    #define rDCDST0         (*(volatile unsigned *)0x4B00001C)
   747    #define rDMASKTRIG0     (*(volatile unsigned *)0x4B000020)
   748    #define rDISRC1         (*(volatile unsigned *)0x4B000040)
   749    #define rDISRCC1        (*(volatile unsigned *)0x4B000044)
   750    #define rDIDST1         (*(volatile unsigned *)0x4B000048)
   751    #define rDIDSTC1        (*(volatile unsigned *)0x4B00004C)
   752    #define rDCON1          (*(volatile unsigned *)0x4B000050)
   753    #define rDSTAT1         (*(volatile unsigned *)0x4B000054)
   754    #define rDCSRC1         (*(volatile unsigned *)0x4B000058)
   755    #define rDCDST1         (*(volatile unsigned *)0x4B00005C)
   756    #define rDMASKTRIG1     (*(volatile unsigned *)0x4B000060)
   757    #define rDISRC2         (*(volatile unsigned *)0x4B000080)
   758    #define rDISRCC2        (*(volatile unsigned *)0x4B000084)
   759    #define rDIDST2         (*(volatile unsigned *)0x4B000088)
   760    #define rDIDSTC2        (*(volatile unsigned *)0x4B00008C)
   761    #define rDCON2          (*(volatile unsigned *)0x4B000090)
   762    #define rDSTAT2         (*(volatile unsigned *)0x4B000094)
   763    #define rDCSRC2         (*(volatile unsigned *)0x4B000098)
   764    #define rDCDST2         (*(volatile unsigned *)0x4B00009C)
   765    #define rDMASKTRIG2     (*(volatile unsigned *)0x4B0000A0)
   766    #define rDISRC3         (*(volatile unsigned *)0x4B0000C0)
   767    #define rDISRCC3        (*(volatile unsigned *)0x4B0000C4)
   768    #define rDIDST3         (*(volatile unsigned *)0x4B0000C8)
   769    #define rDIDSTC3        (*(volatile unsigned *)0x4B0000CC)
   770    #define rDCON3          (*(volatile unsigned *)0x4B0000D0)
   771    #define rDSTAT3         (*(volatile unsigned *)0x4B0000D4)
   772    #define rDCSRC3         (*(volatile unsigned *)0x4B0000D8)
   773    #define rDCDST3         (*(volatile unsigned *)0x4B0000DC)
   774    #define rDMASKTRIG3     (*(volatile unsigned *)0x4B0000E0)
   775   
   776   
   777    /* CLOCK & POWER MANAGEMENT */
   778    #define rLOCKTIME       (*(volatile unsigned *)0x4C000000)
   779    #define rMPLLCON        (*(volatile unsigned *)0x4C000004)
   780    #define rUPLLCON        (*(volatile unsigned *)0x4C000008)
   781    #define rCLKCON         (*(volatile unsigned *)0x4C00000C)
   782    #define rCLKSLOW        (*(volatile unsigned *)0x4C000010)
   783    #define rCLKDIVN        (*(volatile unsigned *)0x4C000014)
   784   
   785   
   786    /* LCD CONTROLLER */
   787    #define rLCDCON1        (*(volatile unsigned *)0x4D000000)
   788    #define rLCDCON2        (*(volatile unsigned *)0x4D000004)
   789    #define rLCDCON3        (*(volatile unsigned *)0x4D000008)
   790    #define rLCDCON4        (*(volatile unsigned *)0x4D00000C)
   791    #define rLCDCON5        (*(volatile unsigned *)0x4D000010)
   792    #define rLCDSADDR1      (*(volatile unsigned *)0x4D000014)
   793    #define rLCDSADDR2      (*(volatile unsigned *)0x4D000018)
   794    #define rLCDSADDR3      (*(volatile unsigned *)0x4D00001C)
   795    #define rREDLUT         (*(volatile unsigned *)0x4D000020)
   796    #define rGREENLUT       (*(volatile unsigned *)0x4D000024)
   797    #define rBLUELUT        (*(volatile unsigned *)0x4D000028)
   798    #define rDITHMODE       (*(volatile unsigned *)0x4D00004C)
   799    #define rTPAL           (*(volatile unsigned *)0x4D000050)
   800    #define rLCDINTPND      (*(volatile unsigned *)0x4D000054)
   801    #define rLCDSRCPND      (*(volatile unsigned *)0x4D000058)
   802    #define rLCDINTMSK      (*(volatile unsigned *)0x4D00005C)
   803   
   804   
   805    /* NAND FLASH */
   806    #define rNFCONF         (*(volatile unsigned *)0x4E000000)
   807    #define rNFCMD          (*(volatile unsigned *)0x4E000004)
   808    #define rNFADDR         (*(volatile unsigned *)0x4E000008)
   809    #define rNFDATA         (*(volatile unsigned *)0x4E00000C)
   810    #define rNFSTAT         (*(volatile unsigned *)0x4E000010)
   811    #define rNFECC          (*(volatile unsigned *)0x4E000014)
   812   
   813   
   814    /* UART */
   815    #define rULCON0         (*(volatile unsigned *)0x50000000)
   816    #define rUCON0          (*(volatile unsigned *)0x50000004)
   817    #define rUFCON0         (*(volatile unsigned *)0x50000008)
   818    #define rUMCON0         (*(volatile unsigned *)0x5000000C)
   819    #define rUTRSTAT0       (*(volatile unsigned *)0x50000010)
   820    #define rUERSTAT0       (*(volatile unsigned *)0x50000014)
   821    #define rUFSTAT0        (*(volatile unsigned *)0x50000018)
   822    #define rUMSTAT0        (*(volatile unsigned *)0x5000001C)
   823    #define rUBRDIV0        (*(volatile unsigned *)0x50000028)
   824   
   825    #define rULCON1         (*(volatile unsigned *)0x50004000)
   826    #define rUCON1          (*(volatile unsigned *)0x50004004)
   827    #define rUFCON1         (*(volatile unsigned *)0x50004008)
   828    #define rUMCON1         (*(volatile unsigned *)0x5000400C)
   829    #define rUTRSTAT1       (*(volatile unsigned *)0x50004010)
   830    #define rUERSTAT1       (*(volatile unsigned *)0x50004014)
   831    #define rUFSTAT1        (*(volatile unsigned *)0x50004018)
   832    #define rUMSTAT1        (*(volatile unsigned *)0x5000401C)
   833    #define rUBRDIV1        (*(volatile unsigned *)0x50004028)
   834   
   835    #define rULCON2         (*(volatile unsigned *)0x50008000)
   836    #define rUCON2          (*(volatile unsigned *)0x50008004)
   837    #define rUFCON2         (*(volatile unsigned *)0x50008008)
   838    #define rUTRSTAT2       (*(volatile unsigned *)0x50008010)
   839    #define rUERSTAT2       (*(volatile unsigned *)0x50008014)
   840    #define rUFSTAT2        (*(volatile unsigned *)0x50008018)
   841    #define rUBRDIV2        (*(volatile unsigned *)0x50008028)
   842   
   843    #ifdef __BIG_ENDIAN
   844    #define rUTXH0          (*(volatile unsigned char *)0x50000023)
   845    #define rURXH0          (*(volatile unsigned char *)0x50000027)
   846    #define rUTXH1          (*(volatile unsigned char *)0x50004023)
   847    #define rURXH1          (*(volatile unsigned char *)0x50004027)
   848    #define rUTXH2          (*(volatile unsigned char *)0x50008023)
   849    #define rURXH2          (*(volatile unsigned char *)0x50008027)
   850   
   851    #define WrUTXH0(ch)     (*(volatile unsigned char *)0x50000023)=(unsigned char)(ch)
   852    #define RdURXH0()       (*(volatile unsigned char *)0x50000027)
   853    #define WrUTXH1(ch)     (*(volatile unsigned char *)0x50004023)=(unsigned char)(ch)
   854    #define RdURXH1()       (*(volatile unsigned char *)0x50004027)
   855    #define WrUTXH2(ch)     (*(volatile unsigned char *)0x50008023)=(unsigned char)(ch)
   856    #define RdURXH2()       (*(volatile unsigned char *)0x50008027)
   857   
   858    #define UTXH0           (0x50000020+3)  /* byte_access address by DMA */
   859    #define URXH0           (0x50000024+3)
   860    #define UTXH1           (0x50004020+3)
   861    #define URXH1           (0x50004024+3)
   862    #define UTXH2           (0x50008020+3)
   863    #define URXH2           (0x50008024+3)
   864   
   865    #else /* Little Endian */
   866    #define rUTXH0          (*(volatile unsigned char *)0x50000020)
   867    #define rURXH0          (*(volatile unsigned char *)0x50000024)
   868    #define rUTXH1          (*(volatile unsigned char *)0x50004020)
   869    #define rURXH1          (*(volatile unsigned char *)0x50004024)
   870    #define rUTXH2          (*(volatile unsigned char *)0x50008020)
   871    #define rURXH2          (*(volatile unsigned char *)0x50008024)
   872   
   873    #define WrUTXH0(ch)     (*(volatile unsigned char *)0x50000020)=(unsigned char)(ch)
   874    #define RdURXH0()       (*(volatile unsigned char *)0x50000024)
   875    #define WrUTXH1(ch)     (*(volatile unsigned char *)0x50004020)=(unsigned char)(ch)
   876    #define RdURXH1()       (*(volatile unsigned char *)0x50004024)
   877    #define WrUTXH2(ch)     (*(volatile unsigned char *)0x50008020)=(unsigned char)(ch)
   878    #define RdURXH2()       (*(volatile unsigned char *)0x50008024)
   879   
   880    #define UTXH0           (0x50000020)    /* byte_access address by DMA */
   881    #define URXH0           (0x50000024)
   882    #define UTXH1           (0x50004020)
   883    #define URXH1           (0x50004024)
   884    #define UTXH2           (0x50008020)
   885    #define URXH2           (0x50008024)
   886    #endif
   887   
   888   
   889    /* PWM TIMER */
   890    #define rTCFG0          (*(volatile unsigned *)0x51000000)
   891    #define rTCFG1          (*(volatile unsigned *)0x51000004)
   892    #define rTCON           (*(volatile unsigned *)0x51000008)
   893    #define rTCNTB0         (*(volatile unsigned *)0x5100000C)
   894    #define rTCMPB0         (*(volatile unsigned *)0x51000010)
   895    #define rTCNTO0         (*(volatile unsigned *)0x51000014)
   896    #define rTCNTB1         (*(volatile unsigned *)0x51000018)
   897    #define rTCMPB1         (*(volatile unsigned *)0x5100001C)
   898    #define rTCNTO1         (*(volatile unsigned *)0x51000020)
   899    #define rTCNTB2         (*(volatile unsigned *)0x51000024)
   900    #define rTCMPB2         (*(volatile unsigned *)0x51000028)
   901    #define rTCNTO2         (*(volatile unsigned *)0x5100002C)
   902    #define rTCNTB3         (*(volatile unsigned *)0x51000030)
   903    #define rTCMPB3         (*(volatile unsigned *)0x51000034)
   904    #define rTCNTO3         (*(volatile unsigned *)0x51000038)
   905    #define rTCNTB4         (*(volatile unsigned *)0x5100003C)
   906    #define rTCNTO4         (*(volatile unsigned *)0x51000040)
   907   
   908   
   909    /* USB DEVICE */
   910    #ifdef __BIG_ENDIAN
   911    #define rFUNC_ADDR_REG      (*(volatile unsigned char *)0x52000143)
   912    #define rPWR_REG        (*(volatile unsigned char *)0x52000147)
   913    #define rEP_INT_REG     (*(volatile unsigned char *)0x5200014B)
   914    #define rUSB_INT_REG        (*(volatile unsigned char *)0x5200015B)
   915    #define rEP_INT_EN_REG      (*(volatile unsigned char *)0x5200015F)
   916    #define rUSB_INT_EN_REG     (*(volatile unsigned char *)0x5200016F)
   917    #define rFRAME_NUM1_REG     (*(volatile unsigned char *)0x52000173)
   918    #define rFRAME_NUM2_REG     (*(volatile unsigned char *)0x52000177)
   919    #define rINDEX_REG      (*(volatile unsigned char *)0x5200017B)
   920    #define rMAXP_REG       (*(volatile unsigned char *)0x52000183)
   921    #define rEP0_CSR        (*(volatile unsigned char *)0x52000187)
   922    #define rIN_CSR1_REG        (*(volatile unsigned char *)0x52000187)
   923    #define rIN_CSR2_REG        (*(volatile unsigned char *)0x5200018B)
   924    #define rOUT_CSR1_REG       (*(volatile unsigned char *)0x52000193)
   925    #define rOUT_CSR2_REG       (*(volatile unsigned char *)0x52000197)
   926    #define rOUT_FIFO_CNT1_REG  (*(volatile unsigned char *)0x5200019B)
   927    #define rOUT_FIFO_CNT2_REG  (*(volatile unsigned char *)0x5200019F)
   928    #define rEP0_FIFO       (*(volatile unsigned char *)0x520001C3)
   929    #define rEP1_FIFO       (*(volatile unsigned char *)0x520001C7)
   930    #define rEP2_FIFO       (*(volatile unsigned char *)0x520001CB)
   931    #define rEP3_FIFO       (*(volatile unsigned char *)0x520001CF)
   932    #define rEP4_FIFO       (*(volatile unsigned char *)0x520001D3)
   933    #define rEP1_DMA_CON        (*(volatile unsigned char *)0x52000203)
   934    #define rEP1_DMA_UNIT       (*(volatile unsigned char *)0x52000207)
   935    #define rEP1_DMA_FIFO       (*(volatile unsigned char *)0x5200020B)
   936    #define rEP1_DMA_TX_LO      (*(volatile unsigned char *)0x5200020F)
   937    #define rEP1_DMA_TX_MD      (*(volatile unsigned char *)0x52000213)
   938    #define rEP1_DMA_TX_HI      (*(volatile unsigned char *)0x52000217)
   939    #define rEP2_DMA_CON        (*(volatile unsigned char *)0x5200021B)
   940    #define rEP2_DMA_UNIT       (*(volatile unsigned char *)0x5200021F)
   941    #define rEP2_DMA_FIFO       (*(volatile unsigned char *)0x52000223)
   942    #define rEP2_DMA_TX_LO      (*(volatile unsigned char *)0x52000227)
   943    #define rEP2_DMA_TX_MD      (*(volatile unsigned char *)0x5200022B)
   944    #define rEP2_DMA_TX_HI      (*(volatile unsigned char *)0x5200022F)
   945    #define rEP3_DMA_CON        (*(volatile unsigned char *)0x52000243)
   946    #define rEP3_DMA_UNIT       (*(volatile unsigned char *)0x52000247)
   947    #define rEP3_DMA_FIFO       (*(volatile unsigned char *)0x5200024B)
   948    #define rEP3_DMA_TX_LO      (*(volatile unsigned char *)0x5200024F)
   949    #define rEP3_DMA_TX_MD      (*(volatile unsigned char *)0x52000253)
   950    #define rEP3_DMA_TX_HI      (*(volatile unsigned char *)0x52000257)
   951    #define rEP4_DMA_CON        (*(volatile unsigned char *)0x5200025B)
   952    #define rEP4_DMA_UNIT       (*(volatile unsigned char *)0x5200025F)
   953    #define rEP4_DMA_FIFO       (*(volatile unsigned char *)0x52000263)
   954    #define rEP4_DMA_TX_LO      (*(volatile unsigned char *)0x52000267)
   955    #define rEP4_DMA_TX_MD      (*(volatile unsigned char *)0x5200026B)
   956    #define rEP4_DMA_TX_HI      (*(volatile unsigned char *)0x5200026F)
   957    #else /*  little endian */
   958    #define rFUNC_ADDR_REG      (*(volatile unsigned char *)0x52000140)
   959    #define rPWR_REG        (*(volatile unsigned char *)0x52000144)
   960    #define rEP_INT_REG     (*(volatile unsigned char *)0x52000148)
   961    #define rUSB_INT_REG        (*(volatile unsigned char *)0x52000158)
   962    #define rEP_INT_EN_REG      (*(volatile unsigned char *)0x5200015C)
   963    #define rUSB_INT_EN_REG     (*(volatile unsigned char *)0x5200016C)
   964    #define rFRAME_NUM1_REG     (*(volatile unsigned char *)0x52000170)
   965    #define rFRAME_NUM2_REG     (*(volatile unsigned char *)0x52000174)
   966    #define rINDEX_REG      (*(volatile unsigned char *)0x52000178)
   967    #define rMAXP_REG       (*(volatile unsigned char *)0x52000180)
   968    #define rEP0_CSR        (*(volatile unsigned char *)0x52000184)
   969    #define rIN_CSR1_REG        (*(volatile unsigned char *)0x52000184)
   970    #define rIN_CSR2_REG        (*(volatile unsigned char *)0x52000188)
   971    #define rOUT_CSR1_REG       (*(volatile unsigned char *)0x52000190)
   972    #define rOUT_CSR2_REG       (*(volatile unsigned char *)0x52000194)
   973    #define rOUT_FIFO_CNT1_REG  (*(volatile unsigned char *)0x52000198)
   974    #define rOUT_FIFO_CNT2_REG  (*(volatile unsigned char *)0x5200019C)
   975    #define rEP0_FIFO       (*(volatile unsigned char *)0x520001C0)
   976    #define rEP1_FIFO       (*(volatile unsigned char *)0x520001C4)
   977    #define rEP2_FIFO       (*(volatile unsigned char *)0x520001C8)
   978    #define rEP3_FIFO       (*(volatile unsigned char *)0x520001CC)
   979    #define rEP4_FIFO       (*(volatile unsigned char *)0x520001D0)
   980    #define rEP1_DMA_CON        (*(volatile unsigned char *)0x52000200)
   981    #define rEP1_DMA_UNIT       (*(volatile unsigned char *)0x52000204)
   982    #define rEP1_DMA_FIFO       (*(volatile unsigned char *)0x52000208)
   983    #define rEP1_DMA_TX_LO      (*(volatile unsigned char *)0x5200020C)
   984    #define rEP1_DMA_TX_MD      (*(volatile unsigned char *)0x52000210)
   985    #define rEP1_DMA_TX_HI      (*(volatile unsigned char *)0x52000214)
   986    #define rEP2_DMA_CON        (*(volatile unsigned char *)0x52000218)
   987    #define rEP2_DMA_UNIT       (*(volatile unsigned char *)0x5200021C)
   988    #define rEP2_DMA_FIFO       (*(volatile unsigned char *)0x52000220)
   989    #define rEP2_DMA_TX_LO      (*(volatile unsigned char *)0x52000224)
   990    #define rEP2_DMA_TX_MD      (*(volatile unsigned char *)0x52000228)
   991    #define rEP2_DMA_TX_HI      (*(volatile unsigned char *)0x5200022C)
   992    #define rEP3_DMA_CON        (*(volatile unsigned char *)0x52000240)
   993    #define rEP3_DMA_UNIT       (*(volatile unsigned char *)0x52000244)
   994    #define rEP3_DMA_FIFO       (*(volatile unsigned char *)0x52000248)
   995    #define rEP3_DMA_TX_LO      (*(volatile unsigned char *)0x5200024C)
   996    #define rEP3_DMA_TX_MD      (*(volatile unsigned char *)0x52000250)
   997    #define rEP3_DMA_TX_HI      (*(volatile unsigned char *)0x52000254)
   998    #define rEP4_DMA_CON        (*(volatile unsigned char *)0x52000258)
   999    #define rEP4_DMA_UNIT       (*(volatile unsigned char *)0x5200025C)
  1000    #define rEP4_DMA_FIFO       (*(volatile unsigned char *)0x52000260)
  1001    #define rEP4_DMA_TX_LO      (*(volatile unsigned char *)0x52000264)
  1002    #define rEP4_DMA_TX_MD      (*(volatile unsigned char *)0x52000268)
  1003    #define rEP4_DMA_TX_HI      (*(volatile unsigned char *)0x5200026C)
  1004    #endif /*  __BIG_ENDIAN */
  1005   
  1006   
  1007    /* WATCH DOG TIMER */
  1008    #define rWTCON          (*(volatile unsigned *)0x53000000)
  1009    #define rWTDAT          (*(volatile unsigned *)0x53000004)
  1010    #define rWTCNT          (*(volatile unsigned *)0x53000008)
  1011   
  1012   
  1013    /* IIC */
  1014    #define rIICCON         (*(volatile unsigned *)0x54000000)
  1015    #define rIICSTAT        (*(volatile unsigned *)0x54000004)
  1016    #define rIICADD         (*(volatile unsigned *)0x54000008)
  1017    #define rIICDS          (*(volatile unsigned *)0x5400000C)
  1018   
  1019   
  1020    /* IIS */
  1021    #define rIISCON         (*(volatile unsigned *)0x55000000)
  1022    #define rIISMOD         (*(volatile unsigned *)0x55000004)
  1023    #define rIISPSR         (*(volatile unsigned *)0x55000008)
  1024    #define rIISFCON        (*(volatile unsigned *)0x5500000C)
  1025   
  1026    #ifdef __BIG_ENDIAN
  1027    #define IISFIF          ((volatile unsigned short *)0x55000012)
  1028    #else /*  little endian */
  1029    #define IISFIF          ((volatile unsigned short *)0x55000010)
  1030    #endif
  1031   
  1032   
  1033    /* I/O PORT */
  1034    #define rGPACON         (*(volatile unsigned *)0x56000000)
  1035    #define rGPADAT         (*(volatile unsigned *)0x56000004)
  1036   
  1037    #define rGPBCON         (*(volatile unsigned *)0x56000010)
  1038    #define rGPBDAT         (*(volatile unsigned *)0x56000014)
  1039    #define rGPBUP          (*(volatile unsigned *)0x56000018)
  1040   
  1041    #define rGPCCON         (*(volatile unsigned *)0x56000020)
  1042    #define rGPCDAT         (*(volatile unsigned *)0x56000024)
  1043    #define rGPCUP          (*(volatile unsigned *)0x56000028)
  1044   
  1045    #define rGPDCON         (*(volatile unsigned *)0x56000030)
  1046    #define rGPDDAT         (*(volatile unsigned *)0x56000034)
  1047    #define rGPDUP          (*(volatile unsigned *)0x56000038)
  1048   
  1049    #define rGPECON         (*(volatile unsigned *)0x56000040)
  1050    #define rGPEDAT         (*(volatile unsigned *)0x56000044)
  1051    #define rGPEUP          (*(volatile unsigned *)0x56000048)
  1052   
  1053    #define rGPFCON         (*(volatile unsigned *)0x56000050)
  1054    #define rGPFDAT         (*(volatile unsigned *)0x56000054)
  1055    #define rGPFUP          (*(volatile unsigned *)0x56000058)
  1056   
  1057    #define rGPGCON         (*(volatile unsigned *)0x56000060)
  1058    #define rGPGDAT         (*(volatile unsigned *)0x56000064)
  1059    #define rGPGUP          (*(volatile unsigned *)0x56000068)
  1060   
  1061    #define rGPHCON         (*(volatile unsigned *)0x56000070)
  1062    #define rGPHDAT         (*(volatile unsigned *)0x56000074)
  1063    #define rGPHUP          (*(volatile unsigned *)0x56000078)
  1064   
  1065    #define rMISCCR         (*(volatile unsigned *)0x56000080)
  1066    #define rDCLKCON        (*(volatile unsigned *)0x56000084)
  1067    #define rEXTINT0        (*(volatile unsigned *)0x56000088)
  1068    #define rEXTINT1        (*(volatile unsigned *)0x5600008C)
  1069    #define rEXTINT2        (*(volatile unsigned *)0x56000090)
  1070    #define rEINTFLT0       (*(volatile unsigned *)0x56000094)
  1071    #define rEINTFLT1       (*(volatile unsigned *)0x56000098)
  1072    #define rEINTFLT2       (*(volatile unsigned *)0x5600009C)
  1073    #define rEINTFLT3       (*(volatile unsigned *)0x560000A0)
  1074    #define rEINTMASK       (*(volatile unsigned *)0x560000A4)
  1075    #define rEINTPEND       (*(volatile unsigned *)0x560000A8)
  1076    #define rGSTATUS0       (*(volatile unsigned *)0x560000AC)
  1077    #define rGSTATUS1       (*(volatile unsigned *)0x560000B0)
  1078   
  1079   
  1080    /* RTC */
  1081    #ifdef __BIG_ENDIAN
  1082    #define rRTCCON         (*(volatile unsigned char *)0x57000043)
  1083    #define rTICNT          (*(volatile unsigned char *)0x57000047)
  1084    #define rRTCALM         (*(volatile unsigned char *)0x57000053)
  1085    #define rALMSEC         (*(volatile unsigned char *)0x57000057)
  1086    #define rALMMIN         (*(volatile unsigned char *)0x5700005B)
  1087    #define rALMHOUR        (*(volatile unsigned char *)0x5700005F)
  1088    #define rALMDATE        (*(volatile unsigned char *)0x57000063)
  1089    #define rALMMON         (*(volatile unsigned char *)0x57000067)
  1090    #define rALMYEAR        (*(volatile unsigned char *)0x5700006B)
  1091    #define rRTCRST         (*(volatile unsigned char *)0x5700006F)
  1092    #define rBCDSEC         (*(volatile unsigned char *)0x57000073)
  1093    #define rBCDMIN         (*(volatile unsigned char *)0x57000077)
  1094    #define rBCDHOUR        (*(volatile unsigned char *)0x5700007B)
  1095    #define rBCDDATE        (*(volatile unsigned char *)0x5700007F)
  1096    #define rBCDDAY         (*(volatile unsigned char *)0x57000083)
  1097    #define rBCDMON         (*(volatile unsigned char *)0x57000087)
  1098    #define rBCDYEAR        (*(volatile unsigned char *)0x5700008B)
  1099    #else /*  little endian */
  1100    #define rRTCCON         (*(volatile unsigned char *)0x57000040)
  1101    #define rTICNT          (*(volatile unsigned char *)0x57000044)
  1102    #define rRTCALM         (*(volatile unsigned char *)0x57000050)
  1103    #define rALMSEC         (*(volatile unsigned char *)0x57000054)
  1104    #define rALMMIN         (*(volatile unsigned char *)0x57000058)
  1105    #define rALMHOUR        (*(volatile unsigned char *)0x5700005C)
  1106    #define rALMDATE        (*(volatile unsigned char *)0x57000060)
  1107    #define rALMMON         (*(volatile unsigned char *)0x57000064)
  1108    #define rALMYEAR        (*(volatile unsigned char *)0x57000068)
  1109    #define rRTCRST         (*(volatile unsigned char *)0x5700006C)
  1110    #define rBCDSEC         (*(volatile unsigned char *)0x57000070)
  1111    #define rBCDMIN         (*(volatile unsigned char *)0x57000074)
  1112    #define rBCDHOUR        (*(volatile unsigned char *)0x57000078)
  1113    #define rBCDDATE        (*(volatile unsigned char *)0x5700007C)
  1114    #define rBCDDAY         (*(volatile unsigned char *)0x57000080)
  1115    #define rBCDMON         (*(volatile unsigned char *)0x57000084)
  1116    #define rBCDYEAR        (*(volatile unsigned char *)0x57000088)
  1117    #endif
  1118   
  1119   
  1120    /* ADC */
  1121    #define rADCCON         (*(volatile unsigned *)0x58000000)
  1122    #define rADCTSC         (*(volatile unsigned *)0x58000004)
  1123    #define rADCDLY         (*(volatile unsigned *)0x58000008)
  1124    #define rADCDAT0        (*(volatile unsigned *)0x5800000C)
  1125    #define rADCDAT1        (*(volatile unsigned *)0x58000010)
  1126   
  1127   
  1128    /* SPI */
  1129    #define rSPCON0         (*(volatile unsigned *)0x59000000)
  1130    #define rSPSTA0         (*(volatile unsigned *)0x59000004)
  1131    #define rSPPIN0         (*(volatile unsigned *)0x59000008)
  1132    #define rSPPRE0         (*(volatile unsigned *)0x5900000C)
  1133    #define rSPTDAT0        (*(volatile unsigned *)0x59000010)
  1134    #define rSPRDAT0        (*(volatile unsigned *)0x59000014)
  1135    #define rSPCON1         (*(volatile unsigned *)0x59000020)
  1136    #define rSPSTA1         (*(volatile unsigned *)0x59000024)
  1137    #define rSPPIN1         (*(volatile unsigned *)0x59000028)
  1138    #define rSPPRE1         (*(volatile unsigned *)0x5900002C)
  1139    #define rSPTDAT1        (*(volatile unsigned *)0x59000030)
  1140    #define rSPRDAT1        (*(volatile unsigned *)0x59000034)
  1141   
  1142   
  1143    /* SD INTERFACE */
  1144    #define rSDICON         (*(volatile unsigned *)0x5A000000)
  1145    #define rSDIPRE         (*(volatile unsigned *)0x5A000004)
  1146    #define rSDICmdArg      (*(volatile unsigned *)0x5A000008)
  1147    #define rSDICmdCon      (*(volatile unsigned *)0x5A00000C)
  1148    #define rSDICmdSta      (*(volatile unsigned *)0x5A000010)
  1149    #define rSDIRSP0        (*(volatile unsigned *)0x5A000014)
  1150    #define rSDIRSP1        (*(volatile unsigned *)0x5A000018)
  1151    #define rSDIRSP2        (*(volatile unsigned *)0x5A00001C)
  1152    #define rSDIRSP3        (*(volatile unsigned *)0x5A000020)
  1153    #define rSDIDTimer      (*(volatile unsigned *)0x5A000024)
  1154    #define rSDIBSize       (*(volatile unsigned *)0x5A000028)
  1155    #define rSDIDatCon      (*(volatile unsigned *)0x5A00002C)
  1156    #define rSDIDatCnt      (*(volatile unsigned *)0x5A000030)
  1157    #define rSDIDatSta      (*(volatile unsigned *)0x5A000034)
  1158    #define rSDIFSTA        (*(volatile unsigned *)0x5A000038)
  1159    #ifdef __BIG_ENDIAN
  1160    #define rSDIDAT         (*(volatile unsigned char *)0x5A00003F)
  1161    #else
  1162    #define rSDIDAT         (*(volatile unsigned char *)0x5A00003C)
  1163    #endif
  1164    #define rSDIIntMsk      (*(volatile unsigned *)0x5A000040)
  1165   
  1166    #endif
  1167   
  1168    #endif /*__S3C24X0_H__*/

/////////////

linux
相关资讯       mini2440 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款