#include "config.h"
Include dependency graph for usb_specific_request.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | S_line_coding |
Defines | |
#define | GET_LINE_CODING 0x21 |
#define | SET_LINE_CODING 0x20 |
#define | SET_CONTROL_LINE_STATE 0x22 |
#define | SEND_BREAK 0x23 |
#define | SEND_ENCAPSULATED_COMMAND 0x00 |
#define | GET_ENCAPSULATED_COMMAND 0x01 |
Functions | |
Bool | usb_user_read_request (U8, U8) |
This function is called by the standard usb read request function when the Usb request is not supported. | |
Bool | usb_user_get_descriptor (U8, U8) |
usb_user_get_descriptor.This function returns the size and the pointer on a user information structure | |
void | usb_user_endpoint_init (U8) |
usb_user_endpoint_init.This function configures the endpoints. | |
void | cdc_get_line_coding () |
cdc_get_line_coding.This function manages reception of line coding parameters (baudrate...). | |
void | cdc_set_line_coding () |
cdc_set_line_coding.This function manages reception of line coding parameters (baudrate...). | |
void | cdc_set_control_line_state (void) |
cdc_set_control_line_state.This function manages the SET_CONTROL_LINE_LINE_STATE CDC request. | |
Variables | |
code S_usb_device_descriptor | usb_dev_desc |
code S_usb_user_configuration_descriptor | usb_conf_desc |
code S_usb_user_configuration_descriptor | usb_other_conf_desc |
code S_usb_device_qualifier_descriptor | usb_qual_desc |
code S_usb_manufacturer_string_descriptor | usb_user_manufacturer_string_descriptor |
code S_usb_product_string_descriptor | usb_user_product_string_descriptor |
code S_usb_serial_number | usb_user_serial_number |
code S_usb_language_id | usb_user_language_id |
#define GET_LINE_CODING 0x21 |
#define SET_LINE_CODING 0x20 |
#define SET_CONTROL_LINE_STATE 0x22 |
#define SEND_BREAK 0x23 |
Definition at line 28 of file usb_specific_request.h.
#define SEND_ENCAPSULATED_COMMAND 0x00 |
Definition at line 29 of file usb_specific_request.h.
#define GET_ENCAPSULATED_COMMAND 0x01 |
Definition at line 30 of file usb_specific_request.h.
This function is called by the standard usb read request function when the Usb request is not supported.
This function returns TRUE when the request is processed. This function returns FALSE if the request is not supported. In this case, a STALL handshake will be automatically sent by the standard usb read request function.
none |
Definition at line 51 of file usb_specific_request.c.
References cdc_get_line_coding(), cdc_set_control_line_state(), cdc_set_line_coding(), FALSE, GET_LINE_CODING, SET_CONTROL_LINE_STATE, SET_LINE_CODING, TRUE, and Usb_read_byte.
Referenced by usb_process_request().
00052 { 00053 U8 descriptor_type ; 00054 U8 string_type ; 00055 00056 string_type = Usb_read_byte(); 00057 descriptor_type = Usb_read_byte(); 00058 switch(request) 00059 { 00060 case GET_LINE_CODING: 00061 cdc_get_line_coding(); 00062 return TRUE; 00063 break; 00064 00065 case SET_LINE_CODING: 00066 cdc_set_line_coding(); 00067 return TRUE; 00068 break; 00069 00070 case SET_CONTROL_LINE_STATE: 00071 cdc_set_control_line_state(); 00072 return TRUE; 00073 break; 00074 00075 default: 00076 return FALSE; 00077 break; 00078 00079 } 00080 return FALSE; 00081 }
Here is the call graph for this function:
usb_user_get_descriptor.This function returns the size and the pointer on a user information structure
none |
Definition at line 93 of file usb_specific_request.c.
References FALSE.
Referenced by usb_get_descriptor().
00094 { /* 00095 switch(type) 00096 { 00097 case STRING_DESCRIPTOR: 00098 switch (string) 00099 { 00100 case LANG_ID: 00101 data_to_transfer = sizeof (usb_user_language_id); 00102 pbuffer = &(usb_user_language_id.bLength); 00103 return TRUE; 00104 break; 00105 case MAN_INDEX: 00106 data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor); 00107 pbuffer = &(usb_user_manufacturer_string_descriptor.bLength); 00108 return TRUE; 00109 break; 00110 case PROD_INDEX: 00111 data_to_transfer = sizeof (usb_user_product_string_descriptor); 00112 pbuffer = &(usb_user_product_string_descriptor.bLength); 00113 return TRUE; 00114 break; 00115 case SN_INDEX: 00116 data_to_transfer = sizeof (usb_user_serial_number); 00117 pbuffer = &(usb_user_serial_number.bLength); 00118 return TRUE; 00119 break; 00120 default: 00121 return FALSE; 00122 } 00123 default: 00124 return FALSE; 00125 }*/ 00126 00127 return FALSE; 00128 }
void usb_user_endpoint_init | ( | U8 | conf_nb | ) |
usb_user_endpoint_init.This function configures the endpoints.
none |
Definition at line 138 of file usb_specific_request.c.
References DIRECTION_IN, DIRECTION_OUT, INT_EP, NYET_ENABLED, ONE_BANK, RX_EP, SIZE_32, TX_EP, TYPE_BULK, TYPE_INTERRUPT, usb_configure_endpoint, and Usb_reset_endpoint.
Referenced by usb_set_configuration().
00139 { 00140 usb_configure_endpoint(INT_EP, \ 00141 TYPE_INTERRUPT, \ 00142 DIRECTION_IN, \ 00143 SIZE_32, \ 00144 ONE_BANK, \ 00145 NYET_ENABLED); 00146 00147 usb_configure_endpoint(TX_EP, \ 00148 TYPE_BULK, \ 00149 DIRECTION_IN, \ 00150 SIZE_32, \ 00151 ONE_BANK, \ 00152 NYET_ENABLED); 00153 00154 usb_configure_endpoint(RX_EP, \ 00155 TYPE_BULK, \ 00156 DIRECTION_OUT, \ 00157 SIZE_32, \ 00158 ONE_BANK, \ 00159 NYET_ENABLED); 00160 00161 Usb_reset_endpoint(INT_EP); 00162 Usb_reset_endpoint(TX_EP); 00163 Usb_reset_endpoint(RX_EP); 00164 00165 00166 }
void cdc_get_line_coding | ( | void | ) |
cdc_get_line_coding.This function manages reception of line coding parameters (baudrate...).
none |
Definition at line 176 of file usb_specific_request.c.
References S_line_coding::bCharFormat, S_line_coding::bDataBits, S_line_coding::bParityType, S_line_coding::dwDTERate, Is_usb_read_control_enabled, Is_usb_receive_out, line_coding, LSB0, LSB1, LSB2, LSB3, Usb_ack_receive_out, Usb_ack_receive_setup, Usb_send_control_in, and Usb_write_byte.
Referenced by usb_user_read_request().
00177 { 00178 Usb_ack_receive_setup(); 00179 Usb_write_byte(LSB0(line_coding.dwDTERate)); 00180 Usb_write_byte(LSB1(line_coding.dwDTERate)); 00181 Usb_write_byte(LSB2(line_coding.dwDTERate)); 00182 Usb_write_byte(LSB3(line_coding.dwDTERate)); 00183 Usb_write_byte(line_coding.bCharFormat); 00184 Usb_write_byte(line_coding.bParityType); 00185 Usb_write_byte(line_coding.bDataBits); 00186 00187 Usb_send_control_in(); 00188 while(!(Is_usb_read_control_enabled())); 00189 //Usb_clear_tx_complete(); 00190 00191 while(!Is_usb_receive_out()); 00192 Usb_ack_receive_out(); 00193 }
void cdc_set_line_coding | ( | void | ) |
cdc_set_line_coding.This function manages reception of line coding parameters (baudrate...).
none |
Definition at line 204 of file usb_specific_request.c.
References S_line_coding::bCharFormat, S_line_coding::bDataBits, S_line_coding::bParityType, S_line_coding::dwDTERate, Is_usb_read_control_enabled, Is_usb_receive_out, line_coding, LSB0, LSB1, LSB2, LSB3, Uart_set_baudrate, Usb_ack_receive_out, Usb_ack_receive_setup, Usb_read_byte, and Usb_send_control_in.
Referenced by usb_user_read_request().
00205 { 00206 Usb_ack_receive_setup(); 00207 while (!(Is_usb_receive_out())); 00208 LSB0(line_coding.dwDTERate) = Usb_read_byte(); 00209 LSB1(line_coding.dwDTERate) = Usb_read_byte(); 00210 LSB2(line_coding.dwDTERate) = Usb_read_byte(); 00211 LSB3(line_coding.dwDTERate) = Usb_read_byte(); 00212 line_coding.bCharFormat = Usb_read_byte(); 00213 line_coding.bParityType = Usb_read_byte(); 00214 line_coding.bDataBits = Usb_read_byte(); 00215 Usb_ack_receive_out(); 00216 00217 Usb_send_control_in(); // send a ZLP for STATUS phase 00218 while(!(Is_usb_read_control_enabled())); 00219 #ifdef UART_U2 00220 Uart_set_baudrate((line_coding.dwDTERate)/2); 00221 #else 00222 Uart_set_baudrate(line_coding.dwDTERate); 00223 #endif 00224 }
void cdc_set_control_line_state | ( | void | ) |
cdc_set_control_line_state.This function manages the SET_CONTROL_LINE_LINE_STATE CDC request.
none |
Definition at line 237 of file usb_specific_request.c.
References Is_usb_read_control_enabled, Usb_ack_receive_setup, and Usb_send_control_in.
Referenced by usb_user_read_request().
00238 { 00239 Usb_ack_receive_setup(); 00240 Usb_send_control_in(); 00241 while(!(Is_usb_read_control_enabled())); 00242 00243 }
Definition at line 38 of file usb_descriptors.c.
Definition at line 57 of file usb_descriptors.c.
Definition at line 123 of file usb_descriptors.c.
Definition at line 132 of file usb_descriptors.c.
Definition at line 141 of file usb_descriptors.c.
Definition at line 150 of file usb_descriptors.c.