在2013年上半年接手DM365、DM368的IPNC(網絡攝像機)產品的收尾與穩定性測試工作。
1.簡介:
TI針對TMS320DM365、DM368進行了DVR和IPNC的應用方案參考。DVR方案一般基於DM368 DVRRD SDK (includes TI DVSDK, TI LSP, DVR applications, DVR filesystem, boot and other utilities)開發。IPNC方案也是基於DVSDK。具體開發環境的搭建參考相應的開發包中的文檔。
本文主要介紹IPNC
2.IPNC中軟件架構
3.應用層結構
AV_Server
Systemserver
RTPstreaming server
HTTPserver
這些進程的作用:AV_Server process is responsible for:
• Capturingvideo and audio data from image sensor and audio device
• Encodingaudio and video data
• Managingand storing encoded data in the circular buffer and cache buffer
• Sendingaudio or video bit-stream response requested by other application
System server process responsible for:
• Storingand restoring system parameter
• Savingor uploading video files to ftp servers or local disk depending on the
alarm or schedule events
• Controllingthe system devices (RTC, USB)
HTTP server and RTP streaming servers areresponsible for:
• Sendingresponse of the video, audio, or system requested from internet
Processes use POSIX msgsnd and msgrcv tocommunicate with each other
• Passingparameters by POSIX share memory or CMEM device driver
Circular buffers, cache pools and messagequeues in shared memory are used for
inter-process communication.
4.程序的啓動分析
啓動腳本位於文件系統的/etc/init.d/rsS文件中,其中核心啓動順序代碼如下:
DVEVMDIR=/opt/ipnc #聲明一個變量並賦值
# Load the dsplink and cmem kernel modules 加載dsplink和cmem等內核模塊
cd $DVEVMDIR #進入opt/ipnc目錄
$DVEVMDIR/av_capture_load.sh #”$”表示引用變量
{#av_capture_load.sh
#!/bin/sh
#"#!"字符告訴系統同一行上緊跟在他後面的那個參數用來執行文件的程序
./av_capture_unload.sh 2>/dev/null #首先將相關的模塊卸載
#0表示標準輸入,1表示標準output, 2表示標準錯誤error,該命令表示將腳本csl_unload.sh錯誤信息輸入到(重定向到)只寫文件中(/dev/null經典的黑洞文件,即只能寫不能讀),可以理解爲不要將錯誤信息輸入到標準輸出設備。
./csl_load.sh #加載csl(片級支持庫)模塊
./drv_load.sh #加載drv(驅動模塊)模塊
insmod cmemk.ko phys_start=0x83000000 phys_end=0x88000000allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672
#加載cmemk.ko(連續內存模塊)模塊,用於DSP和ARM共享,它的起始位置是0x83000000,結束位置爲0x88000000,大小爲80M。
insmod edmak.ko #加載EDMA模塊
insmod irqk.ko #加載快速中斷模塊
insmod dm365mmap.ko #加載dm365內存映射模塊
}
cd /dev
ln -s rtc0 rtc #建立連接
cd $DVEVMDIR
mount -t jffs2 /dev/mtdblock4 /mnt/nand #掛載日誌文件系統
sleep 1
./system_server & #後臺運行system_server
$DVEVMDIR/loadkmodules.sh #運行內核模塊腳本
$DVEVMDIR/loadmodules_ipnc.sh #運行內核模塊腳本
ifconfig lo 127.0.0.1 #設定本機迴環地址爲 127.0.0.1
./boot_proc 1
# Start the demo application #開始運行應用程序demo
cd $DVEVMDIR
$DVEVMDIR/autorun.sh #執行autorun.sh腳本
{# autorun.sh
#echo "2" >/proc/cpu/alignment
sleep 1
./boa -c /etc & #啓動boa服務器
}