⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_otg.h

📁 philips公司ISP1362 USB OTG控制芯片的驱动
💻 H
字号:
/**************************************************************
 * Philips OTG module for USB OTG controller
 *
 * (c) 2002 Koninklijke Philips Electronics N.V., All rights reserved
 * 
 * This  source code and any compilation or derivative thereof is the
 * proprietary information of Koninklijke Philips Electronics N.V.
 * and is confidential in nature.
 * Under no circumstances is this software to be exposed to or placed
 * under an Open Source License of any type without the expressed
 * written permission of Koninklijke Philips Electronics N.V.
 *
 * File Name:	usb_otg.h
 *
 * History:	
 *
 *	Version	Date		Author		Comments
 * -------------------------------------------------
 * 	1.0		09/23/02	SYARRA		Initial Creation
 *
 **************************************************************/

#ifndef __USB_OTG_H__
#define	__USB_OTG_H__



typedef struct {
		int	action;
} usb_otg_notif_t;

/* status_code values in usb_otg_info_t structure */
#define		OTG_STATUS_NONE				0x00	/* No status */
#define		OTG_STATUS_TIMEOUT			0x01	/* Protocol Timeout */
#define		OTG_STATUS_VBUS_ERR			0x02	/* VBUS error for A device */
#define		OTG_STATUS_ENUM_SUCCESS		0x03	/* Remote OTG device enumerated  successfully */
#define		OTG_STATUS_ENUM_FAILED		0x04	/* Remote OTG device enumeration failed */

/* action values */
#define		OTG_NOTIF_STATE_CHANGE	0

typedef struct {
	unsigned char	id;
	unsigned char	state;
	unsigned char	status_code;
} usb_otg_info_t;

/* state values */
// The following five are used as commands by Application to change state
#define		OTG_IDLE			0
#define		OTG_HOST			1
#define		OTG_PERIPHERAL		2
#define		OTG_BUS_DROP		3
#define		OTG_BUS_OPEN		4


/* Complete State values */
#define		OTG_A_DEV_BASE		0x10
#define		OTG_B_DEV_BASE		0x0
#define		OTG_WAIT_RMT_CON	3
#define		OTG_INV_STATE		0xFF

/* Application abstraction states */
#define		OTG_A_IDLE			(OTG_A_DEV_BASE + OTG_IDLE)
#define		OTG_A_HOST			(OTG_A_DEV_BASE + OTG_HOST)
#define		OTG_A_PERIPHERAL	(OTG_A_DEV_BASE + OTG_PERIPHERAL)

#define		OTG_B_IDLE			(OTG_B_DEV_BASE + OTG_IDLE)
#define		OTG_B_HOST			(OTG_B_DEV_BASE + OTG_HOST)
#define		OTG_B_PERIPHERAL	(OTG_B_DEV_BASE + OTG_PERIPHERAL)

/* Additional SW FSM States */
#define		OTG_A_WAIT_BCON		(OTG_A_DEV_BASE + OTG_WAIT_RMT_CON)
#define		OTG_A_WAIT_VRISE	(OTG_A_DEV_BASE + 4)
#define		OTG_A_SUSPEND		(OTG_A_DEV_BASE	+ 5)
#define		OTG_A_WAIT_VFALL	(OTG_A_DEV_BASE + 6)
#define		OTG_A_VBUS_ERR		(OTG_A_DEV_BASE + 7)
#define		OTG_A_LAST_STATE	(OTG_A_VBUS_ERR + 1)

#define		OTG_B_WAIT_ACON		(OTG_B_DEV_BASE + OTG_WAIT_RMT_CON)
#define		OTG_B_SRP_INIT		(OTG_B_DEV_BASE + 4)
#define		OTG_B_LAST_STATE	(OTG_B_SRP_INIT + 1)


#define		USB_OTG_MAJOR		244
#define		USB_OTG_MODULE_NAME	"usb-otgfsm"

/* usb-otg device IOCTL VALUES */
#define	OTG_IOC_MAGIC			'o'

#define		OTG_IOC_GET_STATE	_IOR(OTG_IOC_MAGIC, 0, usb_otg_info_t)
#define		OTG_IOC_SET_STATE	_IOW(OTG_IOC_MAGIC, 1, usb_otg_info_t)

extern void usb_otg_receive_notif(usb_otg_notif_t	*notif);

extern void* usb_otg_register_dcd(void *dcd_priv);

extern void usb_otg_set_hnp(void	*otg_priv, unsigned char feature);

#ifdef __KERNEL__
#include "otg_fsm.h"

typedef struct {
	usb_otg_info_t			status;

	otg_fsm_t				fsm_data;

	struct fasync_struct 	*fasync_q;
	unsigned long			notif_mem;				/* Application notification memory area */
	struct usb_device		*usb_otg_dev;			/* OTG device usb structure */
}usb_otgdev_t;

extern void usb_otgdev_async_notif(usb_otgdev_t    *otgdev);
extern	usb_otgdev_t	*usb_otgdev;

#define	otg_bus(fsm)		((usb_otgdev_t*)fsm->usb_otg_data)->dev

/* OTG Descriptor structure */
struct usb_otg_descriptor {
	__u8  bLength;
	__u8  bDescriptorType;
	__u8  bmAttributes;
} __attribute__ ((packed));

/* OTG desctiptor type */
#define		USB_DT_OTG					0x09
#define		USB_DT_OTG_SIZE				0x03

/* GET_DESCRIPTOR (OTG) values */
#define		USB_OTG_SRP_SUPPORT			0x01
#define		USB_OTG_HNP_SUPPORT			0x02

/* SET_FEATURE values for HNP */
#define		USB_OTG_FS_HNP_ENABLE		0x03		/* B device HNP enable */
#define		USB_OTG_FS_HNP_SUPPORT		0x04		/* A device HNP Supports */
#define		USB_OTG_FS_ALT_HNP_SUPPORT	0x05		/* A device HNP support on alternate port */

/* Set feature control time out */
#define		USB_OTG_GET_TIMEOUT		4

/* Un supported OTG device */
#define		USB_OTG_UNSUP_PROD_ID		0xBADD
#define		USB_OTG_UNSUP_VEND_ID		0x1A0A

#endif /* __KERNEL__ */

#define		USB_OTG_VERSION		"1.0"
#define		DRIVER_AUTHOR		"philips Semiconductors"
#define		DRIVER_DESC			"Philips USB OTG Driver"
#endif /* __USB_OTG__H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -