load3531d_slave 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. #!/bin/sh
  2. # Useage: ./load3531d [ -r|-i|-a ] [ ad ]
  3. # -r : rmmod all modules
  4. # -i : insmod all modules
  5. # default : rmmod all moules and then insmod them
  6. #
  7. ####################Variables Definition##########################
  8. AD_TYPE=6134 # ad type
  9. mem_total=2048; # 512M, total mem
  10. mem_start=0x40000000; # phy mem start
  11. os_mem_size=256; # 128M, os mem
  12. mmz_start=0x50000000; # mmz start addr
  13. mmz_size=1784M; # 128M, mmz size
  14. message_size=1M; # 1M, pciv message size
  15. pciv_start=0xbf800000;
  16. pciv_start1=0xbf900000;
  17. ##################################################################
  18. report_error()
  19. {
  20. echo "******* Error: There's something wrong, please check! *****"
  21. exit 1
  22. }
  23. insert_audio()
  24. {
  25. insmod hi3531d_aio.ko
  26. insmod hi3531d_ai.ko
  27. insmod hi3531d_ao.ko
  28. insmod hi3531d_aenc.ko
  29. insmod hi3531d_adec.ko
  30. # insmod extdrv/tlv_320aic31.ko
  31. }
  32. remove_audio()
  33. {
  34. # rmmod tlv_320aic31.ko
  35. rmmod hi3531d_adec
  36. rmmod hi3531d_aenc
  37. rmmod hi3531d_ao
  38. rmmod hi3531d_ai
  39. rmmod hi3531d_aio
  40. }
  41. insert_ad()
  42. {
  43. case $AD_TYPE in
  44. 6134)
  45. insmod extdrv/nvp6134_ex.ko
  46. ;;
  47. 2853)
  48. insmod extdrv/tp2853.ko
  49. ;;
  50. *)
  51. echo "xxxx Invalid ad type $AD_TYPE xxxx"
  52. report_error
  53. ;;
  54. esac
  55. }
  56. remove_ad()
  57. {
  58. case $AD_TYPE in
  59. 6134)
  60. rmmod nvp6134_ex.ko
  61. ;;
  62. 2853)
  63. rmmod tp2853.ko
  64. ;;
  65. *)
  66. echo "xxxx Invalid ad type $AD_TYPE xxxx"
  67. report_error
  68. ;;
  69. esac
  70. }
  71. # If you want to use PCIe cascade, please compile PCIe related uboot, kernel, rootfs in directory: osdrv/.
  72. # Also, please compile PCIe related ko files in directory: osdrv/pub/. Then create a directory named pcie in current directory,
  73. # and put theses ko files in the directory.
  74. # For more details, please read the files in directory: osdrv/ and osdrv/drv/pcie_mcc/.
  75. insert_pci()
  76. {
  77. insmod pcie/hi35xx_dev_slv.ko
  78. insmod pcie/pcit_dma_slv.ko
  79. insmod pcie/mcc_drv_slv.ko shm_phys_addr=$pciv_start shm_size=0x100000
  80. insmod pcie/mcc_usrdev_slv.ko
  81. insmod hi3531d_pciv_fmw.ko
  82. insmod hi3531d_pciv.ko
  83. }
  84. remove_pci()
  85. {
  86. rmmod hi3531d_pciv.ko
  87. rmmod hi3531d_pciv_fmw.ko
  88. rmmod mcc_usrdev_slv.ko
  89. rmmod mcc_drv_slv.ko
  90. rmmod pcit_dma_slv.ko
  91. rmmod hi35xx_dev_slv.ko
  92. }
  93. insert_ko()
  94. {
  95. # low power control
  96. # source ./lowpower.sh > /dev/null
  97. insmod sys_config.ko mode=slave2
  98. # pinmux configuration
  99. #source ./padctrl_Hi3531D_slave2.sh > /dev/null
  100. # source ./pinmux_slave2.sh > /dev/null
  101. # source ./pinmux_bt1120.sh > /dev/null
  102. # source ./pinmux_master.sh > /dev/null
  103. # source ./pinmux_slave.sh > /dev/null
  104. # crg configuration
  105. #source ./crgctrl_hi3531d.sh > /dev/null
  106. # system configuration
  107. #source ./sysctl_hi3531d.sh > /dev/null
  108. insmod hi_osal.ko mmz=anonymous,0,$mmz_start,$mmz_size:window,0,$pciv_start1,7M anony=1 || report_error
  109. insmod hi_base.ko
  110. insmod hi3531d_sys.ko mem_total=$mem_total
  111. if [[ $? -ne 0 ]]; then
  112. exit;
  113. fi
  114. insmod hi3531d_vdec.ko
  115. insmod hi3531d_vfmw.ko
  116. insmod hi3531d_jpegd.ko
  117. insmod hi3531d_tde.ko
  118. insmod hi3531d_region.ko
  119. insmod hi3531d_vgs.ko
  120. insmod hi3531d_viu.ko detect_err_frame=10;
  121. insmod hi3531d_vpss.ko
  122. insmod hi3531d_vou.ko
  123. insmod hifb.ko video="hifb:vram0_size:32400,vram1_size:8100,vram2_size:2160,vram3_size:128,vram4_size:128" softcursor="off"
  124. insmod hi3531d_hdmi.ko
  125. insmod hi3531d_rc.ko
  126. insmod hi3531d_venc.ko
  127. insmod hi3531d_chnl.ko
  128. insmod hi3531d_vedu.ko
  129. insmod hi3531d_h264e.ko
  130. insmod hi3531d_h265e.ko
  131. insmod hi3531d_jpege.ko
  132. insmod hi3531d_vda.ko
  133. insmod hi3531d_ive.ko
  134. # insmod extdrv/sil9024.ko norm=5 #720P@60fps
  135. # insmod extdrv/sil9024.ko norm=9 #1080P@60fps
  136. # insmod extdrv/sil9024.ko norm=12 #1080P@30fps
  137. # echo "==== Your input AD type is $AD_TYPE ===="
  138. insert_ad
  139. insert_audio
  140. insert_pci
  141. }
  142. remove_ko()
  143. {
  144. remove_pci
  145. remove_audio
  146. remove_ad
  147. # rmmod sil9024 &> /dev/null
  148. rmmod hi3531d_ive
  149. rmmod hi3531d_vda
  150. rmmod hi3531d_jpege
  151. rmmod hi3531d_h265e
  152. rmmod hi3531d_h264e
  153. rmmod hi3531d_vedu
  154. rmmod hi3531d_chnl
  155. rmmod hi3531d_venc
  156. rmmod hi3531d_rc
  157. rmmod hi3531d_hdmi
  158. rmmod hifb
  159. rmmod hi3531d_vou
  160. rmmod hi3531d_vpss
  161. rmmod hi3531d_viu
  162. rmmod hi3531d_vgs
  163. rmmod hi3531d_region
  164. rmmod hi3531d_tde
  165. rmmod hi3531d_jpegd
  166. rmmod hi3531d_vdec
  167. rmmod hi3531d_vfmw
  168. rmmod hi3531d_sys
  169. rmmod hi_base
  170. rmmod hi_osal
  171. rmmod sys_config
  172. #rmmod hi_media
  173. #rmmod hiuser
  174. #rmmod mmz
  175. }
  176. load_usage()
  177. {
  178. echo "Usage: ./load3531d [-option] [ad_name]"
  179. echo "options:"
  180. echo " -i insert modules"
  181. echo " -r remove modules"
  182. echo " -a remove modules first, then insert modules"
  183. echo " -ad ad_name config AD type [default: tp2823]"
  184. echo " -osmem os_mem_size config os mem size [unit: M, default: 64]"
  185. echo " -h help information"
  186. echo -e "Available ad: nvp6134, tp2853"
  187. echo -e "notes: osmem option can't be used when mmz zone partition is enable\n\n"
  188. echo -e "for example: ./load3531d -a -ad 2853 -osmem 64\n"
  189. }
  190. calc_mmz_info()
  191. {
  192. mmz_start=`echo "$mem_start $os_mem_size" |
  193. awk 'BEGIN { temp = 0; }
  194. {
  195. temp = $1/1024/1024 + $2;
  196. }
  197. END { printf("0x%x00000\n", temp); }'`
  198. mmz_size=`echo "$mem_total $os_mem_size" |
  199. awk 'BEGIN { temp = 0; }
  200. {
  201. temp = $1 - $2 - 8;
  202. }
  203. END { printf("%dM\n", temp); }'`
  204. pciv_start=`echo "$mmz_start $mmz_size" |
  205. awk 'BEGIN { temp = 0; }
  206. {
  207. temp = $1/1024/1024 + $2;
  208. }
  209. END { printf("0x%x00000\n", temp); }'`
  210. mmz_size=`echo "$mem_total $os_mem_size" |
  211. awk 'BEGIN { temp = 0; }
  212. {
  213. temp = $1 - $2 - 8;
  214. }
  215. END { printf("%dM\n", temp); }'`
  216. pciv_start1=`echo "$pciv_start $message_size" |
  217. awk 'BEGIN { temp = 0; }
  218. {
  219. temp = $1/1024/1024 + $2;
  220. }
  221. END { printf("0x%x00000\n", temp); }'`
  222. echo "mmz_start: $mmz_start, mmz_size: $mmz_size, pciv_start: $pciv_start,pciv_start1: $pciv_start1"
  223. }
  224. ######################parse arg###################################
  225. b_arg_os_mem=0
  226. b_arg_ad=0
  227. b_arg_insmod=0
  228. b_arg_remove=0
  229. for arg in $@
  230. do
  231. if [ $b_arg_os_mem -eq 1 ] ; then
  232. b_arg_os_mem=0;
  233. os_mem_size=$arg;
  234. if [ -z $os_mem_size ]; then
  235. echo "[error] os_mem_size is null"
  236. exit;
  237. fi
  238. if [ $os_mem_size -ge $mem_total ] ; then
  239. echo "[err] os_mem[$os_mem_size], over total_mem[$mem_total]"
  240. exit;
  241. fi
  242. calc_mmz_info;
  243. fi
  244. if [ $b_arg_ad -eq 1 ] ; then
  245. b_arg_ad=0
  246. AD_TYPE=$arg;
  247. fi
  248. case $arg in
  249. "-i")
  250. b_arg_insmod=1;
  251. ;;
  252. "-r")
  253. b_arg_remove=1;
  254. ;;
  255. "-a")
  256. b_arg_insmod=1;
  257. b_arg_remove=1;
  258. ;;
  259. "-h")
  260. load_usage;
  261. ;;
  262. "-ad")
  263. b_arg_ad=1;
  264. ;;
  265. "-osmem")
  266. b_arg_os_mem=1;
  267. ;;
  268. esac
  269. done
  270. #######################parse arg end########################
  271. #######################Action###############################
  272. if [ $b_arg_remove -eq 1 ]; then
  273. remove_ko;
  274. fi
  275. if [ $b_arg_insmod -eq 1 ]; then
  276. insert_ko;
  277. fi