📄 tpe3.c
字号:
/* $Id: tpe3.c,v 1.4 2000/11/15 17:44:54 apc Exp $ *//* Copyright 2000 AG Electronics Ltd. *//* This code is distributed without warranty under the GPL v2 (see COPYING) */#include <bsp.h>#include <malloc.h>#include <ppc.h>#include <console.h>#include <stdio.h>#include <pci.h>#include <net.h>static void pci_configure (void){ /* On bus 0, we don't configure device 0. Because it is us. */ int dev; pci_root.have_io_space = 1; pci_root.have_prefetch_space = 0; pci_root.fast_back_to_back = 1; for (dev = 1; dev < 32; dev++) if (dev != 12) /* On Sandpoint, dev 12 is also the PMC */ { u32 data; int result = pci_config_read_32 (0, dev, 0, 0, &data); if (result == 0 && data != 0xffffffff) pci_configure_device (&pci_root, dev, 0); } pci_set_command(&pci_root);}void bsp_init_post_reloc(void){ extern unsigned __bss_end[]; malloc_add_pool(__bss_end + 16384, 1024*1024); TftpLoadAddress = (unsigned char *)(__bss_end + 16384 + 1024*1024); init_console_16550(0x61000000, 6144000, 1); }void bsp_init_post_hello(void){ printf("Now the tricky stuff...\n"); ppc_setup_cpu(1); printf("Done cpu setup\n"); tpe3_init_pci(); pci_configure();}void bsp_indicate_dead(void){ for(;;) { volatile int i; *(volatile char *)0x61000004 = 0x8; for(i = 0; i < 1000000; i++) ; *(volatile char *)0x61000004 = 0x4; for(i = 0; i < 1000000; i++) ; } }int NetInit(void){ extern NetCard_t NetNE2100; NetCard_t * nc = &NetNE2100; if (NetCard != nc) { if (NetCard) (*NetCard->halt)(); if (!(*nc->init)()) return 0; NetCard = nc; } return 1;}extern void BootpRequest(void);void bsp_identify(void){ printf("TPE3 BSP\n"); ppc_identify();}unsigned bsp_clock_speed(void){ return 66666666 / 4;}/* Start a loaded executable */void bsp_run_executable(unsigned entry, char *cmd_line, unsigned initrd_start, unsigned initrd_length){ unsigned *bootblock = (unsigned *) (2*1024*1024); bootblock[0] = 128*1024*1024; bootblock[1] = (unsigned) cmd_line; if (cmd_line) bootblock[2] = (unsigned) (cmd_line + strlen(cmd_line)); else bootblock[2] = 0; bootblock[3] = initrd_start; bootblock[4] = initrd_start + initrd_length; ppc_run_executable(entry, 0x54504533); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -