📄 cy7c67200_300_pcd.c
字号:
/***************************************************************** * * Function Name: udc_endpoint_halted * * Description: This function is not used for EZ-HOST * *****************************************************************/int udc_endpoint_halted(unsigned int ep, struct usb_device_instance * device){ return 0;}/***************************************************************** * * Function Name: udc_set_address * * Description: Called from control endpoint function after it decodes a set * address setup packet. *****************************************************************/void udc_set_address(unsigned char address, struct usb_device_instance * device){ sie_info * sie_data = (sie_info * ) device->bus->privdata; //pcd_dbg("udc_set_address enter"); sie_data->usb_address = address;}/***************************************************************** * * Function Name: udc_serial_init * * Description: This function sets up links in the data structures. * *****************************************************************/int __init udc_serial_init(struct usb_bus_instance * bus){ /* At this time, the device instance does not exist */ /* The sie global should have been initialized by now in perhiperhal init */ bus->privdata = sie; sie->bus = bus; return SUCCESS;}/***************************************************************** * * Function Name: udc_max_endpoints * * Description: Return the number of pysical endpoints * *****************************************************************/int udc_max_endpoints(void){ return(UDC_MAX_ENDPOINTS);}/***************************************************************** * * Function Name: udc_check_ep * * Description: This function will verify whether a function driver has set * up its endpoint descriptors properly. It will retrieve the * endpoint descriptors, and then check their endpoint numbers * against what the bus interface is capable of handling, i.e. * whether or not a function driver tries to implement nine * endpoints, when only eight are supported on the hardware. * *****************************************************************/ int udc_check_ep(int logical_endpoint, int packetsize, struct usb_device_instance * device){ int pys_ep; pys_ep = (((logical_endpoint & 0xf) >= UDC_MAX_ENDPOINTS) || (packetsize > 64)) ? 0 : (logical_endpoint & 0xf); return pys_ep;}/***************************************************************** * * Function Name: udc_setup_ep * * Description: This function will prepare the endpoint_instance structure * for each physical endpoint. It allocates the number of * URB's to be held in the receive queue for each endpoint. * Additionally, this endpoint will call the BIOS SW interrupt * SUSBx_RECEIVE_INT to set up the receive endpoint for a * pending USB packet. *****************************************************************/ void udc_setup_ep(struct usb_device_instance * device, unsigned int ep, struct usb_endpoint_instance * endpoint){ int port_num; sie_info * sie_data = (sie_info *)device->bus->privdata; cy_priv_t * cy_priv = (cy_priv_t * ) sie_data->cy_priv; pcd_dbg("udc_setup_ep enter: ep = %d", ep); port_num = (sie_data->sie_number == SIE1) ? PORT0 : PORT2; if (ep < UDC_MAX_ENDPOINTS) { device->bus->endpoint_array[ep] = *endpoint; if (ep == 0) { usbd_fill_rcv(device, endpoint, CONTROL_EP_RECV_URB_COUNT); endpoint->rcv_urb = first_urb_detached(&endpoint->rdy); } else if (endpoint->endpoint_address & 0x80) { // IN ENDPOINT -> send } else if( endpoint->endpoint_address ) { // OUT ENDPOINT -> receive TRANSFER_FRAME frame; unsigned short struct_location = sie_data->recv_struct_location + ep*TXRX_STRUCT_SIZE; unsigned short buff_location = sie_data->recv_buffer_location + ep*RECV_BUFF_LENGTH; usbd_fill_rcv(device, endpoint, OUT_EP_URB_COUNT); endpoint->rcv_urb = first_urb_detached(&endpoint->rdy); frame.link_pointer = 0x0000; frame.absolute_address = buff_location; frame.data_length = sie_data->recv_buffer_length; frame.callback_function_location = 0; lcd_recv_data(struct_location, port_num, ep, 8, (char*) &frame, NULL, 0, cy_priv); pcd_dbg("Setup ep%d", endpoint->endpoint_address & 0xf); } }}/***************************************************************** * * Function Name: udc_disable_ep * * Description: This function is not used. * *****************************************************************/void udc_disable_ep(unsigned int ep){}/***************************************************************** * * Function Name: udc_connected * * Description: This function is not used. * *****************************************************************/int udc_connected(void){ return 1;}/***************************************************************** * * Function Name: udc_connect * * Description: This function is not used. * *****************************************************************/void udc_connect(){}/***************************************************************** * * Function Name: udc_disconnect * * Description: This function is not used. * *****************************************************************/void udc_disconnect(){}/***************************************************************** * * Function Name: udc_all_interrupts * * Description: This function is not used. * *****************************************************************/void udc_all_interrupts(struct usb_device_instance *device){}/***************************************************************** * * Function Name: udc_suspened_interrupts * * Description: This function is not used. * *****************************************************************/void udc_suspended_interrupts(struct usb_device_instance *device){}/***************************************************************** * * Function Name: udc_disable_interrupts * * Description: This function is not used. * *****************************************************************/void udc_disable_interrupts(struct usb_device_instance *device){}/***************************************************************** * * Function Name: udc_ep0_packetsize * * Description: This function returns ep0 packet size. * *****************************************************************/int udc_ep0_packetsize(void){ return EP0_PACKETSIZE;}/***************************************************************** * * Function Name: udc_enable * * Description: This function is not used. * *****************************************************************/void udc_enable(struct usb_device_instance *device){}/***************************************************************** * * Function Name: udc_disable * * Description: This function is not used. * *****************************************************************/void udc_disable(void){}/***************************************************************** * * Function Name: udc_startup_events * * Description: This function issues events to the usbd core as * part of initialization. * *****************************************************************/void udc_startup_events(struct usb_device_instance * device){ usbd_device_event(device, DEVICE_INIT, 0); usbd_device_event(device, DEVICE_CREATE, 0);}/***************************************************************** * * Function Name: udc_init * * Description: This function is not used. * *****************************************************************/int udc_init(){ return SUCCESS;}/***************************************************************** * * Function Name: udc_regs * * Description: This function is not used. * *****************************************************************/void udc_regs(void){}/***************************************************************** * * Function Name: udc_name * * Description: This function returns the name of the interface * to the usbd core. * *****************************************************************/char * udc_name(void){ return UDC_NAME;}/***************************************************************** * * Function Name: udc_request_udc_irq * * Description: This function is not used. * *****************************************************************/int udc_request_udc_irq(void){ return SUCCESS;}/***************************************************************** * * Function Name: udc_request_cable_irq * * Description: This function is not used. * *****************************************************************/int udc_request_cable_irq(void){ return SUCCESS;}/***************************************************************** * * Function Name: udc_request_io * * Description: This function is not used. * *****************************************************************/int udc_request_io(void){ return SUCCESS;}/***************************************************************** * * Function Name: udc_release_udc_irq * * Description: This function is not used. * *****************************************************************/void udc_release_udc_irq(void){ }/***************************************************************** * * Function Name: udc_release_cable_irq * * Description: This function is not used. * *****************************************************************/void udc_release_cable_irq(void){}/***************************************************************** * * Function Name: udc_release_io * * Description: This function is not used. * *****************************************************************/void udc_release_io(void){}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -