




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
2012年上学期嵌入式系统设计课程大作业1、叙述下列相关名词的含义ARM、xscale、PXA255、RISC、体系结构答:1)ARM:英国的一家公司;时下流行的一种体系结构。2)XScale:ARM架构v5TE指令集的CPU。3)PXA255:XScale的内核版本。4)RISC:Reduced Instruction Set Computing,即精简指令集,一种CPU的设计概念;与之相对的是CISC,即复杂指令集5)体系结构:嵌入式系统硬件与软件的衔接;它确定嵌入式系统设计的部件、部件功能、部件间借口的设计,并集中于嵌入式系统的核心部分处理器的运算与内存的存取。2、画出嵌入式硬件系统组成的模块结构图3、叙述基于linux的嵌入式平台的搭建过程答:Linux嵌入式平台的搭建符合嵌入式平台搭建的一般过程,但是具体到Linux嵌入式平台,又有些许不同,其搭建过程如下:1)处理器以及硬件开发平台的选择以处理器为主,结合考虑硬件平台的情况。处理器考虑的问题包括应用类型及I/O接口、主频和功耗、对不同类型存储器的支持、封装等;硬件平台的选择和设计包括内存和外围存储器、输入输出接口以及设备等几项主要内容。2)操作系统的选择由于已经选取了Linux操作系统,因此此处主要是内核版本的选取以及对内核功能的裁剪。3)开发环境的选取即开发工具的选取,主要是指开发软件的选取,比如常用的minicom。4)开发实施首先,Bootloader的烧制。目的是对硬件系统基本功能的支持,比如串口通信。其次,内核文件的制作。接下来,内核文件的拷贝。此时,可以通过串口或者网口实施传输,能够大幅度提高传输速度。最后,在主机使用开发软件,完成对硬件系统的开发工作。包括硬件驱动程序、上层的应用程序、系统的集成与调试等。4、如下为xscale处理器的内核框图:简述内核框图中每个模块的名称及指标。答:1)Instruction Cache:指令Cache;大小32KB,32路,支持线性锁定2)Micro-Processor:微处理器;七级流水3)Data Cache:数据Cache;最大支持32KB,32路4)Data Ram:数据Ram;最大支持28KB5)Mini-Data Cache:迷你数据Cache;大小2KB,2路6)Branch Target Buffer:分支目标缓存;128入口7)IMMU/DMMU:指令/数据 存储管理单元;32路,全相关,支持锁定8)Fill Buffer:填充缓存;48入口9)Performance Monitoring:功能显示器10)Debug:硬件中断断点记录11)Power Management Control:电源管理控制12)MAC:乘加单元;40位累加/累乘,16位单指令多数据流操作,16*32位操作单周期支持13)Write Buffer:写缓存;8入口,支持合并操作14)JTAG:边界扫描技术;支持JTAG操作5、下述英文为BTB模块功能的详细介绍,阅读后说明该模块的作用。n The BTB stores the history of branches that have executed along with their targets. Figure 5-1 shows an entry in the BTB, where the tag is the instruction address of a previously executed branch and the data contains the target address of the previously executed branch along with two bits of history information.n The BTB takes the current instruction address and checks to see if this address is a branch that was previously seen. It uses bits 8:2 of the current address to select the tag from the BTB and then compares this tag to bits 31:9,1 of the current instruction address. If the current instruction address matches the tag in the BTB and the history bits indicate that this branch is usually taken in the past, the BTB uses the data (target address) as the next instruction address to send to the instruction cache.答:分支目标缓存目标地址历史的分支,具体到每个入口(表项),由Tag和数据组成。Tag是以前执行分支的指令地址,数据包括以前执行分支的目标地址,以及2比特的历史信息。分支目标缓存取得当前的指令地址,检查这个地址是否是以前执行过的分支。它用现行指令的位8:2来选择分支目标缓存中的标志Tag,并与现行指令的位31:9,1进行匹配。若匹配且历史位指出该分支过去常产生,则分支目标缓存中的数据(目标地址31:1)作为下一条指令地址送至指令Cache。6、下面是linux下的一个简单的设备驱动程序,写出linux设备驱动常用的数据结构,同时阅读下面代码,请给出测试程序中的每条语句加以注释。设备驱动程序Keypad.c的源代码:#include #include #include #include #include #include #include #include #include #include #include #define LEDnKEY_MAJOR 251#define KEYPAD_NAME X-Hyper250 Keypad#define KEYPAD_VERSION Version 0.1#define EXT_KEY_CS EXT_PORT2#define EXT_LED_CS EXT_PORT3#define LED_SHOW 10/*EXT_KEY_CS 为向外部LED进行数值设定,它定义在其它头文件里*/void led_off_on() /*/int i;EXT_LED_CS = 0xff;for(i =0 ; i8;+i)EXT_LED_CS = (1 i) & 0xff);/*点亮相应LED灯*/udelay(30000);EXT_LED_CS = 0xff;/*应用程序用open来打开设备文件,实际上调用驱动的lednkey_open()函数*/ int lednkey_open(struct inode *inode, struct file *filp) /*打开设备文件*/MOD_INC_USE_COUNT;/*内核提供的一个宏,检查使用驱动程序的用户数*/return (0); /* success */ int lednkey_release(struct inode *inode, struct file *filp) /*释放设备文件*/led_off_on();MOD_DEC_USE_COUNT;return (0);ssize_t lednkey_read(struct file *filp, char *Putbuf, size_t length, loff_t *f_pos) /*按键读取函数*/unsigned short BottonStatus; unsigned char Bottontmp = 0;int i;BottonStatus = ( EXT_KEY_CS & 0xff ); /*按键状态*/for(i = 0 ; i i) & 1) = 0 ) Bottontmp = (i+1);copy_to_user( Putbuf, &Bottontmp, length); /*将数据从内核态拷贝到用户态,这是由定义在里的特殊函数实现在不同的空间传输任意字节的数据*/return length;ssize_t lednkey_write(struct file *filp, const char *Getbuf, size_t length, loff_t *f_pos)int num;unsigned char UsrWantLed; copy_from_user( &UsrWantLed, Getbuf, length);/*将数据从用户态拷贝到核心态*/num = ( (UsrWantLed) & 0xff );/*确定哪一位要进行设定*/EXT_LED_CS = (1 (num-1); /*点亮相应LED灯*/return (0);int lednkey_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,unsigned long arg)/* lednkey_ioctl 接口函数,主要用于获取或者改变正在运行的设备参数*/switch(cmd)case LED_SHOW: /*如果要点亮LED灯*/if(arg)led_off_on(); break;return 0;/*以下这些驱动函数是与用户的应用程序里对设备文件操作的函数相对应的*/struct file_operations lednkey_fops = open: lednkey_open,read: lednkey_read,write: lednkey_write,ioctl: lednkey_ioctl,release: lednkey_release,;static int _init xhyper250_keypad_init(void) /*初始化设备函数,在函数名之前加上这个属性之后,系统会在初始化完成之后丢弃初始化函数,收回它所占用的内存,以减小内核所占用的内存空间,它只对内建的驱动起作用*/int result;result = register_chrdev(LEDnKEY_MAJOR, lednkey, &lednkey_fops);/*向操作系统注册一个主号为251,设备名为lednkey,并传递设备驱动程序的指针为lednkey_fops(全局变量) ,其中register_chrdev ( )是内核提供的函数,作用是完成注册新的字符设备*/printf(%s %s initialized.n,KEYPAD_NAME, KEYPAD_VERSION);led_off_on();return 0;static void _exit xhyper250_keypad_exit(void) /*向操作系统卸载设备函数*/ unregister_chrdev( LEDnKEY_MAJOR, lednkey ); led_off_on();module_init(xhyper250_keypad_init); /*显式声明初始化设备函数*/module_exit(xhyper250_keypad_exit); /*显式声明卸载设备函数*/*通过上述两个声明内核知道驱动程序的进入点*/测试文件的源代码如下:#include#include#include#include#include#include#define LED_SHOW 10int fd;static char *dev_name = /dev/keypad;int main(int argc, char *argv)int data = 0, pre_data;fd = open( dev_name , O_RDWR );if( !(fd =0) )printf(%s file open failedn, dev_name );exit(-1);printf(nkeypad App : press the push button see show led - Exit Ctrl-C n,dev_name);ioctl(fd,LED_SHOW,1);while(1)dopre_data = data;read( fd, (char * )&data, sizeof(data) );data = (data & 0xff);while(data = 0);if( pre_data = 0)printf(Write %d LEDn,data);write( fd, (const char *)&data, sizeof(const char )data) ); close( fd );return 0;1)数据结构struct file_operationsstruct module *owner;loff_t (*llseek) (struct file *, loff_t, int);ssize_t (*read) (struct file *, char _user *, size_t, loff_t *);ssize_t (*aio_read) (struct kiocb *, char _user *, size_t, loff_t);ssize_t (*write) (struct file *, const char _user *, size_t, loff_t *);ssize_t (*aio_write) (struct kiocb *, const char _user *, size_t, loff_t);int (*readdir) (struct file *, void *, filldir_t);unsigned int (*poll) (struct file *, struct poll_table_struct *);int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);long (*compat_ioctl) (struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *);int (*open) (struct inode *, struct file *);inode_operations。int (*flush) (struct file *);int (*release) (struct inode *, struct file *);int (*fsync) (struct file *, struct dentry *, int datasync);int (*aio_fsync) (struct kiocb *, int datasync);int (*fasync) (int, struct file *, int);int (*lock) (struct file *, int, struct file_lock *);ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);int (*check_flags)(int);int (*dir_notify)(struct file *
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 出纳资金安全培训课件
- 十八项核心制度试题及答案
- 出差公司安全培训记录课件
- 出国安全培训心得课件
- 电动汽产业链整合-洞察及研究
- 2025房屋租赁(出租)合同书(标准版本):租赁双方的权利与义务
- 2025农副产品购销合同 标准版模板大全
- 2025建筑扣件出租协议(合同版本)
- 2025年:从“京派、海派”之争审视民间委托合同的效力
- 2025物流服务委托合同模板
- 生物安全管理体系文件
- 医院过期药品处理流程规范
- 苏教版九年级数学上册全册教案
- 幼儿园教材教学培训
- 2025年高校教师资格证考试题库(带答案能力提升)
- 金属结构自检自查报告
- 2025年高端酒店装修设计与施工合同范本2篇
- 个人健康个性化营养搭配与服务提供系统建设
- 房地产估价四假设开发法的应用案例
- 2023年政府采购评审专家考试题库(含答案)
- 大型运输车辆交通安全教育
评论
0/150
提交评论