1 /*******************************************************************************
3 * This software is supplied by Renesas Electronics Corporation and is only
4 * intended for use with Renesas products. No other uses are authorized. This
5 * software is owned by Renesas Electronics Corporation and is protected under
6 * all applicable laws, including copyright laws.
7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
16 * Renesas reserves the right, without notice, to make changes to this software
17 * and to discontinue the availability of this software. By using this software,
18 * you agree to the additional terms and conditions found by accessing the
20 * http://www.renesas.com/disclaimer
21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
22 *******************************************************************************/
23 /*******************************************************************************
24 * File Name : usb1_host_drv_api.c
26 * $Date:: 2014-07-09 16:29:19 +0900#$
31 * Description : RZ/A1H R7S72100 USB Sample Program
34 *******************************************************************************/
37 /*******************************************************************************
38 Includes <System Includes> , "Project Includes"
39 *******************************************************************************/
40 #include "usb1_host.h"
44 /*******************************************************************************
46 *******************************************************************************/
49 /*******************************************************************************
51 *******************************************************************************/
54 /*******************************************************************************
55 Imported global variables and functions (from other files)
56 *******************************************************************************/
59 /*******************************************************************************
60 Exported global variables and functions (to be accessed by other files)
61 *******************************************************************************/
62 static void usb1_host_resetEP(USB_HOST_CFG_PIPETBL_t *tbl);
65 /*******************************************************************************
66 Private global variables and functions
67 *******************************************************************************/
70 /*******************************************************************************
71 * Function Name: usb1_api_host_init
72 * Description : Initializes USB module in the USB host mode.
73 * : USB connection is executed when executing this function in
74 * : the states that USB device isconnected to the USB port.
75 * Arguments : uint8_t int_level : USB Module interrupt level
76 * : USBU16 mode : USB_HOST_HIGH_SPEED
77 * : USB_HOST_FULL_SPEED
78 * : uint16_t clockmode : USB Clock mode
79 * Return Value : USB detach or attach
82 *******************************************************************************/
83 uint16_t usb1_api_host_init (uint8_t int_level, uint16_t mode, uint16_t clockmode)
86 volatile uint8_t dummy_buf;
88 CPG.STBCR7 &= 0xfc; /*The clock of USB0/1 modules is permitted */
89 dummy_buf = CPG.STBCR7; /* (Dummy read) */
91 g_usb1_host_SupportUsbDeviceSpeed = mode;
93 usb1_host_setting_interrupt(int_level);
94 usb1_host_reset_module(clockmode);
96 g_usb1_host_bchg_flag = USB_HOST_NO;
97 g_usb1_host_detach_flag = USB_HOST_NO;
98 g_usb1_host_attach_flag = USB_HOST_NO;
100 g_usb1_host_driver_state = USB_HOST_DRV_DETACHED;
101 g_usb1_host_default_max_packet[USB_HOST_DEVICE_0] = 64;
103 usb1_host_InitModule();
105 connect = usb1_host_CheckAttach();
107 if (connect == USB_HOST_ATTACH)
109 g_usb1_host_attach_flag = USB_HOST_YES;
113 usb1_host_UsbDetach2();
119 #if(1) /* ohci_wrapp */
121 /*******************************************************************************
122 * Function Name: usb1_api_host_enumeration
123 * Description : Initializes USB module in the USB host mode.
124 * : USB connection is executed when executing this function in
125 * : the states that USB device isconnected to the USB port.
126 * Arguments : uint16_t devadr : device address
127 * Return Value : DEVDRV_USBH_DETACH_ERR : device detach
128 * : DEVDRV_SUCCESS : device enumeration success
129 * : DEVDRV_ERROR : device enumeration error
130 *******************************************************************************/
131 int32_t usb1_api_host_enumeration (uint16_t devadr)
136 g_usb1_host_setUsbAddress = devadr;
140 driver_sts = usb1_api_host_GetUsbDeviceState();
142 if (driver_sts == USB_HOST_DRV_DETACHED)
144 ret = DEVDRV_USBH_DETACH_ERR;
147 else if (driver_sts == USB_HOST_DRV_CONFIGURED)
149 ret = DEVDRV_SUCCESS;
152 else if (driver_sts == USB_HOST_DRV_STALL)
157 else if (driver_sts == USB_HOST_DRV_NORES)
168 if (driver_sts == USB_HOST_DRV_NORES)
172 driver_sts = usb1_api_host_GetUsbDeviceState();
174 if (driver_sts == USB_HOST_DRV_DETACHED)
184 /*******************************************************************************
185 * Function Name: usb1_api_host_detach
186 * Description : USB detach routine
188 * Return Value : USB_HOST_DETACH : USB detach
189 * : USB_HOST_ATTACH : USB attach
190 * : DEVDRV_ERROR : error
191 *******************************************************************************/
192 int32_t usb1_api_host_detach (void)
199 driver_sts = usb1_api_host_GetUsbDeviceState();
201 if (driver_sts == USB_HOST_DRV_DETACHED)
203 ret = USB_HOST_DETACH;
206 else if (driver_sts == USB_HOST_DRV_CONFIGURED)
208 ret = USB_HOST_ATTACH;
211 else if (driver_sts == USB_HOST_DRV_STALL)
216 else if (driver_sts == USB_HOST_DRV_NORES)
227 if (driver_sts == USB_HOST_DRV_NORES)
231 driver_sts = usb1_api_host_GetUsbDeviceState();
233 if (driver_sts == USB_HOST_DRV_DETACHED)
243 /*******************************************************************************
244 * Function Name: usb1_api_host_data_in
245 * Description : Executes USB transfer as data-in in the argument specified pipe.
246 * Arguments : uint16_t devadr ; device address
247 * : uint16_t Pipe ; Pipe Number
248 * : uint32_t Size ; Data Size
249 * : uint8_t *data_buf ; Data data_buf Address
250 * Return Value : DEVDRV_SUCCESS ; success
251 * : DEVDRV_ERROR ; error
252 *******************************************************************************/
253 int32_t usb1_api_host_data_in (uint16_t devadr, uint16_t Pipe, uint32_t Size, uint8_t * data_buf)
257 if (Pipe == USB_HOST_PIPE0)
262 if (RZA_IO_RegRead_16(&g_usb1_host_pipemaxp[Pipe], USB_PIPEMAXP_DEVSEL_SHIFT, USB_PIPEMAXP_DEVSEL) != devadr)
267 if (RZA_IO_RegRead_16(&g_usb1_host_pipecfg[Pipe], USB_PIPECFG_DIR_SHIFT, USB_PIPECFG_DIR) == 1)
272 if (g_usb1_host_pipe_status[Pipe] == USB_HOST_PIPE_IDLE)
274 usb1_host_start_receive_transfer(Pipe, Size, data_buf);
278 return DEVDRV_ERROR; /* Now pipe is busy */
281 /* waiting for completing routine */
284 if (g_usb1_host_detach_flag == USB_HOST_YES)
289 if ((g_usb1_host_pipe_status[Pipe] != USB_HOST_PIPE_IDLE) && (g_usb1_host_pipe_status[Pipe] != USB_HOST_PIPE_WAIT))
296 if (g_usb1_host_detach_flag == USB_HOST_YES)
298 return DEVDRV_USBH_DETACH_ERR;
301 switch (g_usb1_host_pipe_status[Pipe])
303 case USB_HOST_PIPE_DONE:
304 ret = DEVDRV_SUCCESS;
307 case USB_HOST_PIPE_STALL:
308 ret = DEVDRV_USBH_STALL;
311 case USB_HOST_PIPE_NORES:
312 ret = DEVDRV_USBH_COM_ERR;
320 usb1_host_stop_transfer(Pipe);
322 g_usb1_host_pipe_status[Pipe] = USB_HOST_PIPE_IDLE;
327 /*******************************************************************************
328 * Function Name: usb1_api_host_data_out
329 * Description : Executes USB transfer as data-out in the argument specified pipe.
330 * Arguments : uint16_t devadr ; device address
331 * : uint16_t Pipe ; Pipe Number
332 * : uint32_t Size ; Data Size
333 * : uint8_t *data_buf ; Data data_buf Address
334 * Return Value : DEVDRV_SUCCESS ; success
335 * : DEVDRV_ERROR ; error
336 *******************************************************************************/
337 int32_t usb1_api_host_data_out (uint16_t devadr, uint16_t Pipe, uint32_t Size, uint8_t * data_buf)
341 if (Pipe == USB_HOST_PIPE0)
346 if (RZA_IO_RegRead_16(&g_usb1_host_pipemaxp[Pipe], USB_PIPEMAXP_DEVSEL_SHIFT, USB_PIPEMAXP_DEVSEL) != devadr)
351 if (RZA_IO_RegRead_16(&g_usb1_host_pipecfg[Pipe], USB_PIPECFG_DIR_SHIFT, USB_PIPECFG_DIR) == 0)
356 if (g_usb1_host_pipe_status[Pipe] == USB_HOST_PIPE_IDLE)
358 usb1_host_start_send_transfer(Pipe, Size, data_buf);
362 return DEVDRV_ERROR; /* Now pipe is busy */
365 /* waiting for completing routine */
368 if (g_usb1_host_detach_flag == USB_HOST_YES)
373 if ((g_usb1_host_pipe_status[Pipe] != USB_HOST_PIPE_IDLE) && (g_usb1_host_pipe_status[Pipe] != USB_HOST_PIPE_WAIT))
380 if (g_usb1_host_detach_flag == USB_HOST_YES)
382 return DEVDRV_USBH_DETACH_ERR;
385 switch (g_usb1_host_pipe_status[Pipe])
387 case USB_HOST_PIPE_DONE:
388 ret = DEVDRV_SUCCESS;
391 case USB_HOST_PIPE_STALL:
392 ret = DEVDRV_USBH_STALL;
395 case USB_HOST_PIPE_NORES:
396 ret = DEVDRV_USBH_COM_ERR;
404 usb1_host_stop_transfer(Pipe);
406 g_usb1_host_pipe_status[Pipe] = USB_HOST_PIPE_IDLE;
411 /*******************************************************************************
412 * Function Name: usb1_api_host_control_transfer
413 * Description : Executes USB control transfer.
414 * Arguments : uint16_t devadr ; device address
415 * : uint16_t Req ; bmRequestType & bRequest
416 * : uint16_t Val ; wValue
417 * : uint16_t Indx ; wIndex
418 * : uint16_t Len ; wLength
419 * : uint8_t *buf ; Buffer
420 * Return Value : DEVDRV_SUCCESS ; success
421 * : DEVDRV_USBH_DETACH_ERR ; device detach
422 * : DEVDRV_USBH_CTRL_COM_ERR ; device no response
423 * : DEVDRV_USBH_STALL ; STALL
424 * : DEVDRV_ERROR ; error
425 *******************************************************************************/
426 int32_t usb1_api_host_control_transfer (uint16_t devadr, uint16_t Req, uint16_t Val, uint16_t Indx,
427 uint16_t Len, uint8_t * Buf)
433 ret = usb1_host_CtrlTransStart(devadr, Req, Val, Indx, Len, Buf);
435 if (ret == DEVDRV_SUCCESS)
437 if (g_usb1_host_detach_flag == USB_HOST_YES)
442 if ((g_usb1_host_pipe_status[USB_HOST_PIPE0] != USB_HOST_PIPE_IDLE)
443 && (g_usb1_host_pipe_status[USB_HOST_PIPE0] != USB_HOST_PIPE_WAIT))
454 if (g_usb1_host_detach_flag == USB_HOST_YES)
456 return DEVDRV_USBH_DETACH_ERR;
459 switch (g_usb1_host_pipe_status[USB_HOST_PIPE0])
461 case USB_HOST_PIPE_DONE:
462 ret = DEVDRV_SUCCESS;
465 case USB_HOST_PIPE_STALL:
466 ret = DEVDRV_USBH_STALL;
469 case USB_HOST_PIPE_NORES:
470 ret = DEVDRV_USBH_CTRL_COM_ERR;
478 g_usb1_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_IDLE;
483 /*******************************************************************************
484 * Function Name: usb1_api_host_set_endpoint
485 * Description : Sets end point on the information specified in the argument.
486 * Arguments : uint16_t devadr ; device address
487 * : uint8_t *configdescriptor ; device configration descriptor
488 * : USB_HOST_CFG_PIPETBL_t *user_table ; pipe table
489 * Return Value : DEVDRV_SUCCESS ; success
490 * : DEVDRV_ERROR ; error
491 *******************************************************************************/
492 int32_t usb1_api_host_set_endpoint (uint16_t devadr, USB_HOST_CFG_PIPETBL_t * user_table, uint8_t * configdescriptor)
497 uint32_t totalLength;
498 USB_HOST_CFG_PIPETBL_t * pipe_table;
500 /* End Point Search */
502 offset = configdescriptor[0];
503 totalLength = (uint16_t)(configdescriptor[2] + ((uint16_t)configdescriptor[3] << 8));
507 if (configdescriptor[offset + 1] == USB_HOST_ENDPOINT_DESC)
509 pipe_table = &user_table[end_point];
511 if (pipe_table->pipe_number == 0xffff)
516 ret = usb1_api_host_SetEndpointTable(devadr, pipe_table, (uint8_t *)&configdescriptor[offset]);
518 if ((ret != USB_HOST_PIPE_IN) && (ret != USB_HOST_PIPE_OUT))
526 /* Next End Point Search */
527 offset += configdescriptor[offset];
529 } while (offset < totalLength);
531 return DEVDRV_SUCCESS;
534 /*******************************************************************************
535 * Function Name: usb1_api_host_clear_endpoint
536 * Description : Clears the pipe definition table specified in the argument.
537 * Arguments : uint16_t pipe_sel : Pipe Number
538 * : USB_HOST_CFG_PIPETBL_t *user_table : pipe table
539 * Return Value : DEVDRV_SUCCESS ; success
540 * : DEVDRV_ERROR ; error
541 *******************************************************************************/
542 int32_t usb1_api_host_clear_endpoint (USB_HOST_CFG_PIPETBL_t * user_table)
546 for (pipe = USB_HOST_PIPE0; pipe <= USB_HOST_MAX_PIPE_NO; ++pipe)
548 if (user_table->pipe_number == 0xffff)
552 user_table->pipe_cfg &= (USB_HOST_DBLBFIELD | USB_HOST_CNTMDFIELD);
553 user_table->pipe_max_pktsize = 0;
554 user_table->pipe_cycle = 0;
559 return DEVDRV_SUCCESS;
562 /*******************************************************************************
563 * Function Name: usb1_api_host_clear_endpoint_pipe
564 * Description : Clears the pipe definition table specified in the argument.
565 * Arguments : USB_HOST_CFG_PIPETBL_t *user_table : pipe table
566 * Return Value : DEVDRV_SUCCESS ; success
567 * : DEVDRV_ERROR ; error
568 *******************************************************************************/
569 int32_t usb1_api_host_clear_endpoint_pipe (uint16_t pipe_sel, USB_HOST_CFG_PIPETBL_t * user_table)
573 for (pipe = USB_HOST_PIPE0; pipe <= USB_HOST_MAX_PIPE_NO; ++pipe)
575 if (user_table->pipe_number == 0xffff)
580 if (user_table->pipe_number == pipe_sel)
582 user_table->pipe_cfg &= (USB_HOST_DBLBFIELD | USB_HOST_CNTMDFIELD);
583 user_table->pipe_max_pktsize = 0;
584 user_table->pipe_cycle = 0;
591 return DEVDRV_SUCCESS;
595 /*******************************************************************************
596 * Function Name: usb1_api_host_SetEndpointTable
597 * Description : Sets the end point on the information specified by the argument.
598 * Arguments : uint16_t devadr : device address
599 * : USB_HOST_CFG_PIPETBL_t *user_table : pipe table
600 * : uint8_t *Table : Endpoint descriptor
601 * Return Value : USB_HOST_DIR_H_IN ; IN endpoint
602 * : USB_HOST_DIR_H_OUT ; OUT endpoint
603 * : USB_END_POINT_ERROR ; error
604 *******************************************************************************/
605 uint16_t usb1_api_host_SetEndpointTable (uint16_t devadr, USB_HOST_CFG_PIPETBL_t * user_table, uint8_t * Table)
609 uint16_t pipe_number;
611 uint16_t ret_flag = 0; // avoid warning.
613 pipe_number = user_table->pipe_number;
615 if (Table[1] != USB_HOST_ENDPOINT_DESC)
617 return USB_END_POINT_ERROR;
620 switch (Table[3] & USB_HOST_EP_TYPE)
622 case USB_HOST_EP_CNTRL:
623 ret_flag = USB_END_POINT_ERROR;
626 case USB_HOST_EP_ISO:
627 if ((pipe_number != USB_HOST_PIPE1) && (pipe_number != USB_HOST_PIPE2))
629 return USB_END_POINT_ERROR;
632 PipeCfg = USB_HOST_ISO;
635 case USB_HOST_EP_BULK:
636 if ((pipe_number < USB_HOST_PIPE1) || (pipe_number > USB_HOST_PIPE5))
638 return USB_END_POINT_ERROR;
641 PipeCfg = USB_HOST_BULK;
644 case USB_HOST_EP_INT:
645 if ((pipe_number < USB_HOST_PIPE6) || (pipe_number > USB_HOST_PIPE9))
647 return USB_END_POINT_ERROR;
650 PipeCfg = USB_HOST_INTERRUPT;
654 ret_flag = USB_END_POINT_ERROR;
658 if (ret_flag == USB_END_POINT_ERROR)
663 /* Set pipe configuration table */
664 if ((Table[2] & USB_HOST_EP_DIR_MASK) == USB_HOST_EP_IN) /* IN(receive) */
666 if (PipeCfg == USB_HOST_ISO)
668 /* Transfer Type is ISO*/
669 PipeCfg |= USB_HOST_DIR_H_IN;
671 switch (user_table->fifo_port)
678 PipeCfg |= (uint16_t)(user_table->pipe_cfg & USB_HOST_DBLBFIELD);
682 ret_flag = USB_END_POINT_ERROR;
686 if (ret_flag == USB_END_POINT_ERROR)
693 /* Transfer Type is BULK or INT */
694 PipeCfg |= (USB_HOST_SHTNAKON | USB_HOST_DIR_H_IN); /* Compulsory SHTNAK */
696 switch (user_table->fifo_port)
701 PipeCfg |= (uint16_t)(user_table->pipe_cfg & (USB_HOST_DBLBFIELD | USB_HOST_CNTMDFIELD));
706 PipeCfg |= (uint16_t)(user_table->pipe_cfg & (USB_HOST_DBLBFIELD | USB_HOST_CNTMDFIELD));
707 #ifdef __USB_DMA_BFRE_ENABLE__
708 /* this routine cannnot be perfomred if read operation is executed in buffer size */
709 PipeCfg |= USB_HOST_BFREON;
714 ret_flag = USB_END_POINT_ERROR;
718 if (ret_flag == USB_END_POINT_ERROR)
723 ret = USB_HOST_PIPE_IN;
727 if (PipeCfg == USB_HOST_ISO)
729 /* Transfer Type is ISO*/
730 PipeCfg |= (uint16_t)(user_table->pipe_cfg & USB_HOST_DBLBFIELD);
734 /* Transfer Type is BULK or INT */
735 PipeCfg |= (uint16_t)(user_table->pipe_cfg & (USB_HOST_DBLBFIELD | USB_HOST_CNTMDFIELD));
737 PipeCfg |= USB_HOST_DIR_H_OUT;
738 ret = USB_HOST_PIPE_OUT;
741 switch (user_table->fifo_port)
744 g_usb1_host_PipeTbl[pipe_number] = (uint16_t)USB_HOST_CFIFO_USE;
748 g_usb1_host_PipeTbl[pipe_number] = (uint16_t)USB_HOST_D0FIFO_USE;
752 g_usb1_host_PipeTbl[pipe_number] = (uint16_t)USB_HOST_D1FIFO_USE;
756 g_usb1_host_PipeTbl[pipe_number] = (uint16_t)USB_HOST_D0FIFO_DMA;
760 g_usb1_host_PipeTbl[pipe_number] = (uint16_t)USB_HOST_D1FIFO_DMA;
764 ret_flag = USB_END_POINT_ERROR;
768 if (ret_flag == USB_END_POINT_ERROR)
773 /* Endpoint number set */
774 PipeCfg |= (uint16_t)(Table[2] & USB_HOST_EP_NUM_MASK);
775 g_usb1_host_PipeTbl[pipe_number] |= (uint16_t)(Table[2] & USB_HOST_EP_NUM_MASK);
777 /* Max packet size set */
778 PipeMaxp = (uint16_t)((uint16_t)Table[4] | (uint16_t)((uint16_t)Table[5] << 8));
782 return USB_END_POINT_ERROR;
785 /* Set device address */
786 PipeMaxp |= (uint16_t)(devadr << 12);
788 user_table->pipe_cfg = PipeCfg;
789 user_table->pipe_max_pktsize = PipeMaxp;
791 usb1_host_resetEP(user_table);
796 /*******************************************************************************
797 * Function Name: usb1_host_resetEP
798 * Description : Sets the end point on the information specified by the argument.
799 * Arguments : USB_HOST_CFG_PIPETBL_t *tbl : pipe table
800 * Return Value : none
801 *******************************************************************************/
802 static void usb1_host_resetEP (USB_HOST_CFG_PIPETBL_t * tbl)
808 /* The pipe number of pipe definition table is obtained */
809 pipe = (uint16_t)(tbl->pipe_number & USB_HOST_BITCURPIPE); /* Pipe Number */
811 /* FIFO port access pipe is set to initial value */
812 /* The connection with FIFO should be cut before setting the pipe */
813 if (RZA_IO_RegRead_16(&USB201.CFIFOSEL,
814 USB_CFIFOSEL_CURPIPE_SHIFT,
815 USB_CFIFOSEL_CURPIPE) == pipe)
817 usb1_host_change_fifo_port(USB_HOST_PIPE0, USB_HOST_CUSE, USB_HOST_NO, USB_HOST_BITMBW_16);
820 if (RZA_IO_RegRead_16(&USB201.D0FIFOSEL,
821 USB_DnFIFOSEL_CURPIPE_SHIFT,
822 USB_DnFIFOSEL_CURPIPE) == pipe)
824 usb1_host_change_fifo_port(USB_HOST_PIPE0, USB_HOST_D0USE, USB_HOST_NO, USB_HOST_BITMBW_16);
827 if (RZA_IO_RegRead_16(&USB201.D1FIFOSEL,
828 USB_DnFIFOSEL_CURPIPE_SHIFT,
829 USB_DnFIFOSEL_CURPIPE) == pipe)
831 usb1_host_change_fifo_port(USB_HOST_PIPE0, USB_HOST_D1USE, USB_HOST_NO, USB_HOST_BITMBW_16);
834 /* Interrupt of pipe set is disabled */
835 usb1_host_disable_brdy_int(pipe);
836 usb1_host_disable_nrdy_int(pipe);
837 usb1_host_disable_bemp_int(pipe);
839 /* Pipe to set is set to NAK */
840 usb1_host_set_pid_nak(pipe);
843 USB201.PIPESEL = pipe;
845 USB201.PIPECFG = tbl->pipe_cfg;
846 USB201.PIPEBUF = tbl->pipe_buf;
847 USB201.PIPEMAXP = tbl->pipe_max_pktsize;
848 USB201.PIPEPERI = tbl->pipe_cycle;
850 g_usb1_host_pipecfg[pipe] = tbl->pipe_cfg;
851 g_usb1_host_pipebuf[pipe] = tbl->pipe_buf;
852 g_usb1_host_pipemaxp[pipe] = tbl->pipe_max_pktsize;
853 g_usb1_host_pipeperi[pipe] = tbl->pipe_cycle;
855 /* Sequence bit clear */
856 usb1_host_set_sqclr(pipe);
858 usb1_host_aclrm(pipe);
859 usb1_host_set_csclr(pipe);
861 /* Pipe window selection is set to unused */
862 USB201.PIPESEL = USB_HOST_PIPE0;
866 #if(1) /* ohci_wrapp */
868 /*******************************************************************************
869 * Function Name: usb1_api_host_data_count
870 * Description : Get g_usb0_host_data_count[pipe]
871 * Arguments : uint16_t pipe ; Pipe Number
872 * : uint32_t *data_count ; return g_usb0_data_count[pipe]
873 * Return Value : DEVDRV_SUCCESS ; success
874 * : DEVDRV_ERROR ; error
875 *******************************************************************************/
876 int32_t usb1_api_host_data_count (uint16_t pipe, uint32_t * data_count)
878 if (pipe > USB_HOST_MAX_PIPE_NO)
883 *data_count = g_usb1_host_PipeDataSize[pipe];
885 return DEVDRV_SUCCESS;