📄 load
字号:
#!/bin/sh# Create by C42025 20060616# ANSI COLORSCRE="[K"NORMAL="[0;39m"RED="[1;31m"GREEN="[1;32m"YELLOW="[1;33m"BLUE="[1;34m"MAGENTA="[1;35m"CYAN="[1;36m"WHITE="[1;37m"print_menu(){ cat << MAYDAY${GREEN}VENC PAL:${YELLOW} 1.cifp : 1 x cif 1.hd1p : 1 x half d1 1.d1p : 1 x d1 1.2cifp : 1 x 2cif 1.4cifp: 1 x 4cif 2.hd1p : 2 x 2half d1 2.2cifp : 2 x 2cif 4.qcifp : 4 x qcif 4.cifp : 4 x cif 4.d1p : 4 x d1 4.4cifp : 4 x 4cif${GREEN}VENC NTSC:${RED} 1.cifn : 1 x cif 1.hd1n : 1 x half d1 1.d1n : 1 x d1 1.2cifn : 1 x 2cif 1.4cifn: 1 x 4cif 2.hd1n : 2 x 2half d1 2.2cifn : 2 x 2cif 4.qcifn : 4 x qcif 4.cifn : 4 x cif 4.d1n : 4 x d1 4.4cifn : 4 x 4cif${GREEN}VENC DIG:${CYAN} qvga: qvga vga: vga sxga: sxga${NORMAL}${GREEN}VDEC:${CYAN} vdec: video decode mode ${GREEN}H263P:${RED} 263.p: h263 venc${GREEN}H263N:${RED} 263.n: h263 venc MAYDAY}print_help(){ cat << MAYDAY${WHITE}Discription:${NORMAL} This script need at most one parameters. parameters after the first one willbe ingored. Without any argument, the script will run on interoperatable mode,or it will excute correspongding task and then directly exit.${WHITE}examples:${NORMAL} ./load m : print menu ./load 1.4cifp : load 1 x 4cif in PAL mode ./load 1.hd1n : load 1 x hd1 in NTSC mode ./load h : print help infomationMAYDAY}CUR_DIR=`dirname $0`MODULES=\" $CUR_DIR/extdrv/hi_sio.ko \ $CUR_DIR/extdrv/tlv320.ko \ $CUR_DIR/hi3510_vs.ko \ $CUR_DIR/extdrv/adv7171.ko \ $CUR_DIR/extdrv/tw2834.ko \ $CUR_DIR/extdrv/ov9653.ko \ $CUR_DIR/extdrv/gpio_i2c.ko \ $CUR_DIR/extdrv/hi_i2c.ko \ $CUR_DIR/extdrv/misc_gpio.ko \ $CUR_DIR/extdrv/hi_gpio.ko "#First we check whether all kernel modules we want is ready.check_mod(){ for m in $MODULES do if [ ! -f $m ];then echo "Module ${RED}$m ${NORMAL}does _NOT_ existed! Maybe you need run \"make\" again :)" exit 1 fi done}load(){ if [ $# -lt 5 ];then echo "argument number <$#> error!" return 1 fi check_mod _NORM_MOD=$1 _MCHANNEL=$2 _2834_VIDEO_SIZE=$3 _CH=$4 _3510_VIDEO_SIZE=$5 while : do MOD=`/sbin/lsmod |awk '{if($3==0) print $1}'` if [ "$MOD" == "" ];then break fi for n in $MOD do /sbin/rmmod $n || exit 1 done done set -e /sbin/insmod $CUR_DIR/extdrv/hi_gpio.ko /sbin/insmod $CUR_DIR/extdrv/misc_gpio.ko ch=$_CH /sbin/insmod $CUR_DIR/extdrv/hi_i2c.ko if [ $_3510_VIDEO_SIZE -gt 5 ];then /sbin/insmod $CUR_DIR/extdrv/gpio_i2c.ko if [ $_3510_VIDEO_SIZE -eq 8 ];then /sbin/insmod $CUR_DIR/extdrv/ov9653.ko out_mode=1 else /sbin/insmod $CUR_DIR/extdrv/ov9653.ko out_mode=0 fi else /sbin/insmod $CUR_DIR/extdrv/tw2834.ko mchannel=$_MCHANNEL \ videosize=$_2834_VIDEO_SIZE norm_mode=$_NORM_MOD fi /sbin/insmod $CUR_DIR/extdrv/adv7171.ko norm_mode=$_NORM_MOD /sbin/insmod $CUR_DIR/hi3510_vs.ko chiptype=0 mchannel=$_MCHANNEL videosize=$_3510_VIDEO_SIZE \ task=0 firmware=$CUR_DIR/hi3510_v264.bin norm_mode=$_NORM_MOD /sbin/insmod $CUR_DIR/extdrv/tlv320.ko /sbin/insmod $CUR_DIR/extdrv/hi_sio.ko}load_vdec(){ rmmod hi_sio.ko rmmod tlv320.ko rmmod hi3510_vs.ko rmmod adv7171.ko rmmod tw2834.ko rmmod ov9653.ko rmmod gpio_i2c.ko rmmod hi_i2c.ko rmmod misc_gpio.ko rmmod hi_gpio.ko CUR_DIR=`dirname $0` insmod $CUR_DIR/extdrv/hi_gpio.ko insmod $CUR_DIR/extdrv/misc_gpio.ko ch=0 insmod $CUR_DIR/extdrv/hi_i2c.ko insmod $CUR_DIR/extdrv/tw2834.ko mchannel=0 videosize=1 insmod $CUR_DIR/extdrv/adv7171.ko insmod $CUR_DIR/hi3510_vs.ko chiptype=0 mchannel=0 videosize=3 task=1 firmware=$CUR_DIR/hi3510_v264.bin insmod $CUR_DIR/extdrv/tlv320.ko insmod $CUR_DIR/extdrv/hi_sio.ko}load_263(){ if [ $# -lt 5 ];then echo "argument number <$#> error!" return 1 fi check_mod _NORM_MOD=$1 _MCHANNEL=$2 _2834_VIDEO_SIZE=$3 _CH=$4 _3510_VIDEO_SIZE=$5 while : do MOD=`/sbin/lsmod |awk '{if($3==0) print $1}'` if [ "$MOD" == "" ];then break fi for n in $MOD do /sbin/rmmod $n || exit 1 done done set -e /sbin/insmod $CUR_DIR/extdrv/hi_gpio.ko /sbin/insmod $CUR_DIR/extdrv/misc_gpio.ko ch=$_CH /sbin/insmod $CUR_DIR/extdrv/hi_i2c.ko if [ $_3510_VIDEO_SIZE -gt 5 ];then /sbin/insmod $CUR_DIR/extdrv/gpio_i2c.ko if [ $_3510_VIDEO_SIZE -eq 8 ];then /sbin/insmod $CUR_DIR/extdrv/ov9653.ko out_mode=1 else /sbin/insmod $CUR_DIR/extdrv/ov9653.ko out_mode=0 fi else /sbin/insmod $CUR_DIR/extdrv/tw2834.ko mchannel=$_MCHANNEL \ videosize=$_2834_VIDEO_SIZE norm_mode=$_NORM_MOD fi /sbin/insmod $CUR_DIR/extdrv/adv7171.ko norm_mode=$_NORM_MOD /sbin/insmod $CUR_DIR/hi3510_vs.ko chiptype=0 mchannel=$_MCHANNEL videosize=$_3510_VIDEO_SIZE \ task=0 firmware=$CUR_DIR/hi3510_v263.bin norm_mode=$_NORM_MOD /sbin/insmod $CUR_DIR/extdrv/tlv320.ko /sbin/insmod $CUR_DIR/extdrv/hi_sio.ko}echo "$1"if [ "$1" = "vdec" ];then load_vdec exit 0fi#Infinite loopwhile :doif [ $# -lt 1 ];then echo -e -n "type ${RED}m${NORMAL} for menu, ${RED}h${NORMAL} for help, and ${RED}q${NORMAL} for quit. " echo -n "enter your choice :" read CHOICEelse CHOICE=$1ficase $CHOICE in #load norm_mod mchannle 2834_videosize ch 3510_videosieze 1.cifp) load 0 0 1 0 1 # 1 x cif exit 0 ;; 1.hd1p) load 0 0 1 0 2 # 1 x hd1 exit 0 ;; 1.d1p) load 0 0 1 0 3 # 1 x d1 exit 0 ;; 1.2cifp) load 0 0 1 0 4 # 1 x 2cif exit 0 ;; 1.4cifp) load 0 0 1 0 5 # 1 x 4cif exit 0 ;; 2.hd1p) load 0 1 1 0 2 # 2 x 2hd1 exit 0 ;; 2.2cifp) load 0 1 4 0 4 # 2 x 2cif exit 0 ;; 4.qcifp) load 0 1 0 0 0 # 4 x qcif exit 0 ;; 4.cifp) load 0 1 0 0 1 # 4 x cif exit 0 ;; 4.d1p) load 0 1 2 0 3 # 4 x d1 exit 0 ;; 4.4cifp) load 0 1 2 0 5 # 4 x 4cif exit 0 ;; 1.cifn) load 1 0 1 0 1 # 1 x cif exit 0 ;; 1.hd1n) load 1 0 1 0 2 # 1 x hd1 exit 0 ;; 1.d1n) load 1 0 1 0 3 # 1 x d1 exit 0 ;; 1.2cifn) load 1 0 1 0 4 # 1 x 2cif exit 0 ;; 1.4cifn) load 1 0 1 0 5 # 1 x 4cif exit 0 ;; 2.hd1n) load 1 1 1 0 2 # 2 x 2hd1 exit 0 ;; 2.2cifn) load 1 1 4 0 4 # 2 x 2cif exit 0 ;; 4.qcifn) load 1 1 0 0 0 # 4 x qcif exit 0 ;; 4.cifn) load 1 1 0 0 1 # 4 x cif exit 0 ;; 4.d1n) load 1 1 2 0 3 # 4 x d1 exit 0 ;; 4.4cifn) load 1 1 2 0 5 # 4 x 4cif exit 0 ;; qvga) load 0 0 0 1 6 # 1 x qvga exit 0 ;; vga) load 0 0 0 1 7 # 1 x vga exit 0 ;; sxga) load 0 0 0 1 8 # 1 x sxga exit 0 ;; vdec) load 0 0 0 1 8 # 1 x sxga load_vdec exit 0 ;; 263.p) load_263 0 1 0 0 1# 266 petro exit 0 ;; 263.n) load_263 1 1 0 0 1# 266 petro exit 0 ;; h) print_help if [ ! $# -lt 1 ];then exit 0 fi ;; m) print_menu if [ ! $# -lt 1 ];then exit 0 fi ;; q|Q) exit 0 ;; *) echo -e "\"$CHOICE\" is a invalid choice!" if [ ! $# -lt 1 ];then echo -e " load h for help." exit 0 fi print_help ;;esacdone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -