Contiki 2.6

usb-arch.h

00001 #ifndef __USB_ARCH_H__0Z52ZDP0H6__
00002 #define __USB_ARCH_H__0Z52ZDP0H6__
00003 
00004 #include <contiki-conf.h>
00005 #include <usb-api.h>
00006 
00007 
00008 /* Includes control endpoint 0 */
00009 #ifndef USB_MAX_ENDPOINTS
00010 #define USB_MAX_ENDPOINTS 4
00011 #endif
00012 
00013 #ifndef CTRL_EP_SIZE
00014 #define CTRL_EP_SIZE 8
00015 #endif
00016 
00017 #ifndef USB_EP1_SIZE 
00018 #define USB_EP1_SIZE 8
00019 #endif
00020 #ifndef USB_EP2_SIZE 
00021 #define USB_EP2_SIZE 8
00022 #endif
00023 #ifndef USB_EP3_SIZE 
00024 #define USB_EP3_SIZE 8
00025 #endif
00026 #ifndef USB_EP4_SIZE 
00027 #define USB_EP4_SIZE 0
00028 #endif
00029 #ifndef USB_EP5_SIZE 
00030 #define USB_EP5_SIZE 0
00031 #endif
00032 #ifndef USB_EP6_SIZE 
00033 #define USB_EP6_SIZE 0
00034 #endif
00035 #ifndef USB_EP7_SIZE 
00036 #define USB_EP7_SIZE 0
00037 #endif
00038 
00039 
00040 #ifndef MAX_CTRL_DATA
00041 #define MAX_CTRL_DATA 128
00042 #endif
00043 
00044 void
00045 usb_arch_setup(void);
00046 
00047 void
00048 usb_arch_setup_control_endpoint(uint8_t addr);
00049 
00050 void
00051 usb_arch_setup_bulk_endpoint(uint8_t addr);
00052 
00053 void
00054 usb_arch_setup_interrupt_endpoint(uint8_t addr);
00055 
00056 void
00057 usb_arch_disable_endpoint(uint8_t addr);
00058 
00059 void
00060 usb_arch_discard_all_buffers(uint8_t addr);
00061 
00062 /* Stall a control endpoint. The stall will be cleared when the next
00063    SETUP token arrives. */
00064 void
00065 usb_arch_control_stall(uint8_t addr);
00066 
00067 /* Set or remove a HALT condition on an endpoint */
00068 void
00069 usb_arch_halt_endpoint(uint8_t addr, int halt);
00070 
00071 void
00072 usb_arch_set_configuration(uint8_t usb_configuration_value);
00073 
00074 uint16_t
00075 usb_arch_get_ep_status(uint8_t addr);
00076 
00077 void
00078 usb_arch_set_address(uint8_t addr);
00079 
00080 
00081 /* Select what process should be polled when a global event occurs. Intended for the protocol handler. Applications should use usb_set_global_event_process  */
00082 void
00083 usb_arch_set_global_event_process(struct process *p);
00084 
00085 unsigned int
00086 usb_arch_get_global_events(void);
00087 
00088 /* Return true if not all data has been sent to the host */
00089 int 
00090 usb_arch_send_pending(uint8_t ep_addr);
00091 
00092 #endif /* __USB_ARCH_H__0Z52ZDP0H6__ */