BSP 和设备驱动开发指南

来源:互联网 发布:仿淘宝 下拉刷新 编辑:程序博客网 时间:2024/05/18 03:18

BSP 和设备驱动开发指南

bsp_howto.BSP和设备驱动开发指南.双语.V20131224.pdf
RTEMS 的bsp_howto文档的原创翻译。

目录

1  简介 15
2  目标依赖文件 17
2.1 CPU依赖 17
2.2  主板依赖 18
2.3  外设依赖 19
2.4  要问的问题 19
2.5  CPU依赖的执行器文件 21
2.6  CPU依赖的支持文件 21
2.7  板级支持包结构 22
3  Makefile 25
3.1  在BSP建立过程中使用Makefile 27
3.2  创建新的BSP Make定制文件 30
4  链接器脚本 33
4.1  什么是“linkcmds”文件? 33
4.2  程序段 33
4.3  可执行文件映像 35
4.4  示例链接器命令脚本 36
4.5  初始化数据 43
5  杂项支持文件 47
5.1  GCC编译器规范文件 47
5.2  自述文件 48
5.3  次数 49
5.4  工具子目录 49
5.5  bsp.h包含文件 49
5.6  tm27.h包含文件 50
5.7  调用开销文件 51
5.8  sbrk()实现 52
5.9  bsp_fatal_extension() - 清除硬件 52
5.10  配置宏 53
5.11  set_vector() – 安装中断向量 55
6  Ada95中断支持 57
6.1  简介 57
6.2  将中断映射到POSIX信号 57
6.3  Ada95中断程序示例 58
6.4  版本要求 59
7  初始化代码 61
7.1  简介 61
7.2  所需的全局变量 62
7.3  主板初始化 63
7.3.1  启动代码 - 汇编语言初始化 66
7.3.2  boot_card() - 引导卡片 67
7.3.3  bsp_start() - BSP特定的初始化 70
7.3.4  RTEMS Pretasking回调 71
7.3.5  RTEMS Predriver回调 71
7.3.6  设备驱动初始化 72
7.3.7  RTEMS Postdriver回调 73
7.4  中断向量表 73
7.4.1  gen68340 BSP上的中断向量表 74
7.5  片选初始化 74
7.6  集成的处理器寄存器初始化 75
7.7  数据段的再复制 76
7.8  RTEMS配置表 76
8  控制台驱动 79
8.1  简介 79
8.2  Termios 80
8.3  驱动程序的运作模式 81
8.4  串行驱动运作概述 82
8.4.1  基础 83
8.4.2  Termios和轮询IO 86
8.4.3  Termios和中断驱动IO 88
8.4.4  初始化 90
8.4.5  打开串行设备 92
8.4.6  关闭串行设备 94
8.4.7  从串行设备读取字符 95
8.4.8  将字符写入串行设备 95
8.4.9  更改串行线路参数 96
9  时钟驱动 99
9.1  简介 99
9.2  时钟驱动全局变量 99
9.2.1  主、次设备号 99
9.2.2  节拍计数器 100
9.3  初始化 100
9.4  系统关机 101
9.5  时钟中断子例程 101
9.6  IO控制 102
10  定时器驱动 103
10.1  基准定时器 103
10.1.1  benchmark_timer_initialize 103
10.1.2  Read_timer 104
10.1.3  benchmark_timer_disable_subtracting_average_overhead 105
10.2  gen68340 UART FIFO完整模式 105
11  实时时钟驱动 107
11.1  简介 107
11.2  初始化 109
11.3  setRealTimeToRTEMS 110
11.4  setRealTimeFromRTEMS 111
11.5  getRealTime 111
11.6  setRealTime 111
11.7  checkRealTime 112
12  ATA驱动 113
12.1  术语 113
12.2  简介 113
12.3  初始化 114
12.4  ATA驱动架构 115
12.4.1  ATA驱动主要的内部数据结构 115
12.4.2  简短的ATA驱动核心概述 117
13  IDE控制器驱动 119
13.1  简介 119
13.2  初始化 120
13.3  读取IDE控制器寄存器 120
13.4  写入IDE控制器寄存器 121
13.5  通过IDE控制器数据寄存器读取数据块 121
13.6  通过IDE控制器数据寄存器写入数据块 122
14  非易失性存储器驱动 125
14.1  主、次设备号 126
14.2  非易失性存储器驱动配置 126
14.3  初始化非易失性存储器驱动 129
14.4  禁用读取和写入处理程序 129
14.5  打开特定的存储器分区 130
14.6  关闭特定的存储器分区 130
14.7  从特定的存储器分区读取 130
14.8  写入到特定的存储器分区 131
14.9  擦除非易失性存储器区域 132
15  网络驱动 133
15.1  简介 133
15.2  了解网络设备 133
15.3  了解网络调度约定 135
15.4  网络驱动的Makefile 136
15.5  编写驱动程序连接函数 137
15.6  编写驱动程序启动函数 140
15.7  编写驱动程序初始化函数 140
15.8  编写驱动程序发送任务 141
15.9  编写驱动程序接收任务 141
15.10  编写驱动程序中断处理程序 142
15.11  编写驱动程序IOCTL函数 142
15.12  编写驱动程序统计打印函数 143
16  共享内存支持驱动 145
16.1  共享内存配置表 145
16.2  原语 147
16.2.1  转换地址 147
16.2.2  获得配置 148
16.2.3  锁定原语 148
16.2.3.1  初始化共享锁 150
16.2.3.2  获取共享锁 150
16.2.3.3  释放共享锁 151
16.3  安装MPCI ISR 151
17  帧缓冲区驱动 153
17.1  简介 153
17.2  驱动程序函数概述 154
17.2.1  初始化 154
17.2.2  打开帧缓冲设备 155
17.2.3  关闭帧缓冲设备 156
17.2.4  从帧缓冲设备读取 157
17.2.5  写入到帧缓冲设备 157
17.2.6  帧缓冲区IO控制 158
18  模拟驱动 161
18.1  主、次设备号 162
18.2  模拟驱动配置 162
18.3  初始化模拟板 163
18.4  打开特定的模拟 163
18.5  关闭特定的模拟 163
18.6  从特定的模拟读取 164
18.7  写入到特定的模拟 165
18.8  复位DAC 165
18.9  重新初始化DAC 165
18.10  获得最后一个写入值 166
19  离散驱动 167
19.1  主、次设备号 168
19.2  离散I/O驱动配置 169
19.3  初始化离散I/O板 169
19.4  打开特定的离散位域 170
19.5  关闭特定的离散位域 170
19.6  从特定的离散位域读取 170
19.7  写入到特定的离散位域 171
19.8  禁用离散输出 172
19.9  启用离散输出 172
19.10  重新初始化输出 172
19.11  获得最后一个写入值 172
命令和变量索引 175
概念索引 177

 

