TUSB1044 驱动代码
时间: 2024-01-01 10:44:15 浏览: 246
![PPT](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PPT.png)
TUSB驱动设计总结-USB驱动程序开发课件
TUSB1044 是一款四端口 USB Type-C 控制器芯片,其驱动程序可以在操作系统中实现 USB Type-C 的支持。以下是一份基于 Linux 操作系统的 TUSB1044 驱动代码示例:
```c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/usb.h>
#include <linux/usb/typec.h>
#define USB_VENDOR_ID_TI 0x0451
#define USB_DEVICE_ID_TUSB1044 0x1044
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(USB_VENDOR_ID_TI, USB_DEVICE_ID_TUSB1044) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, id_table);
static int tusb1044_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct typec_capability cap;
struct usb_device *dev = interface_to_usbdev(interface);
int ret;
ret = usb_typec_register_port(dev, &interface->dev, &cap,
sizeof(cap));
if (ret)
return ret;
dev_info(&interface->dev, "TUSB1044 USB Type-C Controller "
"registered\n");
return 0;
}
static void tusb1044_disconnect(struct usb_interface *interface)
{
struct usb_device *dev = interface_to_usbdev(interface);
usb_typec_unregister_port(dev, &interface->dev);
dev_info(&interface->dev, "TUSB1044 USB Type-C Controller "
"unregistered\n");
}
static struct usb_driver tusb1044_driver = {
.name = "tusb1044",
.probe = tusb1044_probe,
.disconnect = tusb1044_disconnect,
.id_table = id_table,
};
module_usb_driver(tusb1044_driver);
MODULE_AUTHOR("Texas Instruments");
MODULE_DESCRIPTION("TUSB1044 USB Type-C Controller Driver");
MODULE_LICENSE("GPL");
```
此代码实现了 TUSB1044 的 USB Type-C 控制器驱动,当设备连接到计算机上时,驱动程序将自动注册 USB Type-C 端口。这是一个非常简单的示例,真实的驱动程序可能会更加复杂。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)