Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

usb_hid_generic_api.h File Reference

Go to the source code of this file.

Defines

#define USB_HID_WAIT_MODE   0
#define USB_HID_WAIT_REPORT   1
#define USB_HID_RECEIVE_DATA_STANDARD   2
#define USB_HID_SEND_DATA_STANDARD   3
#define USB_HID_WAIT_SEND_DATA_STANDARD   4
#define USB_HID_MODE_CONTINUOUS   5
#define USB_HID_RECEIVE_DATA_CONTINUOUS   6
#define USB_HID_SEND_DATA_CONTINUOUS   7
#define USB_HID_WAIT_SEND_DATA_CONTINUOUS   8
#define DIR_OUT   0
#define DIR_IN   1
#define MSK_AUXR1_ENBOOT   0x20
#define MAP_BOOT   AUXR1 |= MSK_AUXR1_ENBOOT;
#define UNMAP_BOOT   AUXR1 &= ~MSK_AUXR1_ENBOOT;
#define __API_JMP_BOOTLOADER   (*((const void(code*)(void)) 0xF400 ))
#define Is_new_data_read()   (Usb_select_endpoint(EP_HID_OUT),Is_usb_receive_out_hid())
#define Is_write_data_ready()   (send_free == 1)

Functions

U8 usb_read_continuous (U8 *buffer)
U8 usb_write_continuous (U8 *buffer, U8)
void usb_standard_transfer (void)

Variables

U8 send_free


Define Documentation

#define USB_HID_WAIT_MODE   0
 

Definition at line 16 of file usb_hid_generic_api.h.

#define USB_HID_WAIT_REPORT   1
 

Definition at line 17 of file usb_hid_generic_api.h.

#define USB_HID_RECEIVE_DATA_STANDARD   2
 

Definition at line 18 of file usb_hid_generic_api.h.

#define USB_HID_SEND_DATA_STANDARD   3
 

Definition at line 19 of file usb_hid_generic_api.h.

#define USB_HID_WAIT_SEND_DATA_STANDARD   4
 

Definition at line 20 of file usb_hid_generic_api.h.

#define USB_HID_MODE_CONTINUOUS   5
 

Definition at line 21 of file usb_hid_generic_api.h.

#define USB_HID_RECEIVE_DATA_CONTINUOUS   6
 

Definition at line 22 of file usb_hid_generic_api.h.

#define USB_HID_SEND_DATA_CONTINUOUS   7
 

Definition at line 23 of file usb_hid_generic_api.h.

#define USB_HID_WAIT_SEND_DATA_CONTINUOUS   8
 

Definition at line 24 of file usb_hid_generic_api.h.

#define DIR_OUT   0
 

Definition at line 26 of file usb_hid_generic_api.h.

#define DIR_IN   1
 

Definition at line 27 of file usb_hid_generic_api.h.

#define MSK_AUXR1_ENBOOT   0x20
 

Definition at line 29 of file usb_hid_generic_api.h.

#define MAP_BOOT   AUXR1 |= MSK_AUXR1_ENBOOT;
 

Definition at line 30 of file usb_hid_generic_api.h.

Referenced by user_application_task().

#define UNMAP_BOOT   AUXR1 &= ~MSK_AUXR1_ENBOOT;
 

Definition at line 31 of file usb_hid_generic_api.h.

#define __API_JMP_BOOTLOADER   (*((const void(code*)(void)) 0xF400 ))
 

Definition at line 32 of file usb_hid_generic_api.h.

Referenced by user_application_task().

 
#define Is_new_data_read  )     (Usb_select_endpoint(EP_HID_OUT),Is_usb_receive_out_hid())
 

Definition at line 36 of file usb_hid_generic_api.h.

Referenced by usb_read_continuous(), and user_application_task().

 
#define Is_write_data_ready  )     (send_free == 1)
 

Definition at line 37 of file usb_hid_generic_api.h.

Referenced by user_application_task().


Function Documentation

U8 usb_read_continuous U8 buffer  ) 
 

Definition at line 38 of file usb_hid_generic_api.c.

References EP_HID_OUT, Is_new_data_read, U8, Usb_ack_receive_out_hid, Usb_byte_counter_8, usb_configuration_nb, and usb_read_packet().

Referenced by user_application_task().

00039 { 00040 U8 number_of_byte; 00041 if (usb_configuration_nb != 0) 00042 { 00043 number_of_byte = 0; 00044 if (Is_new_data_read()) 00045 { 00046 number_of_byte = Usb_byte_counter_8(); 00047 usb_read_packet(EP_HID_OUT,buffer,number_of_byte); 00048 Usb_ack_receive_out_hid(); 00049 } 00050 return number_of_byte; 00051 } 00052 else 00053 { 00054 return 0; 00055 } 00056 }

U8 usb_write_continuous U8 buffer,
U8 
 

Definition at line 74 of file usb_hid_generic_api.c.

References EP_HID_IN, LENGTH_OF_REPORT, send_free, U8, usb_configuration_nb, Usb_select_endpoint, Usb_send_control_in, and Usb_write_byte.

Referenced by user_application_task().

00075 { 00076 U8 remaining; 00077 U8 c; 00078 if (usb_configuration_nb != 0) 00079 { 00080 if (data_length > LENGTH_OF_REPORT) 00081 { 00082 data_length = LENGTH_OF_REPORT; 00083 } 00084 c = data_length; 00085 remaining = LENGTH_OF_REPORT - data_length; 00086 send_free=0; 00087 Usb_select_endpoint(EP_HID_IN); 00088 while(0 != c) // send data contained in buffer 00089 { 00090 Usb_write_byte(*buffer); 00091 c--; 00092 buffer++; 00093 } 00094 while(0!=remaining) // complete the report if necessary with 0xFF 00095 { 00096 Usb_write_byte(0xFF); 00097 remaining--; 00098 } 00099 00100 Usb_send_control_in(); 00101 return data_length; 00102 } 00103 else 00104 { 00105 return 0; 00106 } 00107 }

void usb_standard_transfer void   ) 
 


Variable Documentation

U8 send_free
 

Definition at line 34 of file usb_hid_generic_api.h.


Generated on Mon Apr 10 17:23:31 2006 for Atmel by doxygen 1.3.7