📄 board.c
字号:
#include "arch.h"#include "mcfuart.h"char ident[] = "Motorola 5206e C3";char copyright[] = "(C) 1999, Moreton Bay Ventures, Rob Scott, Roland Seuhs";extern unsigned long consoleBase;void configureConsole(){ consoleBase = MCFUART_BASE1; configureSerial(consoleBase, 19200, MCF_CLK);}void configureAuxSerial(){ configureSerial(MCFUART_BASE2, 115200, MCF_CLK);}void setLED(int state){ unsigned char bits; switch(state) { case 0: bits = 0x00; break; case 1: bits = 0x06; break; case 2: bits = 0x5b; break; case 3: bits = 0x4f; break; case 4: bits = 0x66; break; case 5: bits = 0x6d; break; case 6: bits = 0x7d; break; case 7: bits = 0x07; break; case 8: bits = 0x7f; break; case 10: bits = 0x77; break; case 11: bits = 0x7C; break; case 12: bits = 0x39; break; case 13: bits = 0x5e; break; case 14: bits = 0x79; break; case 15: bits = 0x71; break; default: return; } *((volatile unsigned short *) 0x40000000) = (unsigned short) (bits << 8);}extern unsigned int downloadPort;extern unsigned int image_size;extern unsigned char *xfer_addr;extern unsigned char *down_addr;extern unsigned char *dest_addr;extern unsigned char *source_addr;void setImageParams(){ downloadPort = 1; image_size = *(volatile unsigned long *)(0xffe20004);//0x80000; xfer_addr = (unsigned char *)0x20000; down_addr = (unsigned char *)0xffe20000; //0xfff40000 dest_addr = (unsigned char *)0xf1000000; source_addr = (unsigned char *)0xffe20000; //0xfff40000}void setupBoard(){ volatile unsigned char *mbar; mbar = (volatile unsigned char *) MCF_MBAR; /* * Firstly set up the LEDs. They are on * parallel I/O pins of the 5206e. *//* *((volatile unsigned short *) (mbar + MCFSIM_PAR)) = 0x0000; //0x40000000 *((volatile unsigned short *) (mbar + MCFSIM_PADDR)) = 0x00FF; //0xfeb7bf7d*/ /* * Setup chip selects... */ /* CS2 -- used by optional SRAM */ *((volatile unsigned short *) (mbar + MCFSIM_CSAR2)) = 0x3000; *((volatile unsigned long *) (mbar + MCFSIM_CSMR2)) = 0x00070000; *((volatile unsigned short *) (mbar + MCFSIM_CSCR2)) = 0x0503;// setLED(0); // /* CS3 -- used by Ethernet, address 30000000 */ *((volatile unsigned short *) (mbar + MCFSIM_CSAR3)) = 0x4000; *((volatile unsigned long *) (mbar + MCFSIM_CSMR3)) = 0x000f0000; *((volatile unsigned short *) (mbar + MCFSIM_CSCR3)) = 0x0083; /* entire ChipSelect must be properly set up before writing to CSMR0 */ /* CS0 -- FLASH ROM */ *((volatile unsigned short *) (mbar + MCFSIM_CSAR0)) = 0xffe0; *((volatile unsigned short *) (mbar + MCFSIM_CSCR0)) = 0x0da3; *((volatile unsigned long *) (mbar + MCFSIM_CSMR0)) = 0x000f0000; /* CS1 -- used by ?*/ *((volatile unsigned short *) (mbar + MCFSIM_CSCR1)) = 0x0000; /* CS4 -- used by ? */ *((volatile unsigned short *) (mbar + MCFSIM_CSCR4)) = 0x0000; /* CS5 -- used by ? */ *((volatile unsigned short *) (mbar + MCFSIM_CSCR5)) = 0x0000; /* CS6 -- used by ? */ *((volatile unsigned short *) (mbar + MCFSIM_CSCR6)) = 0x0000; /* CS7 -- used by ? */ *((volatile unsigned short *) (mbar + MCFSIM_CSCR7)) = 0x0000;}void setupDRAM(){ volatile unsigned char *mbar = (unsigned char *)MCF_MBAR; /* DCTR definition: <15>: DAEM, 1 = Drive Multiplexed Address During External Master DRAM xfer <14>: EDO, 1 = EDO, 0 = Normal <12>: RCD, 1 = 2 clk RAS-to-CAS, 0 = 1.0 clk RAS-to-CAS <10:09>: RSH, 10 = 3.5 clk RAS low, 01 = 2.5 clk, 00 = 1.5 clk <06:05>: RP, 10 = 3.5 clk RAS Precharge, 01 = 2.5 clk, 00 = 1.5 clk <03>: CAS, 1 = 2.5 clk CAS assertion, 0 = 1.5 clk <01>: CP, 1 = 1.5 CAS clk precharge, 0 = .5 clk <00>: CSR, 1 = 2.0 clk CAS before RAS setup, 0 = 1.0 clk */ *((volatile unsigned short *) (mbar + MCFSIM_DCRR)) = 0x0034; *((volatile unsigned short *) (mbar + MCFSIM_DCTR)) = 0x144B; *((volatile unsigned short *) (mbar + MCFSIM_DCAR0)) = 0x0000; *((volatile unsigned long *) (mbar + MCFSIM_DCMR0)) = 0x003e0000; *((volatile unsigned char *) (mbar + MCFSIM_DCCR0)) = 0x07;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -