Beispiel #1
0
void usb_init(void *param)
{
	usb_endpoint_t *ep;

	flags.state=USB_STATE_DETACHED;
	flags.config=0;
	flags.suspended=0;
	flags.address=0;
	usb_ctl_init();
	sofCB=preSOFCB=0;
	stateChangeCallback=0;

	// ### TODO: need to do this for all configurations
	ep=usb_get_first_ep(1);
	while (ep) {
		if (!ep) continue;
		ep->data->stat=USB_EPSTAT_INACTIVE;
		ep->data->timed_out=0;
		ep->data->timeout=3000;
		//ep->data->epstat_cb=0;
		ep->data->evt_cb=0;
		//ep->data->cp_ptr=0;
		ep->data->buf=0;
		ep->data->reqlen=0;
		ep->data->actlen=0;
		ep->data->hwdata=0;
		ep=ep->next;
	}
	usbhw_init(param);
	usbhw_int_en();
}
Beispiel #2
0
//-----------------------------------------------------------------
// usb_init:
//-----------------------------------------------------------------
void usb_init(FP_BUS_RESET bus_reset, FP_CLASS_REQUEST class_request)
{
    _class_request = class_request;
    usbhw_init(bus_reset, usb_process_setup, usb_process_out);
}