123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- #!/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=256; # 128M, os mem
- mmz_start=0x50000000; # mmz start addr
- mmz_size=1784M; # 128M, mmz size
- message_size=1M; # 1M, pciv message size
- pciv_start=0xbf800000;
- pciv_start1=0xbf900000;
- ##################################################################
- 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
- ;;
- *)
- 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
- ;;
- *)
- echo "xxxx Invalid ad type $AD_TYPE xxxx"
- report_error
- ;;
- esac
- }
- # If you want to use PCIe cascade, please compile PCIe related uboot, kernel, rootfs in directory: osdrv/.
- # Also, please compile PCIe related ko files in directory: osdrv/pub/. Then create a directory named pcie in current directory,
- # and put theses ko files in the directory.
- # For more details, please read the files in directory: osdrv/ and osdrv/drv/pcie_mcc/.
- insert_pci()
- {
- insmod pcie/hi35xx_dev_slv.ko
- insmod pcie/pcit_dma_slv.ko
- insmod pcie/mcc_drv_slv.ko shm_phys_addr=$pciv_start shm_size=0x100000
- insmod pcie/mcc_usrdev_slv.ko
- insmod hi3531d_pciv_fmw.ko
- insmod hi3531d_pciv.ko
- }
- remove_pci()
- {
- rmmod hi3531d_pciv.ko
- rmmod hi3531d_pciv_fmw.ko
-
- rmmod mcc_usrdev_slv.ko
- rmmod mcc_drv_slv.ko
- rmmod pcit_dma_slv.ko
- rmmod hi35xx_dev_slv.ko
- }
- insert_ko()
- {
- # low power control
- # source ./lowpower.sh > /dev/null
- insmod sys_config.ko mode=slave2
- # pinmux configuration
- #source ./padctrl_Hi3531D_slave2.sh > /dev/null
- # source ./pinmux_slave2.sh > /dev/null
- # source ./pinmux_bt1120.sh > /dev/null
- # source ./pinmux_master.sh > /dev/null
- # source ./pinmux_slave.sh > /dev/null
- # crg configuration
- #source ./crgctrl_hi3531d.sh > /dev/null
- # system configuration
- #source ./sysctl_hi3531d.sh > /dev/null
-
- insmod hi_osal.ko mmz=anonymous,0,$mmz_start,$mmz_size:window,0,$pciv_start1,7M 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
-
- insert_pci
- }
- remove_ko()
- {
- remove_pci
- remove_audio
- remove_ad
- # rmmod sil9024 &> /dev/null
- rmmod hi3531d_ive
- rmmod hi3531d_vda
- rmmod hi3531d_jpege
- rmmod hi3531d_h265e
- rmmod hi3531d_h264e
- 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 " -osmem os_mem_size config os mem size [unit: M, default: 64]"
- echo " -h help information"
- echo -e "Available ad: nvp6134, tp2853"
- 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 -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 - 8;
- }
- END { printf("%dM\n", temp); }'`
-
- pciv_start=`echo "$mmz_start $mmz_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 - 8;
- }
- END { printf("%dM\n", temp); }'`
-
- pciv_start1=`echo "$pciv_start $message_size" |
- awk 'BEGIN { temp = 0; }
- {
- temp = $1/1024/1024 + $2;
- }
- END { printf("0x%x00000\n", temp); }'`
-
- echo "mmz_start: $mmz_start, mmz_size: $mmz_size, pciv_start: $pciv_start,pciv_start1: $pciv_start1"
- }
- ######################parse arg###################################
- b_arg_os_mem=0
- b_arg_ad=0
- b_arg_insmod=0
- b_arg_remove=0
- for arg in $@
- do
- 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
- 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;
- 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;
- ;;
- esac
- done
- #######################parse arg end########################
- #######################Action###############################
- if [ $b_arg_remove -eq 1 ]; then
- remove_ko;
- fi
- if [ $b_arg_insmod -eq 1 ]; then
- insert_ko;
- fi
|