macos Mac驱动开发

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1001374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:13:30  来源:igfitidea点击:

Mac driver development

macoskerneldriver

提问by No hay Problema

I am thinking about migrating a Windows driver into OS X. Now I am just starting to look around to see what is available and there is a lot about objective C and cocoa. Seems that the language and the cocoa framework are high level APIs, am I right to assume that?

我正在考虑将 Windows 驱动程序迁移到 OS X。现在我只是开始四处看看有什么可用的,并且有很多关于目标 C 和可可的内容。似乎语言和可可框架是高级 API,我这样假设是否正确?

I have strong C++ skills and I use them for kernel development, can I use the same skills for Mac driver development (I imagine the answer is yes). Has Macintosh any type of application/dev environment for building drivers?

我有很强的 C++ 技能并且我将它们用于内核开发,我可以将相同的技能用于 Mac 驱动程序开发吗(我想答案是肯定的)。Macintosh 是否有用于构建驱动程序的任何类型的应用程序/开发环境?

回答by William Brendel

The Apple Hardware & Drivers pagehas lots of information about Mac driver development. It should be enough to get you started. Some of the highlights:

苹果的硬件和驱动程序页面有很多有关Mac的驱动程序开发的信息。这应该足以让你开始。一些亮点:

  • Getting Started- A guided learning path for hardware and driver developers new to Mac OS X.

  • Frameworks- API references organized by framework.

  • USB Sample Code- Resources for developing USB devices and software to access them.

  • FireWire Sample Code- Resources for developing FireWire devices and software to access them.

  • 入门- 针对 Mac OS X 新手的硬件和驱动程序开发人员的指导学习路径。

  • 框架- 按框架组织的 API 参考。

  • USB 示例代码- 用于开发 USB 设备和访问它们的软件的资源。

  • FireWire 示例代码- 用于开发 FireWire 设备和访问它们的软件的资源。

回答by John Cromartie

Start here http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/About/About.html

从这里开始http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/About/About.html

Mac development is generally done using Xcode, as it handles various Mac-specific concepts like bundles and frameworks. You will most likely be working in pure C. You will not be using Cocoa for driver development, as that is an application-oriented framework.

Mac 开发通常使用 Xcode 完成,因为它处理各种特定于 Mac 的概念,如包和框架。您很可能使用纯 C 语言工作。您不会使用 Cocoa 进行驱动程序开发,因为它是一个面向应用程序的框架。

回答by TomJeffries

First, C++ works just fine, although Objective C is not all that hard to learn. If you have a background in Windows drivers you know some of the essentials- memory management is critical, time is critical, etc.

首先,C++ 工作得很好,尽管 Objective C 并不难学。如果您有 Windows 驱动程序的背景,您就会知道一些基本知识——内存管理很重要,时间很重要,等等。

You will probably be using the IOKit. I suggest starting here for a good, step by step intro to getting the driver to work.

您可能会使用 IOKit。我建议从这里开始,逐步介绍如何让驱动程序工作。

Kernel Extensions

内核扩展

There are a few things that don't seem to work the way they say they will, and I'm trying to figure out if it really is not possible to debug a driver on a single machine, but it's better than most Apple documentation.

有一些事情似乎不像他们说的那样工作,我试图弄清楚是否真的不可能在单台机器上调试驱动程序,但它比大多数 Apple 文档要好。

回答by Xavier Lowmiller

If you're targeting Catalina or higher, you should also consider DriverKit.

如果您的目标是 Catalina 或更高版本,您还应该考虑DriverKit