devapi.h
3.68 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
#ifndef __devapi_h__
#define __devapi_h__ 1
/*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
***
*** File: devapi.h
***
*** Comments:
*** This file contains USB device API definitions.
***
**************************************************************************
*END*********************************************************************/
#ifndef __USB_OS_MQX__
#include "types.h"
#endif
#define USB_SEND (1)
#define USB_RECV (0)
/* Endpoint types */
#define USB_ISOCHRONOUS_ENDPOINT (0x01)
#define USB_INTERRUPT_ENDPOINT (0x02)
#define USB_CONTROL_ENDPOINT (0x03)
#define USB_BULK_ENDPOINT (0x04)
/* Informational Request/Set Types */
#define USB_STATUS_DEVICE_STATE (0x01)
#define USB_STATUS_INTERFACE (0x02)
#define USB_STATUS_ADDRESS (0x03)
#define USB_STATUS_CURRENT_CONFIG (0x04)
#define USB_STATUS_SOF_COUNT (0x05)
#define USB_STATUS_DEVICE (0x06)
#define USB_STATUS_ENDPOINT (0x10)
#define USB_STATUS_ENDPOINT_NUMBER_MASK (0x0F)
/* Available service types */
/* Services 0 through 15 are reserved for endpoints */
#define USB_SERVICE_EP0 (0x00)
#define USB_SERVICE_EP1 (0x01)
#define USB_SERVICE_EP2 (0x02)
#define USB_SERVICE_EP3 (0x03)
#define USB_SERVICE_BUS_RESET (0x10)
#define USB_SERVICE_RESUME (0x11)
#define USB_SERVICE_SLEEP (0x12)
#define USB_SERVICE_ERROR (0x13)
#define USB_SERVICE_STALL (0x14)
#define USB_SERVICE_SOF (0x15)
typedef pointer _usb_device_handle;
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
uint_8 _usb_device_init(uint_8, _usb_device_handle _PTR_, uint_8);
void _usb_device_read_setup_data(_usb_device_handle, uint_8, uchar_ptr);
uint_8 _usb_device_send_data(_usb_device_handle, uint_8,
uchar_ptr, uint_32);
uint_8 _usb_device_recv_data(_usb_device_handle, uint_8,
uchar_ptr, uint_32);
uint_8 _usb_device_get_transfer_status(_usb_device_handle, uint_8, uint_8);
uint_8 _usb_device_cancel_transfer(_usb_device_handle, uint_8, uint_8);
uint_8 _usb_device_get_status(_usb_device_handle, uint_8, uint_16_ptr);
uint_8 _usb_device_set_status(_usb_device_handle, uint_8, uint_16);
uint_8 _usb_device_register_service(_usb_device_handle, uint_8,
void(_CODE_PTR_)(pointer, boolean, uint_8, uint_8_ptr, uint_32));
uint_8 _usb_device_unregister_service(_usb_device_handle, uint_8);
uint_8 _usb_device_call_service(_usb_device_handle, uint_8,
boolean, boolean, uint_8_ptr, uint_32);
uint_8 _usb_device_init_endpoint(_usb_device_handle, uint_8,
uint_16, uint_8, uint_8, uint_8);
uint_8 _usb_device_deinit_endpoint(_usb_device_handle, uint_8, uint_8);
void _usb_device_shutdown(_usb_device_handle);
void _usb_device_unstall_endpoint(_usb_device_handle, uint_8, uint_8);
void _usb_device_stall_endpoint(_usb_device_handle, uint_8, uint_8);
#ifdef __cplusplus
}
#endif
#endif
/* EOF */