summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweety <[email protected]>2013-07-21 17:19:30 +0800
committerweety <[email protected]>2013-07-21 17:19:30 +0800
commit3bdbf640b7bcdc40a2d5171b67e50f92bbd588f6 (patch)
tree104ec0b9cf631b557e9bd09c309669887303c154
parent885301bb14f34e840beb14ca2ee1b7b28012e294 (diff)
update at91sam9260 project directory structure.
-rwxr-xr-xbsp/at91sam9260/SConscript30
-rw-r--r--bsp/at91sam9260/applications/SConscript11
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/applications/application.c (renamed from bsp/at91sam9260/application.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/applications/startup.c (renamed from bsp/at91sam9260/startup.c)0
-rw-r--r--bsp/at91sam9260/drivers/SConscript31
-rw-r--r--bsp/at91sam9260/drivers/at91_i2c_gpio.c (renamed from bsp/at91sam9260/at91_i2c_gpio.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/at91_mci.c (renamed from bsp/at91sam9260/at91_mci.c)0
-rw-r--r--bsp/at91sam9260/drivers/at91_mci.h (renamed from bsp/at91sam9260/at91_mci.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/board.c (renamed from bsp/at91sam9260/board.c)13
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/board.h (renamed from bsp/at91sam9260/board.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/led.c (renamed from bsp/at91sam9260/led.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/led.h (renamed from bsp/at91sam9260/led.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/macb.c (renamed from bsp/at91sam9260/macb.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/drivers/macb.h (renamed from bsp/at91sam9260/macb.h)0
-rw-r--r--bsp/at91sam9260/drivers/mii.h (renamed from bsp/at91sam9260/mii.h)0
-rw-r--r--bsp/at91sam9260/drivers/usart.c (renamed from bsp/at91sam9260/usart.c)0
-rw-r--r--bsp/at91sam9260/platform/SConscript26
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_aic.h (renamed from libcpu/arm/at91sam926x/at91_aic.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_pdc.h (renamed from libcpu/arm/at91sam926x/at91_pdc.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_pio.h (renamed from libcpu/arm/at91sam926x/at91_pio.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_pit.h (renamed from libcpu/arm/at91sam926x/at91_pit.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_pmc.h (renamed from libcpu/arm/at91sam926x/at91_pmc.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_rstc.h (renamed from libcpu/arm/at91sam926x/at91_rstc.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_serial.h (renamed from libcpu/arm/at91sam926x/at91_serial.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_shdwc.h (renamed from libcpu/arm/at91sam926x/at91_shdwc.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91_tc.h (renamed from libcpu/arm/at91sam926x/at91_tc.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91sam9260_matrix.h (renamed from libcpu/arm/at91sam926x/at91sam9260_matrix.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/at91sam926x.h (renamed from libcpu/arm/at91sam926x/at91sam926x.h)0
-rw-r--r--bsp/at91sam9260/platform/gpio.h (renamed from libcpu/arm/at91sam926x/gpio.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/interrupt.c (renamed from libcpu/arm/at91sam926x/interrupt.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/io.h (renamed from libcpu/arm/at91sam926x/io.h)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/irq.h (renamed from libcpu/arm/at91sam926x/irq.h)0
-rw-r--r--bsp/at91sam9260/platform/reset.c34
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/start_gcc.S (renamed from libcpu/arm/at91sam926x/start_gcc.S)0
-rw-r--r--bsp/at91sam9260/platform/start_rvds.S (renamed from libcpu/arm/at91sam926x/start_rvds.S)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/system_clock.c (renamed from libcpu/arm/at91sam926x/system_clock.c)0
-rw-r--r--[-rwxr-xr-x]bsp/at91sam9260/platform/trap.c (renamed from libcpu/arm/at91sam926x/trap.c)1
-rwxr-xr-xbsp/at91sam9260/rtconfig.py2
-rw-r--r--[-rwxr-xr-x]libcpu/arm/arm926/context_gcc.S (renamed from libcpu/arm/at91sam926x/context_gcc.S)0
-rw-r--r--libcpu/arm/arm926/context_rvds.S (renamed from libcpu/arm/at91sam926x/context_rvds.S)0
-rw-r--r--[-rwxr-xr-x]libcpu/arm/arm926/cpuport.c (renamed from libcpu/arm/at91sam926x/cpu.c)23
-rw-r--r--libcpu/arm/arm926/mmu.c (renamed from libcpu/arm/at91sam926x/mmu.c)39
-rw-r--r--libcpu/arm/arm926/mmu.h53
-rw-r--r--[-rwxr-xr-x]libcpu/arm/arm926/stack.c (renamed from libcpu/arm/at91sam926x/stack.c)0
44 files changed, 190 insertions, 73 deletions
diff --git a/bsp/at91sam9260/SConscript b/bsp/at91sam9260/SConscript
index c754911e9d..fe0ae941ae 100755
--- a/bsp/at91sam9260/SConscript
+++ b/bsp/at91sam9260/SConscript
@@ -1,24 +1,14 @@
-import rtconfig
+# for module compiling
+import os
Import('RTT_ROOT')
-from building import *
-src_bsp = ['application.c', 'startup.c', 'board.c']
-src_drv = ['usart.c']
+cwd = str(Dir('#'))
+objs = []
+list = os.listdir(cwd)
-if GetDepend('RT_USING_LED'):
- src_drv += ['led.c']
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
-if GetDepend('RT_USING_SDIO'):
- src_drv += ['at91_mci.c']
-
-if GetDepend('RT_USING_LWIP'):
- src_drv += ['macb.c']
-
-if GetDepend('RT_USING_I2C') and GetDepend('RT_USING_I2C_BITOPS'):
- src_drv += ['at91_i2c_gpio.c']
-
-src = File(src_bsp + src_drv)
-CPPPATH = [RTT_ROOT + '/bsp/at91sam9260']
-group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
-
-Return('group')
+Return('objs')
diff --git a/bsp/at91sam9260/applications/SConscript b/bsp/at91sam9260/applications/SConscript
new file mode 100644
index 0000000000..01eb940dfb
--- /dev/null
+++ b/bsp/at91sam9260/applications/SConscript
@@ -0,0 +1,11 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = os.path.join(str(Dir('#')), 'applications')
+src = Glob('*.c')
+CPPPATH = [cwd, str(Dir('#'))]
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/at91sam9260/application.c b/bsp/at91sam9260/applications/application.c
index 95eed6572e..95eed6572e 100755..100644
--- a/bsp/at91sam9260/application.c
+++ b/bsp/at91sam9260/applications/application.c
diff --git a/bsp/at91sam9260/startup.c b/bsp/at91sam9260/applications/startup.c
index 2a06126b36..2a06126b36 100755..100644
--- a/bsp/at91sam9260/startup.c
+++ b/bsp/at91sam9260/applications/startup.c
diff --git a/bsp/at91sam9260/drivers/SConscript b/bsp/at91sam9260/drivers/SConscript
new file mode 100644
index 0000000000..d0470f9049
--- /dev/null
+++ b/bsp/at91sam9260/drivers/SConscript
@@ -0,0 +1,31 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = os.path.join(str(Dir('#')), 'drivers')
+
+# add the general drvers.
+src = Split("""
+board.c
+usart.c
+""")
+
+# add Ethernet drvers.
+if GetDepend('RT_USING_LED'):
+ src += ['led.c']
+
+if GetDepend('RT_USING_SDIO'):
+ src += ['at91_mci.c']
+
+if GetDepend('RT_USING_LWIP'):
+ src += ['macb.c']
+
+if GetDepend('RT_USING_I2C') and GetDepend('RT_USING_I2C_BITOPS'):
+ src += ['at91_i2c_gpio.c']
+
+
+CPPPATH = [cwd]
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/at91sam9260/at91_i2c_gpio.c b/bsp/at91sam9260/drivers/at91_i2c_gpio.c
index bbee2033aa..bbee2033aa 100644
--- a/bsp/at91sam9260/at91_i2c_gpio.c
+++ b/bsp/at91sam9260/drivers/at91_i2c_gpio.c
diff --git a/bsp/at91sam9260/at91_mci.c b/bsp/at91sam9260/drivers/at91_mci.c
index 39fd364f11..39fd364f11 100755..100644
--- a/bsp/at91sam9260/at91_mci.c
+++ b/bsp/at91sam9260/drivers/at91_mci.c
diff --git a/bsp/at91sam9260/at91_mci.h b/bsp/at91sam9260/drivers/at91_mci.h
index 3a726aabe2..3a726aabe2 100644
--- a/bsp/at91sam9260/at91_mci.h
+++ b/bsp/at91sam9260/drivers/at91_mci.h
diff --git a/bsp/at91sam9260/board.c b/bsp/at91sam9260/drivers/board.c
index 81f156d158..a9ac7f07e2 100755..100644
--- a/bsp/at91sam9260/board.c
+++ b/bsp/at91sam9260/drivers/board.c
@@ -16,6 +16,7 @@
#include <rthw.h>
#include "board.h"
+#include <mmu.h>
/**
* @addtogroup at91sam9260
@@ -24,13 +25,21 @@
extern void rt_hw_clock_init(void);
-extern void rt_hw_mmu_init(void);
extern void rt_hw_get_clock(void);
extern void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn);
extern void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv);
extern void rt_dbgu_isr(void);
+static struct mem_desc at91_mem_desc[] = {
+ { 0x00000000, 0xFFFFFFFF, 0x00000000, RW_NCNB }, /* None cached for 4G memory */
+ { 0x20000000, 0x24000000-1, 0x20000000, RW_CB }, /* 64M cached SDRAM memory */
+ { 0x00000000, 0x100000, 0x20000000, RW_CB }, /* isr vector table */
+ { 0x90000000, 0x90400000 - 1, 0x00200000, RW_NCNB }, /* 4K SRAM0 + 4k SRAM1 */
+ { 0xA0000000, 0xA4000000-1, 0x20000000, RW_NCNB } /* 64M none-cached SDRAM memory */
+};
+
+
#define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
#define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20)
@@ -132,7 +141,7 @@ void rt_hw_board_init()
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
/* initialize mmu */
- rt_hw_mmu_init();
+ rt_hw_mmu_init(at91_mem_desc, sizeof(at91_mem_desc)/sizeof(at91_mem_desc[0]));
/* initialize timer0 */
rt_hw_timer_init();
diff --git a/bsp/at91sam9260/board.h b/bsp/at91sam9260/drivers/board.h
index 59992480ed..59992480ed 100755..100644
--- a/bsp/at91sam9260/board.h
+++ b/bsp/at91sam9260/drivers/board.h
diff --git a/bsp/at91sam9260/led.c b/bsp/at91sam9260/drivers/led.c
index f3fddcce53..f3fddcce53 100755..100644
--- a/bsp/at91sam9260/led.c
+++ b/bsp/at91sam9260/drivers/led.c
diff --git a/bsp/at91sam9260/led.h b/bsp/at91sam9260/drivers/led.h
index 71fd6947e6..71fd6947e6 100755..100644
--- a/bsp/at91sam9260/led.h
+++ b/bsp/at91sam9260/drivers/led.h
diff --git a/bsp/at91sam9260/macb.c b/bsp/at91sam9260/drivers/macb.c
index 293a0662db..293a0662db 100755..100644
--- a/bsp/at91sam9260/macb.c
+++ b/bsp/at91sam9260/drivers/macb.c
diff --git a/bsp/at91sam9260/macb.h b/bsp/at91sam9260/drivers/macb.h
index 4697790f62..4697790f62 100755..100644
--- a/bsp/at91sam9260/macb.h
+++ b/bsp/at91sam9260/drivers/macb.h
diff --git a/bsp/at91sam9260/mii.h b/bsp/at91sam9260/drivers/mii.h
index 8c932039eb..8c932039eb 100644
--- a/bsp/at91sam9260/mii.h
+++ b/bsp/at91sam9260/drivers/mii.h
diff --git a/bsp/at91sam9260/usart.c b/bsp/at91sam9260/drivers/usart.c
index 11823b9c8c..11823b9c8c 100644
--- a/bsp/at91sam9260/usart.c
+++ b/bsp/at91sam9260/drivers/usart.c
diff --git a/bsp/at91sam9260/platform/SConscript b/bsp/at91sam9260/platform/SConscript
new file mode 100644
index 0000000000..1f5de6e772
--- /dev/null
+++ b/bsp/at91sam9260/platform/SConscript
@@ -0,0 +1,26 @@
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = GetCurrentDir()
+CPPPATH = [cwd]
+
+# The set of source files associated with this SConscript file.
+if rtconfig.PLATFORM == 'armcc':
+ src = Glob('*.c') + Glob('*_rvds.S')
+
+if rtconfig.PLATFORM == 'gcc':
+ src = Glob('*.c') + Glob('*_gcc.S') + Glob('*_init.S')
+
+if rtconfig.PLATFORM == 'iar':
+ src = Glob('*.c') + Glob('*_iar.S')
+
+if rtconfig.PLATFORM == 'cl':
+ src = Glob('*.c')
+
+if rtconfig.PLATFORM == 'mingw':
+ src = Glob('*.c')
+
+group = DefineGroup('platform', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/libcpu/arm/at91sam926x/at91_aic.h b/bsp/at91sam9260/platform/at91_aic.h
index 6de01c4444..6de01c4444 100755..100644
--- a/libcpu/arm/at91sam926x/at91_aic.h
+++ b/bsp/at91sam9260/platform/at91_aic.h
diff --git a/libcpu/arm/at91sam926x/at91_pdc.h b/bsp/at91sam9260/platform/at91_pdc.h
index 1e52944c92..1e52944c92 100755..100644
--- a/libcpu/arm/at91sam926x/at91_pdc.h
+++ b/bsp/at91sam9260/platform/at91_pdc.h
diff --git a/libcpu/arm/at91sam926x/at91_pio.h b/bsp/at91sam9260/platform/at91_pio.h
index 917d1e2c9d..917d1e2c9d 100755..100644
--- a/libcpu/arm/at91sam926x/at91_pio.h
+++ b/bsp/at91sam9260/platform/at91_pio.h
diff --git a/libcpu/arm/at91sam926x/at91_pit.h b/bsp/at91sam9260/platform/at91_pit.h
index 00e2df1f3e..00e2df1f3e 100755..100644
--- a/libcpu/arm/at91sam926x/at91_pit.h
+++ b/bsp/at91sam9260/platform/at91_pit.h
diff --git a/libcpu/arm/at91sam926x/at91_pmc.h b/bsp/at91sam9260/platform/at91_pmc.h
index 39e7699d1c..39e7699d1c 100755..100644
--- a/libcpu/arm/at91sam926x/at91_pmc.h
+++ b/bsp/at91sam9260/platform/at91_pmc.h
diff --git a/libcpu/arm/at91sam926x/at91_rstc.h b/bsp/at91sam9260/platform/at91_rstc.h
index efa302830d..efa302830d 100755..100644
--- a/libcpu/arm/at91sam926x/at91_rstc.h
+++ b/bsp/at91sam9260/platform/at91_rstc.h
diff --git a/libcpu/arm/at91sam926x/at91_serial.h b/bsp/at91sam9260/platform/at91_serial.h
index 6c476d3f6f..6c476d3f6f 100755..100644
--- a/libcpu/arm/at91sam926x/at91_serial.h
+++ b/bsp/at91sam9260/platform/at91_serial.h
diff --git a/libcpu/arm/at91sam926x/at91_shdwc.h b/bsp/at91sam9260/platform/at91_shdwc.h
index 059a22e121..059a22e121 100755..100644
--- a/libcpu/arm/at91sam926x/at91_shdwc.h
+++ b/bsp/at91sam9260/platform/at91_shdwc.h
diff --git a/libcpu/arm/at91sam926x/at91_tc.h b/bsp/at91sam9260/platform/at91_tc.h
index f7fb920baa..f7fb920baa 100755..100644
--- a/libcpu/arm/at91sam926x/at91_tc.h
+++ b/bsp/at91sam9260/platform/at91_tc.h
diff --git a/libcpu/arm/at91sam926x/at91sam9260_matrix.h b/bsp/at91sam9260/platform/at91sam9260_matrix.h
index 4405c58b8f..4405c58b8f 100755..100644
--- a/libcpu/arm/at91sam926x/at91sam9260_matrix.h
+++ b/bsp/at91sam9260/platform/at91sam9260_matrix.h
diff --git a/libcpu/arm/at91sam926x/at91sam926x.h b/bsp/at91sam9260/platform/at91sam926x.h
index 2301140d24..2301140d24 100755..100644
--- a/libcpu/arm/at91sam926x/at91sam926x.h
+++ b/bsp/at91sam9260/platform/at91sam926x.h
diff --git a/libcpu/arm/at91sam926x/gpio.h b/bsp/at91sam9260/platform/gpio.h
index 1872d3d68d..1872d3d68d 100644
--- a/libcpu/arm/at91sam926x/gpio.h
+++ b/bsp/at91sam9260/platform/gpio.h
diff --git a/libcpu/arm/at91sam926x/interrupt.c b/bsp/at91sam9260/platform/interrupt.c
index 0a1809e43b..0a1809e43b 100755..100644
--- a/libcpu/arm/at91sam926x/interrupt.c
+++ b/bsp/at91sam9260/platform/interrupt.c
diff --git a/libcpu/arm/at91sam926x/io.h b/bsp/at91sam9260/platform/io.h
index 3afdd1ceff..3afdd1ceff 100755..100644
--- a/libcpu/arm/at91sam926x/io.h
+++ b/bsp/at91sam9260/platform/io.h
diff --git a/libcpu/arm/at91sam926x/irq.h b/bsp/at91sam9260/platform/irq.h
index b56d9a1f79..b56d9a1f79 100755..100644
--- a/libcpu/arm/at91sam926x/irq.h
+++ b/bsp/at91sam9260/platform/irq.h
diff --git a/bsp/at91sam9260/platform/reset.c b/bsp/at91sam9260/platform/reset.c
new file mode 100644
index 0000000000..e116304dd4
--- /dev/null
+++ b/bsp/at91sam9260/platform/reset.c
@@ -0,0 +1,34 @@
+/*
+ * File : reset.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2011-01-13 weety modified from mini2440
+ */
+
+#include <rthw.h>
+#include <rtthread.h>
+#include "at91sam926x.h"
+
+/**
+ * @addtogroup AT91SAM926X
+ */
+/*@{*/
+
+void machine_reset(void)
+{
+ at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
+}
+
+void machine_shutdown(void)
+{
+ at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
+}
+
+/*@}*/
diff --git a/libcpu/arm/at91sam926x/start_gcc.S b/bsp/at91sam9260/platform/start_gcc.S
index f2ac7ad6e7..f2ac7ad6e7 100755..100644
--- a/libcpu/arm/at91sam926x/start_gcc.S
+++ b/bsp/at91sam9260/platform/start_gcc.S
diff --git a/libcpu/arm/at91sam926x/start_rvds.S b/bsp/at91sam9260/platform/start_rvds.S
index 49ad09ea17..49ad09ea17 100644
--- a/libcpu/arm/at91sam926x/start_rvds.S
+++ b/bsp/at91sam9260/platform/start_rvds.S
diff --git a/libcpu/arm/at91sam926x/system_clock.c b/bsp/at91sam9260/platform/system_clock.c
index 8af42bfccf..8af42bfccf 100755..100644
--- a/libcpu/arm/at91sam926x/system_clock.c
+++ b/bsp/at91sam9260/platform/system_clock.c
diff --git a/libcpu/arm/at91sam926x/trap.c b/bsp/at91sam9260/platform/trap.c
index 9be71ddcae..6735ffd238 100755..100644
--- a/libcpu/arm/at91sam926x/trap.c
+++ b/bsp/at91sam9260/platform/trap.c
@@ -156,7 +156,6 @@ void rt_hw_trap_irq()
at91_sys_write(AT91_AIC_EOICR, 0);
return;
}
- //at91_sys_write(AT91_AIC_EOICR, 0x55555555);
/* get interrupt service routine */
isr_func = irq_desc[irq].handler;
diff --git a/bsp/at91sam9260/rtconfig.py b/bsp/at91sam9260/rtconfig.py
index 07432cedc0..10870f8807 100755
--- a/bsp/at91sam9260/rtconfig.py
+++ b/bsp/at91sam9260/rtconfig.py
@@ -2,7 +2,7 @@ import os
# toolchains options
ARCH = 'arm'
-CPU = 'at91sam926x'
+CPU = 'arm926'
TextBase = '0x20000000'
CROSS_TOOL = 'gcc'
diff --git a/libcpu/arm/at91sam926x/context_gcc.S b/libcpu/arm/arm926/context_gcc.S
index 30d8235331..30d8235331 100755..100644
--- a/libcpu/arm/at91sam926x/context_gcc.S
+++ b/libcpu/arm/arm926/context_gcc.S
diff --git a/libcpu/arm/at91sam926x/context_rvds.S b/libcpu/arm/arm926/context_rvds.S
index 86f13dd1ba..86f13dd1ba 100644
--- a/libcpu/arm/at91sam926x/context_rvds.S
+++ b/libcpu/arm/arm926/context_rvds.S
diff --git a/libcpu/arm/at91sam926x/cpu.c b/libcpu/arm/arm926/cpuport.c
index dce573c83d..caddf45a96 100755..100644
--- a/libcpu/arm/at91sam926x/cpu.c
+++ b/libcpu/arm/arm926/cpuport.c
@@ -14,16 +14,13 @@
#include <rthw.h>
#include <rtthread.h>
-#include "at91sam926x.h"
-
-/**
- * @addtogroup AT91SAM926X
- */
-/*@{*/
#define ICACHE_MASK (rt_uint32_t)(1 << 12)
#define DCACHE_MASK (rt_uint32_t)(1 << 2)
+extern void machine_reset(void);
+extern void machine_shutdown(void);
+
#ifdef __GNUC__
rt_inline rt_uint32_t cp15_rd(void)
{
@@ -148,16 +145,6 @@ rt_base_t rt_hw_cpu_dcache_status()
return (cp15_rd() & DCACHE_MASK);
}
-static void at91sam9260_reset(void)
-{
- at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
-}
-
-static void at91sam9260_poweroff(void)
-{
- at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
-}
-
/**
* reset cpu by dog's time-out
*
@@ -166,7 +153,7 @@ void rt_hw_cpu_reset()
{
rt_kprintf("Restarting system...\n");
- at91sam9260_reset();
+ machine_reset();
while(1); /* loop forever and wait for reset to happen */
@@ -183,7 +170,7 @@ void rt_hw_cpu_shutdown()
rt_kprintf("shutdown...\n");
level = rt_hw_interrupt_disable();
- at91sam9260_poweroff();
+ machine_shutdown();
while (level)
{
RT_ASSERT(0);
diff --git a/libcpu/arm/at91sam926x/mmu.c b/libcpu/arm/arm926/mmu.c
index 5b88eee27c..c14f22bd84 100644
--- a/libcpu/arm/at91sam926x/mmu.c
+++ b/libcpu/arm/arm926/mmu.c
@@ -11,31 +11,7 @@
* Date Author Notes
*/
-#include <rtthread.h>
-
-#define CACHE_LINE_SIZE 32
-
-#define DESC_SEC (0x2|(1<<4))
-#define CB (3<<2) //cache_on, write_back
-#define CNB (2<<2) //cache_on, write_through
-#define NCB (1<<2) //cache_off,WR_BUF on
-#define NCNB (0<<2) //cache_off,WR_BUF off
-#define AP_RW (3<<10) //supervisor=RW, user=RW
-#define AP_RO (2<<10) //supervisor=RW, user=RO
-
-#define DOMAIN_FAULT (0x0)
-#define DOMAIN_CHK (0x1)
-#define DOMAIN_NOTCHK (0x3)
-#define DOMAIN0 (0x0<<5)
-#define DOMAIN1 (0x1<<5)
-
-#define DOMAIN0_ATTR (DOMAIN_CHK<<0)
-#define DOMAIN1_ATTR (DOMAIN_FAULT<<2)
-
-#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */
-#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */
-#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
-#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
+#include "mmu.h"
#ifdef __CC_ARM
void mmu_setttbase(rt_uint32_t i)
@@ -459,7 +435,7 @@ void mmu_setmtt(rt_uint32_t vaddrStart, rt_uint32_t vaddrEnd, rt_uint32_t paddrS
}
}
-void rt_hw_mmu_init(void)
+void rt_hw_mmu_init(struct mem_desc *mdesc, rt_uint32_t size)
{
/* disable I/D cache */
mmu_disable_dcache();
@@ -468,11 +444,12 @@ void rt_hw_mmu_init(void)
mmu_invalidate_tlb();
/* set page table */
- mmu_setmtt(0x00000000, 0xFFFFFFFF, 0x00000000, RW_NCNB); /* None cached for 4G memory */
- mmu_setmtt(0x20000000, 0x24000000-1, 0x20000000, RW_CB); /* 64M cached SDRAM memory */
- mmu_setmtt(0x00000000, 0x100000, 0x20000000, RW_CB); /* isr vector table */
- mmu_setmtt(0x90000000, 0x90400000 - 1, 0x00200000, RW_NCNB); /* 4K SRAM0 + 4k SRAM1 */
- mmu_setmtt(0xA0000000, 0xA4000000-1, 0x20000000, RW_NCNB); /* 64M none-cached SDRAM memory */
+ for (; size > 0; size--)
+ {
+ mmu_setmtt(mdesc->vaddr_start, mdesc->vaddr_end,
+ mdesc->paddr_start, mdesc->attr);
+ mdesc++;
+ }
/* set MMU table address */
mmu_setttbase((rt_uint32_t)_page_table);
diff --git a/libcpu/arm/arm926/mmu.h b/libcpu/arm/arm926/mmu.h
new file mode 100644
index 0000000000..e45d3b0239
--- /dev/null
+++ b/libcpu/arm/arm926/mmu.h
@@ -0,0 +1,53 @@
+/*
+ * File : mmu.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
+#ifndef __MMU_H__
+#define __MMU_H__
+
+#include <rtthread.h>
+
+#define CACHE_LINE_SIZE 32
+
+#define DESC_SEC (0x2|(1<<4))
+#define CB (3<<2) //cache_on, write_back
+#define CNB (2<<2) //cache_on, write_through
+#define NCB (1<<2) //cache_off,WR_BUF on
+#define NCNB (0<<2) //cache_off,WR_BUF off
+#define AP_RW (3<<10) //supervisor=RW, user=RW
+#define AP_RO (2<<10) //supervisor=RW, user=RO
+
+#define DOMAIN_FAULT (0x0)
+#define DOMAIN_CHK (0x1)
+#define DOMAIN_NOTCHK (0x3)
+#define DOMAIN0 (0x0<<5)
+#define DOMAIN1 (0x1<<5)
+
+#define DOMAIN0_ATTR (DOMAIN_CHK<<0)
+#define DOMAIN1_ATTR (DOMAIN_FAULT<<2)
+
+#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */
+#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */
+#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
+#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
+
+struct mem_desc {
+ rt_uint32_t vaddr_start;
+ rt_uint32_t vaddr_end;
+ rt_uint32_t paddr_start;
+ rt_uint32_t attr;
+};
+
+void rt_hw_mmu_init(struct mem_desc *mdesc, rt_uint32_t size);
+
+#endif
+
diff --git a/libcpu/arm/at91sam926x/stack.c b/libcpu/arm/arm926/stack.c
index 7075fcff80..7075fcff80 100755..100644
--- a/libcpu/arm/at91sam926x/stack.c
+++ b/libcpu/arm/arm926/stack.c