#!/bin/sh # Useage: ./load3531d [ -r|-i|-a ] [ ad ] # -r : rmmod all modules # -i : insmod all modules # default : rmmod all moules and then insmod them # ####################Variables Definition########################## AD_TYPE=6134 # ad type mem_total=2048; # 512M, total mem mem_start=0x40000000; # phy mem start os_mem_size=512; # 128M, os mem mmz_start=0x60000000; # mmz start addr mmz_size=1792M; # 128M, mmz size board_mode="slave1"; # demo or sck ################################################################## b_arg_demb=1 report_error() { echo "******* Error: There's something wrong, please check! *****" exit 1 } insert_audio() { insmod hi3531d_aio.ko insmod hi3531d_ai.ko insmod hi3531d_ao.ko insmod hi3531d_aenc.ko insmod hi3531d_adec.ko # insmod extdrv/tlv_320aic31.ko } remove_audio() { # rmmod tlv_320aic31.ko rmmod hi3531d_adec rmmod hi3531d_aenc rmmod hi3531d_ao rmmod hi3531d_ai rmmod hi3531d_aio } insert_ad() { case $AD_TYPE in 6134) insmod extdrv/nvp6134_ex.ko ;; 2853) insmod extdrv/tp2853.ko ;; 2827) insmod extdrv/tp2827.ko ;; *) echo "xxxx Invalid ad type $AD_TYPE xxxx" report_error ;; esac } remove_ad() { case $AD_TYPE in 6134) rmmod nvp6134_ex.ko ;; 2853) rmmod tp2853.ko ;; 2827) rmmod tp2827.ko ;; *) echo "xxxx Invalid ad type $AD_TYPE xxxx" report_error ;; esac } insert_ko() { # sys_config(drv/sys_config): pinmux and ddr priority configuration insmod sys_config.ko mode=$board_mode echo $board_mode; # osal load (contains mmz.ko/hiuser.ko/media.ko) insmod hi_osal.ko mmz=anonymous,0,$mmz_start,$mmz_size anony=1 || report_error insmod hi_base.ko insmod hi3531d_sys.ko mem_total=$mem_total if [[ $? -ne 0 ]]; then exit; fi insmod hi3531d_vdec.ko insmod hi3531d_vfmw.ko insmod hi3531d_jpegd.ko insmod hi3531d_tde.ko insmod hi3531d_region.ko insmod hi3531d_vgs.ko insmod hi3531d_viu.ko detect_err_frame=10; insmod hi3531d_vpss.ko insmod hi3531d_vou.ko insmod hifb.ko video="hifb:vram0_size:32400,vram1_size:8100,vram2_size:2160,vram3_size:128,vram4_size:128" softcursor="off" insmod hi3531d_hdmi.ko insmod hi3531d_rc.ko insmod hi3531d_venc.ko insmod hi3531d_chnl.ko insmod hi3531d_vedu.ko insmod hi3531d_h264e.ko insmod hi3531d_h265e.ko insmod hi3531d_jpege.ko insmod hi3531d_vda.ko insmod hi3531d_ive.ko # insmod extdrv/sil9024.ko norm=5 #720P@60fps # insmod extdrv/sil9024.ko norm=9 #1080P@60fps # insmod extdrv/sil9024.ko norm=12 #1080P@30fps # echo "==== Your input AD type is $AD_TYPE ====" insert_ad insert_audio } remove_ko() { remove_audio remove_ad # rmmod sil9024 &> /dev/null rmmod hi3531d_ive rmmod hi3531d_vda rmmod hi3531d_jpege rmmod hi3531d_h264e rmmod hi3531d_h265e rmmod hi3531d_vedu rmmod hi3531d_chnl rmmod hi3531d_venc rmmod hi3531d_rc rmmod hi3531d_hdmi rmmod hifb rmmod hi3531d_vou rmmod hi3531d_vpss rmmod hi3531d_viu rmmod hi3531d_vgs rmmod hi3531d_region rmmod hi3531d_tde rmmod hi3531d_jpegd rmmod hi3531d_vdec rmmod hi3531d_vfmw rmmod hi3531d_sys rmmod hi_base rmmod hi_osal rmmod sys_config #rmmod hi_media #rmmod hiuser #rmmod mmz } load_usage() { echo "Usage: ./load3531d [-option] [ad_name]" echo "options:" echo " -i insert modules" echo " -r remove modules" echo " -a remove modules first, then insert modules" echo " -ad ad_name config AD type [default: tp2823]" echo " -total mem_size config total mem size [unit: M, default: 2048]" echo " -osmem os_mem_size config os mem size [unit: M, default: 256]" echo " -mode demo config board type [demo or sck etc., default: demo]" echo " -h help information" echo -e "Available ad: nvp6134, tp2853,tp2827" echo -e "notes: osmem option can't be used when mmz zone partition is enable\n\n" echo -e "for example: ./load3531d -a -ad 2853 -total 2048 -osmem 64\n" } calc_mmz_info() { mmz_start=`echo "$mem_start $os_mem_size" | awk 'BEGIN { temp = 0; } { temp = $1/1024/1024 + $2; } END { printf("0x%x00000\n", temp); }'` mmz_size=`echo "$mem_total $os_mem_size" | awk 'BEGIN { temp = 0; } { temp = $1 - $2; } END { printf("%dM\n", temp); }'` echo "mmz_start: $mmz_start, mmz_size: $mmz_size" } ######################parse arg################################### b_arg_os_mem=0 b_arg_total_mem=0 b_arg_ad=0 b_arg_insmod=0 b_arg_remove=0 b_arg_mode=0 for arg in $@ do if [ $b_arg_total_mem -eq 1 ]; then b_arg_total_mem=0; mem_total=$arg; if [ -z $mem_total ]; then echo "[error] mem_total is null" exit; fi fi if [ $b_arg_mode -eq 1 ]; then b_arg_mode=0; board_mode=$arg; if [ -z $board_mode ]; then echo "[error] board_mode is null" exit; fi fi if [ $b_arg_os_mem -eq 1 ] ; then b_arg_os_mem=0; os_mem_size=$arg; if [ -z $os_mem_size ]; then echo "[error] os_mem_size is null" exit; fi fi if [ $b_arg_ad -eq 1 ] ; then b_arg_ad=0 AD_TYPE=$arg; fi case $arg in "-i") b_arg_insmod=1; ;; "-r") b_arg_remove=1; ;; "-a") b_arg_insmod=1; b_arg_remove=1; ;; "-h") load_usage; ;; "-ad") b_arg_ad=1; ;; "-osmem") b_arg_os_mem=1; ;; "-total") b_arg_total_mem=1; ;; "-sck") b_arg_demb=0; ;; "-pro") b_arg_demb=2; ;; "-mode") b_arg_mode=1; ;; esac done #######################parse arg end######################## if [ $os_mem_size -ge $mem_total ] ; then echo "[err] os_mem[$os_mem_size], over total_mem[$mem_total]" exit; fi calc_mmz_info; #######################Action############################### if [ $# -lt 1 ]; then load_usage; exit 0; fi if [ $b_arg_remove -eq 1 ]; then remove_ko; fi if [ $b_arg_insmod -eq 1 ]; then insert_ko; fi