1  Introduction
1  简介

Before reading this documentation, it is strongly advised to read the RTEMS Development Environment Guide to get acquainted with the RTEMS directory structure. This document describes how to do a RTEMS Board Support Package, i.e. how to port RTEMS on a new target board. Discussions are provided for the following topics:
在阅读本文档之前,强烈建议阅读RTEMS开发环境指南以熟悉RTEMS目录结构。本文档描述如何制作RTEMS板级支持包,即如何在新的目标板上移植RTEMS。对下列主题提供了讨论:

 RTEMS Board Support Package Organization
 Makefiles and the Linker Command Script
 Board Initialization Sequence
 Device Drivers Including:
 Console Driver
 Clock Driver
 Timer Driver
 Real-Time Clock Driver
 Non-Volatile Memory Driver
 Networking Driver
 Shared Memory Support Driver
 Analog Driver
 Discrete Driver

 RTEMS板级支持包组织
 Makefile和链接器命令脚本
 主板初始化序列
 设备驱动包括:
 控制台驱动
 时钟驱动
 定时器驱动
 实时时钟驱动
 非易失性存储器驱动
 网络驱动
 共享内存支持驱动
 模拟驱动
 离散驱动

The original version of this manual was written by Geoffroy Montel <g_montel@yahoo.com>. When he started development of the gen68340 BSP, this manual did not exist. He wrote the initial version of this manual as the result of his experiences. At that time, this document was viewed internally as the most important "missing manual" in the RTEMS documentation set.
本指南的原始版本由Geoffroy Montel <g_montel@yahoo.com>编写。当他开始gen68340 BSP的开发时,本指南并不存在。他编写了本指南的初始版本作为他经验的总结。当时,此文档在内部被视为RTEMS文档集中最重要的“失踪指南”。

The gen68340 BSP is a good example of the life of an RTEMS BSP. It is based upon a part not recommended for new designs and none of the core RTEMS Project team members have one of these boards. Thus we are unlikely to perform major updates on this BSP. So as long as it compiles and links all tests, it will be available.
gen68340 BSP是RTEMS BSP生活的一个好示例。它基于不推荐用于新设计的一部分,所有RTEMS项目组成员都没有这些主板之一。因此我们不大可能执行此BSP的重大更新。因此,只要它编译和链接所有测试,它将是可用的。

The RTEMS Project team members are always trying to identify common code across BSPs and refactoring the code into shared routines. As part of this effort, the we will enhance the common BSP Framework. Not surprisingly, not every BSP takes advantage of every feature in the framework. The gen68340 does not take advantage of as many features as the ERC32 BSP does. So in many ways, the ERC32 is a better example BSP at this point. But even the ERC32 BSP does not include examples of every driver template and framework available to the BSP author. So in this guide we will try to point out good examples from other BSPs.
RTEMS项目组成员总是试图识别跨BSP的公共代码并将代码重构到共享例程。作为此努力的一部分,我们将加强公共BSP框架。不足为奇的是,不是每个BSP在框架中获得每个特征的优势。gen68340没有获得像ERC32 BSP一样多的特征的优势。所以在许多方面,ERC32此时是一个更好的示例BSP。但实际上ERC32 BSP不包括每个驱动模板的示例和可用于BSP作者的框架。因此,在本指南中我们将试图指出来自其他BSP的好示例。

Our goal is for you to be able to reuse as much code as possible and write as little board specific code as possible.
我们的目标是让你能够重用尽可能多的代码和编写尽可能少的主板特定的代码。
 

全文下载地址:http://download.csdn.net/detail/zhumaill/6988429

0 0
原创粉丝点击