Exemplo n.º 1
0
void uart_usb_configure_endpoints() {
	usb_configure_endpoint(
		VCP_INT_EP,     
		TYPE_INTERRUPT,   
		DIRECTION_IN,  
		SIZE_32,       
		ONE_BANK,     
		NYET_ENABLED
	);

	usb_configure_endpoint(
		VCP_TX_EP,      
		TYPE_BULK,     
		DIRECTION_IN,  
		SIZE_32,       
		TWO_BANKS,     
		NYET_ENABLED
	);

	usb_configure_endpoint(
		VCP_RX_EP,      
		TYPE_BULK,     
		DIRECTION_OUT,  
		SIZE_32,       
		TWO_BANKS,     
		NYET_ENABLED
	);

	Usb_reset_endpoint(VCP_INT_EP);
	Usb_reset_endpoint(VCP_TX_EP);
	Usb_reset_endpoint(VCP_RX_EP);
	
	USB_CDC_ACM_HOOK_CONFIGURED();
}
Exemplo n.º 2
0
void cdc_ecm_configure_endpoints() {
#if CDC_ECM_USES_INTERRUPT_ENDPOINT
	usb_configure_endpoint(INT_EP,      \
						 TYPE_INTERRUPT,     \
						 DIRECTION_IN,  \
						 SIZE_8,       \
						 TWO_BANKS,     \
						 NYET_ENABLED);
#endif

	usb_configure_endpoint(TX_EP,      \
						 TYPE_BULK,  \
						 DIRECTION_IN,  \
						 SIZE_64,     \
						 TWO_BANKS,     \
						 NYET_ENABLED);

	usb_configure_endpoint(RX_EP,      \
						 TYPE_BULK,     \
						 DIRECTION_OUT,  \
						 SIZE_64,       \
						 TWO_BANKS,     \
						 NYET_ENABLED);
#if CDC_ECM_USES_INTERRUPT_ENDPOINT
	Usb_reset_endpoint(INT_EP);
#endif
	Usb_reset_endpoint(TX_EP);
	Usb_reset_endpoint(RX_EP);
	usb_eth_is_active = 1;
}
Exemplo n.º 3
0
//! usb_init_device.
//!
//! This function initializes the USB device controller and
//! configures the Default Control Endpoint.
//!
//!
//! @param none
//!
//! @return status
//!
U8 usb_init_device (void)
{
   Usb_select_device();
   if(Is_usb_id_device())
   {
      Usb_select_endpoint(EP_CONTROL);
      if(!Is_usb_endpoint_enabled())
      {
#if (USB_LOW_SPEED_DEVICE==DISABLE)
         return usb_configure_endpoint(EP_CONTROL,    \
                                TYPE_CONTROL,  \
                                DIRECTION_OUT, \
                                SIZE_64,       \
                                ONE_BANK,      \
                                NYET_DISABLED);
#else
         return usb_configure_endpoint(EP_CONTROL,    \
                                TYPE_CONTROL,  \
                                DIRECTION_OUT, \
                                SIZE_8,       \
                                ONE_BANK,      \
                                NYET_DISABLED);
#endif
      }
   }
   return FALSE;
}
Exemplo n.º 4
0
//! @brief This function configures the endpoints
//!
//! @param conf_nb configuration number choosed by USB host
//!
void usb_user_endpoint_init(U8 conf_nb)
{
   usb_configure_endpoint(EP_MS_IN,      \
                          TYPE_BULK,     \
                          DIRECTION_IN,  \
                          SIZE_64,       \
                          TWO_BANKS,     \
                          NYET_ENABLED);
   usb_configure_endpoint(EP_MS_OUT,     \
                          TYPE_BULK,     \
                          DIRECTION_OUT, \
                          SIZE_64,       \
                          TWO_BANKS,     \
                          NYET_ENABLED);
}
Exemplo n.º 5
0
//! @brief This function configures the endpoints
//!
//! @param conf_nb configuration number choosed by USB host
//!
void usb_user_endpoint_init(U8 conf_nb)
{
   usb_configure_endpoint( EP_HID_IN,   \
                           TYPE_INTERRUPT,\
                           DIRECTION_IN,  \
                           SIZE_64,        \
                           ONE_BANK,      \
                           NYET_ENABLED);

   usb_configure_endpoint( EP_HID_OUT,    \
                           TYPE_INTERRUPT,\
                           DIRECTION_OUT, \
                           SIZE_64,        \
                           ONE_BANK,      \
                           NYET_ENABLED);
}
//! @brief This function configures the endpoints
//!
//! @param conf_nb configuration number choosed by USB host
//!
void usb_user_endpoint_init(U8 conf_nb)
{
	//modify for reportlength change
   usb_configure_endpoint( EP_HID_IN,   \
                           TYPE_INTERRUPT,\
                           DIRECTION_IN,  \
                           SIZE_64,        \
                           ONE_BANK,      \
                           NYET_ENABLED);

   usb_configure_endpoint( EP_HID_OUT,    \
                           TYPE_INTERRUPT,\
                           DIRECTION_OUT, \
                           SIZE_64,        \
                           ONE_BANK,      \
                           NYET_ENABLED);
}
//! usb_user_endpoint_init.
//!
//! This function configures the endpoints.
void usb_user_endpoint_init(void)
{
 usb_configure_endpoint(EP_IN,          
                         TYPE_BULK,     
                         DIRECTION_IN,  
                        #if EP_IN_LENGTH == 64
                            SIZE_64,
                        #elif EP_IN_LENGTH == 256
                            SIZE_256,
                        #elif EP_IN_LENGTH == 512
                            SIZE_512,
                        #else
                            #error Wrong EP_IN_LENGTH
                        #endif
                        
                         ONE_BANK,
                        
                         NYET_ENABLED);
 
 usb_configure_endpoint(EP_OUT,        
                         TYPE_BULK,     
                         DIRECTION_OUT, 
                        #if EP_OUT_LENGTH == 64
                            SIZE_64,
                        #elif EP_OUT_LENGTH == 256
                            SIZE_256,
                        #elif EP_OUT_LENGTH == 512
                            SIZE_512,
                        #else
                            #error Wrong EP_OUT_LENGTH
                        #endif
                        
                         ONE_BANK,
                        
                         NYET_ENABLED);

usb_configure_endpoint(EP_EVENT,        
                         TYPE_BULK,     
                         DIRECTION_IN,
                            SIZE_64,
                         TWO_BANKS,
                         NYET_ENABLED);
}
Exemplo n.º 8
0
static void diag_configure(int configured, void *_ctxt)

