Exemple #1
0
/**
 * \brief Allocation of the control endpoint
 *
 * \param address USB address of endpoint
 * \param ep_size control endpoint size
 */
static void main_usb_enable_ctrl_ep(uint8_t address, uint8_t ep_size)
{
	// Configure USB address
	udd_disable_address();
	udd_configure_address(address);
	udd_enable_address();

	// Alloc and configure control endpoint
	udd_disable_endpoint(0);
	udd_unallocate_memory(0);
#if SAM3XA
	udd_configure_endpoint(0,
			USB_EP_TYPE_CONTROL,
			0,
			ep_size,
			UOTGHS_DEVEPTCFG_EPBK_1_BANK);
#else
	udd_configure_endpoint(0,
			USB_EP_TYPE_CONTROL,
			0,
			ep_size, AVR32_USBB_UECFG0_EPBK_SINGLE);
#endif
	udd_allocate_memory(0);
	udd_enable_endpoint(0);
}
Exemple #2
0
static void udd_reset_ep_ctrl(void)
{
	irqflags_t flags;

	// Reset USB address to 0
	udd_configure_address(0);
	udd_enable_address();

	// Alloc and configure control endpoint
	udd_configure_endpoint(0,
			USB_EP_TYPE_CONTROL,
			0,
			USB_DEVICE_EP_CTRL_SIZE, AVR32_USBC_UECFG0_EPBK_SINGLE);

	// Use internal buffer for endpoint control
	udd_udesc_set_buf0_addr(0, udd_ctrl_buffer);

	// don't use multipacket on endpoint control
	udd_udesc_rst_buf0_size(0);
	udd_enable_endpoint(0);
	udd_disable_busy_bank0(0);
	flags = cpu_irq_save();
	udd_enable_setup_received_interrupt(0);
	udd_enable_out_received_interrupt(0);
	udd_enable_endpoint_interrupt(0);
	cpu_irq_restore(flags);
}
void udd_set_address(uint8_t address)
{
	udd_disable_address_state();
	udd_disable_address();
	if (address) {
		udd_configure_address(address);
		udd_enable_address();
		udd_enable_address_state();
	}
}
static void udd_reset_ep_ctrl(void)
{
	irqflags_t flags;

	// Reset USB address to 0
	udd_enable_address();
	udd_configure_address(0);
	// Alloc and configure control endpoint in OUT direction
	udd_configure_endpoint(0, USB_EP_TYPE_CONTROL, 0);
	udd_enable_endpoint(0);

	flags = cpu_irq_save();
	udd_enable_endpoint_interrupt(0);
	cpu_irq_restore(flags);
}
Exemple #5
0
static void udd_reset_ep_ctrl(void)
{
	irqflags_t flags;
	// Reset USB address to 0
	udd_configure_address(0);
	udd_enable_address();
	// Alloc and configure control endpoint
	udd_configure_endpoint(0,
			USB_EP_TYPE_CONTROL,
			0,
			USB_DEVICE_EP_CTRL_SIZE, AVR32_USBB_UECFG0_EPBK_SINGLE);

	udd_allocate_memory(0);
	udd_enable_endpoint(0);
	flags = cpu_irq_save();
	udd_enable_setup_received_interrupt(0);
	udd_enable_out_received_interrupt(0);
	udd_enable_endpoint_interrupt(0);
	cpu_irq_restore(flags);
}