於2013在上半場 - 年DM36五、DM368的IPNC(網絡攝像機)與穩定性測試工做產品結束。算法
TI針對TMS320DM36五、DM368進行了DVR和IPNC的應用方案參考。DVR方案通常基於DM368 DVRRD SDK (includes TI DVSDK, TI LSP, DVR applications, DVR filesystem, boot and other utilities)開發。IPNC方案也是基於DVSDK。詳細開發環境的搭建參考對應的開發包中的文檔。編程
本文主要介紹IPNC網絡
AV_Server多線程
Systemserver架構
RTPstreaming serverapp
HTTPserver框架
這些進程的做用:AV_Server process is responsible for:socket
• Capturingvideo and audio data from image sensor and audio deviceide
• 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.
啓動腳本位於文件系統的/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 & #啓動boaserver
}
如PISA、ONVIF(安防標準)。boa(提供網頁訪問)。GoDB(提供網頁訪問的UI),wis-streamer(提供網絡視頻流)等。
systemserver進程基本與視頻採集和codec無關,是純純的Linux編程。涉及多線程、socket、System V進程通訊,以及USB、網口等各方面的編程,對於學習Linux編程很是有幫助。