📄 param.c
字号:
#include <stdio.h>#include <stdlib.h>#include "bios.h"#include "config.h"struct system_table_struct system_table = { vendor_id: GENERAL_VENDOR_ID, device_id: GENERAL_DEVICE_ID, rev: 0, system_table_size: sizeof(struct system_table_struct), partition_table_offset: PARTITION_TABLE_OFFSET, partition_table_size: sizeof(struct partition_table_struct), default_table_offset: DEFAULT_TABLE_OFFSET, /* * pmc index: 0=normal rom, 1=4word, 2=8word, 3=16word * tpa index: 0=2cycle, 1=3cycle, 2=4cycle, 3=5cycle * tacc index: 0=0cycle, 1=2cycle, 2=3cycle, 3=4cycle, 4=7cycle */ rom_table: /* size width flag pmc tpa tacc*/ {{0x00080000, DBWTH_8BIT, tROMCON, 0, 3, 4}, {0x00200000, DBWTH_16BIT, tROMCON, 0, 3, 4}, {0x00000000, DBWTH_8BIT, tROMCON, 0, 3, 4}, {0x00000000, DBWTH_8BIT, tROMCON, 0, 3, 4}, {0x00000000, DBWTH_8BIT, tROMCON, 0, 3, 4}, {0x00000000, DBWTH_8BIT, tROMCON, 0, 3, 4}}, /* * trcd index: 0=1cycle, 1=2cycle * trp index: 0=1cycle, 1=2cycle, 2=3cycle, 3=4cycle * can index: 0=8bit, 1=9bit, 2=10bit, 3=11bit * trc index: 0=1cycle, 1=2cycle, 2=3cycle, 3=4, 4=5, 5=6 * period index: 0=8us, 1=16us, 2=24us, 3=32us */ dram_table: /* size width flag refresh trcd trp can trc period */ {{0x01000000, DBWTH_32BIT, tDRAMCON, tREFEXTCON, 1, 3, 0, 5, 1}, {0x00000000, DBWTH_32BIT, tDRAMCON, tREFEXTCON, 1, 3, 0, 5, 1}, {0x00000000, DBWTH_32BIT, tDRAMCON, tREFEXTCON, 1, 3, 0, 5, 1}, {0x00000000, DBWTH_32BIT, tDRAMCON, tREFEXTCON, 1, 3, 0, 5, 1}}, /* * tcos index: 0=0cycle, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7 * tacs index: 0=0cycle, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7 * tcoh index: 0=0cycle, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7 * tacc index: 0=0cycle, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7 */ ext_table: /* width flag tcos tacs tcoh tacc */ {{DBWTH_32BIT, tEXTACON, 7, 7, 7, 7}, {DBWTH_32BIT, tEXTACON, 7, 7, 7, 7}, {DBWTH_32BIT, tEXTACON, 7, 7, 7, 7}, {DBWTH_32BIT, tEXTACON, 7, 7, 7, 7}}, /* * cache index: 0=0k(off), 1=4k(on), 2=8k(on) * wbuf index: 0=off, 1=on * clk_div index: 0=div1, 1=div2, 2=div3, 3=div5 */ /* SYSCFG CLKCON cache wbuf clk_div */ cpu: {tSYSCFG, tCLKCON, 2, 1, 0}, iop: {tIOPMOD, tIOPCON, tIOPDATA}, eth: {ETH_MAC_ADDR, ETH_IP_ADDR}, bios_size: BIOS_SIZE, startup_mode: BOOT_MENU, password: {'a', 'r', 'm', '\0'},};#define PF_NONE PART_FLAG_NONE#define PF_DISK PART_FLAG_DISK#define PF_NET PART_FLAG_NET#define PT_RO PART_TYPE_RO#define PT_RW PART_TYPE_RW#define IMG_OTH IMAGE_OTHER#define IMG_LIN IMAGE_UCLINUX#define LIN_EADDR UCLINUX_EXEC_ADDR#define LIN_PADDR UCLINUX_PARAM_ADDRstruct partition_table_struct partition_table = {boot_partition: 02,partition:/* flag, type, offset, size, image, gzipped, exec_addr, param_addr, cmdline */{{PF_DISK, PT_RO, 0x00000000, 0x00040000, IMG_OTH, 0, 0, 0, '\0'}, {PF_DISK, PT_RW, 0x00040000, 0x00040000, IMG_OTH, 0, 0, 0, '\0'}, {PF_DISK, PT_RW, 0x00090000, 0x000f0000, IMG_LIN, 1, LIN_EADDR, LIN_PADDR, '\0'}, {PF_DISK, PT_RW, 0x00180000, 0x000f0000, IMG_LIN, 1, LIN_EADDR, LIN_PADDR, '\0'}, {PF_DISK, PT_RW, 0x00090000, 0x001e0000, IMG_LIN, 0, LIN_EADDR, LIN_PADDR, '\0'}, {PF_NONE, PT_RW, 0x00000000, 0x00000000, IMG_LIN, 1, LIN_EADDR, LIN_PADDR, '\0'}, {PF_NET, PT_RO, 0x00000000, 0x00000004, IMG_LIN, 1, LIN_EADDR, LIN_PADDR, '\0'}, {PF_NET, PT_RO, 0x00000000, 0x00000004, IMG_LIN, 0, LIN_EADDR, LIN_PADDR, '\0'}},};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 + -