📄 mini_system.c
字号:
#include "Mini_System.h"
#include "MIU_Control.h"
#define _WritePort(Port,Value) {*((UV32*)(Port)) = (UV32)(Value);}
void InitSPCE3200(U32 miu_mp4_clock_ratio)
{
unsigned int *port;
unsigned int i;
_WritePort(0x88210038, 0x00000002); // cpu clk / 3
// MP4
_WritePort(0x88210140, 0x00000003); // P_CKG_CFG_BUFCTRL Enable
_WritePort(0x882100f0, miu_mp4_clock_ratio-1); //0:1:1;(1:MIU_CLK 2:MP4_CLK 1)
_WritePort(0x882100ec, 0x00000007);
_WritePort(0x88210024, 0x00000000); // PPU Clock = 81MHz
_WritePort(0x88210020, 0x00000003); // PPU Clock Enable
_WritePort(0x882100C8, 0x00000003); // BUF Control Enable
_WritePort(0x8809004c, 0x00000001); // BUF Control Interrupt Mask
_WritePort(0x882100FC, 0x00000003); // SFTCFG Clock Enable
// mp4
/* if(miu_mp4_clock_ratio==1)
_WritePort(0x882000c0, 0x00000006); */
/* else if(miu_mp4_clock_ratio==2) */
_WritePort(0x882000c0, 0x0000000a);//SFTCFG
/* else if(miu_mp4_clock_ratio==3) */
/* _WritePort(0x882000c0, 0x0000000f);//SFTCFG */
_WritePort(0x88210034, 0x00000003);// en lcd clk
_WritePort(0x88200000, 0x00000002);// LCD pin mux
_WritePort(0x88200004, 0x00000001);// SFTCFG Select I2C
port = (unsigned int *)0x88200000; *port |= 0x00000300;// SFTCFG Select CCIR656
_WritePort(0x88210018, 0x00000003);// CSI Clock Enable
_WritePort(0x8821001C, 0x00000008);// Pixel Clock Enable
_WritePort(0x88210094, 0x00000003);// I2C Clock Enable
_WritePort(0x88210050, 0x00000003);// BLNDMA Clock Enable
//port = 0x880A0010; *port = 0x001AC68F; //rex: switch priority of SPU and Timer
//port = 0x880A0004; *port = 0x00000002;//
_WritePort(0x882100CC, 0x00000003);// LDMDMA Clock Enable
_WritePort(0x880a0020, 0x00000000);// IRQ Mask Enable
_WritePort(0x880a0024, 0x00000000);// IRQ Mask Enable
_WritePort(0x88210030, 0x00000003);// TVE Clock Enable
_WritePort(0x88030050, 0x00000000);// Video DAC Enable
_WritePort(0x882100A4, 0x00000003);// SDCard Clock Enable
_WritePort(0x88210098, 0x00000003);// SPI Clock Enable
_WritePort(0x88210058, 0x00000003);// APBDMA Clock Enable
_WritePort(0x8821005C, 0x00000003);// UART Clock Enable
_WritePort(0x88200030, 0xf819f819);// P_NFLASH_GPIO_PUPD for SDCard Setting
_WritePort(0x882000A4, 0x00010100);// SFTCFG SDCard Enable && SPI
_WritePort(0x8821003C, 0x00000003);// SPU Clock Enable
_WritePort(0x882100AC, 0x00000003);// ADC Clock Enable
_WritePort(0x88051474, 0xFFFFFFFE);// DAC output Enable
for(i=0;i<200000;i++) // Delay between enabling CEN and OEN, at least 30ms
{}
_WritePort(0x88051474, 0xFFFFFFFC);// DAC output Enable
for(i=0;i<200000;i++) // Delay for DAC stablization
{}
}
/**
* InitSystem - initialize all basic function
*/
void InitSystem(void)
{
//initialize MIU1 & MIU2
MIU1_Init();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -