如何从 VxWorks 中的 RTP 访问内存映射 I/O 设备 (FPGA)?
使用 VxWorks 时,我们尝试从实时进程访问内存映射 I/O 设备。
由于 RTP 具有内存保护,我如何从其中访问我的 I/O 设备?
When using VxWorks, we are trying to access a memory mapped I/O device from a Real-Time Process.
Since RTPs have memory protection, how can I access my I/O device from one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用两种方法从 RTP 访问 I/O 映射设备。
I/O 子系统(首选)
您实际上创建了一个小型设备驱动程序。 该驱动程序可以集成到VxWorks的I/O子系统中。 集成后,RTP 只需使用标准 I/O 操作即可使用该驱动程序:打开、关闭、读取、写入、ioctl。
请注意,“创建设备驱动程序”不必很复杂。 它可以像为 ioctl 函数定义一个包装器一样简单。 有关更多详细信息,请参阅 ioLib。
直接映射内存(不推荐)
您可以通过 sdOpen 调用创建共享内存区域。 创建共享内存时,您可以指定物理地址应该是什么。 指定该地址为您设备的I/O映射区域,您可以直接访问该设备。
问题在于共享内存区域是可用于任何空间的公共对象,直接攻击硬件违背了 RTP 背后的理念。
There are two methods you can use to access your I/O mapped device from an RTP.
I/O Subsystem (preferred)
You essentially create a small device driver. This driver can be integrated into the I/O Subsystem of VxWorks. Once integrated, the driver is available to the RTP by simply using standard I/O operations: open, close, read, write, ioctl.
Note that "creating a device driver" doesn't have to be complicated. It could be as simple as just defining a wrapper for the ioctl function. See ioLib for more details.
Map Memory Directly (not recommended)
You can create a shared memory region via the sdOpen call. When creating the shared memory, you can specify what the physical address should be. Specify the address to be your device's I/O mapped region, and you can access the device directly.
The problem is that a shared memory region is a public object that is available to any space, and poking directly at hardware goes against the philosophy behind RTPs.