arcusb_devapi.h 3.48 KB
#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*********************************************************************/

/* 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, 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 /* __devapi_h__ */