53 #include "rndis/cdc_ecm.h"
55 #include "serial/uart_usb_lib.h"
58 #include <avr/pgmspace.h>
59 #include <avr/eeprom.h>
66 bit ms_multiple_drive;
70 extern PGM_VOID_P pbuffer;
71 extern U8 data_to_transfer;
95 case SEND_ENCAPSULATED_COMMAND:
109 case GET_ENCAPSULATED_COMMAND:
123 case SET_ETHERNET_PACKET_FILTER:
125 cdc_ecm_set_ethernet_packet_filter();
132 case MASS_STORAGE_RESET:
143 ms_multiple_drive = 1;
151 case GET_LINE_CODING:
155 cdc_get_line_coding();
162 case SET_LINE_CODING:
166 cdc_set_line_coding();
173 case SET_CONTROL_LINE_STATE:
175 cdc_set_control_line_state();
204 case STRING_DESCRIPTOR:
208 data_to_transfer =
sizeof (usb_user_language_id);
209 pbuffer = &(usb_user_language_id.
bLength);
221 static char itoh(
unsigned char i) {
223 ret = pgm_read_byte_near(PSTR(
"0123456789abcdef")+(i&0xF));
226 const char* usb_user_get_string_sram(U8 string_type) {
227 static char serial[13];
232 case USB_STRING_SERIAL:
233 case USB_STRING_MAC_ADDRESS:
235 uint8_t mac_address[6];
236 usb_eth_get_mac_address(mac_address);
239 serial[i*2] = itoh(mac_address[i]>>4);
240 serial[i*2+1] = itoh(mac_address[i]);
252 PGM_P usb_user_get_string(U8 string_type) {
256 return PSTR(
"Atmel");
258 case USB_STRING_PRODUCT:
259 return PSTR(
"Jackdaw 6LoWPAN Adaptor");
261 case USB_STRING_CONFIG_COMPOSITE:
262 return PSTR(
"RNDIS+Debug");
264 case USB_STRING_CONFIG_RNDIS:
265 case USB_STRING_INTERFACE_RNDIS:
266 return PSTR(
"RNDIS");
268 case USB_STRING_CONFIG_EEM:
269 case USB_STRING_INTERFACE_EEM:
270 return PSTR(
"CDC-EEM");
272 case USB_STRING_CONFIG_ECM:
273 case USB_STRING_INTERFACE_ECM:
274 return PSTR(
"CDC-ECM");
276 case USB_STRING_CONFIG_ECM_DEBUG:
277 return PSTR(
"CDC-ECM+DEBUG");
279 case USB_STRING_INTERFACE_SERIAL:
280 return PSTR(
"Debug Port");
288 case USB_STRING_CONFIG_MS:
289 case USB_STRING_INTERFACE_MS:
290 return PSTR(
"Mass Storage");
317 if(USB_CONFIG_HAS_DEBUG_PORT(conf_nb)) {
318 uart_usb_configure_endpoints();
323 case USB_CONFIG_ECM_DEBUG:
324 cdc_ecm_configure_endpoints();
327 case USB_CONFIG_RNDIS_DEBUG:
328 case USB_CONFIG_RNDIS:
329 rndis_configure_endpoints();
332 cdc_ecm_configure_endpoints();
337 usb_configure_endpoint(VCP_INT_EP, \
344 usb_configure_endpoint(VCP_TX_EP, \
351 usb_configure_endpoint(VCP_RX_EP, \
370 extern S_line_coding line_coding;
376 void cdc_get_line_coding(
void)
395 void cdc_set_line_coding (
void)
398 if(usb_endpoint_wait_for_receive_out()==0) {
409 usb_endpoint_wait_for_read_control_enabled();
419 void cdc_set_control_line_state (
void)
428 usb_endpoint_wait_for_read_control_enabled();
430 if(interface == INTERFACE2_NB) {
431 uart_usb_set_control_line_state(controlLineState);
436 Bool usb_user_set_alt_interface(U8 interface, U8 alt_setting) {
441 usb_eth_set_active(alt_setting);
uint8_t rndis_send_encapsulated_command(uint16_t wLength)
Handles a "SEND ENCAPSULATED COMMAND" message.
#define Usb_reset_endpoint(ep)
resets the selected endpoint
U8 bLength
size of this descriptor in bytes
Header file for the uIP TCP/IP stack.
#define Usb_read_byte()
returns FIFO byte for current endpoint
#define LSB(u16)
Least significant byte of u16.
This file contains the user callback functions corresponding to the application.
This file contains the USB driver routines.
#define NULL
The null pointer.
#define Usb_write_byte(byte)
writes byte in FIFO for current endpoint
uint8_t rndis_get_encapsulated_command(void)
Handle "GET ENCAPSULATED COMMAND".
U8 usb_configuration_nb
Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device w...
#define Usb_ack_receive_setup()
acks receive SETUP
#define TRUE
An alias for one, used for clarity.
This file manages the RNDIS task.
#define Usb_send_control_in()
sends IN on control endpoint
void usb_user_endpoint_init(U8 conf_nb)
usb_user_endpoint_init.
This file contains the usb parameters that uniquely identify the application through descriptor table...
#define FALSE
An alias for zero, used for clarity.
Bool usb_user_read_request(U8 type, U8 request)
This function is called by the standard usb read request function when the Usb request is not support...
U8 get_nb_lun()
This fonction return the number of logical unit.
This file contains the interface :
#define MSB(u16)
Most significant byte of u16.
#define Usb_ack_receive_out()
acks reveive OUT
Bool usb_user_get_descriptor(U8 type, U8 string)
usb_user_get_descriptor.