基于Linux的广告机系统


    






    基Linux广告机系统


    基Linux广告机系统


    般说广告系统称广告系统网络信息技术时代飞速发展中产生新类型网络媒体信息发布系统系统基础户发布公开显示终端公开信息容种方式目前数字化网络化信息化媒体网络广告机已成亮点媒体市场中广告机单机版单媒体发布形式满足日益增长市场需求没研究种媒体形式功交互式网络广告机篇文章中数Linux系统支持开源软件工具集Linux嵌入式系统设计成低声音功性优良具灵活网络分销网络建立媒体广告机系统
    关键词:广告机Linux嵌入式系统设计 网络信息技术时代













    Advertising Machine System Based on Linux
    Abstract
    Generally speaking an advertising system called an advertising system is a new type of network multimedia information distribution system that has been produced in the rapid development of the era of network information technology On the basis of this system users can publish the information content disclosed on the public display terminal in various ways At present digital networked and informationbased multimedia network advertising machines but it has become a highlight In the media market the standalone version of advertising machines and the form of single media release can meet the growing market demand Study multiple media forms multifunctional interactive network advertising machine In this article I use the open source software and tool set supported by most Linux systems use Linux embedded system design low cost excellent sound function performance and have a flexible network distribution network to establish a media advertising machine system
    Keywords advertising machine Linux embedded system design An era of network information technology











    目录
    ()设计目意义应达技术求 1
    (二)设计国外发展概况存问题 1
    (三)设计应解决问题 2
    1 芯片介绍 2
    11 芯片 2
    12 芯片启动流程 3
    13 交叉编译器 4
    14 uboot 4
    15 移植核 5
    16 烧录核SD卡中 6
    17 文件系统制作 6
    18 文件系统挂载 8
    2 模块编程 10
    21 驱动编程方式 10
    22 模块编译 11
    23 加载卸载模块 12
    3 字符设备 12
    31 linux设备驱动基概念 12
    32 linux系统调接口 12
    33 驱动分析 13
    34 驱动分类 13
    35 字符设备驱动编写流程 13
    36 杂项字符设备 13
    37 杂项字符设备相关函数 14
    38 简单杂项字符设备编写流程 14
    39 键驱动编程 14
    4 LCD应层编程 15
    41 LCD驱动 15
    42 LCD屏组成 16
    43 LCD显存 16
    5 JPEG库移植 17
    51 图片格式 17
    52 JPEG库源码包 17
    53 JPEG库移植 17
    54 JPEG库 19
    55 目录操作函数 20
    6 分析问题 20
    7 设计程 20
    71 配置网络 20
    8 结 24





    前言
    广告机通常称国外数字标牌作媒体推广新动态方式走眼睛快速步伐现难发现银行写字楼铁街道公交通工具身边越越方出现类似电视停滚动播放容信息产品种新媒体技术通特定该广播济商业娱乐信息特定群显示设备广告机典型组成部分
    文提出种基Linux广告机系统特点事实没必连接事情需进行更新改变视频图片字幕容等等
    ()设计目意义应达技术求
    着电子技术媒体技术网络技术飞速发展引擎广告作种产品似第五媒体传统报刊广播电视互联网然研究关广告机新开始思考早期阶段基市场新产品广告机逐渐认户时理相信久会广告更加性化整生命接受更机会
    广告机系统基功:
    1 播放丰富电子资源包括视频图片文
    2 实现图片切换
    3 实现图片切换视频
    4 实现视频音频步
    (二)设计国外发展概况存问题
    [文献21]全球网络时代网络广告代表广告发展新趋势普互联网发展提供企业全新广告传播工具线广告成国外广告业行竞争领域研究现状线广告中国发展趋势提供前瞻性网络广告中国发展理预测指导文分析中国网络线广告基础知识中国网络广告发展现状存问题预测中国网络广告发展趋势:着中国企业网民接受网络广告增加会线广告前未发展机遇中国网络技术发展带网络广告更强技术保障网络法律广告法逐步完善网络广告合法轨道运行该评价方法更加科学互联网已成第四媒体传统报纸广播电视媒体网络广告四媒体中占份额逐步增加成第种类型广告
    文献[22]介绍基μCOSⅡ嵌入式操作系统设计数字音频播放器方法实现该播放器歌曲音频文件存储播放选择暂停倒退等功中解嵌入式 Linux系统开发程中底层系统支持层GUI应方方面面容涵盖Linx操作系统安装相关工具配置嵌入式编程需基础知识硬件部件编程UBootIiux核分析配置移植根文件系统构造核调试技术驱动程序编写移植GUI系统移植应程序调试技术文章系统述设计思想产生影响
    (三)设计应解决问题
    1Linux编译环境搭建配置标准编译器
    2uboot应启动加载器系统必须部分必须掌握应
    3模块编译解核中加载模块
    4LED屏显示LED屏显示相应图片者视频
    5实现视频音频步

    二设计
    1 系统概括
    图1示整系统粗略划分三部分:广告机监控终端服务器控制中心广告机显示终端监视终端通Web浏览器控制页面理员接收该控制命令输入提交表单通网络路服务器控制中心服务器控制中心根提交监控终端启动相应插座服务程中建立述显影板插座监控服务进程网络通信时发送相应控制命令信息形式类调相应CGI程序广告机显示终端解析相应控制命令信息控制显示终端设备媒体信息播放模式

    广告机监控终端服务器控制中心设备普通 PC机广告机显示终端采粤嵌嵌入式GEC6818开发板该开发板处理器三星CortexA53系列高性八核处理器S5P6818高频高达14GHz应嵌入式LinuxAndriod等操作系统驱动应开发开发板留丰富外设支持千兆太网板载LVDS接口MIPI接口USB接口等该 芯 片支持MPEG2H264AVS高清标清解码输出视频输出支持PALNTSC480p576p720p1080i时GEC6818着丰富外围设备强媒体力嵌入式台灵活选择种LCD者显示设备作广告机信息发布节点媒体播放设备

    11 交叉编译器
    编译程序时候程序编译成机器识文件实际代码编译成CPU识指令CPU指令集
    linux系统中编译出程序法直接放exynos4412芯片中运行
    需安装linux中编译编译文件exynos4412芯片中运行编译器
    种两CPU间进行转换编译器称交叉编译器效果linux系统编译东西exynos4412芯片中运行
    源码包:armlinuxgcc451v6vfp20120301tgz
    移植程:
    源码包放享目录复制linux系统中tools目录然解压
    命令:
    sudo passwd root
    输入密码123456重复输入两次123456密码
    修改超级户密码123456
    su
    输入密码123456
    mkdir tools
    cp mnthgfssharearmlinuxgcc451v6vfp20120301tgz tools
    cd tools
    tar xf armlinuxgcc451v6vfp20120301tgz
    echo export PATHPATHtoolsoptFriendlyARMtoolschain451bin >> ~bashrc
    关闭终端新开
    su
    输入密码123456
    armlinuxgcc v
    果显示:gcc version 451 (Sourcery G++ Lite 20100950)
    表示成功安装
    12 uboot
    uboot属bootloader中种开源较通种
    嵌入式中bootloader称启动加载器系统必须部分负责初始化基硬件(重启动外扩存)然核复制外扩存中引导核启动
    完成初始化硬件搬运核引导核启动称bootloader

    uboot中初始化存然通存操作搬运核引导启动
    常mmc命令族实现功
    外网络载需核文件系统等
    源码包:uboot_tiny4412sdk1506tar
    进入超级户权限:
    命令:
    sudo passwd root (果前面已执行执行)
    输入密码123456重复输入两次123456密码
    修改超级户密码123456
    移植程:
    源码包放享目录复制linux系统中work目录然解压
    命令:
    su
    输入密码123456
    mkdir work
    cd work
    cp mnthgfsshareuboot_tiny4412sdk1506tarbz2
    tar xf uboot_tiny4412sdk1506tarbz2
    cd uboot_tiny4412sdk1506
    make clean
    make distclean
    make tiny4412_config
    make j16
    终出现容代表成功:
    armlinuxobjcopy gapfill0xff O binary uboot ubootbin
    13 移植核
    核整系统功实现
    核源码量ch文件组成
    终会编译成型bin文件执行程序
    板子搭建操作系统需移植核
    移植步骤:
    命令:
    su
    果需输入密码输入123456(前提执行sudo passwd root)
    cp mnthgfssharelinux35buildoktargz work
    核源码复制work
    cd work
    tar xf linux35buildoktargz
    解压核源码包
    cd linux35
    make clean
    make distclean
    cp tiny4412_linux_defconfig config
    make menuconfig (保证窗口足够命令需窗口足够执行成功)
    核配置菜单中选择
    System Type >
    [ ] Support TrustZoneenabled Trusted Execution Environment
    左右键移动回车键确定空格键操作
    make j16
    开始编译注意定关闭面 Support TrustZoneenabled Trusted Execution Environment选项
    14 文件系统制作
    文件系统户理系统磁盘应程序提供运行环境等等
    文件系统通源码包制作
    源码包:busybox117220101120tgz
    制作步骤:
    su
    输入密码123456(前提执行sudo passwd root)
    cd work
    cp mnthgfssharebusybox117220101120tgz
    tar xf busybox117220101120tgz
    cd busybox1172
    make clean
    make distclean
    make menuconfig
    需配置选项Busybox Settings中
    Busybox Settings >
    Build Options >
    [*] Build shared libbusybox 选项修改*
    Cross Compiler prefix (NEW) 交叉编译器 armlinux
    Installation Options >
    (_install) BusyBox installation prefix (NEW)修改workroot_nfs
    保存退出
    make && make install
    cd workroot_nfs
    mkdir lib dev etcinitd home proc sys root tmp var p
    lib中放入需动态库
    cp toolsoptFriendlyARMtoolschain451armnonelinuxgnueabisysrootlib* lib rfd
    cp toolsoptFriendlyARMtoolschain451armnonelinuxgnueabisysrootusrlib* lib rfd

    创建两设备节点文件
    cd workroot_nfsdev
    mknod null c 1 3
    mknod console c 5 1

    处理配置文件
    cd workroot_nfsetc
    cp etcpasswd workroot_nfsetc rf
    passwd中bash改sh
    cp etcgroup workroot_nfsetc rf
    cp etcfstab workroot_nfsetc rf

    vim inittab文档中添加容
    sysinitetcinitdrcS
    consoleaskfirstbinsh
    ctrlaltdelsbinreboot
    shutdownbinumount a r


    vim profile文档中添加容
    USER`id un`
    LOGNAMEUSER
    PS1[\u@\h\w]#
    PATHPATH
    HOSTNAME`binhostname`
    export USER LOGNAME PS1 PATH


    cd initd
    vim rcS
    输入容
    #binsh
    mount a
    mkdir devpts
    mount t devpts devpts
    echo sbinmdev > procsyskernelhotplug
    mdev s
    binhostname xyd

    chmod 777 rcS
    15 文件系统挂载
    系统组成
    bootloader + 核 + 文件系统
    uboot linux35核 ext4
    接需文件系统核直接进行连接
    文件系统挂载核

    文件系统挂载较常见方式网络挂载 挂载

    般研发程中linux文件系统基网络挂载原研发程中需常修改文件系统中东西者修改核中东西网络挂载方式修改变轻松

    果挂载需文件系统中发送文件相会麻烦挂载般产品研发成功出成品需修改文件系统者核时候文件系统挂载存储芯片中

    网络挂载文件系统
    面操作超级户权限执行通su命令进入
    挂载步骤
    载nfs服务器
    确保ubuntu系统正常网
    点击系统右角网络适配器选择设置

    选择NAT模式

    终端中执行命令
    aptget install nfsserver
    关闭防火墙
    ufw disable
    设置文件系统路径开放路径
    vim etcexports
    行加入
    workroot_nfs *(rwsyncno_subtree_checkno_root_squash)
    屏蔽掉行
    #opttarget *(rwsyncno_subtree_check)
    保存退出
    exportfs rv
    显示exporting *workroot_nfs代表路径生效
    设置网卡物理网卡
    菜单栏中编辑 虚拟网络编辑器

    点击系统右角网络适配器选择设置
    选择桥接模式


    启动nfs服务器
    service nfskernelserver restart
    service nfskernelserver restart 执行两次

    设置IP址子网掩码网关等

    第四步填入IP址子网掩码网关分
    19216810106 2552552550 192168101
    保存退出

    点击网络连接钮选择刚刚配置网络连接

    启动开发板CRT工具中进入uboot操作界面输入命令printenv环境变量
    中bootargs需操作变量
    输入容:
    set bootargs noinitrd rootdevnfs nfsroot19216810106workroot_nfs ip19216810161192168101061921681012552552550eth0off initlinuxrc consolettySAC0 lcdS702
    输入save回车接网线

    右手边复位键进入文件系统中CRT工具中核加载停止时候
    果回车够出现[root@xyd]#代表文件系统挂载成功开发环境搭建成功

    注意:果停时候回车没反应
    出现问题方:
    1 网线否连接
    2 nfs服务器否开启执行两次service nfskernelserver restart
    3 网卡没物理网卡设置桥接模式IP址没设置
    4 没声明文件系统路径 workroot_nfs *(rwsyncno_subtree_checkno_root_squash)
    5 ubootbootargs环境变量修改出错

    2 模块编程
    21 驱动编程方式
    linux系统中较明显分驱动层应层
    应层编程时候需关注物理设备具体情况型号品牌等等
    需操作驱动层提供设备节点文件操作方式文件操作

    驱动层编程常编程太样
    驱动层编代码需执行
    驱动层编程方式模块编程核层编程基语法

    应程序编程程序main函数开始exit结束程中应程序直运行

    模块编程目核加载模块模块加载核支持模块功加载时候
    运行模块加载函数模块配置操作完成模块会执行操作
    果模块需时候模块卸载掉卸载时候会核模块清相关配置
    会清理掉

    模块操作:
    模块核层代码核进行操作
    模块基操作加载卸载
    加载:核支持模块功
    卸载:模块功核中清掉

    模块编写应层样
    应层
    #include
    int main(void)
    {
    printf(hello world\n)
    return 0
    }

    驱动层
    #include
    #include
    module_init(xxx_init) 入口函数声明
    module_exit(xxx_exit) 出口函数声明
    MODULE_LICENSE(GPL) 开源许协议
    22 模块编译
    面写C文件编译模块
    直接armlinuxgcc进行编译编译器编译应程序
    核模块编译般没固定编译器
    核源码提供模块编译功想编译需助核源码
    编会生成ko缀文件核加载模块

    核源码进行编译需Makefile
    vim Makefile
    表格里容输入进
    FILEmodule
    objm(FILE)o
    KDIRworklinux35
    all
    make C (KDIR) M(PWD) modules
    clean
    @rm *o tmp_versions *cmd* *mod* *symvers *cmd* *order rf

    module应编译c文件果c文件modulec里填module
    果c文件helloc填hello必须C文件编译
    外注意make前tab键缩进@rm前tab键

    23 加载卸载模块
    moduleko例moduleko放开发板文件系统中
    CRT工具中运行起系统输入面命令加载者卸载
    模块加载命令:insmod moduleko
    模块卸载命令:rmmod module
    查已加载模块:lsmod

    第次卸载前先执行命令
    mkdir libmodules350FriendlyARM p
    执行卸载命令

    加载卸载时候会印出 hello module byebye module

    3 字符设备
    31 linux设备驱动基概念
    linux系统空间划分户空间核空间
    windows系统linux系统两种运行模式
    linux系统分两层核心层运行高优先级处理核相关事情应层户层运行低优先级
    shell文编辑器等较常见低优先级程序
    种分层保护核保证系统稳定运行户创建进程运行低优先级基会出现
    运行中产生bug影响核进程运行情况两层间隔离开者进程会空间
    进程崩溃时候局部破坏会影响进程
    核层应层间隔离开显然没办法直接互相通信者说数传输等等
    情况两层间需进行交互保证核稳定核层会直接开隔离
    核层特意留接口应层通接口局限核层进行通信
    接口表现形式基函数

    32 linux系统调接口
    系统调接口面说核层留应层直接交互接口
    接口体现进程控制进程通信文件系统控制存储理网络理套接字控制等等方面
    部分unix系统继承部分添加
    33 驱动分析
    驱动核层实现外部设备功代码块
    外部设备会应驱动模块驱动实现应程序通驱动
    实现设备功基通总线进行理核文件理总线台设备总线等等
    驱动:实现外部设备功
    应程序:驱动间接设备
    34 驱动分类
    块设备驱动:存储设备应驱动
    特性:块单位进行数传输空间连续
    网络设备驱动:网卡等设备应驱动
    特性:网络设备通信模式队列
    字符设备驱动:块设备网络设备外属字符设备
    特性:字节单位进行操作空间连续

    字符设备分杂项字符设备早期字符设备标准字符设备
    35 字符设备驱动编写流程
    1 查原理图数手册解物理设备法
    2 核中找相驱动程序模板进行开发情况需0开始
    3 注册驱动程序户层提供访问接口
    4 设计需实现操作openreadwrite等等
    5 实现核机制中断定时器等
    6 编译模块加载核中
    7 编写应程序测试驱动

    36 杂项字符设备
    设备驱动重属性设备号
    设备号设备核中唯识唯
    核中注册成功设备驱动会分配唯设备号
    设备号两部分组成:设备号次设备号
    设备号取值范围:0255
    次设备号取值范围:0255
    设备号设备号+次设备号构成
    设备号 (设备号 << 20) | 次设备号
    杂项字符设备设备号固定10

    37 杂项字符设备相关函数
    杂项字符设备注册函数
    int misc_register(struct miscdevice * misc)
    函数功:注册杂项字符设备
    形参:misc:杂项字符设备结构体描述杂项字符设备
    返回值:0代表成功负数代表失败

    杂项字符设备注销函数
    int misc_deregister(struct miscdevice *misc)
    功:注销杂项字符设备


    杂项字符设备结构体
    struct miscdevice {
    int minor 次设备号
    const char *name 设备名 会dev出现
    const struct file_operations *fops 文件操作集合较常见readwrite等
    }
    结构体中体现出重点
    设备号:设备号固定10里次设备号果次设备号255表示系统动分配
    设备节点文件:驱动文件系统中留节点文件应程序调
    文件操作集合:参数设置驱动具备文件操作需定义声明

    38 简单杂项字符设备编写流程
    1 编写文件操作函数功
    2 定义文件操作集合结构体传递参数
    3 定义杂项字符设备结构体传递参数
    4 加载函数中调杂项字符设备注册函数
    5 卸载函数中调杂项字符设备注销函数
    6 编写应程序测试驱动否行

    source insight
    ctrl + 左键 查指定结构体变量函数等等

    39 键驱动编程
    51编程
    脚非常简单 P101
    STM32F407
    脚需相关寄存器配置
    exynos4412
    脚需影射寄存器址然操作相关寄存器

    键属开发板物理外设键需知道键脚寄存器址少
    查底板原理图Tiny4412SDK1506Schematic找键应脚编号
    查核心板原理图Tiny44121412Schematic找应IO口GPX3中2345四脚

    找键应脚GPX3_2 GPX3_3 GPX3_4 GPX3_5

    接着查芯片手册Exynos 4412 SCP_Users Manual_Ver01000_Preliminary0第623206章节查
    GPX3模式寄存器数寄存器
    两寄存器址:
    模式寄存器:0x1000 0c60
    配置输入模式应位0
    数寄存器:0x1000 0c64

    芯片物理址程序中直接操作芯片物理址
    需调函数物理址映射进程中
    函数ioremap实现映射
    函数原型:void __iomem *ioremap(phys_addr_t addr unsigned long size)
    函数功:芯片物理址addr映射进程空间通返回值返回映射空间size
    形参:addr:映射物理址 size:映射空间
    返回值:映射虚拟址失败时返回NULL

    代码中需修改:
    模块加载函数中ioremap函数两寄存器物理址映射进程中
    模块卸载函数中iounmap函数两寄存器址释放掉
    read接口函数中检测键状态01松开根键状态应层
    返回样数返回字符1松开返回字符0

    4 LCD应层编程
    41 LCD驱动
    LCD屏外部物理设备想操作LCD屏必须相关核驱动支持
    LCD驱动核中已完成支持较复杂里直接驱动
    里应程序中LCD驱动实现字符汉字图片视频等等容播放

    42 LCD屏组成
    LCD屏素点组成单位体积中素越显示效果越
    LCD显示效果说象素点颜色位深重点
    素点屏幕基构成
    颜色位深素点颜色构成

    43 LCD显存
    LCD驱动注册会核中申请块现存空间显存空间显示帧图数
    显存取决素点数颜色位深
    显存 素点数 * 颜色位深 8

    显存位置素点位置相应颜色位深24时候第素点应显存空间前面3字节
    想操作LCD屏需显存中填充数直接通文件操作read write填充数

    显存核层中直接文件操作效率会低
    提高效率需显存映射进程空间函数mmap

    函数原型: void *mmap(void *addr size_t length int prot int flags int fd off_t offset)
    函数功:显存映射进程空间
    形参:
    addr:映射进程空间首址NULL代表系统动分配
    length:映射显存空间
    prot:显存操作权限
    PROT_EXEC 执行权限
    PROT_READ 读权限
    PROT_WRITE 写权限
    flags:MAP_SHARED:进程享空间
    fd:映射显存空间设备节点文件
    offset:映射偏移量般0
    返回值:映射进程空间首址失败返回NULL
    相反函数munmap释放申请显存空间

    控制设备函数:ioctl函数
    函数原型:int ioctl(int fd int request )
    函数功:控制设备做操作具体操作定义
    形参:fd:控制设备节点文件
    request:命令命令没固定形式设备命令
    命令定义


    显存应层中表现设备节点文件般fb0open函数开然操作
    屏幕显示字符汉字方式显示张图片方式样

    5 JPEG库移植
    51 图片格式
    JPG格式JPEG格式 PNG格式 BMP格式RGB
    BMP格式数存储RGB数排列进行存储图片素数RGB格式进行排列
    BMP格式图片存储完整图片尺寸较占空间较
    JPG格式种图片压缩格式BMP格式压缩JPEG格式压缩例起码1:10
    RGB > 数压缩 > JPG
    10M 1M
    RGB > 数解压 > JPG

    52 JPEG库源码包
    JPEG库源码包中包含BMP格式压缩JPG格式算法
    JEG格式解压BMP格式算法
    两算法支持调相关算法实现图片转换

    源码包写封装较完善通函数
    源码包中c文件头文件
    C文件实现函数功定义头文件进行函数声明
    源码包方式:
    1 源码包中提供函数编写程序
    2 直接源码包中提供现成程序直接
    源码包实际写函数
    函数想编译时候通必须编译器够找该函数应头文件库文件
    源码包首先必须编译源码包应头文件库文件头文件库文件放编译器找路径
    程序编译通想某运行台运行必须应动态库支持源码包编译出库文件需放运行台

    53 JPEG库移植
    源码包:libjpegturbo121tar
    移植前首先保证进入超级户权限安装交叉编译器
    移植步骤:

    源码包复制tools目录(果没tools文件夹创建)
    命令:
    mkdir tools
    cp mnthgfssharelibjpegturbo121targz tools

    解压源码包进入源码包顶层目录
    命令:
    cd tools
    tar xf libjpegturbo121targz
    cd libjpegturbo121

    源码包中没Makefile提供生成Makefile文件程序configure调程序
    命令:
    configure prefix(pwd)tmp hostarmlinux enablesharedyes enablestaticno

    运行会生成Makefile运行Makefile
    命令:
    make && make install

    编译生成头文件库文件放交叉编译器路径
    命令:
    cd toolslibjpegturbo121tmp
    cp include* toolsoptFriendlyARMtoolschain451armnonelinuxgnueabiinclude rfd
    cp lib* toolsoptFriendlyARMtoolschain451armnonelinuxgnueabilib rfd

    编译库文件放运行台
    命令:
    cp lib* workroot_nfslib rfd

    Makefile需调程序生成原:源码包般台运行Makefile赖
    运行台源码包中生成Makefile程序生成前台Makefile

    configure prefix(pwd)tmp hostarmlinux enablesharedyes enablestaticno
    prefix:安装路径生成文件存储目录
    host:系统类型
    enableshared:否编译动态库
    enablestatic:否编译静态库

    编译源码包中函数C文件时候需链接动态库 jpeg
    armlinuxgcc xxxc o xxx ljpeg
    54 JPEG库
    源码包顶层目录会README文件说明源码包
    README中
    libjpegtxt JPEG库
    examplec 示例代码

    步骤
    1 创建相关结构体变量
    struct jpeg_decompress_struct cinfo
    struct jpeg_error_mgr jerr

    cinfoerr jpeg_std_error(&jerr)
    jpeg_create_decompress(&cinfo)

    2 指定解压jpeg图片源
    FILE * infile

    if ((infile fopen(filename rb)) NULL) {
    fprintf(stderr can't open s\n filename)
    exit(1)
    }
    jpeg_stdio_src(&cinfo infile)

    3 获取图片信息
    jpeg_read_header(&cinfo TRUE)

    4 设置解压参数()

    5 开始解压图片
    jpeg_start_decompress(&cinfo)

    6 读取解压数
    jpeg_read_scanlines()
    操作数显示LCD

    7 结束解压
    jpeg_finish_decompress()

    8 销毁相关变量
    jpeg_destroy_decompress(&cinfo)

    55 目录操作函数
    份示例代码中显示图片文件直接外界输入进果图片外面输入图片放指定目录通目录操作获取目录图片文件名

    相关函数:
    opendir readdir closedir
    函数原形:
    DIR *opendir(const char *name)
    struct dirent *readdir(DIR *dirp)
    int closedir(DIR *dirp)
    opendir closedir操作类似openclose
    唯readdirreaddir次调获取目录文件文件信息
    果文件需次调够获取信息:
    struct dirent {
    ino_t d_ino *inode号*
    off_t d_off
    unsigned short d_reclen
    unsigned char d_type *文件类型*
    char d_name[256] * 文件名*
    }
    6 分析问题
    文采Linux系统进行广告机设计实现广告机功性稳定性差维护困难设计中存Linux编译环境搭建配置标准编译器uboot应 LED屏显示必须保证视频音频步实现音频部分够准确会出现音频视频步
    7 设计程
    71 配置网络

    界面选择编辑选择ipv4分组图71

    图71
    选择动ip者手动ip需址栏添加ip netmask gateway
    配置完重启网络
    配置虚拟机网络连接方式图72

    图72
    选择NAT图73

    图73
    桥接线网络图74

    图74
    启动开发板启动完成ctrl+c结束初始程序
    出现命令行开发板系统Linux系统命令行Linux命令行支持学绝数命令
    串口PC文件传送开发板
    (1)先文件拷贝windows文件系统中
    (2)开发板命令行执行命令
            rx 传输文件名
    找传送文件点击发送
    等发送成功
    实现成功
    8 结
    项目设计Linux开源系统软件工具集构建基嵌入式网络节点性优越广告机系统终获满意效果广告机系统IT技术广告行业重突破网络技术媒体技术飞速发展广告互动更加关注种情况传统广告媒体广告方式电视海报吸引力效外新广告方法法常规载体介质目前引入Π技术广告业方法重问题已成巨商机
    先驱者尝试电脑已广泛应边品尝TT技术带处开拓者造成PC技术问题困扰文讨参网络广告机项目结合嵌入式操作系统网络广告系统应着IT广告行业深化技术越越嵌入式系统行业中嵌入式操作系统突破
    项目中ucLinux嵌入式Linux操作系统网络广告机网络事实根硬件解决方案种操作系统包括VxWorksWNCE发挥网络广告系统作外重环节中继服务器充分利嵌入式操作系统许公司继续方面研究希开拓新应




    参考文献
    1华清远见嵌入式培训中心嵌入式Linux C语言应程序设计[M]北京:民邮电出版社20074
    3赵刚等32位ARM嵌入式系统开发技术流程 技巧实现[M]修订3版北京:电子工业出版社2008310
    4博创科技UPCUP S2410典Linux实验指导书[M]北京:北京博创兴业科技限公司200911
    6刘洪涛ARM嵌入式体系结构接口技术[M]北京:民邮电出版社:200917
    7马忠梅徐英慧ARM嵌入式处理器结构应基础(第3版)[M]北京:北京航天航空火学20077
    8百度百科DVl接口[EBOL]httpbaikebaiducomview1297324htm
    9宋宝华Linux设备驱动开发详解(第2版) [M]北京:民邮电出版社2010
    10罗苑棠嵌入式Linux驱动程序系统开发实例精讲[M]北京:电子工业出版社2009
    11 [美]Warren WGay著詹俊鹄卫译实战Linux Socket编程[M]西安:西安电子科技学出版社2002
    12怯肇乾嵌入式系统硬件体系设计[M]北京:北京航空航天学出版社2007
    13ARubiniJCorbetLinux Device Driver[M]O'Reilly PressThird Edition2005
    14广嵌基TQ6410Linux教程[M]广州:广州天嵌计算机科技限公司2009
    15魏伟等嵌入式硬件系统接口电路设计[M]北京:化学工业出版社2010
    16[美]科波特(CorbetJ)等著魏永明等译Linux设备驱动程序(第三版)[M]北京:中国电力出版社2006
    17[美]Daniel PBovelMarco CesatiUnderstang the Linux Kernel[M]BeiingO'Reilly2000
    18李宁莉基ARM嵌入式Linux系统研究应[D]西安:西安电子科技学
    19韦东山嵌入式Linux应开发完全手册[M]北京:民邮电出版社2008
    20王丽洁嵌入式Linux图形界面技术研究实现[D]长沙:国防科学技术学2006
    21金龙高文华基Iix台网络广告机设计[单片机嵌入式系统应20114)256261
    22 段凤云基ARM数字音频播放器设计门实验室科学2010(3)99103




    附 录
    附录1
    程序源代码

    功函数
    int recreaddir(char *dirnamelink_p bmp_listlink_p music_listlink_p video_list)
    {

    link_p bmp_listinit_link()
    link_p music_listinit_link()
    link_p video_listinit_link()
    DIR *mydir
    struct dirent *mydirent
    char filename[100]
    char dir[100]
    mydiropendir(dirname)
    if(mydirNULL)
    {
    perror(opendir)
    return 1
    }

    while((mydirentreaddir(mydir))NULL)
    {
    if(strncmp(mydirent>d_name1)0)
    continue

    if(mydirent>d_typeDT_DIR)
    {
    bzero(dir100)

    sprintf(dirssdirnamemydirent>d_name)

    recreaddir(dirbmp_listmusic_listvideo_list)
    }
    else
    {
    bzero(filename100)

    sprintf(filenamessdirnamemydirent>d_name)
    printf(s\nfilename)

    bmp_list()
    if (strstr(mydirent>d_namebmp)NULL)
    {
    inser_tail(bmp_listfilename)


    }
    else if (strstr(mydirent>d_namemp3)NULL)
    {
    music_list()
    inser_tail(music_listfilename)


    }
    else if (strstr(mydirent>d_namemp4)NULL||strstr(mydirent>d_nameavi)NULL)
    {
    video_list()
    inser_tail(video_listfilename)


    }

    }
    }

    }

    int main(int argc char const *argv[])
    {
    link_p bmp_listinit_link()
    link_p music_listinit_link()
    link_p video_listinit_link()
    recreaddir(homeyuyimyprojectbmp_listmusic_listvideo_list)
    printf(bmp_list\n)
    show_link(bmp_list)
    destroy_link(bmp_list)
    printf(video_list\n)
    show_link(video_list)
    destroy_link(video_list)
    printf(music_list\n)
    show_link(music_list)
    destroy_link(music_list)
    return 0
    }

    link_p init_link()
    {
    link_p headmalloc(sizeof(klink))
    INIT_LIST_HEAD(&head>pointer)
    return head
    }

    link_p inser_tail(link_p headchar *newfile_path)
    {
    link_p newnodemalloc(sizeof(klink))
    strcpy(newnode>pathnewfile_path)
    list_add_tail(&newnode>pointer&head>pointer)
    return newnode
    }

    char *reserch(link_p headchar *file)
    {
    link_p pmalloc(sizeof(klink))
    list_for_each_entry(p&head>pointerpointer)
    {
    if (strstr(p>pathfile) NULL)
    {
    break
    }
    }

    return p>path
    }

    void show_link(link_p head)
    {
    link_p p
    int i0
    list_for_each_entry(p&(head>pointer)pointer)
    {
    if (&p>pointerNULL)
    {
    printf(link is NULL\n)
    break
    }
    printf(path[d] s\nip>path)
    i++
    }
    if (pNULL)
    {
    printf(link is NULLS\n)
    }
    }

    void destroy_link(link_p head)
    {
    link_p phead
    while((p>pointernext)&(head>pointer))
    {
    headlist_entry(p>pointernexttypeof(*p)pointer)
    list_del(&p>pointer)
    free(p)
    phead
    }
    list_del(&p>pointer)
    }

    int main(int argc char const *argv[])
    {
    link_p listinit_link()
    char path1[100]homeyuyi1bmp
    inser_tail(listpath1)
    char path2[100]home2bmp
    inser_tail(listpath2)
    char path3[100]gec3bmp
    inser_tail(listpath3)
    show_link(list)
    char file[50]3bmp
    printf(\nreserch(listfile))
    destroy_link(list)

    return 0
    }

    #include myheadh
    int game_main()
    int function_interface()
    {
    show_picture(funbmp)
    link_p bmp_listinit_link()
    link_p music_listinit_link()
    link_p video_listinit_link()
    recreaddir(IOTbmpprojectbmp_listmusic_listvideo_list)
    printf(bmp_list\n)
    show_link(bmp_list)

    printf(video_list\n)
    show_link(video_list)

    printf(music_list\n)
    show_link(music_list)

    while(1)
    {
    int x
    int y
    int x0
    int y0
    get_x_y(&x&y&x0&y0)
    printf(xd yd x0d y0d\nxyx0y0 )
    if ((x>70&&x<223)&&(y>170&&y<292))
    {
    picture()
    picture(bmp_list)
    show_picture(funbmp)
    continue
    }
    else if ((x>580&&x<727)&&(y>167&&y<281))
    {
    printf(444\n)
    music(music_list)
    show_picture(funbmp)
    continue
    }
    else if ((x>338&&x<487)&&(y>165&&y<285))
    {
    printf(555\n)
    video(video_list)
    show_picture(funbmp)
    continue
    }
    else if ((x>0&&x<110)&&(y>0&&y<110))
    {
    game_main()
    show_picture(funbmp)
    continue
    }
    else if ((x>673&&x<785)&&(y>18&&y<89))
    {
    destroy_link(bmp_list)
    destroy_link(video_list)
    destroy_link(music_list)
    return 0

    }
    }
    }

    #include myheadh

    int fd
    int ts_open()
    {
    fdopen(devinputevent0O_RDONLY)
    if (fd1)
    {
    perror()
    return 1
    }
    }
    int get_x_y(int *xint *yint *x0int *y0)
    {
    printf(xdydx0dy0d\n*x*y*x0*y0 )
    int i0
    int p

    struct input_event tse
    int count0
    size_t rgread(fd&tsesizeof(tse))
    while(1)
    {
    printf(n)
    rgread(fd&tsesizeof(tse))
    printf(countd\ncount )
    if (rg1)
    {
    perror()
    return 1
    }
    if (tsetypeEV_ABS)
    {
    if (tsecodeABS_X)
    {
    printf(***********x\n)
    *xtsevalue*8001024
    count++
    }
    if (tsecodeABS_Y)
    {
    *ytsevalue*480600
    count ++
    }
    }

    if (tsetypeEV_KEY&&tsecodeBTN_TOUCH)
    {
    ptsevalue
    printf(d\np)
    }

    if (i2)
    {
    *x0*x
    *y0*y
    }
    i++

    if (p0&&i>3)
    {
    i0
    printf(get n)
    printf(x0y0(dd)\n*x0*y0)
    printf(xy(dd)\n*x*y)
    printf(___________________________****\n)
    break
    }

    }



    return 0


    }
    int ts_close()
    {
    close(fd)
    return 0
    }

    int main(int argc char const *argv[])
    {
    int x
    int y
    int x0
    int y0
    ts_open()
    char buf[100]musicbmp
    show_picture(buf)
    while(1)
    {
    get_x_y(&x&y&x0&y0)
    printf(main n)
    printf((x0dy0d)\nx0y0)
    printf((xdyd)\nxy)
    printf(*************************\n)

    }


    ts_close()

    return 0
    }

    #include myheadh
    if ()
    {
    show_picture()

    int Clean_Area(int Xint Yint widthint height)
    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)
    int judgment(char *bufint countchar a)
    {

    if (a0)
    {
    if(st0)
    {
    printf(buf1s\nbuf1 )
    int Clean_Area(int Xint Yint widthint height)
    Clean_Area(32414217330)
    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)
    Display_characterX(324142strlen(buf1)+1buf12) }
    else
    {


    int Clean_Area(int Xint Yint widthint height)
    Clean_Area(32617817130)
    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)
    Display_characterX(326178strlen(buf1)+1buf12)
    }
    }
    else if (a'h')
    {
    Clean_Area(6254244024)
    Display_characterX(625424strlen(buf1)+1buf11)
    }
    else if (a'w')
    {
    Clean_Area(6833834024)
    Display_characterX(683383strlen(buf1)+1buf11)
    }


    }
    }
    int main(int argc char const *argv[])
    {
    ts_open()
    char str[100]signbmp
    char buf[100]{0}
    show_picture(str)
    judement(buf)
    printf(main s\nbuf)
    ts_close()


    return 0
    }

    #include myheadh
    #include projecth #include usrinclude
    #include xxxh usrinclude
    #include font_libsh

    int LCD_fd
    unsigned long *fb_mem NULL
    unsigned char *bmp_buf NULL


    int Init_Lcd(void)
    {

    int ret


    LCD_fd open(devfb0O_RDWR)
    if(LCD_fd 1)
    {
    perror(Open LCD)
    return 1
    }



    fb_mem (unsigned long *)mmap(NULL
    FB_SIZE LCD 800*480*4
    PROT_READ | PROT_WRITE PROT_EXEC Pages may be executed
    PROT_READ Pages may be read
    PROT_WRITE Pages may be written
    PROT_NONE Pages may not be accessed
    MAP_SHARED LCD_fd 0)

    if(fb_mem MAP_FAILED)
    {
    perror(Mmap LCD)
    return 1
    }

    Show_Bmp(00logobmp)

    return 0

    }


    void UnInit_Lcd(void)
    {

    free(bmp_buf)
    munmap(fb_mem
    FB_SIZE)

    close(LCD_fd)
    }




    int Show_Bmp(int X int Yconst char *bmpfile)
    {
    FILE *filp
    int xyiret
    int widthheightbits
    BMPFH BmpFH
    BMPIH BmpIH

    filp fopen(bmpfiler)
    if(filp NULL)
    {
    perror(Fppen BMP)
    return 1
    }


    fread(&BmpFHsizeof(BMPFH)1filp)
    printf(TYPE cBmpFHbfType & 0xFF) printf(c \n(BmpFHbfType >> 8) & 0xFF) printf(FILE SIZE d \nBmpFHbfSize)

    fread(&BmpIHsizeof(BMPIH)1filp)
    printf(BIT d \nBmpIHbiBitCount)
    printf(RGB SIZE d \nBmpIHbiSizeImage)
    printf(x width d \nBmpIHbiWidth)
    printf(x heigth d \nBmpIHbiHeight)

    width BmpIHbiWidth
    height BmpIHbiHeight
    bits BmpIHbiBitCount>>3
    bmp_buf (unsigned char *)malloc(BmpIHbiSizeImage)
    memset(bmp_buf0x0BmpIHbiSizeImage)


    fread(bmp_bufBmpIHbiSizeImage1filp)


    int index
    int linebyte (BmpIHbiSizeImageheight)

    for(index0y(479Yheight)i0y<(479Y)y++index+linebyte)
    {
    for(iindexxXx {
    fb_mem[(479y)*800+x] (bmp_buf[i] | bmp_buf[i+1]<<8 | bmp_buf[i+2] <<16)
    }

    }
    *(fb_mem+(479y)*800+x)
    16bit锛65 5551锛 24bit(888) 32bit(8888)


    fclose(filp)

    return 0
    }


    int Show_Msg(int xint ychar *msg)
    {
    int i0
    char str[50]
    char cn

    while( (cn *(msg++)) '\0')
    {

    if((cn > 47 && cn < 58) || (cn >96 && cn<123))
    {
    memset(str0sizeof(str))
    sprintf(strkeyboardcbmpcn)
    Show_Bmp(x+i++*50 ystr)
    }

    }

    sleep(2)
    return 0

    }


    int Create_LineEdit(int Xint Yint widthint height)
    {
    int xy

    for(yYy {
    for(xXx {
    fb_mem[y*800+x] 0xFFFFFFFF
    }

    }

    return 0
    }


    int Clean_Area(int Xint Yint widthint height)
    {
    int xy

    for(yYy {
    for(xXx {
    fb_mem[y*800+x] 0xFFFFFFFF
    }

    }
    return 0
    }




    int Draw_Text16(unsigned int xunsigned int yunsigned long colorconst unsigned char ch[])
    {
    unsigned short int ij
    unsigned char maskbuffer
    for(i0i<16i++)
    {
    mask 0x80
    buffer ch[i*2]
    for(j0j<8j++)
    {
    if(buffer &mask)
    {
    fb_mem[(y+i)*800+(x+j)] color
    }
    mask mask >>1
    }
    mask 0x80
    buffer ch[i*2+1]
    for(j0j<8j++)
    {
    if(buffer &mask)
    {
    fb_mem[(y+i)*800+(x+j+8)] color
    }
    mask mask>>1
    }
    }

    return 0
    }


    int Draw_TextX(unsigned int xunsigned int yunsigned long colorconst unsigned char ch[]int size)
    {
    unsigned short int ijkm
    unsigned char maskbuffer
    for(i0i<16i++)
    {
    mask 0x80
    buffer ch[i*2]
    for(j0j<8j++)
    {
    if(buffer &mask)
    {
    for(k0k {
    for(m0m {
    fb_mem[(y+i*size+m)*800+(x+j*size+k)] color
    }
    }
    }
    mask mask >>1
    }
    mask 0x80
    buffer ch[i*2+1]
    for(j0j<8j++)
    {
    if(buffer &mask)
    {
    for(k0k {
    for(m0m {
    fb_mem[(y+i*size+m)*800+(x+(j+8)*size+k)] color
    }
    }
    }
    mask mask>>1
    }
    }

    return 0
    }


    int Draw_ASCII(unsigned int xunsigned int yunsigned long colorconst unsigned char ch[])
    {
    unsigned short int ij
    unsigned char maskbuffer

    for(i0i<16i++)
    {
    mask0x80
    bufferch[i]
    for(j0j<8j++)
    {
    if(buffer&mask)
    {
    fb_mem[(y+i)*800+(x+j)] color
    }
    maskmask>>1
    }
    }

    return 0
    }


    int Draw_ASCIIX(unsigned int xunsigned int yunsigned long colorconst unsigned char ch[]int size)
    {
    unsigned short int ijkm
    unsigned char maskbuffer

    for(i0i<16i++)
    {
    mask0x80
    bufferch[i]
    for(j0j<8j++)
    {
    if(buffer&mask)
    {
    for(k0k {
    for(m0m {
    fb_mem[(y+i*size+m)*800+(x+j*size+k)] color
    }
    }

    }
    maskmask>>1
    }
    }

    return 0
    }


    int Display_character(unsigned int xunsigned int yunsigned int lenunsigned char *string)
    {
    int k xx
    unsigned char qhwh
    const unsigned char *mould
    unsigned int length len

    for(k0xxxk {
    if(string[k]&0x80)
    {
    qh string[k]0xa0
    wh string[k+1]0xa0
    mould &__MYCHS[((qh1)*94+wh1)*32]
    Draw_Text16(4+xxy0xFF0000mould)
    xx+16
    k++
    }
    else
    {
    mould &__ASCII[string[k]*16]
    Draw_ASCII(4+xxy0xFF0000mould)
    xx+8
    }
    }
    return 0
    }

    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)
    {
    int k xx
    unsigned char qhwh
    const unsigned char *mould
    unsigned int length len

    for(k0xxxk {
    if(string[k]&0x80)
    {
    qh string[k]0xa0
    wh string[k+1]0xa0
    mould &__MYCHS[((qh1)*94+wh1)*32]
    Draw_TextX(4*size+xxy0xff0000mouldsize) xx+16*size
    k++ }
    else
    {
    mould &__ASCII[string[k]*16]
    Draw_ASCIIX(4*size+xxy0xff0000mouldsize)
    xx+8*size
    }
    }
    return 0
    }

    int Display_characterXX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint sizeunsigned long color)
    {
    int k xx
    unsigned char qhwh
    const unsigned char *mould
    unsigned int length len

    for(k0xxxk {
    if(string[k]&0x80)
    {
    qh string[k]0xa0
    wh string[k+1]0xa0
    mould &__MYCHS[((qh1)*94+wh1)*32]
    Draw_TextX(4*size+xxycolormouldsize)
    xx+16*size
    k++ }
    else
    {
    mould &__ASCII[string[k]*16]
    Draw_ASCIIX(4*size+xxycolormouldsize)
    xx+8*size
    }
    }
    return 0
    }


    int Roll_Dispaly(unsigned char *str)
    {
    int x

    for(x600x>20x)
    {
    Display_characterXX(x45strlen(str)+1str40xFF0000)
    usleep(50000)
    Display_characterXX(x+145strlen(str)+1str40xFFFFFFFF)
    }

    Display_characterXX(x+145strlen(str)+1str40xFFFFFFFF)
    return 0
    }

    int Init_Lcd(void)
    void UnInit_Lcd(void)
    int main(int argc char const *argv[])
    {
    ts_open()
    Init_Lcd()
    while(1)
    {
    show_picture(sign1bmp)
    int x
    int y
    int x0
    int y0
    get_x_y(&x&y&x0&y0)
    if (x>700&&y<100)
    {
    break
    }
    else
    {
    sign()
    }

    }
    ****
    UnInit_Lcd()
    ts_close()

    return 0
    }

    #include myheadh
    int Init_Lcd(void)
    void UnInit_Lcd(void)
    int Clean_Area(int Xint Yint widthint height)
    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)
    #define usrer_num 3

    int sign()
    {
    show_picture(signbmp)
    int i
    char str[usrer_num][20]{0}
    char str1[40]{0}
    char buf[100]{0}
    FILE *filepfopen(usrtxtr+)
    for ( i 0 i < usrer_num i++)
    {
    fscanf(filepsstr[i])
    }


    for ( i 0 i < usrer_num i++)
    {
    printf(str[i] s\nistr[i])
    }
    while(1)
    {
    Clean_Area(25022028520)
    printf(please input your username\n)
    Display_characterX(250220strlen(please input your username)+1please input your username1)
    int i
    judgment(buf00)
    int usrstrlen(buf)

    for (i 0 i < strlen(str1) i++)
    {
    str1[i]0
    }
    for (i 0 i < usrer_num i++)
    {
    if(strstr(str[i]buf)NULL)
    {
    strcpy(str1str[i])
    break
    }

    }
    if (strstr(str1buf)NULL&&strlen(buf)0)
    {
    printf(please input your password\n)
    Clean_Area(25022028520)
    Display_characterX(250220strlen(please input your password)+1please input your password1)
    judgment(bufstrlen(buf)0)

    for (i 0 i < usrer_num i++)
    {
    if(strcmp(str[i]buf)0)
    {
    strcpy(str1str[i])
    break
    }

    }
    if (strcmp(str1buf)0&&strlen(buf)>usr)
    {
    fclose(filep)
    function_interface()
    return 0

    }
    else
    {
    printf(errorplease input usrername and passwor again\n)
    for (i0 i < 100 i++)
    {
    buf[i]0
    }
    }
    }
    else
    {
    printf(errorplease input usrername again\n)
    Clean_Area(25022028520)
    Display_characterX(250220strlen(errorplease input usrername again)+1errorplease input usrername again1) for (i 0 i < 100 i++)
    {
    buf[i]0
    }
    }
    }


    }

    #include myheadh
    int game_x0
    int game_y0
    void game_x_y(int xint y)
    {
    if (x0)
    {
    if (y0)
    {
    game_x200 game_y40
    }
    if (y1)
    {
    game_x300
    game_y40
    }
    if (y2)
    {
    game_x400
    game_y40
    }
    if (y3)
    {
    game_x500
    game_y40
    }

    }
    if (x1) {
    if (y0)
    {
    game_x200
    game_y140
    }
    if (y1)
    {
    game_x300
    game_y140
    }
    if (y2)
    {
    game_x400
    game_y140
    }
    if (y3)
    {
    game_x500
    game_y140
    }

    }
    if (x2)
    {
    if (y0)
    {
    game_x200
    game_y240
    }
    if (y1)
    {
    game_x300
    game_y240
    }
    if (y2)
    {
    game_x400
    game_y240
    }
    if (y3)
    {
    game_x500
    game_y240
    }

    }
    if (x3)
    {
    if (y0)
    {
    game_x200
    game_y340
    }
    if (y1)
    {
    game_x300
    game_y340
    }
    if (y2)
    {
    game_x400
    game_y340
    }
    if (y3)
    {
    game_x500
    game_y340
    }

    }

    }
    void game_picture(char *pic_name)
    {
    int bmp_fb
    int ij
    int *lcdmem
    bmp_fbopen(pic_nameO_RDWR)
    if (bmp_fb1)
    {
    perror(bmp )
    return
    }
    int lcd_fb
    lcd_fbopen(devfb0O_RDWR)
    if (lcd_fb1)
    {
    perror(lcd €)
    return
    }


    lcdmemmmap(NULL800*480*4PROT_READ | PROT_WRITEMAP_SHAREDlcd_fb0)
    if (lcdmemNULL)
    {
    perror(lcd)
    return
    }

    int width100
    int height100
    int xgame_x
    int x1800xwidth
    int ygame_y

    char bmp_buf[width*height*3]
    lseek(bmp_fb54SEEK_SET)
    size_t bmp_retread(bmp_fbbmp_bufwidth*height*3)
    if (bmp_ret1)
    {
    printf(bmp \n)
    return
    }
    int lcd_buf[width*height]
    for(i0i<(width*height)i++)
    {
    lcd_buf[i]bmp_buf[i*3+2]<<16 | bmp_buf[i*3+1]<<8 | bmp_buf[i*3]<<0
    }

    int fil_buf[width*height]
    for (i 0 i {
    for (j0j {
    fil_buf[i*width+j]lcd_buf[(height1i)*width+j]
    }
    }
    int *pfil_buf
    lcdmemlcdmem+(800*y+x)

    for(i0i {
    int j
    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }

    lcdmemlcdmem+x1+x
    }
    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }
    close(bmp_fb)
    close(lcd_fb)

    munmap(lcdmem800*480*4)

    }

    #include myheadh
    #define BMP_SIZE 800*480*3
    #define LCD_SIZE 800*480
    int show_picture(char *pic_filename)
    {
    int ij

    int bmp_fb

    int *lcdmem
    bmp_fbopen(pic_filenameO_RDWR)
    if (bmp_fb1)
    {
    perror(bmp )
    return 1
    }

    int lcd_fb
    lcd_fbopen(devfb0O_RDWR)
    if (lcd_fb1)
    {
    perror(lcd )
    return 1
    }

    lcdmemmmap(NULL800*480*4PROT_READ | PROT_WRITEMAP_SHAREDlcd_fb0)
    if (lcdmemNULL)
    {
    perror(lcd)
    return 1
    }


    int size
    int width
    int height
    lseek(bmp_fb2SEEK_SET)
    read(bmp_fb&size4)width*height*3+54
    lseek(bmp_fb18SEEK_SET)
    read(bmp_fb&width4)
    read(bmp_fb&height4)

    if (width>800&&height>480)
    {

    int i
    char bmp_buf[BMP_SIZE]{0}
    lseek(bmp_fb54SEEK_SET)
    char *p
    pbmp_buf

    for (i 0 i < 480 i++)
    {
    p&bmp_buf[i*800*3]
    size_t bmp_retread(bmp_fbp800*3)
    lseek(bmp_fb(width800)*3SEEK_CUR)
    if (bmp_ret1)
    {
    printf(\n)
    return 1
    }
    }

    int lcd_buf[LCD_SIZE]{0}
    24 mp 2cd
    for(i0i {
    lcd_buf[i]bmp_buf[i*3+2]<<16 | bmp_buf[i*3+1]<<8 | bmp_buf[i*3]<<0
    }
    for (i 0 i < 480 i++)
    {
    for (j 0 j < 800 j++)
    {
    *(lcdmem+i*800+j)lcd_buf[(479i)*800+j]
    }
    }

    }

    if (width>800&&height<480)
    {
    int i
    char bmp_buf[800*height*3]
    lseek(bmp_fb54SEEK_SET)
    char *p
    pbmp_buf

    for (i 0 i < height i++)
    {
    p&bmp_buf[i*800*3]
    size_t bmp_retread(bmp_fbp800*3)
    lseek(bmp_fb(width800)*3SEEK_CUR)
    if (bmp_ret1)
    {
    printf(bmp \n)
    return 1
    }
    }
    int lcd_buf[800*height]
    24mp cd
    for(i0i<(width*height)i++)
    {
    lcd_buf[i]bmp_buf[i*3+2]<<16 | bmp_buf[i*3+1]<<8 | bmp_buf[i*3]<<0
    }
    for (i 0 i < height i++)
    {
    for (j 0 j < 800 j++)
    {
    *(lcdmem+i*800+j)lcd_buf[(height1i)*800+j]
    }
    }

    }

    if(width<800&&height<480)
    {
    printf(111\n)
    int x(800width)2
    int y(480height)2
    int x10
    printf(xd\nx)
    printf(yd\ny)
    if ((800width)20)
    {
    x1x+1
    }
    char bmp_buf[width*height*3]
    lseek(bmp_fb54SEEK_SET)
    size_t bmp_retread(bmp_fbbmp_bufwidth*height*3)
    if (bmp_ret1)
    {
    printf(bmp \n)
    return 1
    }
    int lcd_buf[width*height]
    24 mp cd
    for(i0i<(width*height)i++)
    {
    lcd_buf[i]bmp_buf[i*3+2]<<16 | bmp_buf[i*3+1]<<8 | bmp_buf[i*3]<<0
    }

    int fil_buf[width*height]
    for (i 0 i {
    for (j0j {
    fil_buf[i*width+j]lcd_buf[(height1i)*width+j]
    }
    }

    int *pfil_buf
    lcdmemlcdmem+(800*y+x)

    for(i0i {
    int j
    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }
    if ((800width)20)
    {
    lcdmemlcdmem+x1+x
    }
    else lcdmemlcdmem+2*x
    }

    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }



    }



    if (width<800&&height>480)
    {
    int i
    char bmp_buf[width*480]
    lseek(bmp_fb54SEEK_SET)


    size_t bmp_retread(bmp_fbbmp_bufwidth*480*3)
    if (bmp_ret1)
    {
    printf(bmp \n)
    return 1
    }

    int lcd_buf[width*480]
    24浣峛mp杞崲涓2浣峫cd
    for(i0i<(width*480)i++)
    {
    lcd_buf[i]bmp_buf[i*3+2]<<16 | bmp_buf[i*3+1]<<8 | bmp_buf[i*3]<<0
    }
    int fil_buf[width*480]
    for (i 0 i <480 i++)
    {
    for (j0j {
    fil_buf[i*width+j]lcd_buf[(4801i)*width+j]
    }
    }


    int *pfil_buf
    for (i 0 i < 479 i++)
    {
    int j
    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }
    lcdmemlcdmem+(800width)
    }
    for (j 0 j< width j++)
    {
    *lcdmem*p
    lcdmem++
    p++
    }


    }

    close(bmp_fb)
    close(lcd_fb)

    munmap(lcdmem800*480*4)
    return 0
    }
    }

    int main(int argc char const *argv[])
    {
    char pic_filename[100]9bmp
    show_picture(pic_filename)
    return 0
    }

    图片函数
    int picture(link_p bmp_list)
    {

    link_p plist_entry(bmp_list>pointernexttypeof(*p)pointer)
    char buf[100]{0}
    int x
    int y
    int x0
    int y0
    int abs_x0
    int abs_y0
    show_picture(p>path)
    char picture_bmp[100]picturebmp
    show_picture(musicbmp)
    while(1)
    {
    get_x_y(&x&y&x0&y0)
    printf(xd yd x0d y0d\nxyx0y0 )
    abs_xabs(xx0)
    abs_yabs(yy0)
    if (abs_x0||abs_y0)
    {
    if (abs_x>abs_y) {
    if (x0>x) {
    if ((p>pointernext)&(bmp_list>pointer))
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    plist_entry(p>pointernexttypeof(*p)pointer)
    show_picture(p>path)
    }
    else
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    show_picture(p>path)
    }

    }
    else
    {
    if ((p>pointerprev)&(bmp_list>pointer))
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    plist_entry(p>pointerprevtypeof(*p)pointer)
    show_picture(p>path)
    }
    else
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    show_picture(p>path)
    }
    }
    }
    else
    {
    if (y>y0)
    {
    if ((p>pointerprev)&(bmp_list>pointer))
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    plist_entry(p>pointerprevtypeof(*p)pointer)
    show_picture(p>path)
    }
    else
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    show_picture(p>path)
    }
    }
    else
    {
    if ((p>pointernext)&(bmp_list>pointer))
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    plist_entry(p>pointernexttypeof(*p)pointer)
    show_picture(p>path)
    }
    else
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    show_picture(p>path)
    }

    }
    }
    }

    else
    {
    return 0
    }
    if()
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    show_picture(p>path)
    continue
    }

    }

    return 0

    }

    int main(int argc char const *argv[])
    {
    ts_open()
    link_p bmp_listinit_link()
    link_p music_listinit_link()
    printf(p\nmusic_list>path )

    link_p video_listinit_link()
    recreaddir(IOTbmpprojectbmp_listmusic_listvideo_list)
    printf(bmp_list\n)
    show_link(bmp_list)

    printf(video_list\n)
    show_llsink(video_list)

    printf(music_list\n)
    show_link(music_list)



    picture(bmp_list)
    ts_close()
    destroy_link(bmp_list)
    destroy_link(video_list)
    destroy_link(music_list)



    return 0
    }

    音乐函数
    int music(link_p music_list)
    {
    link_p plist_entry(music_list>pointernexttypeof(*p)pointer)
    char buf[100]{0}
    int x
    int y
    int x0
    int y0

    show_picture(musicbmp)
    sprintf(bufmadplay s &p>path)
    system(buf)

    while(1)
    {

    get_x_y(&x&y&x0&y0)
    printf(xd yd x0d y0d\nxyx0y0 )
    if ((x>17&&x<162)&&(y>333&&y<480))
    {
    system(killall STOP madplay)
    }

    if ((x>14&&x<154)&&(y>171&&y<313))
    {
    system(killall CONT madplay)
    }
    if ((x>12&&x<149)&&(y>0&&y<132))
    {
    system(killall KILL madplay)
    if ((p>pointerprev)&(music_list>pointer))
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    plist_entry(p>pointerprevtypeof(*p)pointer)
    sprintf(bufmadplay s &p>path)
    system(buf)
    }
    else
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    sprintf(bufmadplay s &p>path)
    system(buf)
    }

    }
    if ((x>640&&x<775)&&(y>344&&y<480))
    {
    system(killall KILL madplay)
    if ((p>pointernext)&(music_list>pointer))
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    plist_entry(p>pointernexttypeof(*p)pointer)
    sprintf(bufmadplay s &p>path)
    system(buf)
    }
    else
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    sprintf(bufmadplay s &p>path)
    system(buf)
    }


    }
    if ((x>629&&x<759)&&(y>7&&y<90))
    {
    system(killall KILL madplay)
    return 0
    }

    else
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    i++
    printf(666xunhs\np>path)
    }
    if(i4&&(p>pointernext)&(music_list>pointer))
    {
    printf(tuic\n)
    break
    }

    }
    return 0

    }
    int main(int argc char const *argv[])
    {
    ts_open()
    link_p bmp_listinit_link()
    link_p music_listinit_link()
    printf(p\nmusic_list>path )

    link_p video_listinit_link()
    recreaddir(IOTbmpprojectbmp_listmusic_listvideo_list)
    printf(bmp_list\n)
    show_link(bmp_list)

    printf(video_list\n)
    show_link(video_list)

    printf(music_list\n)
    show_link(music_list)



    music(music_list)
    ts_close()
    destroy_link(bmp_list)
    destroy_link(video_list)
    destroy_link(music_list)



    return 0
    }

    视频函数
    int Clean_Area(int Xint Yint widthint height)
    int Display_characterX(unsigned int xunsigned int yunsigned int lenunsigned char *stringint size)

    int video(link_p video_list)
    {
    char buf[100]{0}
    link_p plist_entry(video_list>pointernexttypeof(*p)pointer)
    int x
    int y
    int x0
    int y0
    int width600
    int high360

    show_picture(videobmp)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    system(buf)

    while(1)
    {
    printf(s\n p>path)
    get_x_y(&x&y&x0&y0)
    printf(xd yd x0d y0d\nxyx0y0 )
    if ((x>670&&x<748)&&(y>406&&y<464))
    {
    show_picture(keybmp)
    char str[100]{0}
    int i
    system(killall KILL mplayer)
    show_picture(keybmp)


    while(1)
    {
    judgment(str0'h')
    Clean_Area(55035825020)
    Display_characterX(550358strlen(please input high)+1please input high1)
    printf(please input high\n)
    if (strlen(str)>3||strlen(str)<2)
    {
    Clean_Area(55035825020)
    Display_characterX(550358strlen(errornumber too big or small)+1errornumber too big or small1) printf(errornumber too big or small input high again\n)
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    }
    else if (strlen(str)3)
    {
    high(str[0]'0')*100+(str[1]'0')*10
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    break
    }
    else if (strlen(str)2)
    {
    high(str[1]'0')*10
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    break
    }
    }
    while(1)
    {
    Clean_Area(55035825020) Display_characterX(550358strlen(please input width)+1please input width1)

    printf(please input width\n)
    Clean_Area(6833834024)
    judgment(str0'w')
    if (strlen(str)>3||strlen(str)<2)
    {
    Clean_Area(55035825020)
    Display_characterX(550358strlen(errornumber too big or small)+1errornumber too big or small1)
    printf(errornumber too big or small input width again\n)
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    }
    else if (strlen(str)3)
    {
    width(str[0]'0')*100+(str[1]'0')*10
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    break
    }
    else if (strlen(str)2)
    {
    width(str[1]'0')*10
    for (i 0 i < strlen(str) i++)
    {
    str[i]0
    }
    break
    }
    }

    show_picture(videobmp)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    system(buf)
    }

    if ((x>284&&x<360)&&(y>403&&y<468))
    {

    system(killall STOP mplayer)
    }
    if ((x>413&&x<486)&&(y>404&&y<464))
    {

    system(killall CONT mplayer)
    }
    if ((x>161&&x<240)&&(y>405&&y<464))
    {

    system(killall KILL mplayer)
    if ((p>pointerprev)&(video_list>pointer))
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    plist_entry(p>pointerprevtypeof(*p)pointer)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    system(buf)
    }
    else
    {
    plist_entry(p>pointerprevtypeof(*p)pointer)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    system(buf)
    }

    }
    if ((x>543&&x<621)&&(y>407&&y<465))
    {

    system(killall KILL mplayer)
    if ((p>pointernext)&(video_list>pointer))
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    plist_entry(p>pointernexttypeof(*p)pointer)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    }
    else
    {
    plist_entry(p>pointernexttypeof(*p)pointer)
    sprintf(bufmplayer s zoom x d y d &p>pathwidthhigh)
    system(buf)
    }

    }
    if ((x>641&&x<769)&&(y>18&&y<92))
    {
    system(killall KILL mplayer)
    return 0
    }



    }
    return 0
    }
    int main(int argc char const *argv[])
    {
    ts_open()
    link_p bmp_listinit_link()
    link_p music_listinit_link()
    printf(p\nmusic_list>path )

    link_p video_listinit_link()
    recreaddir(IOTbmpprojectbmp_listmusic_listvideo_list)
    printf(bmp_list\n)
    show_link(bmp_list)

    printf(video_list\n)
    show_link(video_list)

    printf(music_list\n)
    show_link(music_list)



    video(video_list)
    ts_close()
    destroy_link(bmp_list)
    destroy_link(video_list)
    destroy_link(music_list)



    return 0
    }


























    附录2
    效果图片

    文档香网(httpswwwxiangdangnet)户传

    《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
    该内容是文档的文本内容,更好的格式请下载文档

    下载文档到电脑,查找使用更方便

    文档的实际排版效果,会与网站的显示效果略有不同!!

    需要 120 香币 [ 分享文档获得香币 ]

    下载文档

    相关文档

    基于单片机的北斗定位系统

    现代社会空巢老人越来越多,老人因意外发生不能及时呼救给健康甚至生命安全带来威胁,因而,老人安全监护受到越来越多的关注。为了解决这一问题,本次设计使用了STC12C5A60S2单片机作为主处理器,...

    3年前   
    1121    0

    Linux系统管理

    Linux系统管理(1~2章) Linux内核版本 例如:2 5 7 中间为奇数表示开发版,中间为偶数表示稳定版例如:2 6 18 图形界面转向字符终端:ctrl+alt+Fn 重启:...

    12年前   
    11879    0

    单片机课程设计报告基于单片机的温控系统

    职业学院机械与电子工程学院基于单片机温控系统课程设计报告班 级 电信班 学生姓名 学 号 指导教...

    3年前   
    1009    0

    定制Linux系统环境变量

    Linux是一个多用户的操作系统。每个用户登录系统后,都会有一个专用的运行环境。通常每个用户默认的环境都是相同的,这个默认环境实际上就是一组环境变量的定义。用户可以对自己的运行环境进行定制,其...

    1个月前   
    108    0

    基于单片机的全自动洗衣机控制系统设计

     XX学院毕业论文题目:基于51单片机的全自动洗衣机控制系统设计专业:电气工程及其自动化 姓名:班级:电气班 学 号:指 导 老 师 : 摘要该...

    5个月前   
    207    0

    基于单片机的智能宠物投喂系统的设计

    基于单片机的智能宠物投喂系统的设计Design of intelligent pet feeding system based on MCU内容摘要随着人们现在生活和工作的压力加大,相互间可以...

    10个月前   
    360    0

    基于单片机温湿度测量系统的研究与设计

    温湿度的测量应用范围是很广的,对温湿度测量系统的研究也具有深远意义,本课题针对国内外对温湿度测量系统的研究与发展状况,分析了目前温湿度测量系统存在的主要问题,设计了一种基于单片机的温湿度测量系统...

    3年前   
    398    0

    基于单片机三层电梯系统设计

    基于单片机三层电梯系统设计 【摘要】本设计是以STC89C52单片机为核心的三层电梯模拟控制系统。硬件部分主要由单片机最小系统模块、电梯内外电路按键矩阵模拟检测模块、楼层显示数码管模块、电梯上...

    3年前   
    463    0

    基于单片机的空调温度控制系统设计毕业设计

     毕业设计  题 目 基于单片机的空调温度控制系统设计 学生姓名 学 号 学 院 计算机与信息工程系 专业班级 指导...

    5年前   
    2592    0

    基于单片机温室大棚温湿度采集系统设计

    温度和湿度是在农业生产中常见的和基本的参数之一,它们会大幅度影响作物产量和品质,现代科学和技术在提高农业生产力方面发挥着重要作用,以确定温度和湿度,实时显示、储存和监测。国内生产,产品质量与节能...

    4年前   
    575    0

    基于51单片机的智能窗帘控制系统

     毕业论文(设计) 学 院: 工学院 ...

    3年前   
    1118    0

    基于单片机的交通灯显示系统的设计与研究课程设计

     XX学院课程设计课 程 单片机课程设计 题 目 交通灯系统 院 系 机电系 ...

    3年前   
    907    0

    最新研究报告-基于单片机的步进控制系统的开发

    常 州 工 学 院PROTEL应用实践 题 目 用ProtelDXP软件设计的步进电机二级学院 电子信息与电气工程学院 班 级 ...

    2年前   
    299    0

    基于单片机的自动节水灌溉系统课程设计

     数理与信息工程学院应用系统设计 题 目: 基于单片机的自动节水灌溉系统 专 业: 计算机科学与技术(专升本) 班 级: ...

    3年前   
    625    0

    基于单片机的温度控制系统设计毕业论文

    职业学院毕业论文 题目:单片机温度控制系统研制 系 院:工程技术学院 学生姓名: 学 号: 专 业:机电一体化 ...

    5年前   
    5896    0

    基于AT89S51单片机无线传输系统设计毕业设计

    毕业论文(设计) 题 目: 单片机无线传输系统设计 完 成 人: ...

    4年前   
    884    0

    基于单片机的乒乓球游戏系统的设计

    基于单片机的乒乓球游戏系统的设计姓 名:学 号:专业班级: 院(系): 设计时间: 设计地点: 指导教师评语: ...

    3年前   
    750    0

    基于单片机的颜色识别早教系统设计与实现

     基于单片机的颜色识别早教系统设计与实现 ...

    3年前   
    653    0

    基于51单片机红外迎宾及人数检测报警系统

    红外感应式门铃如今常用于店铺门口用于迎接顾客。它可依据顾客的进出状况作出有所差别的反应。主要研究了红外感应技术在我们日常生活中的应用,即感应式门铃。通过对它的研究,学会红外接近开关的原理、电路设...

    3年前   
    853    0

    电子信息工程基于单片机的隐形指纹识别系统

    (基于单片机的隐形指纹识别系统)(An invisible fingerprint identification system based on single chip microcomput...

    1年前   
    248    0

    文档贡献者

    平***苏

    贡献于2021-11-21

    下载需要 120 香币 [香币充值 ]
    亲,您也可以通过 分享原创文档 来获得香币奖励!
    下载文档

    该用户的其他文档