2015-04-15 16:08:43 +08:00
|
|
|
/*
|
2021-04-09 10:52:34 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2015-04-15 16:08:43 +08:00
|
|
|
*
|
2021-04-09 10:52:34 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-15 16:08:43 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2015-04-14 ArdaFu first version
|
|
|
|
*/
|
2021-04-09 10:52:34 +08:00
|
|
|
|
2015-04-15 16:08:43 +08:00
|
|
|
/* write register a=address, v=value */
|
2021-04-09 10:52:34 +08:00
|
|
|
#define write_reg(a,v) (*(volatile unsigned int *)(a) = (v))
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Processor Reset */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_RSTC_PROCRST (1 << 0)
|
|
|
|
#define AT91_RSTC_PERRST (1 << 2)
|
|
|
|
#define AT91_RSTC_KEY (0xa5 << 24)
|
|
|
|
#define AT91_MATRIX_BASE (0XFFFFEE00)
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Master Remap Control Register */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_MATRIX_MRCR (AT91_MATRIX_BASE + 0x100)
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Remap Command for AHB Master 0 (ARM926EJ-S InSTRuction Master) */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_MATRIX_RCB0 (1 << 0)
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_MATRIX_RCB1 (1 << 1)
|
|
|
|
|
|
|
|
#define AT91_AIC_BASE (0XFFFFF000)
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Interrupt DisaBLe Command Register */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_AIC_IDCR (AT91_AIC_BASE + 0x124)
|
2015-04-14 21:56:34 +08:00
|
|
|
/* Interrupt Clear Command Register */
|
2015-04-15 16:08:43 +08:00
|
|
|
#define AT91_AIC_ICCR (AT91_AIC_BASE + 0x128)
|
|
|
|
|
|
|
|
#define AT91_WDT_BASE (0XFFFFFD40)
|
|
|
|
#define AT91_WDT_CR (AT91_WDT_BASE + 0x00)
|
|
|
|
#define AT91_WDT_CR_KEY (0xA5000000)
|
|
|
|
#define AT91_WDT_CR_WDRSTT (0x00000001)
|
|
|
|
#define AT91_WDT_MR (AT91_WDT_BASE + 0x04)
|
|
|
|
#define AT91_WDT_MR_WDDIS (0x00008000)
|
2015-04-14 21:56:34 +08:00
|
|
|
|
|
|
|
void rt_low_level_init(void)
|
|
|
|
{
|
|
|
|
// Mask all IRQs by clearing all bits in the INTMRS
|
2015-04-15 16:08:43 +08:00
|
|
|
write_reg(AT91_AIC_IDCR, 0xFFFFFFFF);
|
|
|
|
write_reg(AT91_AIC_ICCR, 0xFFFFFFFF);
|
2015-04-14 21:56:34 +08:00
|
|
|
// Remap internal ram to 0x00000000 Address
|
|
|
|
write_reg(AT91_MATRIX_MRCR, AT91_MATRIX_RCB0 | AT91_MATRIX_RCB1);
|
2015-04-15 16:08:43 +08:00
|
|
|
// Disable the watchdog
|
|
|
|
write_reg(AT91_WDT_CR, AT91_WDT_CR_KEY|AT91_WDT_CR_WDRSTT);
|
|
|
|
write_reg(AT91_WDT_MR, AT91_WDT_MR_WDDIS);
|
|
|
|
|
2015-04-14 21:56:34 +08:00
|
|
|
}
|
|
|
|
|