于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编程很是有帮助。