u-boot-2015.04-rc1/u-boot-2015.04-rc1/api/README
U-Boot machine/arch independent API for external apps
U-BOOT体系作为扩展应用的独立API
=====================================================
1. Main assumptions 主要前提
- there is a single entry point (syscall) to the API
有一个单一的入口点(系统调用)的API
- per current design the syscall is a C-callable function in the U-Boot
text, which might evolve into a real syscall using machine exception trap
once this initial version proves functional
在当前的设计中,在U-BOOT的文本中系统调用是一个C语言调用函数接口,
使用机器异常陷阱,一旦这个初始版本的功能被证明后,则它有可能演变成一个真正的系统调用。
- the consumer app is responsible for producing appropriate context (call
number and arguments)
客户应用程序用来负责产生适当的上下文(调用号及参数)
- upon entry, the syscall dispatches the call to other (existing) U-Boot
functional areas like networking or storage operations
系统调用进入时,系统调用调度其他(已存在的)U-Boot的功能领域,如网络或存储操作。
- consumer application will recognize the API is available by searching
a specified (assumed by convention) range of address space for the
signature
应用程序可通过搜索地址空间指定的(按约定承担)范围内的名字来识别API。
- the U-Boot integral part of the API is meant to be thin and non-intrusive,
leaving as much processing as possible on the consumer application side,
for example it doesn't keep states, but relies on hints from the app and
so on
U-Boot中API的组成部分,就是要简洁,非侵入式,留下尽可能多的处理给消费者的应用层面,
例如,它不保留状态,但依赖于提示从andso上的应用程序。
- optional (CONFIG_API)
可选(CONFIG_API)
2. Calls 调用
- console related (getc, putc, tstc etc.)
控制台相关
- system (reset, platform info)
系统相关(复位,平台信息)
- time (delay, current)
时间相关(延时,当前时刻)
- env vars (enumerate all, get, set)
环境变量
- devices (enumerate all, open, close, read, write); currently two classes
of devices are recognized and supported: network and storage (ide, scsi,
usb etc.)
设备相关(列举所有,打开,关闭,读,写);目前两类设备识别和支持:网络和存储(IDE,SCSI,USB等)。
3. Structure overview 结构概述
- core API, integral part of U-Boot, mandatory
核心API,U-Boot的不可或缺的组成部分,强制性
- implements the single entry point (mimics UNIX syscall)
实现了单一入口点(模仿UNIX系统调用)
- glue
- entry point at the consumer side, allows to make syscall, mandatory
part 在应用方面的切入点,允许进行系统调用,强制性部分
- helper conveniency wrappers so that consumer app does not have to use
the syscall directly, but in a more friendly manner (a la libc calls),
optional part
方便让消费者的应用程序不必直接使用系统调用,但在一个更友好的方式(如libc中调用),可选部分
- consumer application
- calls directly, or leverages the provided glue mid-layer
消费类应用
- 直接调用,或利用所提供的中间层