
/*
 * A simple program that demonstrates executing NAPA code
 * start in ROM, jump to this program in SRAM - setup TTB entries (for SRAM and NAPA),
 * enables I+D cache, enables MMU and then jump to NAPA.
 * NAPA code mapped at 0x00012500
 *
 */

#include "mmu.h"
#include "proto.h"

extern void initChip();

void
_user_start (void)
{
    initChip();
    bootPPC();

    // NAPA VA=PA sections

    setupSectionEntry ((unsigned int *)TRANS_TABLE_ADDR, 0x00012000 >> 20,
                         WRITEBACK_SECTION);

    // SRAM VA=PA sections
    setupSectionEntry ((unsigned int *)TRANS_TABLE_ADDR, 0x0d020000 >> 20,
                         NONBUFFERED_SECTION);
    setupSectionEntry ((unsigned int *)TRANS_TABLE_ADDR, 0x0d400000 >> 20,
                         WRITEBACK_SECTION);
    setupSectionEntry ((unsigned int *)TRANS_TABLE_ADDR, 0x0d800000 >> 20,
                         NONBUFFERED_SECTION);
    setupSectionEntry ((unsigned int *)TRANS_TABLE_ADDR, 0xfff00000 >> 20,
                         WRITEBACK_SECTION);

    enableDCache ();

    enableICache ();

    setupMmuCltAccess ();

    asm ("ldr sp, =0x00016500");
    asm ("ldr pc, =0x00012000");
}

/* eof */
