> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man4/cp2112.4.md).

# cp2112.4

`cp2112` — USB GPIO 与 I2C 外设驱动

## 名称

`cp2112`

## 概要

`若要将此驱动编译进内核，请在你的内核配置文件中加入以下行：`

> device cp2112 device usb device gpio device iicbus

`或者，若要在引导时以模块方式加载此驱动，请在 loader.conf(5) 中加入以下行：`

```sh
cp2112_load="YES"
```

## 描述

`cp2112` 驱动为 Silicon Labs CP2112 设备提供支持。该设备具有 8 个通用 I/O 引脚和一个支持 I2C 协议子集的 I2C 控制器。

所有引脚均支持输入和输出模式。输出引脚可配置为开漏或推挽工作方式。引脚 0、1 和 7 支持特殊功能：分别为 I2C 发送指示、I2C 接收指示和时钟输出。目前 `cp2112` 驱动尚未提供启用和配置这些特殊功能的方法。

I2C 控制器支持最多 512 字节数据的读事务、最多 61 字节数据的写事务，以及一次写后跟重复起始再跟读的事务（其中写最多 16 字节，读最多 512 字节）。不支持零长度传输。`cp2112` 驱动会创建 [gpio(4)](/man/man4/gpio.4.md) 和 [iicbus(4)](/man/man4/iicbus.4.md) 子总线以暴露相应功能。

## 参见

[gpio(4)](/man/man4/gpio.4.md), [iicbus(4)](/man/man4/iicbus.4.md), [usb(4)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man4/usb.4.md)

## 历史

`cp2112` 驱动及本手册页由 Andriy Gapon <avg@FreeBSD.org> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man4/cp2112.4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
