load3531d_master 6.2 KB

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