S3C6410 TVout 测试


一.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. }

  13. static int s3c_tvenc_do_ioctl(struct inode *inode,struct file *filp,unsigned int cmd,void *arg)
  14. {
  15.  // ...
  16.  /* add by Andrew Huang */
  17.     case VIDIOC_G_CTRL:
  18.         {
  19.             struct v4l2_control *ctrl = arg;
  20.             //printk("P: VIDIOC_S_CTRL \n");
  21.             ret = s3c_tvenc_get_v4l2_control(ctrl);
  22.             return ret;
  23.         }
  24.     // ...    
  25. }
  修改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
  • 1
  • 2
  • 下一页

相关内容