Fix init of vector table

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2540 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-02-24 02:28:51 +00:00
parent 756cb31808
commit a0f80361d3
3 changed files with 35 additions and 12 deletions

View File

@ -238,14 +238,29 @@ static void up_vectormapping(void)
static void up_copyvectorblock(void)
{
/* Copy the vectors into ISRAM at the address that will be mapped to the vector
* address:
*
* LPC313X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM
* LPC313X_VECTOR_VSRAM - Virtual address of vector table in SRAM
* LPC313X_VECTOR_VADDR - Virtual address of vector table (0x00000000 or 0xffff0000)
*/
uint32_t *src = (uint32_t*)&_vector_start;
uint32_t *end = (uint32_t*)&_vector_end;
uint32_t *dest = (uint32_t*)LPC313X_VECTOR_VADDR;
uint32_t *dest = (uint32_t*)LPC313X_VECTOR_VSRAM;
while (src < end)
{
*dest++ = *src++;
}
/* Then set the LPC313x shadow register, LPC313X_SYSCREG_ARM926SHADOWPTR, so that
* the vector table is mapped to address 0x0000:0000 - NOTE: that there is not yet
* full support for the vector table at address 0xffff0000.
*/
putreg32(LPC313X_VECTOR_PADDR, LPC313X_SYSCREG_ARM926SHADOWPTR);
}
/************************************************************************************

View File

@ -318,21 +318,29 @@
#define PGTABLE_COARSE_ALLOC (PGTABLE_COARSE_END_VADDR-PGTABLE_COARSE_BASE_VADDR)
#define PGTABLE_NCOARSE_TABLES (PGTABLE_COARSE_SIZE / PGTBALE_COARSE_TABLE_ALLOC)
/* Determine the base address of the vector table */
/* Determine the base address of the vector table:
*
* LPC313X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM
* LPC313X_VECTOR_VSRAM - Virtual address of vector table in SRAM
* LPC313X_VECTOR_VADDR - Virtual address of vector table (0x00000000 or 0xffff0000)
*/
#define VECTOR_TABLE_SIZE 0x00010000
#define VECTOR_TABLE_SIZE 0x00010000
#ifdef CONFIG_ARCH_LOWVECTORS /* Vectors located at 0x0000:0000 */
# define LPC313X_VECTOR_PADDR LPC313X_SHADOWSPACE_PSECTION
# define LPC313X_VECTOR_VADDR 0x00000000
# define LPC313X_VECTOR_VCOARSE 0x00000000
#else /* Vectors located at 0xffff:0000 */
# define LPC313X_VECTOR_PADDR LPC313X_INTSRAM0_PADDR
# define LPC313X_VECTOR_VSRAM LPC313X_INTSRAM0_VADDR
# define LPC313X_VECTOR_VADDR 0x00000000
# define LPC313X_VECTOR_VCOARSE 0x00000000
#else /* Vectors located at 0xffff:0000 -- this probably does not work */
# if CONFIG_ARCH_CHIP_LPC3131
# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM1_PADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE)
# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM1_PADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE)
# define LPC313X_VECTOR_VSRAM (LPC313X_INTSRAM1_VADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE)
# else
# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM0_PADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE)
# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM0_PADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE)
# define LPC313X_VECTOR_VSRAM (LPC313X_INTSRAM0_VADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE)
# endif
# define LPC313X_VECTOR_VADDR 0xffff0000
# define LPC313X_VECTOR_VCOARSE 0xfff00000
# define LPC313X_VECTOR_VADDR 0xffff0000
# define LPC313X_VECTOR_VCOARSE 0xfff00000
#endif
/************************************************************************************

View File

@ -94,7 +94,7 @@ void lpc313x_resetclks(void)
bcrndx = lp313x_bcrndx((enum lpc313x_domainid_e)i);
if (bcrndx != BCRNDX_INVALID)
{
/* Yes.. isable all BCRs */
/* Yes.. disable all BCRs */
putreg32(0, LPC313X_CGU_BCR(bcrndx));
}