Beispiel #1
0
static void startHandler() {
	if(usb_get_speed() == USBHighSpeed) {
		USB_BYTES_AT_A_TIME = 512;
	} else {
		USB_BYTES_AT_A_TIME = 0x80;
	}

	usb_setup_endpoint(1, USBIn, USBBulk, getPacketSizeFromSpeed(), 0);
	usb_setup_endpoint(2, USBOut, USBBulk, getPacketSizeFromSpeed(), 0);
	usb_setup_endpoint(3, USBIn, USBInterrupt, USB_MAX_PACKETSIZE, 0);
	usb_setup_endpoint(4, USBOut, USBInterrupt, USB_MAX_PACKETSIZE, 0);

	usb_receive_interrupt(4, controlRecvBuffer, sizeof(OpenIBootCmd), controlReceived);
}
Beispiel #2
0
static void usb_setup(int reset)
{
    int i;

    for (i = 0; i < N_ENDPOINTS; i++)
        endpoints[i].enabled[0] = endpoints[i].enabled[1] = 0;

    ISP1582_UNLOCK = ISP1582_UNLOCK_CODE;
    if (!reset)
        ISP1582_MODE = 0x88; /* CLKAON | GLINTENA */
    ISP1582_INTCONF = 0x57;
    ISP1582_INTEN = 0xd39;

    ISP1582_ADDRESS = reset ? 0x80: 0;

    usb_setup_endpoint(ep_index(0, DIR_RX), 64, 0);
    usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0);
    
    ISP1582_MODE |= 1; /* SOFTCT on */

    usb_state = STATE_DEFAULT;
    usb_remote_wakeup = 0;
}
Beispiel #3
0
static void usb_setup_interface(void)
{
    usb_setup_endpoint(ep_index(1, DIR_RX), 64, TYPE_BULK);
    usb_setup_endpoint(ep_index(1, DIR_TX), 64, TYPE_BULK);
}