📄 main.c
字号:
/*
DM270 ARM Evaluation Software
(c)Texas Instruments 2003
*/
#include <system/armsys270.h>
#include <system/icache270.h>
#include <system/intc270.h>
#include <system/uart270.h>
#include <system/clkc270.h>
#include <system/osd270.h>
#include <system/prev270.h>
#include <system/ccdc270.h>
#include <system/busc270.h>
#include <user/intc.h>
#include <user/clkc.h>
#include <user/sdramc.h>
#include <user/osd.h>
#include <user/prev.h>
#include <user/ccdc.h>
#include <user/ccdm.h>
#include <user/ccdm_3d3_lens_ctrl.h>
#include <user/venc.h>
#include <user/tmr_delay.h>
#include <user/aic23.h>
#include <appl/still.h>
#include <appl/movie_main.h>
#include <appl/mp3_play.h>
#include <h3a/aewb.h>
#include <demo/config_menu.h>
#include <demo/menu.h>
#include <demo/ui.h>
#include <demo/mem_alloc.h>
#include <demo/preview.h>
#include <demo_gui/demo_gui.h>
void SYS_init();
void MAIN_MENU_run();
STATUS CLOCKInit();
void main()
{
SYS_init();
MAIN_MENU_run();
}
void SYS_init() {
// init CLKC
CLOCKInit(); // User library CLKCInit() called inside boot.asm, override with custom clock settings here
// init SDRAMC
// SDRAMInit(); // done in boot.asm
// init ICACHE
ICACHE_clear();
ICACHE_enable(TRUE, TRUE);
// init INTC
INTCInit();
// init UART-0
{
UART_ConfigData uart0;
uart0.baudRate = 115200;
uart0.charLength = UART_CHAR_LEN_8;
uart0.stopBits = UART_STOPBIT1;
uart0.parity = UART_EVEN_PARITY;
UART_setConfig( UART0, &uart0 );
}
// init VENC
VENCInit(VENC_NTSC, VENC_INTERLACE);
// init OSD
OSDInit();
// init Delay timer, used for lens control, CCD init
TMRDelayInit(TMR_2);
}
// display ARM, DSP, SDRAM, AXL clock frequencies
void ShowClockHz() {
Uint32 arm, dsp, axl, sdram;
Uint8 revID;
revID = BUSC_getDeviceRevision();
sprintf( UART_outBuff, "\r\n\n *** Silicon Revision : DM270 ES%d.%d ***", revID>>4, revID&0xF );
UART_sendString( UART0, UART_outBuff );
arm = CLKC_getClockValue( CLK_ARM );
dsp = CLKC_getClockValue( CLK_DSP );
sdram = CLKC_getClockValue( CLK_SDRC );
axl = CLKC_getClockValue( CLK_AXL );
UART_sendString( UART0, "\r\n" );
sprintf(UART_outBuff, "\r\n ARM CLK = %4d.%-6ld MHz", arm/1000000, arm%1000000);
UART_sendString( UART0, UART_outBuff );
sprintf(UART_outBuff, "\r\n DSP CLK = %4d.%-6ld MHz", dsp/1000000, dsp%1000000);
UART_sendString( UART0, UART_outBuff );
sprintf(UART_outBuff, "\r\n SDRAM CLK = %4d.%-6ld MHz", sdram/1000000, sdram%1000000);
UART_sendString( UART0, UART_outBuff );
sprintf(UART_outBuff, "\r\n AXL CLK = %4d.%-6ld MHz", axl/1000000, axl%1000000);
UART_sendString( UART0, UART_outBuff );
UART_sendString( UART0, "\r\n" );
}
void MAIN_MENU_run() {
char ch;
UART_sendString( UART0, dm270_intro );
// Initialize User Input interface
UI_init();
// show clock setting for ARM, DSP, SDRAM, AXL clock
ShowClockHz();
// init CCDM, CCDC, PREV for draft preview but disable AE/AWB
DraftPreview(FALSE);
// init AF
AFDemoInit();
// init AE/AWB
AEWBDemoInit();
// GUI init
GUI_init((char*)OSD_BMP_WIN0_ADDR, (char*)OSD_BMP_WIN1_ADDR);
// init lens
CCDM_3D3_LENS_INIT_MENU_run();
// init CCDM, CCDC, PREV for draft preview and enable AE/AWB
DraftPreview(TRUE);
// Application init
STILL_init();
MOVIE_init();
MP3_init();
FileDeviceSelectionInit();
profile_init(TMR_1, 10);
USBDEMO_init();
while(1) {
UART_sendString( UART0, main_menu );
ch = UI_getInput();
switch(ch) {
case '1':
DraftPreview(TRUE);
break;
case '2':
STILL_MENU_run();
break;
case '3':
MOVIE_MAIN_MENU_run(MOVIE_MPEG4_MODE);
break;
case '4':
MOVIE_MAIN_MENU_run(MOVIE_MJPEG_MODE);
break;
case '5':
MP3_PLAY_MAIN_MENU_run();
break;
case '6':
MAIN_CONFIG_MENU_run();
break;
default:
break;
}
}
}
#include <system/clkc270.h>
static CLKC_ConfigData clkcConfig = {
15, // pllA_M;
2, // pllA_N;
13, // pllB_M;
2, // pllB_N;
CLKC_PLLB_OUT, // axlPll;
CLKC_PLLA_OUT, // sdramPll;
CLKC_PLLB_OUT, // armPll;
CLKC_PLLB_OUT, // dspPll;
1, // axlDiv;
2, // sdramDiv;
2, // armDiv;
2 // dspDiv;
};
STATUS CLOCKInit() {
STATUS status=E_PASS;
if( BUSC_getDeviceRevision() == DM270_ES1_0 )
clkcConfig.armDiv = 4;
status = CLKC_setConfig( (CLKC_ConfigData*)&clkcConfig );
CLKC_moduleEnableAll();
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -