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

📄 param.c

📁 ARM开发用的启动代码
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>
#include "board.h"
#include "bios.h"

//#define BTE201 1
//#define IRE201 1
//#define NP15B

#define COMPEX_VENDOR_ID   0x11F6
#define IRE201_DEVICE_ID   0x8000
#define NP15B_DEVICE_ID    0x8001
#define BTE201_DEVICE_ID   0x8002
#define NONE_DEVICE_ID     0x0000

struct system_table_struct system_table = {

	bios_size:      0xc000,

#ifdef WITRACE
	vendor_id:      COMPEX_VENDOR_ID,
	device_id:      IRE201_DEVICE_ID,

	sub_vendor_id:  COMPEX_VENDOR_ID,
	sub_device_id:  IRE201_DEVICE_ID,
#endif
#ifdef NP15B
	vendor_id:      COMPEX_VENDOR_ID,
	device_id:      NP15B_DEVICE_ID,

	sub_vendor_id:  COMPEX_VENDOR_ID,
	sub_device_id:  NP15B_DEVICE_ID,
#endif
#ifdef BTE201
	vendor_id:      COMPEX_VENDOR_ID,
	device_id:      BTE201_DEVICE_ID,

	sub_vendor_id:  COMPEX_VENDOR_ID,
	sub_device_id:  BTE201_DEVICE_ID,
#endif
#ifdef SNDS100
	vendor_id:      COMPEX_VENDOR_ID,
	device_id:      NONE_DEVICE_ID,

	sub_vendor_id:  COMPEX_VENDOR_ID,
	sub_device_id:  NONE_DEVICE_ID,
#endif

	rev:            0,

	sys_reg_base:   0x03ff0000,
	sys_clock:      fMCLK_MHz,
	ext_clock:      0xffffffff,

#ifdef WITRACE
	rom_table:      {{0x00200000,  16, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060}},

	dram_table:     {{0x00800000, 16, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398}},
#endif
#ifdef NP15B
	rom_table:      {{0x00080000,  8, 0x00000060},
	                 {0x00080000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060}},

	dram_table:     {{0x00400000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398}},
#endif
#ifdef BTE201
	rom_table:      {{0x00100000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060}},

	dram_table:     {{0x00800000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398}},
#endif
#ifdef SNDS100
	rom_table:      {{0x00080000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060},
	                 {0x00000000,  8, 0x00000060}},

	dram_table:     {{0x00400000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398},
	                 {0x00000000, 32, 0x00000398}},
#endif

	system_table_size:     sizeof(struct system_table_struct),

	partition_table_offset:      0x0000f000,
	partition_table_size:        sizeof(struct partition_table_struct),

	ext_base:       0x03fd0000,
	ext_table:      {{            32, 0x00000fff},
	                 {            32, 0x00000fff},
	                 {            32, 0x00000fff},
	                 {            32, 0x00000fff}},

	iop:            {0x00020070, 0x2ad00300, ~0x00020070},
	uart:           {{0x80000000, 0, 0, 0, 0, 0, 0}, {0x80000000, 1, 0, 0, 0, 0, 0}},

	eth:            {0x80000000, {0x00, 0x80, 0x48, 0x88, 0x00, 0x00}},
	ne2000:         {0x80000000, 0, {0x00, 0x80, 0x48, 0x88, 0x00, 0x01}},
	uart16550:      {0x80000000, 1, 13000000},
	pc97338:        {0x80000000, 1},

	startup_mode:   BOOT_MENU,
	tftp_ipaddr:    0xc0a80164,
};

#ifdef WITRACE
struct partition_table_struct partition_table = {
	{0x8000, 1, 0x10000, 0x1e0000, ADDR,
	 0x4000, 1, 0x1f0000, 0x10000, 0}
};
#endif
#ifdef NP15B
struct partition_table_struct partition_table = {
	{0x8000, 1, 0x10000, 0x70000, ADDR,
	 0x4000, 1, 0x80000, 0x78000, 0,
	 0x0000, 1, 0xf8000, 0x08000, 0}
};
#endif
#ifdef BTE201
struct partition_table_struct partition_table = {
	{0x8000, 1, 0x10000, 0x20000, ADDR,
	 0x4000, 1, 0x30000, 0xc0000, 0,
	 0x0000, 1, 0xf0000, 0x10000, 0}
};
#endif
#ifdef SNDS100
struct partition_table_struct partition_table = {
	{0x8000, 1, 0x10000, 0x20000, ADDR,
	 0x4000, 1, 0x30000, 0x40000, 0}
};
#endif

int main()
{
	FILE *f;

	f = fopen("param.tbl", "wb");
	fwrite((char *)(&system_table), 1, sizeof(struct system_table_struct), f);
	fclose(f);

	f = fopen("mbr.bin", "wb");
	fwrite((char *)(&partition_table), 1, sizeof(struct partition_table_struct), f);
	fclose(f);

	return 0;
}

⌨️ 快捷键说明

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