📄 l1.c
字号:
/*
* Copyright (c) 1995,2000 TriMedia Technologies Inc.
*
* +------------------------------------------------------------------+
* | This software is furnished under a license and may only be used |
* | and copied in accordance with the terms and conditions of such |
* | a license and with the inclusion of this copyright notice. This |
* | software or any other copies of this software may not be provided|
* | or otherwise made available to any other person. The ownership |
* | and title of this software is not transferred. |
* | |
* | The information in this software is subject to change without |
* | any prior notice and should not be construed as a commitment by |
* | TriMedia Technologies. |
* | |
* | this code and information is provided "as is" without any |
* | warranty of any kind, either expressed or implied, including but |
* | not limited to the implied warranties of merchantability and/or |
* | fitness for any particular purpose. |
* +------------------------------------------------------------------+
*
* Module name : L1.c 1.3
*
* Last update : 16:53:00 - 00/06/16
*
* Description :
*
* This program is a simulation of the L1 boot program on tmsim,
* but modified such that it loads 5 megabytes below the top of
* SDRAM. In this area it loads the multiprocessor downloader.
*
*/
#include "tm1/mmio.h"
#include "tmlib/TMDownLoader.h"
#include "tmlib/tmlibc.h"
#include "assert.h"
#include "stdio.h"
void _syscall();
custom_op void iclr(void);
extern Int _host_type_init[];
extern Int _clock_freq_init[];
extern volatile UInt32 _MMIO_base_init[];
typedef void (*Func) ();
main()
{
String filename = "MP_downloader.out";
UInt sdram_length = 4000000;
Pointer sdram_base = (Pointer) ((((UInt) & filename) - 5000000)
& 0xffffff00);
Int alignment, minimal_image_size;
TMDwnLdr_Object_Handle handle;
printf("Loading %s in 0x%08x - 0x%08x...\n", filename, sdram_base, ((UInt) sdram_base) + sdram_length);
TMDwnLdr_load_object_from_file(filename, Null, &handle);
TMDwnLdr_get_image_size(handle, &minimal_image_size, &alignment);
assert(minimal_image_size < (Int) sdram_base + sdram_length);
assert((Int) sdram_base % alignment == 0);
TMDwnLdr_resolve_symbol(handle, "__syscall", (Int) _syscall);
TMDwnLdr_relocate(handle, (tmHostType_t) _host_type_init,
(Address) _MMIO_base_init,
(UInt) _clock_freq_init,
sdram_base, sdram_length,
TMDwnLdr_LeaveCachingToDownloader);
TMDwnLdr_get_memory_image(handle, sdram_base);
TMDwnLdr_unload_object(handle);
printf("Running %s...\n", filename);
_cache_copyback(sdram_base, sdram_length);
iclr();
((Func) sdram_base) ();
/* never come back */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -