歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> S3C6410 TVout 測試

S3C6410 TVout 測試

日期:2017/3/1 10:56:50   编辑:Linux編程
一.tvout_app的移植
為了測試S3C6410的電視輸出,我拿了官方的tvout_app中的測試,這個做的相當初糙,好象是很老的版本,在更改了Makefile後編譯,最後發現有函數未定義 /home/huisen/project/tvout/tvout_app/tv_test.c:450: undefined reference to `s3c_get_media_memory'
查看源碼是這個原因造成的 ctrl.value = POST_BUFF_BASE_ADDR; 而這個宏是如下定義 #define POST_BUFF_BASE_ADDR (UINT32)s3c_get_media_memory(S3C_MDEV_TV)
這個應用程序直接調用驅動裡的函數,這在LINUX是不可以的。我估計三星也沒把這TVOUT當回事,直接就發布了,編譯通不過也不管。雖然在培訓上s3c6410用的很多,但是很多細節上來看,在花了很長時間做s3c2440後,三星匆忙推出s3c6410,然後大隊人馬就去搞s5p系列了。留一下一堆問題。
一種最簡單方法是擴展s3c-tvenc的驅動,增加一個VIDIOC_G_CTRL的ioctl指令,讓其在驅動中調用s3c_get_media_memory.
在s3c-tvenc.c 增加如下代碼: 新增函數: s3c_tvenc_get_v4l2_control() 在s3c_tvenc_do_ioctl()增加命令支持
  1. static int s3c_tvenc_get_v4l2_control(struct v4l2_control *ctrl)
  2. {
  3. switch(ctrl->id) {
  4. case V4L2_CID_MPEG_STREAM_PID_VIDEO:
  5. ctrl->value = tv_param.sp.SrcFrmSt;
  6. return 0;
  7. default:
  8. return -EINVAL;
  9. }
  10. return 0;

  11. }

  12. static int s3c_tvenc_do_ioctl(struct inode *inode,struct file *filp,unsigned int cmd,void *arg)
  13. {
  14. // ...
  15. /* add by Andrew Huang */
  16. case VIDIOC_G_CTRL:
  17. {
  18. struct v4l2_control *ctrl = arg;
  19. //printk("P: VIDIOC_S_CTRL \n");
  20. ret = s3c_tvenc_get_v4l2_control(ctrl);
  21. return ret;
  22. }
  23. // ...
  24. }
修改tv_test.c 代碼,增加對上述ioctl命令的調用 修改 450行,增加如下代碼
  1. //add by Andrew Huang
  2. #if 1
  3. ret = ioctl(tvout_fp, VIDIOC_G_CTRL, &ctrl);
  4. if(ret < 0) {
  5. printf("V4L2 APPL : ioctl(VIDIOC_G_CTRL) failed\n");
  6. goto err;
  7. }
  8. #else
  9. //ctrl.value = POST_BUFF_BASE_ADDR; // 編譯通不過
  10. #endif

去掉一些編譯警告後,可以測試了。
  1. [root@huisen tvout_app]# make clean
  2. rm -f tv_test ./tv_test.o ./FrameExtractor.o ./SsbSipH264Decode.o ./H264Frames.o ./SsbSipMfcDecode.o ./SsbSipLogMsg.o
  3. [root@huisen tvout_app]# make
  4. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o tv_test.o tv_test.c
  5. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o FrameExtractor.o FrameExtractor.c
  6. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipH264Decode.o SsbSipH264Decode.c
  7. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o H264Frames.o H264Frames.c
  8. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipMfcDecode.o SsbSipMfcDecode.c
  9. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -c -o SsbSipLogMsg.o SsbSipLogMsg.c
  10. arm-linux-gcc -Wall -O0 -lpthread -I/home/huisen/rom/mini6410/linux-2.6.28.6/include -I. -g -o tv_test ./tv_test.o ./FrameExtractor.o ./SsbSipH264Decode.o ./H264Frames.o ./SsbSipMfcDecode.o ./SsbSipLogMsg.o -lpthread
Copyright © Linux教程網 All Rights Reserved