f_iap2.c

/*

* Gadget Driver for  iAP

*

* Copyright (C) 2016 

* Author: 

*

*/

#include <linux/module.h>

#include <linux/init.h>

#include <linux/poll.h>

#include <linux/delay.h>

#include <linux/wait.h>

#include <linux/err.h>

#include <linux/interrupt.h>

#include <linux/sched.h>

#include <linux/types.h>

#include <linux/device.h>

#include <linux/miscdevice.h>

#define IAP_BULK_BUFFER_SIZE 4096

/* number of tx requests to allocate */

#define TX_REQ_MAX 4

#define IAP_GET_DEVICE_STATE _IOW('z', 1, int)

static const char iap_shortname[] = "zjinnova_iap";

struct iap_dev {

struct usb_function function;

struct usb_composite_dev *cdev;

spinlock_t lock;

struct usb_ep *ep_in;

struct usb_ep *ep_out;

int online;

int error;

atomic_t read_excl;

atomic_t write_excl;

atomic_t open_excl;

struct list_head tx_idle;

wait_queue_head_t read_wq;

wait_queue_head_t write_wq;

struct usb_request *rx_req;

int rx_done;

struct work_struct work;

struct miscdevice *misc_device;

int sw_online;

};

static struct usb_interface_descriptor iap_interface_desc = {

.bLength = USB_DT_INTERFACE_SIZE,

.bDescriptorType = USB_DT_INTERFACE,

.bInterfaceNumber = 0,

.bNumEndpoints = 2,

.bInterfaceClass = 0xFF,

.bInterfaceSubClass = 0xF0,

.bInterfaceProtocol = 0,

};

static struct usb_endpoint_descriptor iap_highspeed_in_desc = {

.bLength = USB_DT_ENDPOINT_SIZE,

.bDescriptorType = USB_DT_ENDPOINT,

.bEndpointAddress = USB_DIR_IN,

.bmAttributes = USB_ENDPOINT_XFER_BULK,

.wMaxPacketSize = __constant_cpu_to_le16(512),

};

static struct usb_endpoint_descriptor iap_highspeed_out_desc = {

.bLength = USB_DT_ENDPOINT_SIZE,

.bDescriptorType = USB_DT_ENDPOINT,

.bEndpointAddress = USB_DIR_OUT,

.bmAttributes = USB_ENDPOINT_XFER_BULK,

.wMaxPacketSize = __constant_cpu_to_le16(512),

};

static struct usb_endpoint_descriptor iap_fullspeed_in_desc = {

.bLength = USB_DT_ENDPOINT_SIZE,

.bDescriptorType = USB_DT_ENDPOINT,

.bEndpointAddress = USB_DIR_IN,

.bmAttributes = USB_ENDPOINT_XFER_BULK,

};

static struct usb_endpoint_descriptor iap_fullspeed_out_desc = {

.bLength = USB_DT_ENDPOINT_SIZE,

.bDescriptorType = USB_DT_ENDPOINT,

.bEndpointAddress = USB_DIR_OUT,

.bmAttributes = USB_ENDPOINT_XFER_BULK,

};

static struct usb_descriptor_header *fs_iap_descs[] = {

(struct usb_descriptor_header *) &iap_interface_desc,

(struct usb_descriptor_header *) &iap_fullspeed_in_desc,

(struct usb_descriptor_header *) &iap_fullspeed_out_desc,

NULL,

};

static struct usb_descriptor_header *hs_iap_descs[] = {

(struct usb_descriptor_header *) &iap_interface_desc,

(struct usb_descriptor_header *) &iap_highspeed_in_desc,

(struct usb_descriptor_header *) &iap_highspeed_out_desc,

NULL,

};

static struct usb_string iap_string_defs[] = {

[0].s = "iAP Interface",

{ } /* end of list */

};

static struct usb_gadget_strings iap_string_table = {

.language = 0x0409, /* en-us */

.strings = iap_string_defs,

};

static struct usb_gadget_strings *iap_strings[] = {

&iap_string_table,

NULL,

};

/* temporary variable used between iap_open() and iap_gadget_bind() */

static struct iap_dev *_iap_dev;

static inline struct iap_dev *func_to_iap(struct usb_function *f)

{

return container_of(f, struct iap_dev, function);

}

static struct usb_request *iap_request_new(struct usb_ep *ep, int buffer_size)

{

### starRC、LEF 和 DEF 文件的 EDA 工具使用教程 #### 关于 starRC 的使用说明 starRC 是由 Synopsys 开发的一款用于寄生参数提取 (PEX) 的工具,在 detail routing 完成之后被调用,以提供精确的电阻电容延迟分析数据[^2]。该工具能够处理复杂的多层互连结构并支持多种工艺节点。 对于 starRC 的具体操作指南,通常可以从官方文档获取最权威的信息。访问 Synopsys 官方网站的技术资源页面,可以找到最新的产品手册以及应用笔记等资料。此外,还可以通过在线帮助系统获得交互式的指导和支持服务。 #### LEF 和 DEF 文件格式解析及其在 Cadence 中的应用 LEF(Library Exchange Format)和 DEF(Design Exchange Format)是两种广泛应用于集成电路布局布线阶段的标准文件格式之一[^3]。前者主要用于描述标准单元库中的元件几何形状;后者则记录了整个芯片版图的设计信息,包括但不限于各个模块的位置关系、网络连接情况等重要细节。 当涉及到这些文件类型的编辑或读取时,Cadence 提供了一系列强大的平台级解决方案,比如 Virtuoso Layout Editor 就可以直接打开并修改 LEF/DEF 格式的项目工程。为了更好地理解和运用这两种文件格式,建议参阅 Cadence 发布的相关培训材料或是参加其举办的专项课程学习活动。 ```bash # 示例命令:查看 LEF 或 DEF 文件内容 cat my_design.lef cat my_design.def ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

无v邪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值