{
	struct diag_context *ctxt = _ctxt;

	if (!ctxt)
		return;
	if (configured) {
		if (usb_msm_get_speed() == USB_SPEED_HIGH) {
			usb_configure_endpoint(ctxt->epin, &hs_bulk_in_desc);
			usb_configure_endpoint(ctxt->epout, &hs_bulk_out_desc);
		} else {
			usb_configure_endpoint(ctxt->epin, &fs_bulk_in_desc);
			usb_configure_endpoint(ctxt->epout, &fs_bulk_out_desc);
		}
		usb_ept_enable(ctxt->epin,  1);
		usb_ept_enable(ctxt->epout, 1);
		ctxt->configured = 1;
		queue_work(_context.diag_wq, &(_context.usb_config_work));
	} else {
		/* all pending requests will be canceled */
		ctxt->configured = 0;
		if (ctxt->epin) {
			usb_ept_fifo_flush(ctxt->epin);
			usb_ept_enable(ctxt->epin, 0);
		}
		if (ctxt->epout) {
			usb_ept_fifo_flush(ctxt->epout);
			usb_ept_enable(ctxt->epout, 0);
		}
		if ((ctxt->operations) &&
			(ctxt->operations->diag_disconnect))
				ctxt->operations->diag_disconnect();
	}

}
Exemplo n.º 9
0
//! usb_init_device.
//!
//! This function initializes the USB device controller and
//! configures the Default Control Endpoint.
//!
//! @returns Zero is returned if the device could not be initialized. A non-zero,
//!          positive number is returned if the initialization was successful.
uint8_t usb_init_device (void)
{
   Usb_select_device();
   if(Is_usb_id_device())
   {
      Usb_select_endpoint(EP_CONTROL);
      if(!Is_usb_endpoint_enabled())
      {
         return usb_configure_endpoint(EP_CONTROL,    \
                                TYPE_CONTROL,  \
                                DIRECTION_OUT, \
                                SIZE_64,       \
                                ONE_BANK,      \
                                NYET_DISABLED);
      }
   }
   return false;

}
Exemplo n.º 10
0
//! usb_user_endpoint_init.
//!
//! @brief This function configures the endpoints.
//!
//! @param conf_nb Not used
void usb_user_endpoint_init(U8 conf_nb)
{

  /* If we use RNDIS endpoints */
  if ((usb_mode == rndis_only) || (usb_mode == rndis_debug)) {

	  usb_configure_endpoint(INT_EP,      \
	                         TYPE_INTERRUPT,     \
	                         DIRECTION_IN,  \
	                         SIZE_64,       \
	                         ONE_BANK,     \
	                         NYET_ENABLED);

	  usb_configure_endpoint(TX_EP,      \
	                         TYPE_BULK,  \
	                         DIRECTION_IN,  \
	                         SIZE_64,     \
	                         TWO_BANKS,     \
	                         NYET_ENABLED);

	  usb_configure_endpoint(RX_EP,      \
	                         TYPE_BULK,     \
	                         DIRECTION_OUT,  \
	                         SIZE_64,       \
	                         TWO_BANKS,     \
	                         NYET_ENABLED);

  }

  /* If we use virtual comm port (VCP) endpoints */
  if (usb_mode == rndis_debug) {
	  usb_configure_endpoint(VCP_INT_EP,      \
	                         TYPE_INTERRUPT,     \
	                         DIRECTION_IN,  \
	                         SIZE_32,       \
	                         ONE_BANK,     \
	                         NYET_ENABLED);

	  usb_configure_endpoint(VCP_TX_EP,      \
	                         TYPE_BULK,     \
	                         DIRECTION_IN,  \
	                         SIZE_32,       \
	                         TWO_BANKS,     \
	                         NYET_ENABLED);

	  usb_configure_endpoint(VCP_RX_EP,      \
	                         TYPE_BULK,     \
	                         DIRECTION_OUT,  \
	                         SIZE_32,       \
	                         TWO_BANKS,     \
	                         NYET_ENABLED);
  }

  /* If we use mass storage endpoints */
  if (usb_mode == mass_storage) {

   	usb_configure_endpoint(MS_IN_EP,      \
                         TYPE_BULK,     \
                         DIRECTION_IN,  \
                         SIZE_64,       \
                         ONE_BANK,     \
                         NYET_ENABLED);

   	usb_configure_endpoint(MS_OUT_EP,     \
                         TYPE_BULK,     \
                         DIRECTION_OUT, \
                         SIZE_64,       \
                         ONE_BANK,     \
                         NYET_ENABLED);	
  }



  if ((usb_mode == rndis_only) || (usb_mode == rndis_debug)) {
  	Usb_reset_endpoint(INT_EP);
  	Usb_reset_endpoint(TX_EP);
  	Usb_reset_endpoint(RX_EP);
  }

  if (usb_mode == rndis_debug){
  	Usb_reset_endpoint(VCP_INT_EP);
  	Usb_reset_endpoint(VCP_TX_EP);
  	Usb_reset_endpoint(VCP_RX_EP);
  }

  if (usb_mode == mass_storage) {
  Usb_reset_endpoint(VCP_TX_EP);
  Usb_reset_endpoint(VCP_RX_EP);
  }

}