gonzui


Format: Advanced Search

tkernel_2/monitor/driver/flash/src/reset-em1d.cbare sourcepermlink (0.00 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      reset.c
   17:  *
   18:  *       Reset and reboot after Flash ROM write
   19:  */
   20: 
   21: #include "flash.h"
   22: #include <tk/sysdef.h>
   23: 
   24: IMPORT void _start( void );     /* start address after reset */
   25: 
   26: /*
   27:  * reset and reboot
   28:  */
   29: EXPORT void flashwr_reset( void )
   30: {
   31: #define PAGETBL_BASE    (_UW *)0x30000000
   32: 
   33:         void (* volatile reset_p)( void ) = 0;
   34: 
   35:         /* Remap the NOR FlashROM area to its original space, and jump */
   36:         *PAGETBL_BASE = 0x9402;        // Strongly-order, Kernel/RO
   37:         DSB();
   38:         Asm("mcr p15, 0, %0, cr8, cr7, 0":: "r"(0));   // I/D TLB invalidate
   39:         Asm("mcr p15, 0, %0, cr7, cr5, 6":: "r"(0));   // invalidate BTC
   40:         DSB();
   41:         ISB();
   42:         (*reset_p)();          /* call reset entry (does not return) */
   43: }