load3531d_cas_mm 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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="slave1"; # 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
  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 tp2827.ko
  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
  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. insmod hi3531d_rc.ko
  100. insmod hi3531d_venc.ko
  101. insmod hi3531d_chnl.ko
  102. insmod hi3531d_vedu.ko
  103. insmod hi3531d_h264e.ko
  104. insmod hi3531d_h265e.ko
  105. insmod hi3531d_jpege.ko
  106. insmod hi3531d_vda.ko
  107. insmod hi3531d_ive.ko
  108. # insmod extdrv/sil9024.ko norm=5 #720P@60fps
  109. # insmod extdrv/sil9024.ko norm=9 #1080P@60fps
  110. # insmod extdrv/sil9024.ko norm=12 #1080P@30fps
  111. # echo "==== Your input AD type is $AD_TYPE ===="
  112. insert_ad
  113. insert_audio
  114. }
  115. remove_ko()
  116. {
  117. remove_audio
  118. remove_ad
  119. # rmmod sil9024 &> /dev/null
  120. rmmod hi3531d_ive
  121. rmmod hi3531d_vda
  122. rmmod hi3531d_jpege
  123. rmmod hi3531d_h264e
  124. rmmod hi3531d_h265e
  125. rmmod hi3531d_vedu
  126. rmmod hi3531d_chnl
  127. rmmod hi3531d_venc
  128. rmmod hi3531d_rc
  129. rmmod hi3531d_hdmi
  130. rmmod hifb
  131. rmmod hi3531d_vou
  132. rmmod hi3531d_vpss
  133. rmmod hi3531d_viu
  134. rmmod hi3531d_vgs
  135. rmmod hi3531d_region
  136. rmmod hi3531d_tde
  137. rmmod hi3531d_jpegd
  138. rmmod hi3531d_vdec
  139. rmmod hi3531d_vfmw
  140. rmmod hi3531d_sys
  141. rmmod hi_base
  142. rmmod hi_osal
  143. rmmod sys_config
  144. #rmmod hi_media
  145. #rmmod hiuser
  146. #rmmod mmz
  147. }
  148. load_usage()
  149. {
  150. echo "Usage: ./load3531d [-option] [ad_name]"
  151. echo "options:"
  152. echo " -i insert modules"
  153. echo " -r remove modules"
  154. echo " -a remove modules first, then insert modules"
  155. echo " -ad ad_name config AD type [default: tp2823]"
  156. echo " -total mem_size config total mem size [unit: M, default: 2048]"
  157. echo " -osmem os_mem_size config os mem size [unit: M, default: 256]"
  158. echo " -mode demo config board type [demo or sck etc., default: demo]"
  159. echo " -h help information"
  160. echo -e "Available ad: nvp6134, tp2853,tp2827"
  161. echo -e "notes: osmem option can't be used when mmz zone partition is enable\n\n"
  162. echo -e "for example: ./load3531d -a -ad 2853 -total 2048 -osmem 64\n"
  163. }
  164. calc_mmz_info()
  165. {
  166. mmz_start=`echo "$mem_start $os_mem_size" |
  167. awk 'BEGIN { temp = 0; }
  168. {
  169. temp = $1/1024/1024 + $2;
  170. }
  171. END { printf("0x%x00000\n", temp); }'`
  172. mmz_size=`echo "$mem_total $os_mem_size" |
  173. awk 'BEGIN { temp = 0; }
  174. {
  175. temp = $1 - $2;
  176. }
  177. END { printf("%dM\n", temp); }'`
  178. echo "mmz_start: $mmz_start, mmz_size: $mmz_size"
  179. }
  180. ######################parse arg###################################
  181. b_arg_os_mem=0
  182. b_arg_total_mem=0
  183. b_arg_ad=0
  184. b_arg_insmod=0
  185. b_arg_remove=0
  186. b_arg_mode=0
  187. for arg in $@
  188. do
  189. if [ $b_arg_total_mem -eq 1 ]; then
  190. b_arg_total_mem=0;
  191. mem_total=$arg;
  192. if [ -z $mem_total ]; then
  193. echo "[error] mem_total is null"
  194. exit;
  195. fi
  196. fi
  197. if [ $b_arg_mode -eq 1 ]; then
  198. b_arg_mode=0;
  199. board_mode=$arg;
  200. if [ -z $board_mode ]; then
  201. echo "[error] board_mode is null"
  202. exit;
  203. fi
  204. fi
  205. if [ $b_arg_os_mem -eq 1 ] ; then
  206. b_arg_os_mem=0;
  207. os_mem_size=$arg;
  208. if [ -z $os_mem_size ]; then
  209. echo "[error] os_mem_size is null"
  210. exit;
  211. fi
  212. fi
  213. if [ $b_arg_ad -eq 1 ] ; then
  214. b_arg_ad=0
  215. AD_TYPE=$arg;
  216. fi
  217. case $arg in
  218. "-i")
  219. b_arg_insmod=1;
  220. ;;
  221. "-r")
  222. b_arg_remove=1;
  223. ;;
  224. "-a")
  225. b_arg_insmod=1;
  226. b_arg_remove=1;
  227. ;;
  228. "-h")
  229. load_usage;
  230. ;;
  231. "-ad")
  232. b_arg_ad=1;
  233. ;;
  234. "-osmem")
  235. b_arg_os_mem=1;
  236. ;;
  237. "-total")
  238. b_arg_total_mem=1;
  239. ;;
  240. "-sck")
  241. b_arg_demb=0;
  242. ;;
  243. "-pro")
  244. b_arg_demb=2;
  245. ;;
  246. "-mode")
  247. b_arg_mode=1;
  248. ;;
  249. esac
  250. done
  251. #######################parse arg end########################
  252. if [ $os_mem_size -ge $mem_total ] ; then
  253. echo "[err] os_mem[$os_mem_size], over total_mem[$mem_total]"
  254. exit;
  255. fi
  256. calc_mmz_info;
  257. #######################Action###############################
  258. if [ $# -lt 1 ]; then
  259. load_usage;
  260. exit 0;
  261. fi
  262. if [ $b_arg_remove -eq 1 ]; then
  263. remove_ko;
  264. fi
  265. if [ $b_arg_insmod -eq 1 ]; then
  266. insert_ko;
  267. fi