资源简介
Zedboard ov7725板端Linux下tcp视频发送
代码片段和文件信息
////////////////////////////////////////////////////////////////////////
//
// opencv_hello_world.c
//
// This is a simple introductory OpenCV program. The program reads an
// image from a file inverts it and saves the result.
//
////////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
void start_my_dma(unsigned long phy_addr)
{
//return;
int fd = open(“/dev/mem“ O_RDWR);
unsigned char* virtual_addr;
unsigned long size = 32;
virtual_addr = (unsigned char*)mmap(NULL size PROT_READ | PROT_WRITE MAP_SHARED fd (off_t)phy_addr);
if(virtual_addr == MAP_FAILED)
{
perror(“virtual_addr_in mapping for absolute memory access failed.\n“);
return;
}
unsigned int *dma_sta_reg = (volatile unsigned int *)virtual_addr;
*dma_sta_reg = 3;
printf(“dma_sta_reg is 0x%x\n“*dma_sta_reg);
while(*dma_sta_reg & 1 == 1); //printf(“busy\n“);
munmap((void *)virtual_addr size);
close(fd);
}
void send_rgb_tcp(char * ip)
{
int sockfd;
unsigned long vdma_apb_addr = 0x70000000;
unsigned long src_phy_addr1 = 0x1c000000;
unsigned long src_phy_addr2 = 0x1c200000;
unsigned long src_phy_addr3 = 0x1c400000;
sockfd = Socket_Init(ip“8181“);
unsigned char *buffer = (unsigned char *)malloc(640*480*4);
if(NULL == buffer)
printf(“malloc error\n“);
int fd = open(“/dev/mem“ O_RDWR);
volatile unsigned char* virtual_src_addr1*virtual_src_addr2*virtual_src_addr3;
unsigned long size = 640*480*4;
virtual_src_addr1 = (volatile unsigned char*)mmap(NULL size PROT_READ | PROT_WRITE MAP_SHARED fd (off_t)src_phy_addr1);
if(virtual_src_addr1 == MAP_FAILED)
{
perror(“virtual_addr1 mapping for absolute memory access failed.\n“);
return;
}
virtual_src_addr2 = (volatile unsigned char*)mmap(NULL size PROT_READ | PROT_WRITE MAP_SHARED fd (off_t)src_phy_addr2);
if(virtual_src_addr2 == MAP_FAILED)
{
perror(“virtual_addr2 mapping for absolute memory access failed.\n“);
return;
}
virtual_src_addr3 = (volatile unsigned char*)mmap(NULL size PROT_READ | PROT_WRITE MAP_SHARED fd (off_t)src_phy_addr3);
if(virtual_src_addr3 == MAP_FAILED)
{
perror(“virtual_addr3 mapping for absolute memory access failed.\n“);
return;
}
unsigned char *virtual_apb_addr;
virtual_apb_addr = (unsigned char*)mmap(NULL 32 PROT_READ | PROT_WRITE MAP_SHARED fd (off_t)vdma_apb_addr);
if(virtual_apb_addr == MAP_FAILED)
{
perror(“virtual_apb_addr mapping for absolute memory access failed.\n“);
return;
}
volatile int *vdma_reg = (volatile int *)virtual_apb_addr;
printf(“vdma_reg is %x\n“*vdma_reg);
unsigned char * image_addr[3];
image_addr[0] = virtual_src_addr1;
image_addr[1] = virtual_src_addr2;
image_addr[2] = virtual_src_addr3;
int cnt = 0;
while(1)
{
if(*vdma_reg == 0x02)
{
*vdma_reg = 0x02;
memcpy(bufferimage_addr[(cnt++)%3]size);
Socket_Send(sockfdbuffersize);
}
}
}
int ma
相关资源
- Linux上实现基于Socket_的多进程实时通
- xgcom-0.04.2源码
- linux下的一个异步通信的串口类
- Linux设备驱动
- Linux内存分配与回收
- linux gsm0710 CMUX串口多路复用源码
- Linux Socket 基于GTK+聊天软件
- v4l2采集视频并保存和lcd显示
- Linux基于Live555从共享内存 获取rstp实时
- linux下二进制拆弹
- 《Linux环境编程》编程题答案及实验报
- linux平台基于socket图形化网络聊天
- 用链表实现的一个电话本小程序
- linux系统iftop命令所有安装包依赖包
- Linux系统操作实习报告
- 基于嵌入式Linux的车载定位系统设计
- 基于嵌入式Linux系统的远程数据采集
- 实验2 Linux内核编译及系统调用添加
- 支持VMWare Esxi6.7虚拟机操作系统,VM
- Linux下Nao环境搭建及其运行调试
- linuxcnc插补算法函数调用关系图
- 百度网盘qimo for kids带中文版qimo 2.0
- 命令执行程序doit请大家不要copy,注意
- 文件查找程序myfind请大家不要copy注意
- FHS说明文档
- linux基线自查.xlsx
- 尚硅谷周阳Linux视频附加韩顺平老师
- Ubuntu升级openssh7.8p1快速命令集
- curl器linux版
- 简易的彩票系统linux c
评论
共有 条评论