Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:47

0001 /*
0002  *  The license and distribution terms for this file may be
0003  *  found in the file LICENSE in this distribution or at
0004  *  http://www.rtems.org/license/LICENSE.
0005  *
0006  *  This is where the real hardware setup is done. A minimal stack
0007  *  has been provided by the start.S code. No normal C or RTEMS
0008  *  functions can be called from here.
0009  */
0010 
0011 #include <bsp.h>
0012 #include <bsp/bootcard.h>
0013 
0014 extern void _wr_vbr(uint32_t);
0015 
0016 extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount;
0017 
0018 /*
0019  * From linkcmds
0020  */
0021 
0022 extern uint8_t _INTERRUPT_VECTOR[];
0023 
0024 extern uint8_t _clear_start[];
0025 extern uint8_t _clear_end[];
0026 
0027 extern uint8_t _data_src_start[];
0028 extern uint8_t _data_dest_start[];
0029 extern uint8_t _data_dest_end[];
0030 
0031 void Init5225x(void)
0032 {
0033   register uint32_t i;
0034   register uint32_t *dp, *sp;
0035   register uint8_t *dbp, *sbp;
0036 
0037   /* 
0038    * Copy the vector table to RAM 
0039    */
0040 
0041   if (&_VBR != (void *)_INTERRUPT_VECTOR) {
0042     sp = (uint32_t *) _INTERRUPT_VECTOR;
0043     dp = (uint32_t *) &_VBR;
0044     for (i = 0; i < 256; i++) {
0045       *dp++ = *sp++;
0046     }
0047   }
0048 
0049   /* 
0050    * Move initialized data from ROM to RAM. 
0051    */
0052   if (_data_src_start != _data_dest_start) {
0053     dbp = (uint8_t *) _data_dest_start;
0054     sbp = (uint8_t *) _data_src_start;
0055     i = _data_dest_end - _data_dest_start;
0056     while (i--)
0057       *dbp++ = *sbp++;
0058   }
0059 
0060     asm __volatile__ ("move.l %%d5,%0\n\t":"=r" (_d0_reset));
0061     asm __volatile__ ("move.l %%d6,%0\n\t":"=r" (_d1_reset));
0062   
0063   /* 
0064    * Zero uninitialized data 
0065    */
0066 
0067   if (_clear_start != _clear_end) {
0068     sbp = _clear_start;
0069     dbp = _clear_end;
0070     i = dbp - sbp;
0071     while (i--)
0072       *sbp++ = 0;
0073   }
0074 
0075 //_wr_vbr((uint32_t) &_VBR);
0076     asm volatile("move.l %0,%%d7;movec %%d7,%%vbr\n\t"::"i"(&_VBR): "cc");
0077 
0078   /*
0079    * We have to call some kind of RTEMS function here!
0080    */
0081 
0082   boot_card(0);
0083   for (;;) ;
0084 }