otgapi.h 3.84 KB
#ifndef __otgapi_h__
#define __otgapi_h__
/*HEADER******************************************************************
**************************************************************************
*** 
*** Copyright (c) 2001-2002 ARC International.
*** All rights reserved                                          
***                                                              
*** This software embodies materials and concepts which are      
*** confidential to ARC International and is made
*** available solely pursuant to the terms of a written license   
*** agreement with ARC International             
***
*** $Workfile:otgapi.h$
*** $Revision: 1.1 $
*** $Date: 2003/02/17 20:49:01 $
***
*** Description:      
***  This file contains USB OTG device API definitions.
***                                                               
**************************************************************************
*END*********************************************************************/
#include "types.h"

/* 
** State status returned by the OTG state machine.
** The application should identify these events and
** take action according to the event.  
*/
#define  USB_OTG_HOST_UP                    (0x01)
#define  USB_OTG_DEVICE_UP                  (0x02)
#define  USB_OTG_HOST_DOWN                  (0x03)
#define  USB_OTG_DEVICE_DOWN                (0x04)
#define  USB_OTG_SRP_ACTIVE                 (0x05)
#define  USB_OTG_SRP_FAIL                   (0x06)
#define  USB_OTG_EXCEPTION                  (0x07)
#define  USB_OTG_OVER_CURRENT               (0x08)

/* Informational Request/Set Types */
#define  USB_OTG_A_SET_B_HNP_ENABLE         (0x01)
#define  USB_OTG_B_HNP_ENABLE               (0x02)
#define  USB_OTG_A_BUS_REQ                  (0x03)
#define  USB_OTG_B_BUS_REQ                  (0x04)
#define  USB_OTG_A_VBUS_ON                  (0x05)
#define  USB_OTG_B_SRP_REQ                  (0x06)
#define  USB_OTG_B_HNP_REQ                  (0x07)
#define  USB_OTG_B_CONN                     (0x08)
#define  USB_OTG_B_BUS_SUSPEND				  (0x09)
#define  USB_OTG_A_BUS_SUSPEND				  (0x0A)
#define  USB_OTG_J_ATTACH						  (0x0B)
#define  USB_OTG_A_BUS_RESUME               (0x0C)
#define  USB_OTG_A_CONN 						  (0x0D)
#define  USB_OTG_STATE							  (0x0E)
#define  USB_OTG_A_BUS_SUSPEND_REQ 			  (0x0F)
#define  USB_OTG_B_BUS_RESUME               (0x10)

/* no action require with this change */
#define  USB_OTG_A_BUS_DROP                 (0x11)
#define  USB_OTG_HOST_ACTIVE					  (0x12)
#define  USB_OTG_DEVICE_ACTIVE				  (0x13)


/* OTG HNP/SRP states */
#define 	OTG_START  			                 (0)
#define 	A_IDLE			                    (1)
#define 	A_WAIT_VRISE	                    (2)
#define 	A_WAIT_BCON		                    (3)
#define 	A_HOST			                    (4)
#define 	A_SUSPEND		                    (5)
#define 	A_PERIPHERAL	                    (6)
#define 	A_WAIT_VFALL	                    (7)

#define 	B_IDLE			                    (8)
#define 	B_SRP_INIT		                    (9)
#define 	B_PERIPHERAL	                    (10)
#define 	B_WAIT_ACON		                    (11)
#define 	B_HOST			                    (12)

typedef pointer _usb_otg_handle;
/* OTG init structure */
typedef struct otg_init_struct {
	boolean           	A_BUS_DROP;
	boolean           	A_BUS_REQ;
	boolean           	B_BUS_REQ;
   void (_CODE_PTR_     SERVICE)(pointer, uint_32);
} USB_OTG_INIT_STRUCT, _PTR_ USB_OTG_INIT_STRUCT_PTR;

/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
extern uint_8 _usb_otg_init(uint_8, USB_OTG_INIT_STRUCT_PTR, 
	_usb_otg_handle _PTR_);
extern uint_8 _usb_otg_get_status(_usb_otg_handle, uint_8, uint_32_ptr);
extern uint_8 _usb_otg_set_status(_usb_otg_handle, uint_8, boolean);
extern void _usb_otg_shutdown(_usb_otg_handle);
#ifdef __cplusplus
}
#endif

#endif

/* EOF */