Documentation/fmc/fmc-chardev.txt

如果想评论或更新本文的内容,请直接联系原文档的维护者。


如果你使用英文交流有困难的话,也可以向中文版维护者求助。


如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。


中文版维护者: 陶莹莉  tyl18768122426@163.com


中文版翻译者:  陶莹莉  tyl18768122426@163.com


中文版校译者:  陶莹莉  tyl18768122426@163.com
fmc-chardev
===========
fmc字符设备
===========
This is a simple generic driver, that allows user access by means of a
character device (actually, one for each mezzanine it takes hold of).


这是一个简单通用的驱动程序,允许用户通过一个字符设备访问(实际上,为每个夹层它抓住了一个)。


The char device is created as a misc device. Its name in /dev (as
created by udev) is the same name as the underlying FMC device. Thus,
the name can be a silly fmc-0000 look-alike if the device has no
identifiers nor bus_id, a more specific fmc-0400 if the device has a
bus-specific address but no associated name, or something like
fdelay-0400 if the FMC core can rely on both a mezzanine name and a bus
address.


字符设备被创建为一个混杂的设备。它的名字在/dev(由udev创建)和作为底层的FMC装置是一样的。
因此,设备可以看起来是一个愚蠢的FMC-0000如果这个设备没有标识符也没有bus_id,
一个更特殊的FMC-0400是如果该设备有一个总线特定的地址,但没有相关的名称,或类似的东西
如果FMC核心可以依靠夹层名称和总线地址。


Currently the driver only supports read and write: you can lseek to the
desired address and read or write a register.


目前驱动程序仅支持读取和写入:你可以移动指针到所需的地址,读或写一个寄存器。


The driver assumes all registers are 32-bit in size, and only accepts a
single read or write per system call. However, as a result of Unix read
and write semantics, users can simply fread or fwrite bigger areas in
order to dump or store bigger memory areas.


驱动程序假定所有的寄存器是32位的大小,每个系统调用只接受
一个读或写。然而,作为Unix读取和写语义的结果,用户可以简单地用fread或者 fwrite实现更大的领域
用于倾倒或存放更大的内存区域。


There is currently no support for mmap, user-space interrupt management
and DMA buffers. They may be added in later versions, if the need
arises.


目前还没有支持内存文件映射的用户空间的中断管理和DMA缓冲区。这可能会加在以后的版本中,如果有需要


The example below shows raw access to a SPEC card programmed with its
golden FPGA file, that features an SDB structure at offset 256 - i.e.
64 words.  The mezzanine's EEPROM in this case is not programmed, so the
default name is fmc-<bus><devfn>, and there are two cards in the system:


下面的例子显示了一个规范卡片的编程用他的可编程门阵列文件,其特点是在偏移256 - 即64个字的一个SDB结构。
夹层的只读存储器在这种情况下是不可编程的,所以默认名称是FMC-<bus><devfn>,在系统中有两个卡


  spusa.root# insmod fmc-chardev.ko
  [ 1073.339332] spec 0000:02:00.0: Driver has no ID: matches all
  [ 1073.345051] spec 0000:02:00.0: Created misc device "fmc-0200"
  [ 1073.350821] spec 0000:04:00.0: Driver has no ID: matches all
  [ 1073.356525] spec 0000:04:00.0: Created misc device "fmc-0400"
  spusa.root# ls -l /dev/fmc*
  crw------- 1 root root 10, 58 Nov 20 19:23 /dev/fmc-0200
  crw------- 1 root root 10, 57 Nov 20 19:23 /dev/fmc-0400
  spusa.root# dd bs=4 skip=64 count=1 if=/dev/fmc-0200 2> /dev/null | od -t x1z
  0000000 2d 42 44 53                                      >-BDS<
  0000004


The simple program  in this package can access an FMC char
device and read or write a word or a whole area.  Actually, the program
is not specific to FMC at all, it just uses lseek, read and write.


这个包中的tools/fmc-mem这个简单的程序可以访问FMC字符设备并读取或写一个字
或整个区域。事实上,该程序并不是对所有的FMC都是特定的,它只是使用指针,来读取和写入。


Its first argument is the device name, the second the offset, the third
(if any) the value to write and the optional last argument that must
begin with "+" is the number of bytes to read or write.  In case of
repeated reading data is written to stdout; repeated writes read from
stdin and the value argument is ignored.


它的第一个参数是设备名称,第二个是偏移量,第三个(如果有的话)的值用于写入,
可选的最后一个参数,必须以“+”开始是读取或写入的字节数。在这种情况下
重复读取数据写入到stdout;重复写入从stdin中读取的和参数值将被忽略。


The following examples show reading the SDB magic number and the first
SDB record from a SPEC device programmed with its golden image:


下面的例子显示读入存储数据缓冲器不可思议的数字和第一条SDB记录从SPEC设备用其金色的形象编程:


     spusa.root# ./fmc-mem /dev/fmc-0200 100
     5344422d
     spusa.root# ./fmc-mem /dev/fmc-0200 100 +40 | od -Ax -t x1z
     000000 2d 42 44 53 00 01 02 00 00 00 00 00 00 00 00 00  >-BDS............<
     000010 00 00 00 00 ff 01 00 00 00 00 00 00 51 06 00 00  >............Q...<
     000020 c9 42 a5 e6 02 00 00 00 11 05 12 20 2d 34 42 57  >.B......... -4BW<
     000030 73 6f 72 43 72 61 62 73 49 53 47 2d 00 20 20 20  >sorCrabsISG-.   <
     000040
将QT += core QT -= gui CONFIG += c++11 TARGET = UavRectifyLoadLIb CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS win32{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../../RasterManager/bin/Debug } else{ DESTDIR = $$PWD/../../../../RasterManager/bin/release } INCLUDEPATH += $$PWD/../../../include/gdal1101 DEPENDPATH += $$PWD/../../../include/gdal1101 } else{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../product/release32 } else{ DESTDIR = $$PWD/../../../product/release32 } } # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lUAVAutoRectifyMt -lUAVAutoRectify -lUAVAutoRectifyFi INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_core unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_imgproc INCLUDEPATH += $$PWD/../../../lib/opencvf249 DEPENDPATH += $$PWD/../../../lib/opencvf249 unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_core #unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgproc unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_features2d unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgcodecs INCLUDEPATH += $$PWD/../../../../../../../usr/local/include DEPENDPATH += $$PWD/../../../../../../../usr/local/include unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lDEMDriver unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lProjection unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lIImage_gC QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO 转为cmake格式
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值