otgapi.h
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#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 */