load3531d 5.9 KB

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