⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 romstart.c

📁 IXP425的BSP代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* forward declarations */LOCAL void copyLongs (FAST UINT *source, FAST UINT *destination, UINT nlongs);#ifdef	ROMSTART_BOOT_CLEARLOCAL void fillLongs (FAST UINT *buf, UINT nlongs, FAST UINT val);LOCAL void bootClear (void);#endif/* imports */IMPORT STATUS   UNCMP_RTN ();IMPORT void     relocEntry ();IMPORT UCHAR    binArrayStart [];       /* compressed binary image */IMPORT UCHAR    binArrayEnd [];		/* end of compressed binary image */IMPORT char     etext [];               /* defined by the loader */IMPORT char     end [];                 /* defined by the loader */IMPORT char     wrs_kernel_data_end []; /* defined by the loader */#ifdef	ROM_COMPRESS/********************************************************************************* romStart - generic ROM initialization for compressed images** This is the first C code executed after reset.** This routine is called by the assembly start-up code in romInit().* It clears memory, copies ROM to RAM, and invokes the uncompressor.* It then jumps to the entry point of the uncompressed object code.** RETURNS: N/A*/void romStart    (    FAST int startType		/* start type */    )    {    volatile FUNCPTR absEntry = (volatile FUNCPTR)RAM_DST_ADRS;    /* relocate the data segment of the decompression stub */    copyLongs (ROM_DATA_ADRS, (UINT *)UNCACHED(RAM_DATA_ADRS),              ((UINT)binArrayStart - (UINT)RAM_DATA_ADRS) / sizeof (long));    copyLongs ((UINT *)((UINT)ROM_DATA_ADRS + ((UINT)BINARRAYEND_ROUNDOFF -          (UINT)RAM_DATA_ADRS)), (UINT *)UNCACHED(BINARRAYEND_ROUNDOFF),	((UINT)wrs_kernel_data_end - (UINT)binArrayEnd) / sizeof (long));    /* If cold booting, clear memory to avoid parity errors */#ifdef	ROMSTART_BOOT_CLEAR    if (startType & BOOT_CLEAR)	bootClear();#endif    /* decompress the main image */    if (UNCMP_RTN (ROM_DATA(binArrayStart),		UNCACHED(RAM_DST_ADRS),		binArrayEnd - binArrayStart) != OK)	return;    /* and jump to it */    absEntry (startType);    }#endif	/* ROM_COMPRESS */#ifdef	ROM_COPY/********************************************************************************* romStart - generic ROM initialization for uncompressed ROM images** This is the first C code executed after reset.** This routine is called by the assembly start-up code in romInit().* It clears memory, copies ROM to RAM, and then jumps to the entry* point of the copied object code.** RETURNS: N/A*/void romStart    (    FAST int startType		/* start type */    )    {    volatile FUNCPTR absEntry = (volatile FUNCPTR)RAM_DST_ADRS;    /* If cold booting, clear memory to avoid parity errors */#ifdef ROMSTART_BOOT_CLEAR    if (startType & BOOT_CLEAR)        bootClear();#endif    /* copy the main image into RAM */    copyLongs ((UINT *)ROM_DATA(binArrayStart),		(UINT *)UNCACHED(RAM_DST_ADRS),		(binArrayEnd - binArrayStart) / sizeof (long));    /* and jump to it */    absEntry (startType);    }#endif	/* ROM_COPY */#ifdef	ROM_RESIDENT/********************************************************************************* romStart - generic ROM initialization for ROM resident images** This is the first C code executed after reset.** This routine is called by the assembly start-up code in romInit().* It clears memory, copies ROM to RAM, and invokes the uncompressor.* It then jumps to the entry point of the uncompressed object code.** RETURNS: N/A*/void romStart    (    FAST int startType		/* start type */    )    {    /* relocate the data segment into RAM */    copyLongs ((UINT *)ROM_DATA_ADRS, (UINT *)UNCACHED(RAM_DATA_ADRS),		((UINT)end - (UINT)RAM_DATA_ADRS) / sizeof (long));    /* If cold booting, clear memory to avoid parity errors */#ifdef ROMSTART_BOOT_CLEAR    if (startType & BOOT_CLEAR)        bootClear();#endif    /* and jump to the entry */    usrInit (startType);    }#endif	/* ROM_RESIDENT */#ifdef	ROMSTART_BOOT_CLEAR/******************************************************************************** bootClear - clear memory** If cold booting, clear memory not loaded with text & data.** We are careful about initializing all memory (except* STACK_SAVE bytes) due to parity error generation (on* some hardware) at a later stage.  This is usually* caused by read accesses without initialization.*/LOCAL void bootClear (void)    {    /* fill from the bottom of memory to the load image */    fillLongs ((UINT *)SYS_MEM_BOTTOM,	((UINT)RAM_DATA_ADRS - STACK_SAVE - (UINT)SYS_MEM_BOTTOM) /	sizeof (long), 0);    /* fill from the load image to the top of memory */    fillLongs ((UINT *)end, ((UINT)SYS_MEM_TOP - (UINT)end) / sizeof(long), 0);    }/********************************************************************************* fillLongs - fill a buffer with a value a long at a time** This routine fills the first <nlongs> longs of the buffer with <val>.*/LOCAL void fillLongs    (    FAST UINT *	buf,	/* pointer to buffer              */    UINT	nlongs,	/* number of longs to fill        */    FAST UINT	val	/* char with which to fill buffer */    )    {    FAST UINT *bufend = buf + nlongs;    FAST UINT nchunks;    /* Hop by chunks of longs, for speed. */    for (nchunks = nlongs / 8; nchunks; --nchunks)	{#if (CPU_FAMILY == MC680X0)	*buf++ = val;	/* 0 */	*buf++ = val;	/* 1 */	*buf++ = val;	/* 2 */	*buf++ = val;	/* 3 */	*buf++ = val;	/* 4 */	*buf++ = val;	/* 5 */	*buf++ = val;	/* 6 */	*buf++ = val;	/* 7 */#else	buf[0] = val;	buf[1] = val;	buf[2] = val;	buf[3] = val;	buf[4] = val;	buf[5] = val;	buf[6] = val;	buf[7] = val;	buf += 8;#endif	}    /* Do the remainder one long at a time. */    while (buf < bufend)	*buf++ = val;    }#endif/********************************************************************************* copyLongs - copy one buffer to another a long at a time** This routine copies the first <nlongs> longs from <source> to <destination>.*/LOCAL void copyLongs    (    FAST UINT *	source,		/* pointer to source buffer      */    FAST UINT *	destination,	/* pointer to destination buffer */    UINT 	nlongs		/* number of longs to copy       */    )    {    FAST UINT *dstend = destination + nlongs;    FAST UINT nchunks;    /* Hop by chunks of longs, for speed. */    for (nchunks = nlongs / 8; nchunks; --nchunks)	{#if (CPU_FAMILY == MC680X0)	*destination++ = *source++;	/* 0 */	*destination++ = *source++;	/* 1 */	*destination++ = *source++;	/* 2 */	*destination++ = *source++;	/* 3 */	*destination++ = *source++;	/* 4 */	*destination++ = *source++;	/* 5 */	*destination++ = *source++;	/* 6 */	*destination++ = *source++;	/* 7 */#else	destination[0] = source[0];	destination[1] = source[1];	destination[2] = source[2];	destination[3] = source[3];	destination[4] = source[4];	destination[5] = source[5];	destination[6] = source[6];	destination[7] = source[7];	destination += 8, source += 8;#endif	}    /* Do the remainder one long at a time. */    while (destination < dstend)	*destination++ = *source++;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -